Page 1 of 1
Gun Mechanics
Posted: Sat Jul 16, 2016 7:03 pm
by Semeon
Hey,
I was wondering how to implement bullet mechanics. It would help me if you could give the full code with all of the love function etc. cause I get to study the code and I want to understand it well thanks!
Re: Gun Mechanics
Posted: Sat Jul 16, 2016 7:07 pm
by MicroMacro
Well, I'm no expert. I have made simple gun mechanics before.
It depends on how you want it to work. If you want the bullet to follow your mouse, it's a bit trickier, but there's a
great wiki article on how to do that.
Re: Gun Mechanics
Posted: Sat Jul 16, 2016 9:17 pm
by Semeon
Well... that isn't what I was looking for, sadly.
Re: Gun Mechanics
Posted: Sat Jul 16, 2016 10:24 pm
by MadByte
Semeon wrote:Well... that isn't what I was looking for, sadly.
Then you should explain what you're aiming for instead - we cannot read your mind.
Re: Gun Mechanics
Posted: Sat Jul 16, 2016 11:20 pm
by zorg
Nor will we code it for you whole.
Re: Gun Mechanics
Posted: Sun Jul 17, 2016 12:31 am
by Pangit
To give an idea, if you want to have different guns. You have a table of characteristics for each type you will use in the game. This is loaded when the player equips the weapon or an NPC. You can tweak the modifiers to balance the game. In the game each gun would have its own unique instance in the game world so you could account for things like upgrades and modifications, wear and damage ect.. So that not each instance of the type is the same.
You can make it as realistic/complicated as you want. But you will have more of a simulation than a game then if you go down that route. Plus you model the guns that realistic it places a burden on you to model the rest of the game world in the same way.
if you model the bullet characteristics properly and the environment you will quickly find your game is totally unplayable. In a cover shooter for instance if the NPCs have AK47 or AR-15, and you take cover behind most available cover in a environment, they open up on you even in full cover the player is going to get shredded. Realistic but not so good from a game-play narrative perspective.
Trying to keep track of enemy ammunition levels, get them to reload and replenish in a logical way. That is not a trivial thing to implement and will become an accounting nightmare. I have yet to see a game where the NPCs actually adjust there attack patterns based on ammunition reserves.
Re: Gun Mechanics
Posted: Sun Jul 17, 2016 1:48 pm
by Semeon
Hey thanks I did understand what you were talking about, but I managed to figure another way to implement gun mechanics using controller input!