Author Topic: Networking conceptual question  (Read 2591 times)

Thaorius

  • Not-a-newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Networking conceptual question
« on: May 22, 2006, 02:23:38 PM »
Hi there!

Wow, I started my game server using RakNet, but I have a question.

The GameServer have to maintain the position of all monsters and players on the map.

Then, how do i get the monsters locations from the scratch? without loading the map again to get them. And how do I get the info_player_start's entities without loading the map again and drop resources?.

I have this idea:
The server starts with blank records of monsters,entities, players and everything else. Then, when the first cleint get conencted, it send to the server some packages, with info_player_start entities list and postitions, monnster_* information and position, some other several information about the map(including wich map to use!).

Then, the server update all its data, and wait for clients(of course, if this first client get disconnected, the server still work because it just update the server on it start.

Someone have some better idea than using a client to update the server?

Thanks.

the_viking

  • Jr. Member
  • **
  • Posts: 97
  • Karma: 2
    • View Profile
Re: Networking conceptual question
« Reply #1 on: May 22, 2006, 06:17:47 PM »
Huh - this seems to be a very awkward conecept

Usually, the client doesn't need to know about much Entities. It just needs to have enough knowledge to present a valid game world to the player (and spawnpoints don't matter).

Try loading your map when the server starts. Treat the geometry as an game entity, too, that will simplify some steps. Of course you can leave the level geometry as another aspect, but you'll have to send a special THIS_IS_THE_GEOMETRY message or so to each connecting client.
Now, if a client connects, just send messages like INITIAL_ENTITY with all information about the entitiy (do this for each entity that exists in the current game state and that is needed at client side).
Thats the usual way. Rakkar already implemented this in the Replication plugin, just look at the source code and watch the video tutorial somewhere in these forums... It'll do the job.