Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: mmorpg server question  (Read 3566 times)

0 Members and 1 Guest are viewing this topic.

Reiv

  • Newbie
  • *
  • Posts: 13
    • View Profile
mmorpg server question
« on: June 11, 2011, 04:40:35 pm »
How does mmorpg server knows to whom he should send other players position so that client A know he has to draw player from client B on x,y position, player C on x2,y2 position...

I can think only 3 solution.
1) he sends it to every player, but that would be impossible

2) he keeps players in some sorted list/array/whatever and send it just to n nearnest players (eg. for player 55 he send information about position of players 45-56)
but then keeping that list/array/whatever shorted would take the server too much work


3) he send it to every player in area, he send info on players to every player who is with him in the same area (and listening client can make distantion check (packet >> x >> y; if ( ((x - yourx) > maxdistance) || (y-youry) > maxdistance) drop packet; else process packet, draw player from packet...)

but this would mean that game areas should be small, else clients would get hundreads of informations on players that they dont need to follow (they are too far)

I just cant figure out how is this done efficiently

Beliar

  • Newbie
  • *
  • Posts: 27
    • View Profile
mmorpg server question
« Reply #1 on: June 11, 2011, 05:18:02 pm »
I've never written a server for any online game, but i'd say it may be done like this:

- The server knows where each player is ('course he does)
- The server sends the data of all players in a radius around the player to the client. (Or maybe the server even checks if the player can see the other players, but he may delegate that check to the client)
Debuggers don't remove bugs. They only show them in slow motion.

Reiv

  • Newbie
  • *
  • Posts: 13
    • View Profile
mmorpg server question
« Reply #2 on: June 11, 2011, 06:09:54 pm »
but that would mean that if there is N players he compute Nx position for every player and sends it, that would means something like:
computing and sending position for 1 player (N+N) and he would have to do that for every player so: (N+N)xN operations every eg. +-half second (dont know how often to keep smooth moving of object) and computing the distance or sending it to player isnt just 1 operation either.

Or am I missing something?

lakunar

  • Newbie
  • *
  • Posts: 20
    • View Profile
mmorpg server question
« Reply #3 on: June 11, 2011, 08:22:14 pm »
Other posibility:
The Server sends just every X Game Tick the positions(same area) to the player + the direction they are walking, attacking?, action, what they are doing...
Then the client calculates the movement,... of these players and if it gets new positions it correct the self calculatet positions.

In addition you can give closer players a higher priority and send these data more often.

Reiv

  • Newbie
  • *
  • Posts: 13
    • View Profile
mmorpg server question
« Reply #4 on: June 12, 2011, 10:49:57 am »
And do you know how it is done? does server counts distances for players so that it knows who is closer to someone?

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
mmorpg server question
« Reply #5 on: June 12, 2011, 12:57:22 pm »
You send to nearby players at regular intervals, this probably requires some very efficient sorting and networking code to maintain. And would need to be calculated by the server. Note that you update at a much slower rate than an FPS game, and can schedule your updates so that you don't try and do updates for all player simultaneously.

You could use overlapping regions to simplify things. Just send the player data on other players in the regions that the player is currently in. overlapping them will protect against players not receiving data about npc's who are close to the player but not in the same region.

Though I don't know how well this will work in practice or how well it will scale to larger servers.

 

anything