World is the root parent that organizes everything about a 3-D world: the 3-D scene, camera, overlays, user event handling, controllers, user info, etc. Every new world is run in a new AcornVM instance so that its global space is uncorrupted by other worlds.
$ holds the value of the current world, typically rendered in the current window ($window). To switch worlds via a hyperlink:
# Close the current world and start a new world $browser.start('http://newworld.com/world.acn')
At its core, the browser rapidly cycles between three actions on the current world ($): process input events, update the state of the world, and then render to its window the world's current 3d scene and overlays. The World's properties and methods may be used to control how these actions play out.
When created, a world should also specify what happens when launched, e.g.:
- Asking users to sign-in (as a scene) and then retrieving their information and state, as well as any personalization information such as key maps, skinning and window layout.
- Offering a character selection and avatar customization scene.
- Personalizing various controllers that establish rules for motion, collision, etc.
Properties (see Type)
- camera which renders the world's .scene to .window. If .camera is undefined when the world is rendered, a default camera is created and stored here.
- TBD. An ordered list of controllers to send an .update request to every frame.
- TBD. The browser stores here the number of seconds since the last .update.
- TBD. Type whose methods handle specific input events forwarded by the browser. This event-handling type might translate (e.g., using a keymap) and dispatch some of these events to a "picked" 3-D part in the scene or an overlay, depending on the placement of the cursor. More generic events might be forwarded to .user, .camera, the .scene or handled by the world directly.
- Create a new world.
- Perform a full frame: handle input, send out update ticks, and render the world.
- Specifies a list of overlays to render onto Frames or Windows in order.
- Indicates whether the world (and therefore the browser) is running. Typically, the answer is true. Setting it to false for the current world stops the browser.
- TBD. Index of all overlay windows (whether shown or not)
- the world's 3-D scene, typically a group. Changing this property alters the 3-D scene that is rendered.
- TBD. This is called before each render, allowing the world to update the state of anything that needs to change.
- TBD. Information about the current user, such as their account, characters, avatars, keymap preferences, window skinning styles, etc.