Advertisement

Movement equations for multiplayer online games

Started by March 14, 2002 10:14 AM
6 comments, last by midavis 22 years, 10 months ago
I am currently writing a multiplayer online game. I have characters in moving around, but I am at a crossroad everyone arrives at. All my characters are jumping from point to point. Currently, all I am doing is setting each players position to the new one I receive from the server so everyone looks like they are "warping" to the next point. I have read a few articles on how to "defeat" this lag/movement issue. The current one I read was here at gamedevnet. http://www.gamedev.net/reference/articles/article914.asp. This article is great. It tells you what you need to do a cubic spline, which supposively is supposed to be a good way to simulate movement. I understand the article, but I just dont know how to calculate everything. It will say to use the velocity and acceleration. My engine does not give me the velocity and acceleration at any time. Basically every time my engine goes through a cycle I get the new position for the character on the client, send it to the server, then send it back to anyone that needs it. So, every cycle you will get each players new position. All I have to work with are x/y coordinates. I have to calculate everything. I know pretty much how to calculate velocity and acceleration, but if someone could help crunch the numbers for this article, or if you have a better way to do it I would really love the help. I am sure a lot of people out there would as well. Below is a link to a test project I am using to simulate movement before I put it in my engine. If anyone wants to take a look at it and help me out I would appreciate that as well. http://www.theregulators.org/repent/cubicspline.html Thanks for any help anyone gives.
A cubic spline isn''t exactly always the way to go. I believed in it for a year, but never got it good, so I worked out a different method (I cannot tell you much about it, since it''s a deal with someone, and it''s secret), "rubberband" is the key word
www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>
Advertisement
Hi
And if you only send changes? For example send the new direction vector instead of new player position
Hope help
Hehe I totally agree with "Anonymous Poster" :-)
------GameDev'er 4 ever.
Well, if you have positions, you can get velocity very easily by having each ''tick''=.5sec and measure the amount of change in that tick. It''s pretty simple to do, though turning while moving will cause obvious problems for accuracy. This way, you can have the client (which is probably doing very little already) handle the calculation on velocity and leave the server available for other tasks, such as AI.
You just have to make the client sending an "I wanna go south" message to the server. The server will know the exact position of the character,the client too, but there will not be messages between server and clients while the move occurs.
It will not send it back to the client. If your character stops, you just have so send a "stop" message.
You don''t have to update positions every time.

It''s very simple (I don''t understand your point Solinear).
------GameDev'er 4 ever.
Advertisement
the problem with sending only differences / velocities is that
the simulation won''t be synchronized any more at some point. (due to ever so small calculation / timing errors). A solution would be to send key frames once in a while so set the absolute entity position, but that could result in some ugly jerking too.
Ajoling : any more hints concerning the rubberband method you mentioned ? :-)
HI,
I''m no expert in this field, but I have recently written a online multiplayer FPS. I did the player updates by : a sending input keys (1 long) and b: sending current positions (3 floats

every once in a while (like every 15 packets or so) i position the person to the location that the packet says..

hmm

that doesnt sound so clear well.. i "guess" at the location of the other players, and once in a while i set them in their "real" locations, just to keep things interesting. This has worked out very good for me, and seems to be a good way to go (small amount of bandwidth and you dont see any lagg.. even if there is very very large amounts of lag)

: )
Zygote-

This topic is closed to new replies.

Advertisement