Saturday, April 29, 2017

TOE week 35: Infinite Death Star the Only Way to Time Travel

Last week I hacked another thing with animations the attack animation. I don’t know if it was a hack per say but it was implemented in an ugly way. This week it came back to haunt me. One of the things that seems to happen fairly often in development is that you play your game in a certain way. So certain bugs will pop up because of your style of play. Hand the controller to a friend who doesn’t know anything about your game and their style of play reveals places where your code is lacking.
I wasn’t miffed that my friend broke the game. I was pretty vexed that I couldn’t fix it. The way the code works is something like this. 

Player class sees and input from actual player when X is pressed. This sets a flag to true.

Player Animation class is connected to Player class so the attack animation is triggered to play when the flag is true.

When the animation is finished the flag is set to false because of Untiy’s animation event trigger.

The hiccup is if the actual player jams on the Attack Button. Then the flag is always true and then the player is stuck at the last frame of this animation basically unable to move. Because the flag is never cleared. 

I spent the better half of Wednesday (my most useful day because Son has no appointments on Wednesday) trying to get this fixed. To no avail. I also tried to fix it on Thursday and was again completely unproductive. Basically felt like I wasted two days. On Thursday I walked away and just painted stuff. I think I need to create a test project with just this situation isolated to sort it out if I am going to fix this.  

I have been working on a lot of little broken things. For example my artwork with collision objects has no rotation value. All of the collision objects are various different parallelograms. Implementing this broke my grenade weapon that grabbed the rotation value and rotated itself then exploded. With no rotation value this functionality was gone. So I had to fix it. My player gets the angle of an object that they touch from a raycast I used this to get the angle of the same collision objects but my player doesn’t care if the angle is -37 or 37. The grenade object needed to care so basically my thrown grenades only functioned correctly when hitting an object that was 37 and not -37. Not being able to find an elegant solution I opted for a something maybe a bit hacky. Hacky but it works! I sure this hack will never come back to haunt me ever again.

I also checked off creating artwork for the way back portal.  It was then that I accidentally created the infinite death star. It is just looked a bit like the death star not fully operational as of yet. I did this while not fixing the player attacking problem. I think it is a fitting representation of traveling through time. So not a total loss but not my best week either. 


Friday, April 21, 2017

TOE week 34: To do list. Idem 1: Make To Do List.



After last week was over, I opened up a blank text file and started to write down all of the things that I had pretty much avoided doing because they are annoying, difficult or both. This involved me sitting down with the game for about a half hour and really looking at it. Some of these tasks are rather huge. Like show code to a professional engineer so they can yell at me for an hour about inconsistencies with bools and ‘{}’. Also about where I need to refactor the code.  Again not really a programmer so small inconsistencies don’t really bother me very much but I have talked to a few in my time about {} and tabs and spaces. Also if you’re a spaces person YOU ARE insane. What? Fight me! Anyway not a small task. 

Another thing that happens as you do this is you find other things that are either not quite right or not working and the list gets longer. However it seems to be another way to really help me keep my eyes on the goal. One of my goals this week was to get the player’s weapons to spawn after the animation was finished. I believe there was one fruitless day devoted to this.

Did you know that Unity’s animation system is kind of bonkers? While I didn’t until I tried to get an Animator(an object that over sees Animation objects) to see an Animation. This shouldn’t be difficult I would think. I have an Animator that switches what animation is playing. I mistakenly thought that an Animator would have a method to know when a containing animation was finished. If you guessed that this is actually not the case then you win a prize. I Googled how to check when an animation is finished Untiy many a time and got at lot of wishy washy work arounds or doing it from the Animation class not the animator. 

Somewhere on some forum someone clearly smarter than me said ‘the Animator and the Animation objects intentionally don’t know about each other for Unity’s performance reasons’. Well that is great and all but how do I get a collision object to spawn when the animation is done? I found a thread about using the Animation Event System. Basically you can put a function call on a key frame of the Animation that calls to the Animator. To do this you have to do it in the Unity Editor and not in Code. Also this breaks a segment of your code basically exiting in the Unity Editor so if you want to change it you have to remember where the Animation Event is in Untiy. Not hard to do if you leave a comment in the code that says ‘Hey Dummy it is in Untiy’. It seemed kind of hacky but as far as I could tell, was actually the way you’re SUPPOSED to do it.

