Hacking Blaxxun multiuser VRML for offline use: Difference between revisions
No edit summary |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
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. | [[VRML Curation|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. | 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 <code>SharedZone</code>, and hence have <code>DEF SharedZone</code> somewhere. The <code>SharedZone</code> will usually contain one or more <code>SharedEvent</code>s. 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 <code>SharedEvent</code> is, using code copied-and-pasted. The definition begins with <code>PROTO SharedZone</code>. | |||
If the definition defines <code>local</code>, you're in luck, and you just need to change it as follows: | |||
<pre> | |||
PROTO SharedEvent [ | |||
field SFBool local FALSE | |||
field SFBool debug FALSE | |||
</pre> | |||
change <code>local FALSE</code> to <code>local TRUE</code>, so it reads as follows: | |||
<pre> | |||
PROTO SharedEvent [ | |||
field SFBool local TRUE | |||
field SFBool debug FALSE | |||
</pre> | |||
and make sure the <code>SharedZone</code> doesn't have <code>local FALSE</code> in its <code>SharedEvent</code> usages. | |||
If the <code>SharedEvent</code> doesn't contain <code>local</code>, you will need to add it yourself: | |||
Add the definition to the <code>PROTO</code>: | |||
<pre> | |||
PROTO SharedEvent [ | |||
field SFBool local TRUE | |||
</pre> | |||
Find the <code>Script</code> node which should be after the <code>]{</code> that separates the PROTO's fields from its definition, and add <code>local</code> | |||
<pre> | |||
Script { | |||
field SFBool local IS local | |||
</pre> | |||
Below that, after <code>url "vrmlscript:</code>, should be some code, including a block of up to 9 functions with similar names | |||
<pre> | |||
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; } | |||
</pre> | |||
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: | |||
<pre> | |||
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);}} | |||
</pre> | |||
<noinclude> | |||
[[Category:Curation Guides]] | |||
</noinclude> |
Latest revision as of 16:58, 14 October 2023
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 SharedEvent
s. 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);}}