Weapons of mass destruction

Published November 04, 2006
Advertisement
When I quit working on Doom.Net last time, part of the reason was because I couldn't figure out how the weapons worked. My implementation consisted of static classes for each different kind of weapon along with hard-coded screen positions for each frame, it was disgusting.

I decided this time to actually look at the Doom code(which may cause eye cancer). I found one file named info.c that consisted mostly of a huge array of states, it was the Doom state machine.

One change I had to make was to make the game tick based. Basically Doom runs at 35FPS so 35 times a second it creates a "tick" and increments a global tick counter. This counter is used to control the timing for everything. So now instead of the timer mess that was the previous Doom.Net, everything now runs off one timer, the way it's supposed to.

I then of course had to come up with my own state machine. It handles transitions, timing and animation, plus it isn't just for the players weapons, it can be used for anything.

Anyway it took me a few days to add the timer and state machine code, but with them in place it only took about an hour to add in the weapons.















The animations and rate of fire are exactly like in the original Doom, except for the plasma rifle where the animation is a little off. I still have to implement the fists and super shotgun, but that's not a big deal. The point is that they work.

Edit: Wow 20000 views! Thanks guys.
Previous Entry Helloween
Next Entry ZDoom
0 likes 4 comments

Comments

HopeDagger
Awesome. Very glad that's been ironed out! [smile]
November 04, 2006 07:26 PM
jbadams
Quote:Original post by Scet
Edit: Wow 20000 views! Thanks guys.
Thanks for giving us something interesting to read. [smile]
November 04, 2006 10:22 PM
benryves
Top work! [smile]
November 06, 2006 04:45 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement