Hi everybody, I just want to ask if anybody can give me one example or somewhere to search about the SpawnSystem to player, for example in MMORPG have 6.000 mobs and 2.000 NPC if I send all of them to the players gets really laggy...
So how can I make this system?
I got this, one for who is called every 50 miliseconds so checks all of the monsters & npc, yes one for with 8.000 things who is called every 50 miliseconds to all players and that is get laggy and I want to know how do it better or maybe change all the system but make it the best way.
Example I got 30 players online...
Servers SPAM every 50 ml 8.000 to one player, then to other, then to other and send all informations of the mobs/npc one by one. Only spawn the mob/npc who are less than 20 of distance ( The calculation between Mobs X/Y/Z and Player X/Y/Z ).
Packet, packet.
So the servers get a little bit laggy...
Example of code
Code:while (ServerIsRunning()) { // I got a map with players and mobs for ( USERLISTIT it = userList.begin(); it != userList.end(); it++ ) { for ( MOBLISTIT it2 = mobList.begin(); it2 != mobList.end(); ++it2 ){ if ( GetDistance(it->second->GetPosition(), it2->second->GetPosition()) && !AlreadySeeIt(it2->second->mobId) ) { //SPAWNMOB... } else //DESPAWNMOB... } } Sleep(50); }


Reply With Quote![[Question] Best way to do the SpawnSystem.](http://ragezone.com/hyper728.png)


