Skip to main content
gamedev.net
🔒 Locked

MMORPG Server

Started by eraser_iresa 9 replies 2.2k views
Original Post
eraser_iresa
eraser_iresa
Hi, I'm making an MMORPG server, and right now, I'm thinking about how I should keep track of each character's position. By that, I don't mean how to store their data. I actually mean the following: Let's say if one character is in position (50,50). Now, the client side (that player) clicks on (45,45) on the map. The client side will, of course, do the pathfinding, and will go by the following track (assuming no objects blocking the way) 50,50 start 49,49 48,48 47,47 46,46 45,45 arrived but now, one thing I want to question is. Does the server first receive the message 49,49 from the client, and then will Check if 49,49 is beside 50,50 (since character is going from 50,50 to 49,49), and then allow him? Then 48,48, then 47,47, and so on? Will this be a lot of workload for the server if it has to check every single coordinate? Or should the client do the pathfinding first, send the whole path to the server, and the server check if the path is ok? If it is okay, and the client starts moving step by step, and let's say now the client is in 48,48, but some guy logged in at 47,47 suddenly... then how should the server respond? because the path needs to be changed... what's the profession to do this, may i ask?
eraser_iresa
eraser_iresa
hi Anonymous Poster, thx for ur reply, but according to your strategy, it wastes both PC and Server CPU... pathfinding is an algorithm that takes i think NlogN or logN... it is not something fast to do...

if 100 players are on my server repeatingly clicking everywhere... or just 1 person... that means server has to repeatedly do pathfinding... it will lag the server and shut it down in less than 30 seconds...

wouldnt it make more sense if One side does the calculation and send the results to the other side for confirmation?

there are many ways to do this, but i really want the most "professional" and "efficient" way to do this... i would like to hear more suggestions... anyone knows can give me a hint?

cuz i want the game to be a pretty "tight" real-time MMORPG...
Morpheus011
Morpheus011
the server has to be authoritative or you leave yourself wide open to client-side manipulation of data. The server must be completely authoritative and tell every client where it must be at any given time. Performing pathfinding isn't even necessary, you can simply compute a vector from the player to the point, run to that point and perform collision checks with the ground and/or any dynamic/static geometry in the world. Terrain following is the most computationally expensive operation here.
MaulingMonkey
MaulingMonkey
Here's an alternative: Have the client send a movement list. If you're using a grid based layout (which it sounds like you are), this can be done without using too much bandwidth, keeping pathfinding on the client side while avoiding client authority. Basically, you have 8 directions (sides and diagonals) you can travel, which can be stored in 3 bits, then the client does the path finding and sends the server something along the lines of (to get from 50,50 to 45,45):

Move(5): SW SW SW SW SW //straight example
Move(6): SW SW S W SW SW //minor obstacle example
Move(10): S S S S S W W W W W //big obstacle example

You can then have the server halt the player if they hit an obstacle on that path (and inform the client to redo the path from there), or do server side calculations only for badly predicted client paths (or allow dynamic objects to intersect, or do an approximate fudge in the right direction while waiting for the client to repeat the path finding, etc)
Kitt3n
Kitt3n
>doing pathfinding on the client is not really a big task, (your average RTS >does pathfinding for tons of units)

That might be true if you run one server, but imagine case where
50-80 gameservers are running ony one physical server..

You definately do NOT want them to take more then 1-2% cpu time.

Let the client do the pathfinding (or any expensive operation for
that matter) and send it to the server, the server knows the current
position and can determine if the movement (or whatever operation it
is) is valid and update all other clients.

visit my website at www.kalmiya.com
MENTAL
MENTAL
Quote:
That might be true if you run one server, but imagine case where
50-80 gameservers are running ony one physical server..


Just to give you a bit of a reality check, you generally run 1 game server on multiple physical servers...
starfleetrp
starfleetrp
Quote:
Original post by MENTAL
Quote:
That might be true if you run one server, but imagine case where
50-80 gameservers are running ony one physical server..


Just to give you a bit of a reality check, you generally run 1 game server on multiple physical servers...


This is true, however there might be on reason to run one game server on 2 multiple servers even though there might be like 50 zones with its own process. So instead of having 50 servers you only need 2 but when it expands you just need to move the process over. I know someone who has done this for a very small MMO that is growing slowly.
MENTAL
MENTAL
I know, and in some cases it can be useful (especially for small scale projects as you stated).

However, the main reason for providing extra game servers is because all of the ones currently available are packed to the limit and causing slowdown. Running another instance on the same server isn't going to help matters as the hardware is running at maximum capacity.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.