Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Weapons of mass destruction

Sign in to follow this  


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.
Sign in to follow this  


Recommended Comments

Original post by Scet
Edit: Wow 20000 views! Thanks guys.
Thanks for giving us something interesting to read. [smile]

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!