I have developed a simple car racing game, with class symplepishictest, and i have inserted the ia of opponent car, in the metod simpleupdate? I have noticed that if the scene is more complicate of object to render, the update is slower, and the ia change and have a different behavior in base to the object to render? It' s possible my interpretation? Do you know any possible solution?
you need to interpolate your movement and other calculation with the time per frame.
In SimpleGame you can get the tim per frame by calling Timer.getTimer.getTimePerFrame()
how i can use this value to make equals the ia when Timer.getTimer.getTimePerFrame() have diffirent value?
if your enemy is 5 units fast, then you don't write:
unit.getLocalTranslation().z += 5;
This unit would mive faster the higher the framerate is
instead you multiply the speed with the time per frame
unit.getLocalTranslation().z += 500*tpf;
now the unit moves independent of the framerate.
you do this with every movement calculation, translation and rotation.
ok, i have understand, but i have a fear to make all comand depending to this value, example, when the car steer in curve, i must change also this value considering the frame, so for all cases! :’(
Is correct my reasoning?
yes everywhere, i don't know a case where it is not needed.
except physic forces thats another story