Showing posts with label debugging. Show all posts
Showing posts with label debugging. Show all posts

Saturday, September 23, 2006

XNA Shmup

So for anyone who cares and hasn't heard me rant about what I wanted to do with the XNA stuff I'll just explain it now. Ryan inspired me to go in the direction of a shmup, I have wanted to do one for a long time but this new framework seems ideally suited to a game like this. There isn't any particular art style or theme set atm so I'm just laying out some really basic shmup gameplay elements that are pretty much 'required' to have a respectable game. One of the key ideas though is to completely leverage the 360 controller. I want to have a very natural action mapping to the controller that makes sense and gives you more control than simply shoot and move.

A few concepts that I am borrowing for the GD are:
  • Roll defense from starfox
  • Polarized attack for the enemies ala ikaruga (radiant silvergun), the difference here is that ground targets must be bombed, squigies must be railed with mass driver weapons and conventially shielded enemies require beam weapons.
  • All weapons are effective against all enemies but certain weaons are much more effective. This technique is vital to survival.
  • Ability to equip a small pod that can has limited controlled and it's own set of upgrades.
  • Clip/reload system for mass drivers/bombs, energy system for beam weapons. Ammo is plentiful but must actually be collected and you cannot hold the fire button the whole time.


    Here's a screenshot debugging one of the triggers for a mob spawn and the new bullet system:



    Again, not very impressive looking (it looks better in action) but I'll just layout a few of the things that are working now.

  • Follow camera
  • Scene trigger system that can fire proximity events
  • Mob controller with spawn/death management (hooked to trigger system)
  • Mob action scripting pcodes with time driven events (Fire, Rotate, Change properties etc)
  • Random terrain generator

I'm not trying to do a fully polished game currently. Just something that starts up allows you to play through a random level with increasing difficulty and records your high score. I will probably implement a few different types of weapons as well.

I don't know if I want to finish it all in one shot.. I have to get back to some other stuff.. really ;)

Sunday, September 10, 2006

Holdem is finally running, woot!

And it looks amazing! For the record Dragonfly by Lemon D was the song that was playing when the app actually started up and ran and the time is 3am. I have been pursuing this goal of having this game engine run on a symbian smart phone for some time now. I finally tracked down the finaly serious problem pretty much by accident.

The line that was crashing first was:

if(path.compare(rec->name, rec->namelen))

This looks totally innocent.. I'll just say right away that it wasn't any of the usual suspects. Keep in mind that this ran fine on other hardware architectures. The problem was actually memory alignment.

The records that are being referenced here are part of a block of index records stored in the resource file. I have a tool that transforms and packs files into a single file and creates one block of memory to be used as a searchable index. The structure in memory used to look like this:

struct RecordRef
{
uint32 offset;
uint16 nextrec;
uint16 namelen;
// char name[namelen + 1]
};

If I tried to access offset or nextrec and the field didn't lay on a 4 or 2 byte boundary respectively my application would crash. This kind of problems are pretty hard to track down without a debugger. I used loglines traced to a text file on the phones internal memory through multiple builds to track this down.

The new structure looks like this:

struct RecordRef
{
uint32 offset;
uint16 nextrec;
uint16 namelen;
uint16 padding;
uint16 reserved;
// char name[namelen + 1]
};

I calculate the padding when the records are built in memory and before they are stored into the resource file. When they load from the file they are all nicely aligned and the code that searches the index just has to take into account padding when doing any pointer/index math.

Seeing the title screen on my phone makes me very happy!