Friday, January 27, 2017

TOE week 22: Two minor bugs and Hot Garbage



I fixed two minor bugs this week. One was minor in the fact that if you ‘played right’ the game didn’t look stupid. However if you abused it I thought it looked dumb. Funny enough when I showed my wife this same bug before I fixed it she thought it looked cool. Eye of the beholder I guess. This minor issue was that if the player was standing in a place where they were not allow to teleport and tried to open the portal to teleport the portal would pop open for a frame or two and then snap shut. You were not allowed to teleport but you could briefly open the window so to speak. You could also hammer on the B button and see this rather continuously. I didn’t like it but the wife did.

The other bug related to this was the UI indication for if you are allowed to teleport would continuously flicker between true and false. For some related reasons. The way it used to be set up was the bool will reset to true based on the player’s position BUT will be false if the test object was overlapping with collision at the teleport location. So the player would say, “Okay I’m in the right dimension to teleport so condition TRUE.” But the test object would say, “Hey I’m colliding with collision so condition FALSE”. And it would bounce back and forth between these two states. 

When I originally set up the teleport functionality weeks ago when I finally got everything mostly working and saw these two minor issues I thought, “I don’t want to break anything, it works right now, I’ll fix it later.” Well turns out the fix took me about all of ten or twenty minutes. So way have I spent three paragraphs talking about this? Well because the rest of the week was spent painting another background. Describing that is something that a time lapsed video is probably better at. Speaking of those I HATE those people who can just take a blank sheet of photoshop and turn it in a perfect landscape. Your thought is “Hey any idiot can do that.” Then you try and it turns into hot garbage. Need more practice I suppose. 

Overall it was a good week. Great to be back on the horse so to speak. Next week I am hoping to work on the ground textures and get animation working… Animation seems daunting. I have a sprite sheet of my character even broken up into animations. Just got to trick Unity into making them work I suppose. 

The window is open.

 This week's background
HOT GARBAGE as promised.

Saturday, January 21, 2017

TOE week 21: Complex road to a simple solution



I was feeling out of practice when I opened up Visual Studio for the first time in a while. A lot of the code work has been done. Not that this here thing is even close to done, but right now I’m working on the art stuff. So imagine my surprise when I tried to program something that should be a complete cake walk and nothing I did remotely worked. 

Basically I need to have two backgrounds for my game. Because they are backgrounds they need to move with the player in the X and Y directions but not in the Z direction. I remembered in a different game I made from a YouTube tutorial that you could lock an Axis. Meaning that an object would not be allowed to move on a locked Axis. This didn’t work with what I was trying to do because the Backgrounds are not moved because of Ridged Body(a property in Unity). These Backgrounds were instead attached to the Player and move relative to the Player’s position.  If the Player moves in the Z the Backgrounds do the same. Meaning that you could never see the farthest Background because the closer Background always covered it.

So much of programming is Syntax. Have I said that before? Because it is so freaking true. People for the most part are Syntax free. Ask your friend to ‘move cup’ and generally they can look at the table and extrapolate that you want them to pick up the cup on the table. A computer on the other hand will stare back at you and say “error expected: definite article”. 

When I ‘asked’ the computer to set the transform.position.z of the background object to be equal to ALWAYS be equal to its starting Z position the computer said you can’t do that. I fought with it for awhile. More like I tried to trick it with various ways for a while. None of that worked. My brother in law called and I complained to him about my problem we laughed. When I went back I deleted everything I had tried to do and started from scratch. 

Then I basically found out that I was asking the computer to do something entirely the wrong way. 

transform.position.z = stickingPointZ is not legal. 

You have to define a new Vector and set that vector to be equal to your variable. Basically transform.position.z is part of a vector and stickingPointZ is not a vector it is Float. So they don’t like talking to each other I guess. 

transform.position = new Vector3(playerPointX, playerPointY, stickingPointZ);

It is a simple solution but it was complicated getting there. Then I spent the rest of the week painting after I figured out that small problem. After I had finished my BG I plugged it in and bam suddenly my game was like 50 percent more presentable! Next week I have to paint the other background and we will have something that is closer to looking like a game.
 

My game with a background!


 The background.

Friday, January 6, 2017

TOE week 20: Jumping the 1 pixel gap



                The UV rays burn! I think I hate UV mapping or Blender’s UV tools or both. I worked on UV mapping a couple of times over the past few weeks that I haven’t been writing my producer e-mails. (AKA this blog.) I would look at UVs in Blender fight with them throw my hands up in despair and walk away. A friend of mine was coming over to work on my other project with me and have a dev day. He spent the day accomplishing things and my entire Saturday dev day was me know figuring out UVs. The stupid thing is that I already know how to UV things. In fact I recently UVed a hover craft racecar for a completely different project. Racecar’s are harder than squares. Like all I am trying to do is a plainer projection on the front of squares. Blender from what I have looked for on the internet for how to seems to indicate that Blender used to have planer but now uses project from view. Project from view means that the size of all of the objects is different every time I make the projection. And that sucks when you want your UVs to line up. 

                Meanwhile I’m also wrapping up my other project. It is called Ninja Zen and on the Google play store. I have described it as Tetris with Ninjas. So project TOE has been neglected because of the more relevant release. Also not going to lie but UVs have made wanting to work on this project increasingly difficult as mentioned above.

                So this week I got myself in gear and sat down with UV nonsense for a large chunk of time this week. About 4 days this week. I got all of the UVs lined up then got them into Unity fought with Shaders for reasons I’m not entirely clear on then connected all of the pieces together to see how well they all lined up. Looked at the seams adjusted them in Photoshop. Back to Unity got it mostly working. Super annoyed with one piece in particular. There was a 1 pixel gap between a straight piece and a hill piece. I tried everything I could think of to removed this gap. It basically shouldn’t be there. The UVs were right as far as I could tell. I didn’t want to mess with them as I could break them worse. Photoshop was right. I turned up the quality in Unity. No help. Checking boxes and turning all of the relative dials I could find and nothing. Still a 1 pixel gap. 

                My wife told me to quit. It isn’t a big deal. The stupid thing was, it was a BIG deal, to me. This 1 pixel gap was haunting me. The words of advice from Extra Credits ran through my mind “If you are working on something for an hour and it doesn’t go well move on figure it out later.” Good advice. Screw THAT! I joined two Facebook Unity Dev groups. Posted my problem got back three different possible answers. I tried all three and none of them worked. That is when it clicked. It wasn’t in the UVs I thought. I opened Blender and looked at the model. I snapped the two pieces together and looked at their vertexes. Sure enough they didn’t line up. They were off by something stupid like .0012. Rejiggered the vertexes a little used blender’s snap to vertex tool and opened Untiy and BAM! No more 1 pixel gap. Victory yay. Was it worth it? I don’t know.

                As far as learning how to solve problems goes it was clearly worth it. If you try everything to fix a problem and everything fails there is power in that failure. You now know that thing that you think is the problems is actually not the problem.  Knowing where the problem is, is halfway to solving it.
                   Above is the very simple squares that I UVed. Squares that were a pain!
https://scontent.fsnc1-3.fna.fbcdn.net/v/t1.0-9/12963763_10154273491962214_5655090236786102236_n.jpg?oh=e26f6020d41b01b420d1c46e7ad77ef4&oe=58D7ED92
 More complicated race car. This object was easier for me to UV.... I need to get a copy of Max or Maya.