Saturday, February 25, 2017

TOE week 26: Battling UVs and winning maybe?



It was finally time for me to open up Blender and begin work on the ground collision system. I had been avoiding this because of how tedious it was last time but I was determined. I sat down. I opened blender and I tried to open the file menu…. But everything was running SO slowly. Wat? I restarted my computer and opened blender and the basic scene with a cube was TANKING my machine. I opened Unity and it was fine. I scrolled around and panned like the solid state memory I now know and love. Something weird was going on with Blender. But why was this happening NOW, when I was finally motivated/the last item on the to do list. 

I won’t bore you all any longer, long story short Blender doesn’t like the update for my video card. An update that happened on February 10th. Thanks Nvidia. Lots of people said that you had to roll back your video diver and I didn’t really want to do that. Also this is not the best solution. If you right click on Blender you can set your graphics processor to: Integrated Graphics instead of letting Nvidia handle it and then Blender once again ran properly. Finally now time to get to work!

Working with UVs is like battling evil in another dimension. Like you're in the UV dimension. The last time UVs and I faced off in Blender it was not pixel perfect. So I worked on other things and pondered just how I was going to tackle this really annoying problem. I came up with a system where there would be converter pieces on each side of the rectangle. I can delete these pieces to use the middle to extend the rectangle and the middle texture should tile with itself. Allow me to demonstrate.

Then I used my gained knowledge of Blender to create a UV projection and prevented me from having to all of the tedious hard work that made me want to throw my hands up and quit, or con a friend with a copy of Maya to do it for me. One Alanis Morissette song later and doing it this way seems to have actually solved the problem of it not being pixel prefect without the need of a converter piece…. LEARNING YAY! I think next week I am going to do the whole thing over again! Now that is PROGRESS! Anyway this is what it looks like in game. This is test art but you get the idea. 

Friday, February 17, 2017

TOE week 25: Lacking all productivity WITH VIDEO!



Remember how I said that last week was super productive. Well I think it was taking it out on this week. I put in work all the way until Friday. Woke up on Saturday and felt like crap. I got sick somewhere along the way. I tried to work on finishing the one animation I had left on Saturday night. I poked and prodded it and couldn’t get it to work. 

I made a flag and put that flag on the animation that I was trying to activate, to basically no avail. My head hurt I went to bed. Woke up the next morning feeling like less crap. I then realized that the flag needed to be on the preceding animation for the one I wanted to activate. I didn’t feel normal until basically today.  It is nice to be able to breathe correctly again but also nice to be able to think clearly again. 

So as promised I have gone above and beyond! I have made two videos for you guys. They seem to take forever to upload to YouTube. Hyper cam is what I use to capture stuff. If I turn any of the compression options on the videos become pure screen artifacts. The audio still works but the video is garbage. 

The first one is the problem that I was demonstrating last week. After I posted I also learned that my laptop has to be at or below 85% power for the inconsistency to occur.



The next one is me showing off all of the animations that I got working last week.

  

That video was created using this INSANE animation graph from Unity.  I could show you the code too but most would just look at it and ask me 'wat?'.




Friday, February 10, 2017

TOE week 24: Hmmmmmm needs more dinosaur



I did something amazing this week. I finally figured out what was causing my inconsistency and it has nothing to do with how bad I probably am at coding. Or might have everything to do with how bad I am at coding. 

I have a laptop tray. Don’t worry I didn’t waste any money on buying one. This tray originally was for my son’s old baby chair that he has grown out of. It is wide enough that I can use a mouse on. Yeah I’m an old man I need a mouse to use a computer. If you can enter values in Unity or model in Blender better than me with a track pad great on you. I’m still a dinosaur. Last night I was trying to squeeze one final animation onto the player. As I started I noticed that my mouse wasn’t working. Whoops forgot to plug that in, did so. Worked on the last animation, ran the game walked into one of my push boxes with an up vector and the player remained on the ground. “DAMN IT! Why does this happen on a weekly basis?”

 I looked at my laptop battery. My computer wasn’t plugged in must have forgot that too. The game was still running. I thought about how laptops run slower when not plugged in to conserve power. I looked at the player standing in the push box that should be pushing them upward. ‘I wonder what would happen if I plugged this thing in…’ Did so and damn that push box did toss my player up into the air. My secondary weapons started working normal again. The background no longer jittered. It was liked suddenly everything that I hated about my game that I couldn’t fix just needed more power. Like the kind that comes out of the wall from dead dinosaurs.  

