Saturday, September 24, 2016

TOE week 16: Diagonal Legos!



                Diagonal Legos! They are a thing. Last week I tried to use the Pythagorean Theorem to solve a problem and as it turns out the Pythagorean Theorem was exactly why it wouldn’t work. “Wat?” I know right! Last week I was basically trying to make a 1x1 triangle have a hypotenuse of 1. Not possible in this dimension anyway. So it doesn’t work. However what does work is my wife’s solution of parallelograms. They are the Diagonal Legos I have been looking for. Parallelograms line up on the grid! All of this week’s work has been done in Blender making various different collision pieces and lining them up. I did finally get a drawing tablet so I can paint better in photoshop. But the actual painting has still yet to happen. Baby steps right? 

                I guess you might be wondering just why am I doing this? I am trying to work smarter and not harder. I’ve worked on a game like this before and the Level Designers made A LOT of work for the artists by creating levels with no standard sized collision out of boxes of various dimensions. Using this Diagonal Legos system that I have been forced to focus on over the past two weeks, I can make standardized art that works across all levels. In industry MANY a time when I brought up work flow issues I was met with rolled eyes. I fought with some producers about ‘if you make us do X, it will cost us Y’. One time it was an entire level. Content creation is the name of the game. If you can make content easily you can make MORE of it.

                Being the only person currently working on this allows me to spend time on the ease of use of my tools. I don’t yet know the drawback to my Diagonal Legos but I am assuming it is computationally more expensive than box colliders. In my opinion the ease of use out weights this. It was a pretty good week for work overall. Not really a whole a lot to say really aside from Diagonal Legos ROCK! 


Sunday, September 18, 2016

TOE week 15: Parallelogram solution.



                There are monsters under the bed. It might be a good thing that I didn’t try to paint things last week… I found out this week that I’m not yet to painting. I tried to set up art for the slopes I currently have and my God WTFBQQ attack. I have 14 different ground pieces of collision. I was only trying to deal with 7 of them. The ground pieces I’m ignoring the ceiling. It was an unmitigated nightmare. A 22.5 angled piece fits with a 0 angled piece like this but when you try attaching it to a 45 degree piece it no longer works in the same way. Oh and the 0 degrees line up when they are below angled pieces but fail to work in any way whatsoever if they are higher than the angled ones.

                I was hoping to make a simple snapping system too. Where everything collision is on a grid and if you use the Pythagorean Theorem the collision will all line up. Yeah that didn’t work. I thought math was supposed to help me! It didn’t work out the way math is supposed to. Three, Four, Five, right angle? Nope! 

                Fine! I got out an exacto knife and some card stock. Cut out little rectangles 1x3 and placed them at 22.5 and 45 to see just how these damn things are supposed to connect to each other. Like I’m laying on the floor moving card stock around and if my wife asks me what I’m doing my answer was going to be ‘I’m working on the game’. Card stock didn’t seem to cut it so I switched over to photoshop. Photoshop does something really easily that no other 3d editor (excluding XSI) even does. Moving the COG or pivot point is SO easy in Photoshop. I don’t get why it is such a pain or impossible in other editors. But even my Photoshop powers couldn’t help me. 

Side bar NESTED or grouped objects in Unity is not good. Bad Unity! Be better at this!

                I was having so much trouble trying to do this stupid thing that I couldn’t even explain what the problem was to my wife. I mean I don’t even know what this problem is called. Grid based collision? She came over put her head on my shoulder and said. “Oh I see what the problem is now.” We talked about it and she then understood my struggles. She was feeding our son and said something that might be the brilliant solution. “Could you just make everything that is at an angle a parallelogram?” Not having had the Bobby Fisher moment I said “No Unity doesn’t do that….. But Blender does.” I sat there thinking about spacial relationships eyes moving back and forth in a 3D world not our own. Zero to 22.5 check, Zero to 45 check, 22.5 to 45 check,  90 to 22.5 doesn’t quite work as planned and same with 90 to 45 but IT does WORK as far as collision is concerned.  

                I didn’t have the time to create all of the parallelograms to test if this ACTUALLY works. But I did test something that I wasn’t sure would work. I slapped down a cylinder in the level to see if my Ray Casting system would let my Player smoothly walk up and down a circle. And damn it is a fine thing to watch when something complicated works out completely as you think it should work in programming. That right has the rarity of a Unicorn. So I learned that my code allows for this and I didn’t even know it was capable of it. Like I can make arched stone bridges with this and that is pretty cool.

                Was this a good week? NOT REMOTELY. Nothing freaking worked! Did I learn some cool things? I am definitely smarter now about possible solutions and the capacity of my code. Did I get to paint? Nothing but test art. I have yet to try to implement the parallelogram solution. I mean looking at it in my head it ‘should’ work but I thought my original solution ‘worked’ in my head. Turns out the pictures in my head were ‘wrong’. I will update next week on just how well parallelograms either kicked my ass or saved my life. To be continued, game over, insert quarter. 

 

