Manually update physics

Well, the main thing you care about is how the controls feel to the user. That is easily taken care of without breaking the whole physics of the game, e.g. aiming direction doesn’t really exist on the physics level anyway so doing that in a valve way would already alleviate the control issue. Some games do not sync e.g. falling bricks etc at all and just do it client-side as in those games the objects are not influencing the gameplay. What MZ does atm is keep the physics spaces in sync over network delays and simply uses that for everything which is admittedly the simplest way but also lets you see whats actually happening/causing issues and adapt accordingly. Battlefield for example moves the physics bodies according to the networking (with delay and everything) and just displays the geometry in a bit more pleasing way, so you always have to aim ahead based on your current latency. Check the video in this thread: http://hub.jmonkeyengine.org/groups/general/forum/topic/interesting-behind-the-scenes-view-of-battlefield-bad-company-2-physics/

Well!!!

Really encouraging that a AAA game use only interpolation to smooth the gameplay.

aiming direction doesn’t really exist on the physics level

In fact this is jast what i think.

A solution can be that a DirectionMessage is senti in UDP to the server every update() that sets the orientation of the player's rigid body.
Isn't it?

Ok, so one problem (the biggest IMHO) is gone. Thanks ;)

The next: Interpolation XD
Are there standard methods to interpolate vector, quaternions, etc in JME?
I've seen the interpolate method in javadoc but i don't know if it is the correct way to do it.
If it is, and assuming i have the avg of the latency beetween client and server, how can i use this method with the changeAmnt value?

FastMath.interpolateLinear and quaternion.slerp

@normen



Hi,

I stubled with a little problem in interpolation and it is a stupid problem, i know XD

However i don’t know how to adapt the scale variable of the interpolation method (FasthMath.interpolateLinear) to the last message latency.

Assuming that i have the last latency where latency = time a new input is generated form client - time a new state generated from that input arrives to client.

My problem is that i don’t know how to correlate the tpf with the latency to update the interpolation method.

in fact my interpolation works in this way:



a new update message arrives from server.

i set the targetState and the current state of the interpolationLinear method.

the scale value is updated with the tpf to progress in the iterpolation so in the time beetween the updates of the target state

interpolated spatial is rendered for example 10 times.

But if occurs that an updateMessage is lost (it is sent in UDP), the target state is updated with a state that is more distant than the average distance, which results in a swap of the interpolated spatial to a less distant state in the first interpolation.



A little image: XD



[java]



interpolated state (cube for simplicity):

|

| normal

— distance — targetState

| |


> | |
--- ---

if a message is lost:

interpolated state
|
|
--- distance --- targetState
| |
> | |
--- ---

So the interpolation start in a swapped position if only a tpf update manner is used

new
--- distance --- targetState
interpolated state | |
> | |
--- ---

distance that is not interpolated
<
>

[/java]

Now the point (I hope i was clear XD sorry me for my english...) :
to adapt the interpolation state of the spatial to not "jump" the different distance.
And i think that it can be made correlating the difference beetween the last latency time and the scale value of the interpolation method through the tpf value.

Can you help me in doing this? Thanks a lot :)
Again sorry me if i was not clear enough

Its always tpf, unless the latency changes, thats the moment where you have to adapt and slowly move tpf towards the destination time. Theres a smoothing global timer for jme3 that does a similar thing, maybe you can use some code: http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglSmoothingTimer.java