Skip to main content
GameDev.net gamedev.net
🔒 Locked

Basic Shooter

Started by NickyP101 Mar 16, 2005 at 11:24 PM 5 replies 1.4k views
Original Post
NickyP101
NickyP101
In a basic shooter, how many pixels should a bullet travell per frame?? Cheers Nick :)
hallucinogenic
hallucinogenic
Quote:
Original post by NickyP101
In a basic shooter, how many pixels should a bullet travell per frame??


As the previous poster said, this value will depend on factors such as how much distance in the real world each pixel represents. As such, this is something you have to determine by playing with the values in your game until it looks "right."
jbadams
jbadams
As said above, just play with it till it looks right, as there are many factors that effect this.
- Jason Astle-Adams
Aiursrage2k
Aiursrage2k
I would like to see the bullets fly slower than most games, to the point of seeing the incoming bullets.

Similarly what is the best way to handle missles, by simply running in the main timeline or to spawn a new thread for each missle fired.
Insufficent Information: we need more infromationhttp://staff.samods.org/aiursrage2k/
roger_hq
roger_hq
It also depends on if you are doing a fixed time step in your game loop or if you are doing framerate independent movement.

If you are doing fixed time step, it is *relatively* safe to assume your bullet will move x pixels per frame, because you are doing a set number of frames per second. This runs into trouble when you drop below your desired frame rate.

If you are doing framerate independent movement, you need to think not about how many pixels per frame, but how many pixels per second. That way, regardless of your framerate (particularly on different machines), your bullet will travel the same velocity, independent of the user's computer's abilities.

_____________________________http://www.deepbluefuture.com"Set Phasers to neuter...""2+2=5 for sufficiently large values of 2."
Dookie
Dookie
I use a simple 'distanceMoved = timeElapsed * speedValue' formula... This movement formula figures out how many pixels to move an object by checking how long it's been since it was last moved. It's good for variables that can vary the time it takes to complete an iteration of your gameloop (for instance, the difference between playing your game on a PC that barely meets minimum specs and playing your game on a dual-GeForce Alienware). In a nutshell, the bullet won't travel a 'fixed' number of pixels; rather, it will travel a particular distance based on its speed value and the time elapsed since it was last moved.

When you get that formula working, play around with the 'speedValue' until the bullet is travelling fast enough for your game. Then, you can play your game on different computers and the bullet will travel the same speed on all of them!

Hope that helps. Good luck on your game! :)
"The crows seemed to be calling his name, thought Caw"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.