Saturday, September 10, 2016

TOE week 14: The Jim Cunningham Philosophy.



                So last week I struggled with fixing a very broken thing. The day after I wrote that blog about how hard it was to fix the damn thing I fixed the damn thing. The problem basically came down to an error in direction. When traveling to the left I was multiplying in the Y direction (up) when it was supposed to be multiplying in the X direction (side to side). Basically this seemed to make the player check for a collision with the ground in the upper right corner of the player, something that can pretty much NEVER happen as only the left and right lower corners ever touch the ground. Finding this problem took 5 days because the code for walking up a slope and maintaining the player speed is pretty complicated. A bunch of math is involved that I don’t want to bore you with. 

                Then I spent the rest of my time fixing my decrease in power problem. Something happened and all of my parabolas and push colliders all decided that they were no longer powerful enough. My boomerang only would fly out slightly in front of the player and the player would no longer move upward in the push colliders. I thought it was the addition of the art that did this BUT I deleted the art and still the power was too low. So I upped the power and fixed all of the ‘broken’ things. I hope that I don’t have to do this yet again when my computations compound but again I don’t know what happened. 

                I was supposed to paint this week… I didn’t. If I’m being honest I was afraid. I was afraid that I would do something and break the game. I want to say that I have created some simple and yet versatile code but I can’t really confirm that. So unfortunately for me I let fear get the better of me. So after I finally solved my Zoolander problem I ran into the Jim Cunningham problem. (Kudos to you if you get that reference or Googled it.)

                I should probably take heart that I am still solving my problems even if not on a time table to my liking. Means I am still able to work it out in code. Coding is not my strong point but I am still managing. I guess I need an attitude adjustment. I mean I have overcome all of the obstacles so far, basically nothing has stopped me. Also I have finally made it to a part I’m good at! The painting part.

Saturday, September 3, 2016

TOE week 13: The Zoolander Conundrum

                Part of the nature of Game Development is that as you add in new things your old things start to break. This is entirely normal even if it is annoying. I mean if you’re working on a team of a hundred people things can go south real fast. There were days when I couldn’t test my work because the game didn’t work at all that day. If you can’t test your work you can’t verify that it is working so you cannot check in your work. It is somewhat more manageable when you’re the only one making the changes. So I had thought that I had finally made it to the art portion of the game. Well at least for a little bit anyway. I was excited to start painting this thing so it wasn’t just a bunch of squares! I then added in 4 sprites. Basic floor tiles that display over the collision and something snapped. 

                Suddenly my push colliders push values were too low. They would no longer strong enough to push the player. Very strange! My best guess is that this is a frame rate issue. Like my sprites decreased the frame rate so the force is no longer applied at the same rate. But we aren’t taking about significantly large sprites here we are talking 100 x 1000. I don’t even know if the sprites are what broke this either. They were just the last things added and then when I hopped into the push colliders they didn’t work anymore in the Y direction. The power was too low. 

Then I found out something that really confused me. My code for walking up a second hill apparently never worked. So if I have two colliders both at odd angles like 22 and 45 and they are touching, however you cannot walk up the second hill. You instead bounce up the second hill. You couldn’t tell that this was happening until I added in the player head. I rearranged the code and then instead of bouncing up the second hill you fall right through it… Clearly not ideal.  Okay so I looked at the code and found a sign error something was negative when it wasn’t supposed to be, great problem solved! Then I was even more really confused. It only works when the player is heading right. Like going up a hill to the left and you fall through the second hill.

The dumb thing is that I can’t seem to fix this. I have tried all of the things that make any since I even tried breaking it intentionally and going right still worked. I have tried to fix this for three days with no clue as to what is happing. It SHOULD work. Basically the right corner of the player tests for collision when going up a slope then when the slope is not the same angle as it was previously recalculate player velocity x and y. Going left it changes to the left corner to test for collision but it is like that never happens and I don’t know why. 

I am worried about the addition of the artwork. I was stoked to be finally able to add in the base for the pretty colors. The possible drop in performance has got me spooked. Why would adding in a pretty small image tank my frame rate so much to change calculation speed? I mean I have plans for adding in much larger images. Like two 2048 x 1024 backgrounds and what not, something less than half that I would hope wouldn’t tank my frame rate. Or I am doing something VERY wrong. The truth seems to be that as much as I have been able to accomplish in these 13 weeks I still don’t know what the hell I’m doing.

In more productive news. My ducking functionality seems to be working better. Like I went through and prevented the player from moving while ducking and various other things that have been completely overshadowed by the total eight car pileup of a week this has been. Unfortunately though for the immediate future the player character is stuck being Zoolander… And that sucks. It really is defeating when you can’t see it and it continues to evade you. I probably have to show it to someone or tear it down entirely and rebuild it from scratch. Something for next week I guess.