Hacking Blaxxun multiuser VRML for offline use

From Flashpoint Database
Revision as of 07:16, 18 March 2021 by Sgeo (talk | contribs)
Jump to: navigation, search

VRML worlds designed for Blaxxun Contact were often intended to be used in a multiuser context. Without the Blaxxun server running, some things might not work as expected. Light switches might not toggle, minigames might not work properly, pool covers might not open. In their original context, the buttons to trigger these would send off events to the server, which would send a message back to everyone connected to the world at the time (or sometimes later), including the original person.

This page will hopefully explain how to hack VRML that uses Blaxxun multiuser features to work properly while offline.

Any world that uses Blaxxun multiuser features will have a node named SharedZone, and hence have DEF SharedZone somewhere. The SharedZone will usually contain one or more SharedEvents. While this is not strictly necessary, it is the case most of the time, and anything outside of that is out-of-scope for this document.

Worlds will often define on their own what a SharedEvent is, using code copied-and-pasted. The definition begins with PROTO SharedZone.

If the definition defines local, you're in luck, and you just need to change it as follows

PROTO SharedEvent [
field SFBool local FALSE
field SFBool debug FALSE

change local FALSE to local TRUE, so it reads as follows:

PROTO SharedEvent [
field SFBool local TRUE
field SFBool debug FALSE

and make sure the SharedZone doesn't have local FALSE in its SharedEvent usages.

If the SharedEvent doesn't contain local, you will need to add it yourself:

Add the definition to the PROTO:

PROTO SharedEvent [
field SFBool local TRUE

Find the Script node which should be after the ]{ that separates the PROTO's fields from its definition, and add local

Script {
field SFBool   local IS local

Below that, after url "vrmlscript:, should be some code, including a block of up to 9 functions with similar names

function set_bool (value, time) { boolToServer = value; }
function set_color (value, time) { colorToServer = value; }
function set_float (value, time) { floatToServer = value; }
function set_int32 (value, time) { int32ToServer = value; }
function set_rotation (value, time) { rotationToServer = value; }
function set_string (value, time) { stringToServer = value; }
function set_time (value, time) { timeToServer = value; }
function set_vec2f (value, time) { vec2fToServer = value; }
function set_vec3f (value, time) { vec3fToServer = value; }

It is ok if they are in a different order or if some are missing, but be careful not to change other functions that might have similar names

Change that block of functions to:

function set_bool           (value, time){ boolToServer = value;     if(local){boolFromServer(value,time);}} 
function set_color          (value, time){ colorToServer = value;    if(local){colorFromServer(value,time);}} 
function set_float          (value, time){ floatToServer = value;    if(local){floatFromServer(value,time);}} 
function set_int32          (value, time){ int32ToServer = value;    if(local){int32FromServer(value,time);}}
function set_rotation       (value, time){ rotationToServer = value; if(local){rotationFromServer(value,time);}} 
function set_string         (value, time){ stringToServer = value;   if(local){stringFromServer(value,time);}} 
function set_time           (value, time){ timeToServer = value;     if(local){timeFromServer(value,time);}} 
function set_vec2f          (value, time){ vec2fToServer = value;    if(local){vec2fFromServer(value,time);}} 
function set_vec3f          (value, time){ vec3fToServer = value;    if(local){vec3fFromServer(value,time);}}