Table of Contents
4. Mars Roleplay
It was time to rethink the Oxygen/Health system again. Previously, I had the data stored in a database table and fetched data from it when an agent entered the Mars RP Zones, and stored the data when they left the zones.
This allowed them to continue their exploration at a later date with their oxygen and health continuing from where they left off. I realised this wasn't necessary, and possibly quite undesirable. Instead I store the data into the linkset DataStore.
This actually has the same issue, in that data can be retrieved from an earlier session and continued, but items can be removed from the data store when they become stale. This only occurs when the amount of space available in the data store is less than 1kb (out of a total of 128kb).
I also realised that slow regeneration of oxygen and health was just annoying, so that's now fixed.
The Servers
In the image at the top of the page, you'll see the two servers. The cylindrical one on the left is the region hub, and the one on the right is the central server.
The central server tracks the following information for each agent in the Mars RP Zones:
-
Oxygen level
-
Health level
-
Safe zone status (TRUE = safe)
-
Region
-
Oxygen only goes down when safe = FALSE
-
Health only goes down when (safe = FALSE) AND (oxygen = 0)
-
Safe Zone status is updated by the region hub
-
Region contains the region name OR a unix time value
When an agent leaves a region, the region name is replaced with the unix time value set 60 seconds into the future, but only if the current region name is the same as the name of the region sending the 'left' update notice.
When an agent enters a region, the region name is always updated to the new region name.
In this fashion, it is possible to recognise an agent has left the RP Zones entirely - and after 60 seconds, their record can be removed during a clean operation.
The region hub keeps the central server updated on agent presence and safe status, and when HUD updates are received from the central server, updates the respective HUD and the system health status for the avatar. If an agent is not wearing an RP HUD, the region server will pick it up on a region-wide sweep and register the agent with the central server as having no protection.
A HUD will notify the region hub when it enters a region, is attached or detached, and notify the region hub of the protection level selected on the HUD.
In essence, the HUD does very little: it displays information relayed to it by the region hub, and informs the region hub of entry into a region and the selected protection level.
The region hub monitors agents entering and leaving a region, registers their protection level (none if not wearing a HUD), and monitors whether agents are in safe zones. It passes all this information to the central server.
The central server is doing the donkey work; the HUDs basically just display information (and speed up notification on region entry); the region hubs act as relays and monitors.
This allows an agent to wander across multiple regions - their record exists throughout their stay. As soon as they enter a safe zone or sit on an oxygenator, their oxygen and health will restore to 100% (on the next tick).
An additional function of the central server is it keeps a running count of the number of agents and active NPCs across the whole zone.
Communications
Since this setup requires objects in different regions to communicate with each other, I could have used http-in, which is disabled by default in openSimulator because of the security implications. I probably don't have to worry about that because I have full control over my grid, but I'd rather not use http-in.
Another method is to use http-reflection, which is something I already use. The domain mossgrid.uk is registered at an external server, so I have functions I can call on that server which simply pass the call back to a web server inside my network.
However, I have a fully-fledged working system that uses IRC as a message transport system. This utilises OpenSimulator's built-in IRCBridgeModule to create an IRC-based network. This allows me to direct messages to individual objects, broadcast (with a single message) to a group or objects, a sub-group of objects or all objects. It is highly efficient too.
I run my own IRC server on my network, which is blocked by access from the outside world, so I have total control over the channels I create and use. I decided to setup a specific channel for the servers in the Mars RP Zones. These zones consist of:
-
16 of 4×4 regions in the main Mars Complex
-
1 of 4×4 region in the Mars Test region (named simple 'Mars')
-
1 of 1×1 region named Mars Laboratory (development site)
-
1 of 1×1 region named Deimos (home of the central server)
This amounts to the equivalent of 262 standard (256x256m) regions.
The main Mars Complex is divided into four quadrants: NW, NE, SE, SW. Each quadrant is also divided into four regions in a like manner, so the regions in the NW quadrant are named Mars-NW-NW, Mars-NW-NE, Mars-NW-SE and Mars-NW-SW. It keeps it simple.
Region hubs all direct their communiques to the central server, which in turn sends updates for an avatar to the region the avatar is in.


Discussion