Jump to content
  • Advertisement
Sign in to follow this  
BinoAl

Artillery Physics Speed Issue

This topic is 2661 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

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


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

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!