It is currently Fri Dec 15, 2017 6:45 pm
Welcome to helbreath.info, a community for all things Helbreath!
Register today to gain access to post, download pak edits, source files, and much more.


Deutsch Espanol Francais Italiano Portugues Russian Arabic Japanese Korean Simplified Chinese


helbreath.info is closing down in 2018
(read more)



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Mob Spawn Rate
PostPosted: Sat Jun 03, 2017 7:54 am 
Hellhound
Hellhound

Joined: Sat May 14, 2011 4:33 pm
Posts: 36

Thanks given: 0 times
Thanked: 0 times
Been looking into how to Make mobs spawn pretty quickly after being killed for pits.




Top
 OfflineProfile  
 Post subject: Re: Mob Spawn Rate
PostPosted: Mon Jun 05, 2017 11:15 am 
Clay Golem
Clay Golem

Joined: Sat Apr 30, 2016 12:19 am
Posts: 25

Thanks given: 5 times
Thanked: 0 times

Town: Aresden
I think its somewhere in npc.cfg o,o




Top
 OfflineProfile  
 Post subject: Re: Mob Spawn Rate
PostPosted: Mon Jun 05, 2017 10:06 pm 
Very Important Person
Very Important Person
User avatar

Joined: Thu Jul 19, 2007 9:53 pm
Posts: 1102

Thanks given: 1 times
Thanked: 5 times
Sooo, in the config file there will be a number for death time. When an npc dies, this is the amount of time before the server will remove the npc entirely from a spawn. For the server to spawn a new mob, it needs the npc to be removed entirely before it can spawn another one. So this is the easiest way to change that.

Digging deeper into it. The game server should have a main loop that it repeats as long as it is running. Something like this.

*note, code is C#

Code:
public void MainLoop()
{
   while (true)
   {
       NpcProcess(); //handles npc actions
       PlayerProcess(); //handles player actions
       TimerProcess(); //handles all timed processes such as hp/mp/sp regen
       Thread.Sleep(100); //(milliseconds)
   }
}


This loop will happen as fast as it can process those methods and then sleep for 100 millisecond before repeating. So in theory, the fastest you could respawn a mob after it dies is just over 100 millseconds.

However, in the npc process method you might have a spawn timer that gets checked before it will try and spawn missing mobs. The Helbreath Champions project will only let the server respawn mobs every 3 seconds. This could be a bottle neck to check for faster respawns.

Another bottle neck is in how many mobs the server will spawn at once. In the Helbreath Champions project it is limited to 1.
Code:
 if (CreateNpc(spawn.NpcName, spawn.Zone.GetRandomLocation(), spawnID))spawn.Count++;                                   
continue; // only one npc should spawn in each spawn location per iteration


This means that every 3 seconds, the server will check if mobs are missing from spawns. Then spawn only 1 mob and wait another 3 second, this repeats until the pit is filled. To allow all missing mobs from a pit to respawn at once, just have it create as many mobs that are missing from the total allowed.


Hope that helped some! Good luck




Top
 OfflineProfile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB © - View Disclaimer
Style by Daniel St. Jules of Gamexe.net, customized by kinger.