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.

Saturday, May 22, 2010

New Tank Art



Chris put together some great looking art for our first vehicle. Inspired by the warthog from the halo series, this will likely be the standard single passenger land vehicle. He also made some slope segments, so now we don't need to look at those ugly white polygons.

I've been working on getting other things networkable in the game, including projectiles, the tank, and the turret. It took a lot of experimenting and effort to get the tank working right, particularly with syncing information such as which character is driving which vehicle. There are still some bugs to kill, but overall things are working well. Currently, I'm working on adding simple gameplay elements such as health, damage, death, powerups, etc. You know, the things that make a game fun to play. Here's a video of our new tank riding on our new slopes on a single player game.

Wednesday, May 12, 2010

Early Stages of Networking and Multiplayer

It's been awhile since the last update to the blog and that's because I've been doing a lot of reading and research into game networking, specifically for XNA and XBL. Unfortunately, I've read a lot of negativity regarding it. Though I don't know if it's all true, some say there's not a big audience to play multiplayer games on XBL indie games. About a month ago, we decided we want to make this game a multiplayer only game. But, if there's not a big enough audience for it, we may have to reconsider making it a single player game, perhaps with some multiplayer options. I will have to try some multiplayer indie games and see for myself. I also read that game networking is a major hassle in general, and specifically so with XBL because of the packet overhead added with voice chat and XNA. Not that I'm complaining, XNA makes it super easy to at least use its networking features. It's just that I will face some challenges in making it run smoothly over XBL, especially with the physics engine. I'm already facing some animation issues with my regular characters (not using the physics engine) just over system link in my testing. Right now, I have the ability to host and join system link games working and you can play 2 linked computers together (xbox and PC, or PC and PC) moving the characters about freely. It's a lot of work and a good start, but there's still a lot more to do and improve. I'm going to keep experimenting and also read up on network prediction and smoothing algorithms. Hopefully I will be able to improve the animations and get the physics working decently over the network. Check out the video below, see the two little yellow dots on the minimap?


Tuesday, April 27, 2010

Vehicles and Physics

I've added the Farseer Physics Engine to our game. I have to say, it's very impressive and a lot of fun to play with. I spent hours tweaking various physics values and trying different functionality. For now, my goal was to get the engine integrated into our game and create a vehicle that can ride around our maps with a mounted turret gun that fires. To do this, I first had to make our map ledges "collidable" with Farseer's Physics Simulator. I changed the map loading routine to automatically create polygon "Geoms" with which objects can collide with when creating the ledges. Then, I went to work with building a prototype vehicle that I (very) roughly modeled after the Warthog from the Halo series. One interesting thing I discovered during this whole process is that most popular platformers don't actually use realistic physics like this. It makes the character difficult to control and the movement just doesn't feel "right" for a human (or human like being). For this reason, I decided to keep the original, simple, physics system I already had developed and include Farseer as an additional physics system to use only for specific entities that require more complex and realistic physics such as vehicles and grenades. Because we don't have art yet for sloped ground or any vehicles, I just draw simple shapes to demonstrate the physics and vehicle.



Tuesday, April 20, 2010

A Brave New World

It's been a long time since my last update to the blog. It's not because I took a break from the game, but rather that I've tackled my toughest challenge yet. I decided to design my own system for map linking and mini-maps. Instead of looking for help and examples in books, forums, or blogs, I sat down with a pen and paper and planned things out myself. It took me quite awhile to come up with answers to all the problems I faced, but I think I ended up with something decent that works and I'm happy with it. I call a collection of maps a "world", hence the title of this post. I needed to make a new editor to create worlds with, but I'm bored to tears with the UI code so I just put together something super ugly but super quick, copying a lot of code from my previous editors. The video below shows Chris' new shark, which I think is super cool, running through our first test world.







Next up on my TODO list is to fix up a few map transition issues and then experiment with the Farseer 2D physics engine to see if I can get it working with our game.