Tuesday, June 29, 2010

Networking Improvements

After reading through the code of the network prediction project provided on the XNA Creator's Club web site, I was able to implement the prediction and smoothing algorithms into our game. Although it didn't completely remove all the stuttering, I'm happy to say it did help a great deal. This worked fine for regular characters, however, I was faced with a bigger challenge of fitting these algorithms into the Tank class which uses Farseer physics. After thinking about it a bunch, I decided to forgo the algorithms for the Tank class and take another look at ways I can improve its stuttering. I studied the data I was sending for the tanks and discovered I had omitted a very important piece of data.. the velocity! The reason I made this mistake is because I use a Vector2 called "Trajectory" for the Character class which is the velocity. But the Tank class, which is derived from the Character class, uses the Trajectory variable to store the force that is applied to the physics object. The velocity itself is kept by the Farseer class "Body". So I added this data to be transmitted over the network for syncing. Through the testing I've done so far, this works well. However, there could be issues I might see only after some real play testing.

Besides the code updates, we also finally decided to pay attention to another critical aspect of the game.. the design. I downloaded a game design doc template and we started going through it, answering a lot of important questions about what we want the game to be like. I can see a lot of time will be spent on this doc, considering we spent an hour working on it and only got about 25% through it. Good times!

Sunday, June 13, 2010

Artybartfast

Scenery update time. I changed the awkward looking floating dirt blocks into palm trees to make the environment a look a little more natural.



In addition to the above I also created a completely new environment; the underground cavern.

Saturday, June 12, 2010

Performance Problems

I was on vacation last week and so did not work on the game at all. Before leaving for vaca, I found that there were some severe performance issues with the game on the xbox. I was wondering when this was going to happen. I had to do some testing to determine the cause of the performance problems and found some great help for this from Shawn Hargreaves blog here and here. Basically, XNA comes with a really nifty tool you can use to inspect your games heap when its running on your xbox and view all sorts of metrics on the garbage collector and memory usage. This made it easy to discover that I was putting the garbage collector into overdrive because I had 4 objects per map tile allocated for map scripts. This was far too complex. I limited the map scripts to only 20 sets of 4 per map and that solved the problem. This was much harder to do than to type, but I'm glad it's over with. In addition to this change, I've also added the ability to specify a background image for a map in the map editor.