Sunday, February 5, 2012

Collectibles and Menus

Hey Readers,

Another week of programming on the bus gone by. I haven't really figured out how I'm going to format this blog but I think for now I'll just kind of run through the things I did each day. The first thing I tackled was an easy one, just resetting the player's velocity when teleporting them back to the beginning of the level. Before putting that in if the player was moving too fast like if he'd fallen off the edge and I needed to reset him back to the beginning he'd be going so fast he'd fly right through the floor.

The next thing to tackle were my menubars, and let me tell you I had a hell of a time with getting those menubars working again. The menubars were one of the first pieces of my UI that I got working and the code had evolved quite a bit over the course of getting everything working. Needless to say there was some weirdness with how the coordinates were set up and I just could not wrap my head around what I needed to offset to get the mouse coordinates into the right space. The right thing to do would have been to just rewrite them to better match how things were currently working in the more updated UI elements but instead I just hammered on it for 2 days until it started working haha. Definitely sucks losing 2 mornings and 2 evenings to a menu. It's nice having them working now though, I've hooked up all the various windows that I had floating around so I can toggle them visible and invisible. Previously all I could do was click the close button in the corner of the window and it would be gone until the next session.

Shot of the main menu
I also found what I thought was a bug in my debug text rendering. It seemed like the prints constantly flickered, turned out all the prints were in some of my physics code and because I didn't use a fixed time step for my physics sometimes it would skip an update. The side effect of fixing this was that my physics runs way smoother now. Next up were adding some collectibles to the game. I reused some of the components of my trigger volume to set up a coin which disappears when the player moves through it. I still need to figure out how the system will work for adding the collectibles value to the players score. I still need to finish this up by putting in some code for receiving the collected message and rewarding the player appropriately. My current gameplan for the coins is to do something similar to the first Mario Kart where the more coins a player has the higher his top speed is.

Here's a shot of the editor in voxel sprite edit mode.
Here's a shot of the first collectable, a coin.
I also set up some code for better modifying the players control based on three parameters: Top Speed, Acceleration, Spin Handling. This code had to be hooked up to the physics so it could properly limit the different physics properties based on those three values.

There was also a few little tweaks I made. I adjusted the gameplay camera a little bit, moved it up a little bit and removed the horizontal offset I had in place. I also tweaked the color on the tweakable menu so I could see it a little better. I also added a tool to the main menu for duplicating the level 4 times to generate the 4 lanes that the player will race in. I also found a major bonehead error in my bulk frustum check that was resulting in some serious performance issues. I was doing a frustum test on all of the objects in my scene, however the function that performs the frustum check takes an array of aabb's and I was stupidly calling that function once for every object, which squared the number of frustum checks I was doing!!!! So dumb, it doubled my performance getting rid of that stupid loop. Oh yeah I also put in my first pass at the character for the game! He still needs a name though, and trying to figure out the final style for him, whether I extrude certain blocks or make him totally 3d voxelated.
Shot of the tweakable menu
Shot from the current game camera

No comments:

Post a Comment