The open road.

3D & HD-2D

3D Surroundings: The Land Past a Map's Border

reactor_3d_surround.js · 2,422 lines · 101 public functions

The open road.

What This Module Does

An extension of Reactor3D (reactor_3d.js), loaded after the world builder: in the game from scriptUrls, in the editor from Reactor3D.EXTENSIONS, and in Node by the core's own tail.

Classes & Namespaces

Design Notes from the Source Code

An extension of Reactor3D (reactor_3d.js), loaded after the world builder: in the game from scriptUrls, in the editor from Reactor3D.EXTENSIONS, and in Node by the core's own tail.

A map ends at its border; what is seen past it lives in its sidecar as surround:

{ "style": "continue", "distance": 160, "rough": 0.5, "seed": 1, "edges": { "south": "ocean", "north": "mountains" } }

style is what lies past every side: continue (the border's own heights carried outward and rolled into hills), ocean (the land falls to a shore and water runs to the horizon), mountains (the land rises into ridges that close the view), plateau (the map is a mesa: its edge drops to a far floor), void (a floating island: a rock underside under the map) or none. edges says otherwise for one side (not for a void). distance is how far it reaches in tiles, rough (0-1) how hilly, seed which hills; level an ocean's surface (absent: the lowest water at the border, else just under the lowest ground there), height the mountains' (tiles), drop the plateau's and the void's depth, haze (0-1) how far the far land fades into the sky's horizon colour, water the ocean's material.

neighbors names the map past a side: { "north": { "map": 7, "shift": 4 } }. A player who walks (or drives) off the map on that side goes on into that map, onto its facing border, at the same tile along it; shift is the tile of this map the neighbor's first tile lies against.

A neighbor is shown and entered without a break (Reactor3D.Neighbors): as a map starts, the maps past its borders are read and their worlds built beside it in place of each side's style, and then the maps past theirs (DEPTH maps out), so nothing on the horizon changes as the player nears a border. A step or a drive over the border makes the world past it the map's own and leaves this one standing behind it with what stood beside it, with no fade and nothing built again; worlds further than DEPTH maps from the one played are let go. A border reached before its neighbor is ready is crossed with a fade, as any transfer is.

It is scenery: no one walks on it, nothing collides with it, nothing is worked out each frame. One mesh of the room floor's own material (so the border is the same grass, lit the same way, wearing the ground painted there), a ring of rays out from the border whose cells grow with distance, built once when the map is laid; a second mesh of the same far vertices fades them into the sky; an ocean is one water sheet.

View reactor_3d_surround.js on GitHub · Show internal (_) functions