Need some help on Multiplayer FPS development

What I’m thinking about is to bufferize all such inputs and then, in another control, process it to accomplish the prediction and then send the message to the server at a prefixed rate. In this way, a can handle at the same moment the prediction and the server acknowledgment of the new input.



In this way the delay between the prediction and the correct update message ,maybe, is more precise. The only thing that i am not sure on is the camera direction (player view direction) because obviously it can change more frequently than the position of the player, but maybe it can be sent each time an input message is sent. But only if the system above is correct enough. Although frankly I do not think XD

The view direction doesn’t matter. Only the move direction matters.



I have a separate physics loop in the client that handles player movement so its easier to conceptualize this. If an object is moving in a direction at a specific physics slice then that’s the state update. move_forward + direction. The render loop is operating in its own time and interpolating the physics values just like it would any other server-managed object.



It doesn’t matter how fast the view direction is updating. It only matters what the physics tick did for a specific slice of time.

True, but a player may stay in the same position and changing the view direction. A sniper for example can camping while shoot in every direction and see the real direction the sniper is oriented can be important.



However you help me enough on many thigs that wasn’t clary to me. The last one thecnical quation: ( XD )



[java]public void interpolateTransforms(Transform t1,

Transform t2,

float delta)[/java]



This function interpolate the transform object given other 2 and a delay. But what about this case:



A player moves in one direction changing it’s position and that player has a connection with a delay of 20ms. If every player have the same offset for interpolation, 50ms for example, does the player with 20ms delay risks to go back in time??? XD

@kazeshiro said:
Normen, you have wasted a lot of words since i started asking information about multiplayer development.
Nobody forced you to answer my question and everytime you did it seemed to be a nuisance for you, and many times I felt teased by your words. And all this has happened only because you didn't write:

I posted exactly once in this thread, when you were saying wrong things about MonkeyZone. Then when you posed that actual question I answered it immediately in the next post. So I can very well understand you are annoyed about me pointing you at the obvious or telling you that the information you look for is easily found but this must be like the worst moment you could choose to let me have that.. U mad? xD
You were saying "I need something specific". When you have documentation about how its done in general, small examples that show how the bits and pieces work and you have an example implementation where I documented each and every method and class.. How much more specific can it get? I really don't know what you're asking for there, so I mentioned this simple fact that there apparently never can be an example specific enough.
So, please. I already did avoid answering this thread but I can't let you say wrongthings about software I wrote. But if you don't want me to answer questions you directly posed to me, I'm fine with that.
@kazeshiro said:
True, but a player may stay in the same position and changing the view direction. A sniper for example can camping while shoot in every direction and see the real direction the sniper is oriented can be important.


Still, you don't really care where they are aiming, only where they have fired. Though I guess if you wanted to be absolutely sure the player wasn't cheating somehow then you'd have to have regular orientation updates (which you would)... I don't think the 50 ms gap is going to allow much super-cheating.

@kazeshiro said:
However you help me enough on many thigs that wasn't clary to me. The last one thecnical quation: ( XD )

[java]public void interpolateTransforms(Transform t1,
Transform t2,
float delta)[/java]

This function interpolate the transform object given other 2 and a delay. But what about this case:

A player moves in one direction changing it's position and that player has a connection with a delay of 20ms. If every player have the same offset for interpolation, 50ms for example, does the player with 20ms delay risks to go back in time??? XD


I'm not sure I understand. As in the Valve articles, the server is law.with respect to time... everyone else is just a view.

On my client, if I press 'W" then I set the "move forward" bit. My local physics engine starts processing this at a small delay and meanwhile the state goes to the server. Even for my own movement, I don't see it until 150 ms (or whatever the render frame delay is) so any events from the server are all on the same time scale as my own. Every state update has a time and that time is in "server simulation time" as best as the client can determine... and it is exactly that when the server sends messages back.

At least that's my take on it.
you were saying wrong things about MonkeyZone.


MonkeyZone seemd to me to not implement entity interpolation. If i'm wrong point me where it is done please so i can learn from your code.

However, can you indicate me the parts that answare my question in MonkeyZone? I need something like:

The input is handled in this way ………brief explanation……….. here ClassName (or ClassName1, ClassName2)

Lag compensation is done ………brief explanation……….. here ClassName (or ClassName1, ClassName2)


I was asking for that:

The compensation code is in the NetworkManager class..


