Skip to content
forked from fenomas/noa

Experimental voxel game engine.

License

Notifications You must be signed in to change notification settings

Offroaders123/noa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noa-engine

An experimental voxel game engine.

Live demo of testbed here!

For content examples see the hello-world app or testbed app.


API reference:

noa

Main engine object.
Emits: tick, beforeRender, afterRender

var noaEngine = require('noa-engine')
var noa = noaEngine(opts)
  • playerEntity - Entity id for the player entity

  • playerBody - reference to player entity's physics body

  • setPaused (paused) - Pausing the engine will also stop render/tick events, etc.

  • getBlock (x,y,z)

  • setBlock (x,y,z)

  • addBlock (id,x,y,z) - Adds a block unless obstructed by entities

  • getTargetBlock() - Returns value of currently targeted block (or null if none)

  • getTargetBlockPosition() - Returns location of currently targeted block

  • getTargetBlockAdjacent() - Returns location adjactent to target (e.g. for block placement)

  • getPlayerPosition()

  • getPlayerMesh()

  • getPlayerEyePosition()

  • getCameraVector()

  • pick (pos, vec, dist) - Determine which block if any is targeted and within range


noa.entities

Wrangles entities. This class is an instance of ECS, and as such implements the usual ECS methods. It's also decorated with helpers and accessor functions for getting component existence/state.

Expects entity definitions in a specific format - see source components folder for examples.

  • names - Hash containing the component names of built-in components.

  • isTerrainBlocked (x,y,z)

  • add (position, width, height..)

    Helper to set up a general entity, and populate with some common components depending on arguments.

    Parameters: position, width, height, mesh, meshOffset, doPhysics, shadow


noa.world

Module for managing the world, and its chunks

  • getBlockID (x,y,z)

  • getBlockSolidity (x,y,z)

  • getBlockOpacity (x,y,z)

  • getBlockTransparency (x,y,z)

  • getBlockFluidity (x,y,z)

  • getBlockProperties (x,y,z)

  • setBlockID (x,y,z)

  • isBoxUnobstructed (x,y,z)

  • setChunkData (id, array) - client should call this after creating a chunk's worth of data (as an ndarray)


About

Experimental voxel game engine.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%