Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Best Networking Theory


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Scobbo   Members   -  Reputation: 178

Like
0Likes
Like

Posted 26 September 2012 - 10:01 PM

Hi everyone!
So recently I have been thinking about what needs to be sent over a network for games to stay in sync. In regards to say an MMO, but lets scale it down to the basics. In a one-to-many server-client system here is what I assme happens, please correct me if I'm wrong because I'm very interested to see how this is best achieved (for later projects).

The player has direct control over the position and rotation of the character (so walking around, or flying, whatever) using WADS and mouse and instead of sending the control inputs to the server the position and rotation vectors are sent to the server and the server sends them to all other clients that need to see them (so in the same area or instance). I'd assume there would be a check there first to see if the character has been moved by external forces (being hit by a boulder or collided with an object) first or if the character is still alive.

Perhaps the clients computer takes care of the colisions when the server has sent the position of the boulder and then lets the server know that there has been an impact and the boulder and player are now in new positions. Though I'm not sure who would control the boulder (client or server) if this is an object that all players can interact with, possibley the last player or object to interact with it has control of it's position and rotation.

Then there are actions or skills. I'd assume that the input from the player is again translated into a function instead of being sent directly to the server for it to control. (That was hard to understand, I'm awful at my own native language) What I mean is if I cast a fireball which is skill one. If to activeate it I press the number 1, that keypress is not sent to the server but the client sees the button press and then tells the server that fireball is being cast and not skill one is being cast. Then the server lets everyone else know that the player has cast fireball and tells the others what animation needs to be played and to instantiate the projectile using the pos and rotation and velocity they get from the server. With unguided projectiles such as a basic fireball skill would the server give the velocity and then not worry about it or would it update the information every few steps to make sure sync is possible.

With guided objects such as a homing missile, would that also be controlled by the player that fired it, the player it is following or the server? I'd think server, because it has the most up to date information on everything.

I know this is a lot of information and I'll probably be experimenting with it to see what works best for each situation but I'd like a starting point.

Sponsor:

#2 Khatharr   Crossbones+   -  Reputation: 3040

Like
0Likes
Like

Posted 27 September 2012 - 12:28 AM

Stuff like keypress translation and etc is typically handled by the client. The client would just send a packet meaning 'I want to cast fireball in direction X' and the server would check to see if that's okay. If so it would spawn a fireball object and clients in the relevant area would get a spawn notification and update notifications, etc. It would probably be okay in an MMO to let the player have direct control over their rotation, but as far as position, you'd want to send requests to the server. For a free-motion 3D world you could have the client allow movement and then when it comes time to send an update to the server you'd send a 'this is where I think I'm at right now' message in your package. The server would check the position it has for you and then check whether or not you can reach the new position from the old one within the time that has passed. If so then it updates our position, otherwise it would have to react somehow (managing collision, preventing speedhacks, etc). Then you just send the player's position to everyone in the area, including the player, and the client would correct the position if necessary. (That's not to say you shouldn't have collision code on the local side as well, though.)

For a 'homing' object you can actually go either way. You could treat it as a sort of delayed-effect spell: notify the clients of the point of origin, time to impact, and intended destination and let the clients manage the particle, then process the actual effect (explosion damage, whatever) once the time is elapsed. On the other hand, if it's the kind of thing where you fire a homing missile at someone and they have a chance at outrunning it or ducking behind cover while it's in flight then the server would need to have an object representing the projectile.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#3 hplus0603   Moderators   -  Reputation: 5723

Like
0Likes
Like

Posted 27 September 2012 - 11:14 AM

instead of sending the control inputs to the server the position and rotation vectors are sent to the server


This means that the client can cheat by sending whatever position they want. This leads to teleport hacks, speed hacks, etc. If this is not a problem for your game, then that's acceptable, but for most games, where you are at actually matters. Wouldn't want players to warp to the rewards room after the final boss, without first going through the entire dungeon...


enum Bool { True, False, FileNotFound };




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS