Jump to content
  • Advertisement
Sign in to follow this  

Handling Player Animations and Weapons

This topic is 3685 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I’m implementing a First Person Shooter and I’m having problems finding a good idea for the weapon system. I’m focusing in creating the game in such a way that when the game gets released, players can create mods. So the system should be able to handle new players and new weapons. So, the thing is HOW to define players and weapons in the game. So far I have a Player class that holds the entire player visual and physic simulation data. Also it holds a list of the weapons he can use at the moment. Now, the weapon class is just an abstract class with methods for Firing, Reloading, Raising, Lowering the weapon, etc. The problem I’m facing is animations. Is for sure that each of the weapons will need animations for its basic operations (firing, reloading, etc), but given that players can have different skeletons, then there should be versions of the weapon animations for each player. Even if all the players use a biped, the bones can be scaled to match the player size (some character have longer arms, some have a wider back) so a common animation will not fit all the cases. What I thought was to have a set of animation types (firing, reloading, etc) and each character will need to have a packed of those animations for each weapon. So when developing a character, you will need to create animations for all of the weapons in the game. If a character don’t find an animation packet for some weapon, then it knows that it can’t pick that weapon. There comes the first problem: When some player makes a mod that creates a new weapon, it will have to make all the players have the animations for that weapons, but what about if another mod creates a player, it will not be able to pick that weapon. Anyway, even if there are animations for that player too, the system soon enough become too heavy on animations. Another point, how the different weapons are handled? For instance: there are the basic firing weapons like the sniper rifle where you have a fire animation that is played when the weapon’s fire method is called. At some point the fire animation defines a trigger to callback the exact moment where the bullet should be sent. Easy, just an animation and the firing time. But there are other weapons that are more dynamic: A mini canon like in the unreal tournament that start spinning when you press the fire key and when it reach some rotation speed, it start firing until you release the firing key. At this moment it stop firing and start lowering the rotation speed until it stops. Here is also an animation (just spinning) and several firing times, placed each time the bullet cylinder align with the aiming. There are other weapons like the automatics like a machinegun. Those weapons start the firing animation, at some point makes the first firing and because of the firing force the weapon is raised a bit (bounce up), so if the trigger get released the weapon returns to the normal location, but if the triggers remains pressed, it fires again and get a little more raised, and again and again, etc until the weapon is very raised so just the first weapon is accurate and is becoming less accurate as more shoots are perform. How to make that automatic weapon, a firing animation that holds several shoots until the gun gets too high and then don’t raise the gun any higher but make an internal animation loop for firing any number of shots and then lower down the gun. But that is a problem, because if I shoot only 1 time, the weapoin angle will be lower than if I shoot 5 times. So which animation for rising should I play. As you see there any many types of guns, each one with a different firing process. How are they normally implemented in other shooter. That can be code implemented different for each gun, but I’m trying to find if there is some way to generalize the process so every weapon modder just inherit from the weapon class and tweak the values that defines the actions, like for instance, number and location of the firing times, were is the firing loop, the number of clips, etc. If you have implemented a First Person Shooter that can be mod or knows how it has being done in any game, could you explain it a bit so I get some ideas?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!