Tuesday, July 19, 2011

Infiltrator - Season 2, Part 4:

This session has been one of the most annoying and yet most rewarding yet. Let's just hop in with some of my favorite features:

You may not be able to tell without checking twice, but that's actually an old school enemy pile-up. I finally initiated the base enemy framework as well as simple enemy objects for each type. I even have nifty little spawn and kill functions, and let the level spawn enemies wherever it wants. Granted, all it does is load the proper mesh, turn it into a rigid body, and fling it at the wall, but at least it's a start.

Development of this certainly did not go without incident. Walk up to a programmer and say the word "pointer," then say "void pointer," then say "deleted pointer to a pointer to another void pointer being referenced again in some obscure piece of code." If they aren't laying on the floor crying at this point, they haven't been doing enough programming.

Now if you are a programmer, you can probably understand some of the frustration introduced here. To make things short, I needed to be deleting a pointer but it was crashing every time I did. Debugging showed me that the program was actually crashing after the function I was deleting the pointer in had ended. I moved the deletion to a different function and the problem went away. To this day I don't know what the problem was, and I can't figure it out. Programmers can also relate to the amazing annoyance of a problem you solved and don't know why.

Anyway, once I finally got the enemy structure intact, I set about doing some level parsing. I parse levels by first using the config file variable loader to read the number and type of enemies that will appear in the level. I use this information to create enemy arrays big enough to hold all the enemies. Then I go on to read those enemies one at a time and spawn them at the indicated location and heading.

The file format isn't the most user friendly or readable by humans, but it shouldn't have to be anyway. I'll theoretically build a level editor once I get the level object setup properly, so I should only have to write a few of the files by hand. Only the really hardcore modder's will be looking at the format, and they'll be used to handling convoluted files of garbage, so they might be a little forgiving. ;)

Note, that I'm not finished setting up this level parsing thingy yet, as I'm still playing around with it.

I need to start on the real enemy coding. I need the enemies to be more than inanimate pieces of metal laying around. It will take some serious work to work out AI, enemy firing, and things of that nature. Even after that, I need to setup things like doors, keys, powerups, other weapons for the player, and more.

This session took longer than previous ones, punching in at 9 hours. That leaves me at 16 hours total. We'll see how long my optimism lasts. ;)


No comments:

Post a Comment