OK... So I got a multi-threaded echo server functioning. Now I just need to figure out how to roll that into my game code. I am trying to decide what should be done locally at the client, and what should be done on the server.
As far as I can determine right now, the server needs to handle all NPC activity. It needs to handle things like asteroid spawning, and loot table population, but I think that once it is spawned and populated, it should be handed off to the client completely, since it is non-mobile. If a player harvests the asteroid, the client should send a "start mining asteroid 'X'" message, the server should respond with a status message that the requesting client has exclusive access to the asteroid at that point. The client then animates the mining process, plays the destroy animation, runs the looting process, and tells the server at some point in there that the harvesting is finished. If the client requests to start mining, and someone else already has it, then the server would deny the request, and the client would play some sort of 'blocked' animation.
Each update would consist of the client sending it's current X,Y,Z,H,P,R data to the server, and the server sending back NPC and other player data back, along with any asteroid destruction data, etc. My biggest concern is how to perform some sort of culling process so that characters (player and NPC) that are not in view, or nearby, don't have to have positional data sent. Also, some method of adding and removing player avatars into the update list because of login, logout, disconnection, or entering / exiting the solar system.
This was a "stream of consciousness" post. If it doesn't make sense, I will fix it later.
-Joe
Saturday, May 9, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment