max velocity/speed

Started by
19 comments, last by Zahlman 14 years ago
I'll correct my post above : clamping the vertical component right over the ground would work only on a flat terrain. You should instead subtract the velocity by a normal from the terrain below rescaled to a right amount (something like a dot product of the velocity against it) But deciding which normal from the terrain to use when the ship is moving some distance above the ground might prove tricky :x

Quote:Original post by w00
But i'm also wondering how other games do it in general. Like a game as Call Of Duty. It also has physics on their characters. Do they also play with the velocity settings to move them around??

The characters I don't know. I believe that some engines like Valve Source applies physics on dead bodies, but leave the living characters motion in the hands of pre-calc anims (as long as they aren't jumping or falling).
I'm pretty sure though that physics is applied as soon as some vehicle enters the picture, including gravity, friction, collisions... and of course every force applied to the vehicle has an impact on its velocity vector.

Any wheeled vehicle top-speed is also maxed out because of the ability of the vehicle's engine to apply an acceleration to it, ability which is dependent on the current turn/min of the engine, which we could simplify as the vehicle speed (you've certainly seen acceleration/speed charts in racing games already).

Follow NeREIDS development on my blog : fa-nacht.rmyzen.net/

Advertisement
If your ship is moving in space and therefore no drag is applied you should think about calculation like in Einsteins theorie. Those equations limit the maximum speed to the speed of light.
Quote:Original post by alvaro
You are aware that in space there is no maximum speed except the speed of light in the vacuum, right?

If you do not want your ship to travel that fast you only have to replace the constant for the speed of light in Einsteins equations by your desired maximum speed.

There is one feature that comes along with this equations that you probably do not want. Einsteins equations are working by increasing the mass of a moving object. By reaching the speed of light this mass gets infinite. So the effect would be that slowing down your ship from high velocity will take far longer if you are near your maximum speed.

But I am afraid that those equations are far to complicated and have to high computational cost (they involve several square-root operations) to be applied in a game, though they would give you the most realistic behavior.
Quote:Original post by alvaro
You are aware that in space there is no maximum speed except the speed of light in the vacuum, right? If you keep accelerating in some direction, you will end up going very fast.


Checking the pilot's rough inputs to keep the craft in an acceptable state is what avionics are for; nobody is suggesting attrition, only deliberate control systems.

A combat spacecraft has to be as slow as possible to reduce turning radius, slow enough to avoid crashing into obstacles, and hopefully fast enough to outrun or evade missiles and enemies; accelerating into oblivion is a very bad idea.

Omae Wa Mou Shindeiru

Quote:Original post by LorenzoGatti
Checking the pilot's rough inputs to keep the craft in an acceptable state is what avionics are for; nobody is suggesting attrition, only deliberate control systems.


That makes sense, and it suggests one possible implementation: Interpret the user's input as a desired velocity, and apply acceleration to try to get there. That might result in intuitive controls.

Thats the method i use for my controls. It lends it self nicely to AI control.
Quote:Original post by w00
But i'm also wondering how other games do it in general. Like a game as Call Of Duty. It also has physics on their characters. Do they also play with the velocity settings to move them around??


In situations like that, it's the animation that defines the speed a character moves at.

That works by having the animators put translation info into the animation, so that running an animation actually moves a character. The engine looks at the translation info and uses it accordingly in the physics stuff so then it's completely controlled by the animation.

Another option though is to figure out what speed the animation is traveling at, and then adjust the rate of the animation playback based on how fast you actually want to move.

That makes it so that if you want a character to walk slowly somewhere, you can use the same animation as when you want them to walk quickly in another situation. The playback rate will just be different.

And lastly...

this doesn't apply to your game since it isnt character based but if you wanted to you could set up a system like this (pseudo code)...

void MovePlayerAtSpeed(float fSpeed){  if(fSpeed < MaximumWalkSpeed)    MoveUsingWalkAnimation(fSpeed);  else if(fSpeed < MinimumRunSpeed)    MoveByBlendingWalkAndRunAnimations(fSpeed);  else    MoveUsingRunAnimation(fSpeed);}


That will make it so if you tell a character to move slowly, they will walk, and if you tell them to move medium speed they will jog (blending the walk and run animations) and if you tell them to move fast, they will run.

HTH! And yes the examples are a little simplified but hopefully you get the idea (:
Quote:Original post by alvaro
You are aware that in space there is no maximum speed except the speed of light in the vacuum, right? If you keep accelerating in some direction, you will end up going very fast.


The actual laws of physics would make for terrible space games. :)
Quote:Original post by justkevin
Quote:Original post by alvaro
You are aware that in space there is no maximum speed except the speed of light in the vacuum, right? If you keep accelerating in some direction, you will end up going very fast.


The actual laws of physics would make for terrible space games. :)


I know. However, the way the OP was worded ("with physics applied to it"), it was unclear to me that he understood that you need to redefine physics in order to get the gameplay you want.
Quote:Original post by alvaro
However, the way the OP was worded ("with physics applied to it"), it was unclear to me that he understood that you need to redefine physics in order to get the gameplay you want.

"Redefining physics" is a great way to cause all sorts of artifacts and disorientation.
Real physics has been worked out in detail, "redefined" physics has enormous reserves of unexpected behaviour and inconsistencies.

Omae Wa Mou Shindeiru

Quote:Original post by LorenzoGatti
Quote:Original post by alvaro
However, the way the OP was worded ("with physics applied to it"), it was unclear to me that he understood that you need to redefine physics in order to get the gameplay you want.

"Redefining physics" is a great way to cause all sorts of artifacts and disorientation.
Real physics has been worked out in detail, "redefined" physics has enormous reserves of unexpected behaviour and inconsistencies.


You can try to make a space game with no drag mechanics, with ships that don't necessarily face the direction they are moving in and using practically no indirect illumination in rendering (really black shadows). Oh, and make sure you don't hear any explosions or nearby ships. I wonder how many people would want to play that game...

I was thinking of something like using a fake "atmospheric" drag in space, not just making up new rules of Physics.

Anyway, games redefine Physics (as in "the rules that govern the world") all the time. People don't grow when they eat a mushroom, there aren't coins hanging in mid air that you can collect by touching them... If a player wants the exact rules of Physics to apply to a game, why does he need a simulation at all? Just go outside and play.

This topic is closed to new replies.

Advertisement