This page as Markdown: https://bloxd.io/docs/getting-started.md. Every page of these docs, for AI agents: https://bloxd.io/docs/llms.txt

Getting started

There are three places to write JavaScript in Bloxd: code blocks, code boards and World Code. Code in any of them controls the game through api, in custom games and worlds. Only players who can edit code (the canEditCode client option) can write it, but anyone can run a code block or board.

Please use our Discord to report problems or suggest features.

Code Blocks

Boards

World Code

World Code runs for the whole world instead of when someone clicks. Open it with F8. It defines Callbacks, such as tick and onPlayerJoin, which the game calls when things happen. The How-Tos build whole games with it.

Globals

NameValue
apiThe game API: every method in the API Reference
myIdThe ID of the player running the code, or null when nobody is, as in most World Code
playerIdThe same as myId
thisPosThe position of the code block or board running the code, as [x, y, z]
api.ownerDbIdThe database ID of the world's owner, or null if it has none

Logs and results

Next steps

Snippets has short pieces of code to copy into a code block and change.

Logo