Tuesday, June 30, 2015

node.js - How to keep track of players nearby other players in an MMO


I'm confused how to handle the players in my MMO server (using Socket.IO but I think this should apply to any MMO).


Suppose there are 2 players in my server that are far away from eachother. I will call them A and B in this example.


The server launches. No clients are connected.


A joins and is added to the server's active playerlist.


Every second A gets a list from the server with the active players nearby to update their positions. Since there are none online currently, the list is empty.


B joins, far away from A. The server adds B to the active playerlist. Since A cannot see B yet, the list that A receives from the server is still empty.


B is moving towards A and comes within visual range.



What to do now for A? Send an event to A that B has come within range? How can the server know that A was informed of B being nearby? Does this mean I have to maintain a list on the server which player can see another?


Here's what I was doing before with my previous project: I never told the clients that a player was in range, instead the server just sent a list every second of players that are nearby and let the client do the rest. This way, the client keeps track which unit is added and which is not. Is this the best approach, or am I missing something?



Answer



Nic explained this to me briefly yesterday. Check out the explanation on his blog.


http://nic-gamedev.blogspot.com/2011/11/mmo-architecture-creating-ghosting.html


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...