Skip to content

About

HorangHill's engine. A client and editor in the same app.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Repository files navigation

LigmaForge

LigmaForge HorangHill Engine Open Beta

LigmaForge is an intuitive and simple web-driven 3d sandbox game which grants its users wide possibilities to create game worlds for others to play and enjoy, enabling creativity in the process. LigmaForge is committed to the principles of open-source programming and the entire engine's codebase is available on GitHub licensed under GNU AGPL.

Scripting API

In order to simplify and improve developer experience, functions have been added to allow manipulation of the game world by developers.

Basics

API functions are divided into three, each differ in their usage. API functions tend to require uuids of the target objects to run, which can be found on the properties window on the right side of the screen.

node - used to manipulate objects (e.g. mass)
game - used to manipulate the game world (e.g. play sounds)
mesh - Returns properties of the parent mesh

Note

Multiplayer games played on the LigmaForge client only shares player position and avatar to the server. Any changes to the scene done by the player or scripts only applies locally.

The node Object

node.setColor(uuid: String, color: String)

   Used to manipulate object color.
   Example: node.setColor("ZYG06", "#F54927")

node.setPosition(uuid: String, xpos: Number, ypos: Number, zpos: Number)

   Used to manipulate object position.
   Example: node.setPosition("ZYG06", 0, 2, 0)

node.setSize(uuid: String, xsize: Number, ysize: Number, zsize: Number)

   Used to manipulate object size.
   Example: node.setSize("ZYG06", 2, 2, 2)

node.setRotation(uuid: String, x: Number, y: Number, z: Number)

   Used to manipulate object rotation.
   Example: node.setRotation("ZYG06", 0, 3.14, 0)

node.setMass(uuid: String, mass: Number)

   Used to manipulate object mass.
   Example: node.setMass("ZYG06", 1)

The game Object

game.setMenu(id: String, text: String)

   Used to add a text element to the game menu.
   id - unique identification key for accessing the element.
   Example: game.setMenu("points", `Your Points: ${x}`)

game.sendLocalMessage(text: String)

   Used to send a local message (only applies to client).
   Example: game.sendLocalMessage("3.14 is a funny number")

game.playAudio(url: String)

   Used to play an audio track.
   Example: game.playAudio("https://example.com/audio.mp3")

game.spawnMesh(type: String, sizeX: Number, sizeY: Number, sizeZ: Number, x: Number, y: Number, z: Number, mass: Number)

   Spawns an object and returns its ID.
   type - Type of mesh (refer to elemTypes in addShapes.js for mesh types)
   Example: game.spawnMesh("cube", 1, 1, 1, 0, 2, 0, 0)

game.deleteMesh(uuid: String)

   Deletes an object.
   Example: game.deleteMesh("ZYG06")

game.createListener(uuid: String, type: String, callback: Function)

   Listens to a mesh for an event. Only runs callback once.
   type - Only click for now
   Example: game.createListener("ZYG06", "click", () => { console.log("boom"); })

The mesh Object

mesh.getUUID()

   Returns the parent mesh UUID

mesh.getPosition()

   Returns the parent mesh position

mesh.getMass()

   Returns the parent mesh mass

mesh.getColor()

   Returns the parent mesh color

mesh.getSize()

   Returns the parent mesh size

mesh.getRotation()

   Returns the parent mesh rotation

About

HorangHill's engine. A client and editor in the same app.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages