Scripting overview
GAMPEON games are made of resources. A resource is a folder with a manifest, Lua scripts and other files. A server runs many resources at once: one for the game mode, one for the shop, one for the chat, and so on.
Server, client and shared scripts
Section titled “Server, client and shared scripts”| Script type | Runs on | Use it for |
|---|---|---|
| Server script | The game server | Rules, money, inventories, anything that must not be cheated |
| Client script | Every player’s computer | Input, UI, effects |
| Shared script | Both | Configuration and helpers both sides need |
The server is the authority. Never trust a value just because a client sent it: check it on the server. See Events.
Your first resource
Section titled “Your first resource”hello/├── fxmanifest.lua└── server.luaname 'hello'version '1.0.0'server_script 'server.lua'AddEventHandler('onResourceStart', function(name) if name == GetCurrentResourceName() then print('Hello from ' .. name) endend)
CreateThread(function() while true do Wait(60000) print('Another minute passed') endend)How scripts work together
Section titled “How scripts work together”- Events pass messages inside one side and between server and client. See Events.
- Threads run code over time without blocking the game. See Threads and timers.
- Exports let one resource call functions of another. See Exports.
Rules of the sandbox
Section titled “Rules of the sandbox”Every resource runs in its own protected Lua 5.4 state. There is no file access, no require and no os.execute, and every resource has limits on memory and run time. Long loops must call Wait. See Sandbox.
Next steps
Section titled “Next steps”- Read the Lua API reference for every available function.
- Set up autocomplete in your editor: Editor setup.
- Let an AI assistant write and check resources for you: Build with AI.