Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / smooth multiplayer

Author
Message
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 10th Nov 2005 23:39
Okay, im stuck.

powerful game engines, battle engines and map editors? np!
writing shaders? getting there!
inline assembly when required? np!
multiplayer games? jump off a cliff mate!

I just cant seem to do them. This is a big problem right now as I have a multiplayer based (as in, any single player is second priority to the multiplayer) game to work on and only one month to show progress. Not one month to make "the best multi game" but one month to show that im not wasting time.

The game is like continium (originally called subspace) but with tanks. I got a good engine going, wrote a nice map editor which takes any number of seperated object files as doodads but compiles the map as one solid .dbo with entity/shader.dat - got a nice network infrastructure using raknet and the basics of the game engine - sliding collision, lighting, move your tank around, etc.

Packets are currently sent from the client to the server at a rate of 1 every 200ms (5 a second) and contain player states, position, rotation, speed, etc. packets from client to server are reliable. The server who will have alot more stress due to the amount of players i intend to support (at least 64) i have got relaying the packets as unreliable.

It all /works/ in that the players will happily jerk around on each others screens but I just cant manage the dead reckoning! (movement prediction) - im stuck with constantly jerking movements between packets.

I know the theory and whenever I receive a new player state packet the previous player state (from last packet) is stored so i have its last and current known positions. I just appear to suck at getting them to move smoothly from one state to the other. Does anyone have a working IMPLEMENTATION of this? Lots of people talk about it but when asked no one seems to have actually written the code and got it working themselfs :/

I have been looking at this.
it looks good, but unfortunatly I am unable to convert it to code.

I was going to paste a whole ton of my network code and current attempts at prediction, but I have decided its probably fundamentally flawed and its time to start it from scratch. Can anyone direct me with this? Has anyone ever written a multiplayer game that wasnt turn based and involved high speed action? Any code examples of dead reckoning in action will be GREATLY appreiciated.

Thanks for your time, im about ready to hit my head against a wall

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 11th Nov 2005 02:50
Hmmm... a really simple method, is to send key states when you send your position data. That way, the receiving player can move your object according to that data, until the new data arrives. Its simple, maybe not amazingly efficient, but it gets the job done...

I'll post an example in a min, just wanna get something to eat first.

Tempest - P2P UDP Multiplayer Plugin - 49%
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 11th Nov 2005 03:03
that would be grand After reading articles on unreal and quake 3's networking models before even starting this program I did learn about player/game states and that IS what the engine is based around. It sends player states, interpolating between them properly is where im having trouble

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 11th Nov 2005 03:58 Edited at: 11th Nov 2005 03:59
Ok well seeing as I don't have DarkSDK, this is in DBP code. But I assume you have DBP. Also, because I'm not exactly a great fan of the native multiplayer commands, I used the plugin that I'm working on, so you'll need to copy that to the plugins-user folder. Compile the source, then run two instances of it(one to host, one to join). I'm sure the rest is fairly obvious.

http://forum.thegamecreators.com/xt/xt_apollo_download.php?i=702117

There is a constant there that if you set to 0, will turn off prediction so you can see the difference with and without. You will notice that sometimes if you only tap the up key, the other player will see jerky movement due to it moving your player past where you stop, but this is normal, and when you compare it to not using any kind of prediction, you can see its still a much better idea.

By the way, this is what that page calls linear movement.

Tempest - P2P UDP Multiplayer Plugin - 49%

Attachments

Login to view attachments
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 11th Nov 2005 05:48
Big thankyou for that

Its very simular, if not identical, to code I had previously written but simply didnt work. But this time I deleted everything to do with prediction and also took a page out of your book and moved the prediction into its own function. Its really working quite well now! Oh its far from perfection, I couldnt release and sell it like it is. There is the odd random jerk (could be caused by anything - infact in the real world it MAY be fine, my pc doesnt like running 3 directx instances (server, two clients) and turning isnt perfect (did it in much the same way you did movement) - but its good *enough*.

It can be worked on much more later, but the network play is performing just well enough to work on other aspects of the engine now and I can start adding firing and what not or work some more on the editor - so thanks much for the help, seeing the code did help tons And incidently, its nice to see well written dbp code! Big thumbs up there, most dbp coders dont seem to know where their tab key is ^^

So yeah, fine for now, later I will get one of my more mathmatically inclined friends to help me figure out the cubic spline algorithm and patch it up for beta Thanks again!

(nice looking dll too btw xD)

Login to post a reply

Server time is: 2024-04-25 05:05:36
Your offset time is: 2024-04-25 05:05:36