How can I change the spawn rate or amount of mobs?

Modified on Mon, 01 Mar 2021 at 03:10 PM

Mobs are spawned using detail generators in Voxel Play world definition.


To change the spawn probability, look for "PirateIsland" world definition and you'll find the spawners in the Content Generators section:


For example, if you want to increase the amount of cannibals in the island, select the "NetworkCannibalSpawner" and increase the probability value:



Please refer to the Voxel Play documentation about Detail Generators for more info about this feature.

In Pirates of Voxel Play we use a simple Prefab Spawner class which allows you to spawn random prefabs as chunks are being generated by Voxel Play. When a chunk is generated, the spawner is called and a random value is checked with the probability value. If it succeeds, and a suitable biome is in that chunk, a random prefab from the list is spawned.


Also note that spawning must be executed on the server. That's why these spawners are called "ServerPrefabSpawner". You can check its code and notice the NetworkServer.Spawn() call to Mirror when the prefab is instantiated.


The spawners only are executed on the server. Pirates of Voxel Play will only enable detail generation on the server (by setting env.enableDetailGenerators = true on the server only - check the WorldState.cs class).


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article