SWEAT! It is not my fault. It is a processing thing. Or maybe it is entirely my fault… If I ever manage to finish this here thing would it run differently on different machines? Should I cap the frame rate? Wait I have no clue how to do that. This is probably the smallest part of my accomplishments this week. I basically found out the WHY of this problem 15 minutes before I went to bed yesterday.

 The rest of the week was spent attaching animations to the player. Now it looks even MORE like a game. I had to build a player state monitor in C#. If the player’s Y vector is positive display the jump up arc animation if it is negative display the jump down up arc animation. Isolating all of the various things my player can do and figuring out of to actually use that confusing Unity graph was a chunk of work.

On Monday I started a new fresh project dedicated to only animation. I set up a detailed tutorial online about how to animate in Unity. I got Megaman X running with a sprite sheet.  When I pressed the right arrow he ran and he went to idle when I hit the left arrow. STUPID SIMPLE. Breaking it down into its most simple components allowed me to understand how I could integrate it with my must more complicated project. I managed to get 14 of 15 different animations set up and MOSTLY working. There are some tiny problems. Like the player’s actual attack spawns before the animation plays. BUT hey the animation still plays! Also the attack animations end abruptly and I can’t seem to convince the graph to let me hold an animation’s last frame. So the functionality is not fully there but it is almost correct. 

And I almost forgot to mention that I managed to put down some art on the edge of the player’s portal to give it a more rounded and energy portal look as opposed to a window. This art also color cycles, it kind of pulses between colors. Overall this last week super productive I got a lot done and found answers to something that had been plaguing my work. 

I know that last week I promised a video showing off just how all of this is working BUT I think I have to wait another week. Maybe after I get that last animation working. Next week a video and I will have to finally make some textures so I can really show it off!




Friday, February 3, 2017

TOE week 23: Consistent Inconsistency



I worked on consistency this week. Last week I worked on the background plugged it in and things were humming along. Wrote a blog about it and published it. When my wife got home I showed her the thing that I had been working on and it looked slightly wrong. The background jumped around and was not smoothly in place. My secondary weapons began to act up when I checked them. 

So I spent a day looking into this problem. I asked a question on the Unity Facebook group I’m a part of and was told that I should be using Time.FixedDeltaTime instead of Time.DeltaTime and that I shouldn’t have public editor values. Wat?! One of the great things about Unity is public editor values! When you first write code you don’t immediately know that a value of 7 for a force will send the thrown axe careening off into the infinite. You just make a guess of a good value then when you see it working for the first time, and the force is too strong or weak, you adjust it in game, find a value that works, and then leave it the hell alone. Very rarely to never have I coded something in Visual Studio and it just worked perfectly with my guess-timates. 

The issue I have been having doesn’t seem like I changed something else and it impacted the secondary weapons either. I would be thrilled if it was that easy of a problem to solve. This issue seems to pop up depending on  the opening Unity. It also sticks around broken or working for little while. It was broken all of last weekend and worked correctly all of the week and was broken when I opened it today. It breaks and fixes itself regardless of anything I seem to do. Yay…..

I grabbed my Sprite sheet off of my storage hard drive. I got all of the animations in Unity and working. Well that is to say that I managed to import all of them into Unity and they animate. So far as the player animating the only thing I have working right now is making the player sprite flip when you are heading left or right. Man oh man animation in Unity seems complicated! Well that and I have basically never done it before. Maybe some basic things but this is pretty crazy.
Related to this I did write a Player state machine to tell the Animator what animation to display. I haven’t quite yet figured out how to swap animations on the player. I looked at some tutorials on how to do this but I wasn’t really happy with them. But it did also make this: 



For those uninitiated in Unity that is an animation graph. Basically all of the animations are allowed to transition into any connected animation. I just have to get it working… Unfortunately that might mean actually doing one of the tutorials in a separate project to really understand how really implement my sprite animations. So close! Maybe next week I can wow all four of you with a video of the player running around. I could do it right now but it would be complete trickery.