# Artillery Physics Speed Issue

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

## Recommended Posts

Ive started an artillery combat game, with standard turn based battles. The physics work by saving variables UVel and FVel (upward velocity and forward velocity) based on where you click relative to your tank, making a easy way to aim, even for beginners. The shell moves up by UVel each tick and forward by FVel each tick. Uvel is reduced by one each tick for gravity, and FVel changes the same way, but to account for wind. Its a pretty versatile system, and i want to use it, but ive run into a problem. Since this happens once a tick, it happens far too fast. I want a medium size shot to hit ground in about 3 -4 seconds, but its doing it in less than 1 D: any ideas how to smooth and slow the motion of the bullet without giving up this projectile system?

##### Share on other sites
All you have to do is change your values, lets say you wanted the shot to go farther with the same velocity, lower the gravity. If you want you firing controls to be more sensitive, create a modifier field and multiply it by both velocities, a larger value would cause it to go farther with less pixels away from the tank, and vice versa. Pretty standard stuff, just got to think about what would cause what. All games are is changing values in an efficient and meaningful way, you just got to figure out that way. Hope this helps.

##### Share on other sites
Make your motions time sensitive. Instead of doing: pos = pos + vel; vel = vel + accel; like you are doing now, you need to be doing pos = pos + vel * delta_time; vel = vel + accel * delta_time. Use a timer like timeGetTime() or QueryPerformanceCounter or whatever is best available on your system. Take the time at the start of each frame and use it to calculate the real-time since the last frame. That way you know how much real time each one of your "ticks" takes. Scale your acceleration and speed by that time. Then, as noey699 suggests, play with the values for gravity/wind will you have something that looks about right.

##### Share on other sites
Hmm yeah, i figured id have to toy with gravity. Although scaling the velocity hadnt even crossed my mind. Thanks!

1. 1
2. 2
Rutin
18
3. 3
khawk
15
4. 4
A4L
14
5. 5

• 9
• 13
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013665
×