Engine and modding documentation

Back to readme


Level editor

To use the level editor: press A in-game and then click on the right-top menu. Use directional keys and page up / page down to move cursor. Save with 'S' regularly.


Script

The script is using the lua programming language. To modify the script, open the file world.lua with a text editor like notepad or Notepad++

Available functions:

Misc:

Sound

Current object interaction. These functions shall be called only in lua_manage_x and lua_draw_x

Player and camera interaction

'Global' variables:

These variables are managed by the engine, and are accessed in the script through the functions setGlobalVar, getGlobalVar, and addToGlobalVar. These variables are saved when the game is saved.

Text:

2D sprites:

3D models:

Core drawing functions. Typically you call them into lua_loop.

Cube creation functions

Functions called by the engine. You MUST fill them:


Import 3D meshes

With 3DsMax

Export as OBJ

(img1) (img2)

Then in the world.lua file:

--init variable model3D
model3D = 0

--load the model into memory
function lua_load_0()
	model3D = load3DModel('my_object.obj')
end

--do object-related things
function lua_manage_0()
end

--draw the model
function lua_draw_0()
	draw3DModel(model3D)
end

--free the model from memory
function lua_unload_0()
	unload3DModel(model3D)
end

Then increment the return value of lua_getNbObjects() of one:

function lua_getNbObjects()
	return 1
end

Then add the object into the game editor, pressing 'x' key.

Note: if you have several objects of the same type '0' in the game, the function lua_load_0 is called once, when any of these objects is being visible, i.e. not hidden by the fog. The function lua_unload_0 is called when no more object is visible.