[X3D-Public] games > state carryover on anchor between scenes

doug sanden highaspirations at hotmail.com
Tue Oct 15 11:48:19 PDT 2013


>>> Yes it could be fun for games! If you anchor between rooms or
>>> indoor/outdoor scenes all those scenes can be be parsed separately as
>>> needed. Which may render faster depending on viewer.
>>
>>>> The idea of bundling resources in a zip file is common in game engines
>>>> (especially useful to distribute game mods), and as I'm implementing a
>>>> game engine using X3D --- it would be cool if it would be just a
>>>> standard X3D feature :)
>>>>
>>
>> Q. for multi-scene games, how / where is game state -such as scoring, level, persona- carried over to subsequent scenes after an Anchor? Is there an SAI field on the Browser that can be set with (name,value) pairs from Script nodes/javascript, and if so which field(s)? Or is there another paradigm?
>
> [Christoph:] You could load one "master scene" by the Web3D browser, add modules/levels (whatever you call them) dynamically using the method Browser.createVrmlFromUrl() as children of a grouping node. Then you could store your state in the "master scene". You would need to define an interface between the "master scene" and your modules/levels
>
> Do not know whether to call this a "paradigm", it's just a possibility, and it needs more scripting than a simple anchor.
>

Thanks Christoph. 
Q. how does the interface work? Can createX3DFromUrl nodes refer to DEF 
nodes not within its own subscene? Or would we somehow find a node to 
talk to by crawling the scenegraph?

-Doug

Holding Game State Across modules/levels/rooms/scenes

Possibility 1:
Master-Scene holds state for sub-scenes
Method A: Browser.createVrmlFromUrl()/createX3DfromUrl() brings in sub-scenes to children of group node in master scene

Method B: 
i) newscene = createX3DfromURL(url) is called first to generate a new X3DScene
ii) then settings are transferred from the current scene to the newscene
iii) then replaceWorld(newscene)


Possibility 2:
Browser object holds state between peer scenes
Method: an SAI field or function on the Browser object that can be set from Script nodes, 
http://www.web3d.org/files/specifications/19777-1/V3.0/Part1/functions.html#BrowserServices 
- perhaps an array of strings or property list called 'crossSceneState':
http://www.web3d.org/files/specifications/19777-1/V3.0/Part1/types.html#SAIPropertyList
Anchor/LoadURL or createX3DfromURL + replaceWorld brings in peer scenes
- each peer scene keeps the Browser.crossSceneState updated

Q. can I just add more properties to Browser from javascript ie Browser.mystate = new array()? If so would it stick around after an Anchor? 		 	   		  


More information about the X3D-Public mailing list