Libraries & API
Planets
Ringworld

Ring Worlds

Generate a world wrapped along a cylinder. Useful for creating sci-fi megastructures like O'Niell cylinders (opens in a new tab) or Ring Worlds (opens in a new tab)

They can be long with a small diameter, or vast and narrow.

O'Niell Cylinder

An enormous cylinder providing a habitable surface in a counterrotating arrangement.



Niven Ring

A long thin megastructure,such as described in the Ringworld series by Larry Niven, or the Halo series. (You may have to rotate the camera around to see)



Usage

import { RingWorld } from "@hello-worlds/planet"
import worker from "./RingWorld.worker"
 
// ...some threejs scene above
const myWorld = new RingWorld({
  radius: 5_000,
  length: 20_000
  minCellSize: 32,
  minCellResolution: 48,
  workerProps: {
    numWorkers: 8,
    worker,
  },
  data: {
    seed: "My Cool Seed!",
  },
})
scene.add(myWorld)

Props

PropTypeDefault (if optional)Description
invertedbooleanfalseIf true, flips the terrain upside down
radiusnumberrequiredThe radius of the ring world
lengthnumberrequiredThe width of the "rim" of the ring world
minCellSizenumberrequiredThe smallest size that a terrain chunk will be
minCellResolutionnumberrequiredThe amount of subdivisions in a terrain chunk
materialMaterial (opens in a new tab)undefinedThe material to use
positionVector3 (opens in a new tab)requiredThe position to place the world
lodOriginVector3 (opens in a new tab)requiredthe position where to compare the lod algorithm against, typically your camera position. If the lodOrigin is close to a terrain chunk, it may decided to collapse into a higher level of detail.
workerPropsWorkerPropsrequiredConfig for the worker
dataRecord<string, any>requiredUser datta that will be consumed by the worker threads' generator functions
lodDistanceComparisonValuenumber1.25The quadtree will resolve to a higher level of detail if the lodOrigin position is closer than distance * lodDistanceComparisonValue, for thhis reason it must be greater than 0

WorkerProps

export interface workerProps: {
  worker: new () => Worker
  numWorkers: number
}