| Author |
Message |
SodanKerjuu
Commercial License


Joined: 16 Sep 2008
Posts: 730

|
|
I really wish this would be done sooner than 1.0 because without it the engine is quite useless for any serious multiplayer gaming.
Controlling your character feels really clumsy with pings over 100.
I've tried to implement methods to move the character instantly on client, but without results.
It's mostly because you cannot control physical bodies properly client-side.
100-200 and you cannot do accurate movement.
200+ and you will have trouble navigating indoors.
I will do my own hacky way to make it feel smoother for clients, but I'd rather see proper implementation in the engine.
Btw, if you need simulate ping for testing, you can compile Lidgren network dll in debug mode and search the code for
SimulatedMinimumLatency
|
|
|
|
Last edited by SodanKerjuu on Thu Oct 22, 2009 8:44 am; edited 1 time in total
|
|
| |
    |
 |
Maxwolf
Moderator


Age: 25
Joined: 28 Nov 2007
Posts: 1128
Location: Vancouver, British Columbia

|
|
Taken from PhysicsSystem.config under physXSpecific a note that might shed some light into the lower workings of the engine at play here:
| Quote:
|
Raycasts and Manual Movement Problems.
PhysX SDK keeps a double-buffer of all shape states and will not update
until a simulation step is taken. For example the result of setting the
global position/rotation is not immediatly visible until a Tick occurs.
Example: If physical body is moved (by code) you must update the
state of the physics simulation inside PhysX (swap buffers).
This is a CPU intensive operation! If double-buffer is not
updated then raycast will fail with calculation errors
(phantom object with old position/rotation).
|
Could it be possible if the server or client/server (meaning playing the game and hosting it) if using PhysX suffers from this double checking of old position.
Other things that I need to check about basic multiplayer functionality (since the hardest part was actually integrating it into the engine and entity system, there will be problems...)
1. Multiple clients connecting (10+) to sever at once can sometimes cause stack overflow or in some rare instances a lock up on a dedicated server a client hosting a game doesn't seem to get the hang up.
2. The high lag problem is noted, it feels like you are being held back by a rubber band or walking through clay when latency rises above 150+ milliseconds.
3. Multiple people clicking on "usable" objects at once can sometimes cause confusion on the server. Example: 10+ people all clicking use on a tank to enter it at the same time can cause interesting race conditions.
4. Bullets sometimes don't seem to hit where you fire them in high lag situations. I don't know of the checking of old position has something to do with this but it might.
Those are the things I have noticed in the base SDK, not counting my own issues integrating it with my code base for Incognito for things like inventory system. (I have issues with clients inventory getting wiped by server, so you enter tank, loose all your guns upon entering because the server creates a NEW you and properties are copied to it kind of like moving your "soul" around if I may be so frank
|
|
|
|
_________________ I'm NOT paid or work for NeoAxis. I only help moderate these boards. My opinions are not the opinions of NeoAxis Group LTD.
|
|
 |
          |
 |
SodanKerjuu
Commercial License


Joined: 16 Sep 2008
Posts: 730

|
|
I've worked around the bullet problem by using a custom method where client's view of the world is taken as legal and server only checks against static / collision objects from the client's claimed data.
An area is cast around the current client position to see if the client's claimed raycast could have occurred. This is a good method since the client can shoot what he sees, when he sees, and only cheat possible is shooting through other dynamic objects (if you don't take into account all the usual stuff like aimbot, wallhack and speedhack).
Number 3 is also noted. We managed to get two players inside one tank where other player could only fire the cannon, while the other could only move.
I'm planning on checking all the possibilities of having multiple player intellects using object during a single tick.
Pretty sure it can be negated by carefully checking all the functions and testing for dualities in each step.
It's hard to believe that the code is the problem for dedicated servers,
since all the tests against EntitySystemWorld.Instance.IsServer() will be true for client running a server and dedicated alike.
Only thing dedicated is missing are the rendered frames, but not many will require them.
One thing I noticed that if I want to do Client-Only physical objects I need to simulate the physical world. So in GameEngineApp.cs I added the following code into the OnRenderFrame() method:
| Code:
|
//SodanKerjuu: for clientside physics objects we need to simulate physicsworld
if (EntitySystemWorld.Instance != null)
if (EntitySystemWorld.Instance.IsClientOnly())
PhysicsWorld.Instance.Simulate(RendererWorld.Instance.FrameRenderTimeStep);
|
But what I meant that you cannot do anything to the physicsmodel of entities which have NetworkType.Synchronized, they just won't take any forces or alterations from the client.
Currently my method for precognitive movement is to create a camera vessel entity client side for his player character and move the vessel similar to how the player character would move.
The vessel cannot have physics or it will interfere with other objects (dunno why if it's client-side only), so it is not an exact replication of the player character physics, but it's close enough for me at the time being.
|
|
|
|
|
|
| |
    |
 |
Wellu
Commercial License

Joined: 14 Nov 2007
Posts: 1547

|
|
I don't know if C# has synchronized methods but it seems some problems could be tackled using them.
In Java a method can be declared synchronized meaning only one thread can be executing at once. This means all other attempts are locked out for the time being, but only one player could enter a tank etc.
|
|
|
|
_________________ http://games.kipase.com/
|
|
|
    |
 |
SodanKerjuu
Commercial License


Joined: 16 Sep 2008
Posts: 730

|
|
I might have overlooked the problem a bit.
After two days of trying different methods and thinking it thoroughly,
I've figured out how to do correct precognition.
Basically the thing was to make player characters non-synchronized and implementing a class to
control the data between the client instance and server instance.
The end result is clean, working and very flexible (you can create characters with or without synchronization).
To put it simple, here's my mind map:
I already have it working and have implement the basic reflection methods.
And here's proof of concept:
In the picture you see one character which is not reflected (only exists on the client) and one character which
is reflected but without correction, so the errors that occur over time (due to lost packets, etc) will not be fixed.
Feels grrrreat man!
Gonna look into the dead reckoning thingy once needed.
edit: updated the mindmap...
|
|
|
|
|
|
| |
    |
 |
Goto10
Commercial License

Age: 32
Joined: 14 Sep 2008
Posts: 246

|
|
| Thanks for sharing your method. I know I'll need to look into this too.
|
|
|
|
|
|
 |
    |
 |
dazrulez
Commercial License


Joined: 18 Nov 2007
Posts: 216

|
|
it seems that this:
| Code:
|
if (EntitySystemWorld.Instance != null)
if (EntitySystemWorld.Instance.IsClientOnly())
PhysicsWorld.Instance.Simulate(RendererWorld.Instance.FrameRenderTimeStep);
|
is all you need to do, after removing how the server sets the bodies positions then you are able to add forces to bodies also
also incase of lag and any hacks implimented, i send the server position to the client every 4 seconds during a movement
this worked perfectly for me! although, a reflector is a much cleaner way of doing it if you still require the synchronised dynamic entities in the old way
|
|
|
|
_________________
|
|
|
      |
 |
liiir1985
Commercial License

Joined: 15 Apr 2008
Posts: 209

|
|
I don't know what kind of online game are you going to make.
As I can tell from my 2 years of MMORPG server development you don't need precognition at all.
It's normally like this:
Client performs movement and physic all by his own, it can even continue move if the connection is broken. it sends only the target coordinate the player is moving to.
And then the server checks if the movement is valid, if so, it broadcast the message to other player who can see, if not, roll back the movement and tell the player to knock back to original position.
for MMORPG, client only needs to send the move target coordinate packet 1 time per sec, for FPS maybe 5-10 times per sec.
Anyway, this model: Player want to move->client sends move request->server tells where to move->client perform move and does physic isn't good for internet, it'll make player feel very lag. So you need: Player want to move-> client does movement and physic(don't wait for server's reply)->send target position to server->server check, if valid broadcast message and don't need to tell the original player it succeed, if failed, knock back the player.
|
|
|
|
|
|
| |
    |
 |
dazrulez
Commercial License


Joined: 18 Nov 2007
Posts: 216

|
|
| liiir1985 wrote:
|
|
So you need: Player want to move-> client does movement and physic(don't wait for server's reply)->send target position to server->server check, if valid broadcast message and don't need to tell the original player it succeed, if failed, knock back the player.
|
nice idea, thanks
|
|
|
|
_________________
|
|
|
      |
 |
SodanKerjuu
Commercial License


Joined: 16 Sep 2008
Posts: 730

|
|
I'm making RTSFPS game and rigorous updating of positions is necessary (information sent each tick).
The character reflector is far from perfect in the sense that it is very easy to cheat at the moment.
Basically each client sends his position each tick and server shares this information with face value.
This way each player will feel their movement to be very accurate without any delay.
But as each client even calculates gravity for himself, it would be really easy to just stab the memory and make yourself flying,
even instantly teleporting to other place.
I will worry about cheating later.
There are certain things I need to improve a lot.
The creation of the client side characters is a bit hacky, as well as certain default things doesn't work,
like NeoAxis FireInfluence can crash the server.
The picture I posted above is a bit outdated, I could share the whole class and give info how to set it up,
it's a good starting point for precognitive movement as the initial problems are solved in a smart way.
|
|
|
|
|
|
| |
    |
 |
Hell Entertainment
Commercial License


Joined: 06 Jan 2009
Posts: 624
Location: Belgrade

|
|
| |
     |
 |
dazrulez
Commercial License


Joined: 18 Nov 2007
Posts: 216

|
|
| strange - the physics work perfectly for my player character that im controlling, and other playercharacters that have a user controlling them work perfectly, and i can view there movement with no issues. but when i try and use the same setup for gamecharacters (which ive also tried converting to playercharacters) and i add a force to the physics body, the body becomes detached from the mesh and acts crazy :S it makes no sense - the control is exactly the same for the play controlled one and the game ai.. i use a task move for both of them, and both recieve the values correctly, also the movement works on the server for everything perfectly, just not the client
|
|
|
|
_________________
|
|
|
      |
 |
|
|