Thursday, June 28, 2012

One Step Back and Three Steps Forward

I don't really understand why I couldn't wrap me head around the physics movement problem yesterday but here goes. I took a step back and wrote down on paper how I need the movement to work. When I took a look back at the code, it was easy to implement. Now Mario walks, runs, and slides properly around the screen. Jumping and gravity still isn't implemented yet because I need to do collision detection with the blocks.

The next thing I did was fix the animation class so now he animates properly. It doesn't look completely accurate yet, but I'm writing it off as "good enough" until I get the rest of the major elements implemented.

Finally, I created a tile manager class which takes a text file and prints out all the objects on screen. Amazingly I got this working my first try without any errors!

There is one bug to note. When Mario is standing still he appears behind all the objects on the screen. This has to do with the order that the sprites are being drawn and should be an easy fix.


Wednesday, June 27, 2012

Speed, Acceleration, Friction, Time

Today was a complete failure in terms of getting anything meaningful accomplished.

I went through some of my old code and found an XNA library with a few useful functions. I can use the input manager and fps tracker as-is, but the animation manager will need some heavy modification because of the way I did my sprites. The first thing I did was hook up the fps tracker. This allows me to track the frames per second put out by my PC to analyze any problems. For example, if I make a change to the way sprites are rendered and suddenly my FPS drops from 6000 to 4000, I'll know that it was not a very efficient change. It's much easier to debug memory issues and cycle hogs on the spot rather than further down the road when my codebase is 10x as large.

I ran into a big issue when I hooked up the fps tracker. Previously my game was running at a constant 60fps, but suddenly my PC was pushing out frames as fast as humanly (computerly?) possible. This caused my character's movement speed to increase 100 fold. To combat this I need to change my movement algorithm to incorporate elapsed game time. I must be tired or had a brain fart or something because I can't get it working properly. Out of frustration I deleted my current movement code and decided to deal with it tomorrow.

No video for today folks.

Tuesday, June 26, 2012

I Do Indeed Work Best in the Morning

I decided to slowly adjust my sleep schedule in order work on this game in the morning instead of late at night. I realized that after work I just don't have the energy or willpower to do anything productive. Instead I would like to spend the time relaxing, making dinner, playing video games... Waking up at 5am gives me a solid 2.5 hours to work before work. The only problem is I feel like an old geezer.

Today I implemented a sound manager and inserted music from Mario RPG. It begins playing as soon as the game starts and loops indefinitely. Next up I added some blocks to the screen. Currently my implementation is awful because I have to manually set which pixel on screen I want each block to draw. I want to create a level manager that reads a text file and creates a level based on that. Finally, I added a gravity component so that Mario is constantly falling. Once I implement collision detection with the blocks, he will have a nice platform to stand on.


We Have Animation

Today I dove right in and created new classes for sprites and animations. Everything that has only 1 frame (such as Mario standing still) will be a sprite, and everything else will be an animation. Along with that I needed to add Mario's current state so the game knows if he is walking, running, dying, ect. It was rather easy to hook up.

Unfortunately I spent the majority of my time today trying to create a sprite sheet. I found out that specifying individual pixels for each sprite was rather annoying, so I broke up everything into 16x16 pixel pieces. Everything in the game can be broken up into these blocks which I will use for my advantage later on. I may eventually create some sort of image packer program to streamline the process, but I'm not too worried about that right now. It will become more necessary as the number of sprites increase.

Here's the end of the day progress.

Monday, June 25, 2012

Installation Complete. Please Restart Your PC.

In my experience, the hardest part about creating a video game is finalizing it. If you don't have a clear vision of the final product, then your project is doomed to stay unfinished. This is why I've chosen a pre-existing game to copy, Super Mario Bros for the NES. My goal here is not to make money nor distribute my code so I don't have to worry about copyright infringement. I chose Mario as a base because the rules of the game are already well defined; I know exactly how the game should look and feel once I'm finished. As an added bonus, I don't have to worry about creating art assets which will free up my time for more coding goodness.

My goals by the end of this project are to:

  1. Create a level editing tool which will allow me to easily create levels.
  2. Use the tool to recreate the first level of Super Mario Bros.
  3. Build a library of functions for use in future games.
Having a set list of goals is also a good way to keep motivated.

Today I installed Visual C# 2010 Express along with the XNA 4.0 framework on my PC. I grabbed a sprite-sheet from Google and cut out a Mario sprite. I created a Mario class, added keyboard controls, added in a coefficient for velocity and friction, and finally flipped the sprite to look the proper direction when moving. So far so good!


Oh look he's moving!

Sunday, June 24, 2012

Booting Up, Please Wait...

This blog is my motivation.



I have been procrastinating a lot recently and had a reality check last night. I've already decided that I'm not going to be an assistant teacher forever and I need to start working towards my future. As of 5 months ago I didn't know what I wanted to do with my life and as such spent every extra minute studying Japanese. I finished the advanced course offered by the JET program and decided to stop. Unfortunately the free time I now had went into unproductive activities like playing video games. This needs to stop.


It has been my lifelong dream to create video games. I messed around with the idea in high school. I got a degree in Computer Science. I spent my free time at work dabbling in XNA. Now I'm stuck as an assistant teacher which I love but is not a career path. This position offers no advancement, no raises, and no promotions. I sign a yearly contract to continue doing the same thing I'm doing now. 


I need some sort of motivation to keep me going. In the past I've always started a new project, started learning some basic concepts, started digging deeper, but nothing was ever finished. I need to see this through to completion and this blog is my motivation. I will post my ideas and how I execute them every day from this day onward until I leave Japan. 


I promise myself that in 1 years time I will become a video game developer.


Signed: Jon Slabaugh