(However is in the PhysicsSyncManager, again if i'm wrong tell me where it is done)

So I can very well understand you are annoyed about me pointing you at the obvious or telling you that the information you look for is easily found


Do you think that is so obvious understand the entire MonkeyZone architecture? IMHO it is not. But I'm a newby, maybe for an experienced programmer like you this is obvious but as i said before:

when i asked why after installation of JMP there were something that didn’t work, you told me: “RDFM” and the problem whas that i didn’t enable nightly updates.
You take for granted that everyone works with JME for yearsYou take for granted that everyone works with JME for years when i’ve only forgot to eneble the nightly.


You were saying “I need something specific”. When you have documentation about how its done in general, small examples that show how the bits and pieces work and you have an example implementation where I documented each and every method and class.. How much more specific can it get? I really don’t know what you’re asking for there, so I mentioned this simple fact that there apparently never can be an example specific enough.


I was asking for:

The compensation code is in the NetworkManager class..


But if you don’t want me to answer questions you directly posed to me, I’m fine with that.


Maybe you are the best JME programmer in the world so i want you to answer my questions because maybe only you could help me. But if you write: "RDFM" please don't answer my question. Answare only if you think your post will help me.

I'm not good enough in English to understand all you write and what I write probably is horrible so many times I can be misunderstood becuase my incapacity of telling what I want. However i didn't understand that:

but this must be like the worst moment you could choose to let me have that.. U mad?
1 Like

I was a jME2 and game newbie too once, so I know what it means to start using it and what one has to learn. I mentioned how MokeyZone does interpolation in the very first post, maybe you should look for the information in my posts instead of looking for accusations and mistakes. And I do not take for granted everybody knows jme for years, I take for granted that when you want to do something for yourself you do your research in advance and friggin read the effin manual!!! Especially when software as well as manual were written by people who are not paid for any of that its absolutely unbearable when you ask the same people the questions they already answered in those free docs. Again, this is not about this thread. As I wanted to say (what you didn’t understand): Chosing this thread as an example to educate me about my attitude was a silly choice, I didn’t do any of the things you accuse me of in this thread. I merely corrected you and answered you and I still do.

I didn’t do any of the things you accuse me of in this thread. I merely corrected you and answered you and I still do.


This is your point of view but if someone write to you something like

Basic examples are too few, a project is too much.. You gotta start somewhere eh?


Don't you feel teased? If you tell me that before to post on the forum i need to read something, such as when you told me to read the valve documentation, i'm very happy to get some more informations. But english is not my native language and maybe I could misunderstand something so i think it is granted to ask help. And in your posts it seemd to me like if you were bored. As i said no one force you to asware me.

However when you posted the first post about entity interpolation through input delay I've just asked other question to you because many thing wasn't clear to me. Then you posted what i quoted here and IMHO it is not a nice way of doing. Obviously you can think what you want but, i repeat, no one force you to answare me. And like i said instead of waste all this word you could write only where to find the code i needed. Do you think i'm in wrong?

I explained why I take this point of view, I think asking for “more specific” is just silly. I could also have answered more annoyed like: “Do you really expect someone to write an example that just exactly fits your current needs and level of understanding?”… Or even more annoyed… :wink: You have to get started somewhere, simple fact.

The thing is if your questions don’t become more specific like “I cannot find the code that does this and that” or “that part where the input is delayed is not clear” or “this and that crashes” or “the entities positions don’t get updated” then its pretty obvious you are not even looking into the proposed solutions but simply dismiss them and then demand the answers given to you on a silver plate. Every one of us would have to do a certain amount of research and work to implement this in a waterproof way and we’d also look at the resources that we point you at. The final implementation, thats your part of the work. Its okay and good to bounce off ideas off us and ask us specific questions but getting the whole educational package is a completely different thing. So if you are not asking specific questions I will point you at solutions and not start writing essays stabbing in the dark. The material is out there and I also managed to find it, so yes, I might be a little bored pointing people again and again.



Theres two things about the technical aspects you were asking about: One is the fluctuating network speed and one is interpolation of positions that are not transferred via network due to bandwidth reasons.



The network speed will always introduce a certain delay to your actions… Say this fluctuates between 20ms and 80ms for a normal internet connection and computer. This means there is a window of about 60ms of time that messages can come too late or too early. The only solution that works in accordance with Einstein and space-time as we know it is to just delay the whole input by 60ms and then applying those messages that come earlier a bit later… Say if a message had 40ms delay originally it would be delayed by 40ms to then be delivered after the 80ms maximum. Some games indeed do bend Einstein a bit, technically its like changing the global maximum delay (the 60ms in this example) gradually depending on the average network capacity. This is the point where I have to hint at the valve documents again :stuck_out_tongue:



The interpolation of objects is necessary because it can not be every frame that the computer updates the location of its entity via network. So the locations are updated say every 250ms. Now if we just applied those locations every 250ms the objects would just jump around instead of gradually moving in one direction. To counteract this, physics is used on both the server and the client. The server sends both the location and the velocity and movement direction of the physics objects to the server. This way the objects continue to move on the client even when no network message is received, thus you have interpolation. Additionally all input caused by players and AI is also sent via network directly so that sudden turn changes caused by players etc. are accounted for immediately. Most of this stuff I explained in the source of MonkeyZone as well by the way.