Realm Zero – Spawns & Zone Handling!

Over this past month the main focus has been to re-implement and improve the network engine behind Realm Zero. Previously the system was capable of handling interactions such as chat, player movement, orientation, spells and basic item interactions. Since then the system has been improved adding a dual-layer communication process which includes both TCP & UDP streams. This allows for the transmission of critical data through the more reliable TCP protocols, while less trivial packets such as moment and orientation are sent through UDP stream.

Zone Processing
With the addition of the upgraded network components, I’ve started to implement split zone processing. The goal is divide up the overall work handled by the main server, while managing complex tasks such as spawns, AI and player interactions. A zone instance connects much like a player client, however it uses a different authentication protocol to establish a connection.

Take a look at the image below:

Given the example let’s assume our world map only consists of 4 zones, each zone being handles by a separate processing client which could ultimately be residing on a separate server all together. Now besides the obvious¬† benefit of extra processing power and resource utilization we gain another very unique advantage, redundancy. Now let’s say one of these zone was to crash (disconnect), the main server can detect this disconnection and automatically start another instance! While we may lose any current running values, we won’t suffer a hard crash and the player is not likely to notice a difference.

Spawns & AI
The most recent component I’ve been constructing is the spawn handler. A spawn may consist anywhere from 1-100’s of concurrent NPC(s), each with the option to run an AI script to process their interactions. Since it’s pointless to run a spawn(s) for an empty world, area or zone I’ve implemented triggers. You should notice from the image below a green sphere and a red circle. The green sphere is the trigger area, while the red circle is the spawning area. Now a trigger goal is to load or (pop) the spawn once a player(s) are within a given range and de-spawn once the area has been idle for a given period of time. This allows the server to reclaim vital resources and processing power generated from all the NPC(s) and AI scripts. This should cause little to no impact on the players experience given that the (trigger) zone is large enough to be masked by their visual distance.


The next area of focus will be implemented harvest-able resources, which will utilize the spawn handler for generation. This will be one of the first dynamic game elements implemented as resources will spawn in dense areas for a given type and once they reach a certain percentage they will stop generating new nodes. Once a player has extracted (depleted) a node, it will be removed from the world and now the global percentage now has a chance to spawn another node somewhere throughout the area.

Which ultimately brings us to gathering and the skills associated with harvesting the nodes. The first harvest-able resources implemented will be rocks and ore, which require the mining skill. Once this system has been implemented, it will be very easy to replicate it across other resources such as: timber, herbs and other naturally occurring resources.


Agustina 10 July 2014

Dual communication with TCP and UDP sounds good. UDP is your friend when talking about multimedia packets. Btw I liked your spawn idea to let server reclaim resources sounds good and noone will noticed.
To bad I can’t join your RZforum, I made an account but I didn’t receive the activation mail.

    Hank Newman 22 August 2014

    You should be able to join, try resending the activation link.


Leave a Reply