In easier news I managed to create a variable frame rate for my run cycle based on Player input for the left analog stick. Pretty much what this means is that the player’s run cycle animates faster or slower based on the degree of the tilt. It is a simple and really cool effect that I don’t see as often as I think it should be. It is so easy to do it should almost be mandatory. 

I have several other different accomplishments that I could talk about but this has already gotten a little long and I didn’t get around to talking about modular art. Oh well maybe next week. Great news! I already have a list of things that I didn’t manage to get done this week that I can now try to deal with next week!

Friday, April 14, 2017

TOE week 33: My BIG week.



It was a huge week for me. Mainly art stuff: 






Why was it such a big week? My wife was on spring break and she did most if not all of the baby work. I don’t know if readers can fathom what not having a 9-5 feels like for a person who wants to have a 9-5. So probably the best gift from my wife to me was giving me a work week. So I actually got to sit down and put in the work. There were some minor breaks but overall like a vet trip but I think I actually got near 40 hours in.

Yesterday I was trying to make the artwork work. Again it is one thing to make the artwork programming it to function is another matter. Unity is great and all but sometimes the documentation is lacking. What I had done is created a hitbox that when struck flipped a flag between true and false. Pretty easy. Then I wanted the gate’s render texture to appear if true and disappear if false. I Googled how to C# the mesh renderer and got all kinds of answers for Untiy 4… The syntax is now completely different in Untiy 5. I then banged my head against the keyboard until pretty much nothing happened. So I did the smart thing and gave up. No seriously sometimes walking away from a problem for a time will allow you to come back with a different perspective. 

I then went back to painting and made the on and off artwork for my strikebox so you can tell if it is on or off. Then I realized that I needed the mesh renderer problem to be solved for this to actually work. So I sighed and went back to trying to figure out the syntax. Again I tried different things that I thought should work and again no avail. It was at this point that I made end caps for my cliff faces because I didn’t know what else to do. 



When I finished the cliff caps I then again went back to it and for whatever reason I saw it… I was missing the () on the get component call. I believe it was because I found a response on a forum that was said if you and using Unity 4 it is this, if you are using 5 it is this. Then I saw what I was missing and it was the syntax. The BEST part is that I hooked it onto the render texture and it didn’t even work right! I mean it works as intended but from and art perspective it is wrong. Fortunately the strike box that also needed this it works perfectly on. 


It will be hard to have a week as productive as the last one. But we are moving closer and closer to the goal of this being a game. Right now it kind of appears to be one.
 

Friday, April 7, 2017

TOE week 32: I got a rock



I improved on the time gate give it some more doodads. That was the start of the week. The rest of the week was listening to a pod cast and drawing rocks. Lots and lots of rocks. Then shading them. Shading lots and lots of rocks. I made a room for my time gate. 

At first I made this room from scratch in blender, cast UVs using my now greater understanding of them only to find out that what I did was again a waste of time. The new UVs were a different size than the old UVs and that can cause all kinds of problems especially down the road. So tossed that file and opened the old collision set and built the room out of that. Then I had to edit these UVs to then be the room instead of the old collision. This wasn’t difficult so much as it was tedious. Again blenders UVs tools are either bad, or I don’t know how to properly use them, or both are true making a perfect storm of disaster. 

I set up a rainbow bridge in the new UVs quickly to see if it was compatible with the old collision visually. And it was, GREAT something that worked out. Then I started to draw the cave that this was supposed to be. That is when I started drawing rocks so many rocks. 

Many rocks and two podcasts later I had a cave. However I did need a way to connect that cave to the older collision via a conversion piece. Also I never made a ceiling set of artwork for my collision because it didn’t seem necessary at the time. Might need one in the future.
So anyway this is: Time Gate in Cave plus rocks. 



I also had some cool people over who I got to show off my game to. I put it up on the TV and getting to see it like that was pretty awesome. It was like it was a real game or something. All and all it was a very good week.