Files
Roguelike_Algorithm_Visuali…/documents/algorithms.txt

29 lines
1.1 KiB
Plaintext

Dungeon generation algorithms are written in lua and dropped into scripting->algorithms. They are automatically parsed by the visualizer and assigned keys in the program to run them.
Algorithms are made up of a single lua file (possibly more with requires) with the following functionality:
Provided:
global algorithm_manager.register_algorithm(name, init_function, update_function, updates_per_second)
Registers an algorithm with the program with a given name, init function, update function, and updates per second
map.draw_floor(x, y)
Draws a floor on the map at a given x, y position
map.draw_wall(x, y)
draws a wall on the map at a given x, y position
map.fill(bool wall)
Fills the map with either floors (false) or walls (true)
map.is_wall(x, y)
returns true if map[x,y] is a wall, false otherwise
Necessary:
init_function(map_w, map_h)
Should initialize the function fresh with a given width and height.
update()
Called updates_per_second times per second. Should calculate new map state and draw on the map as needed. The map will have the previous state retained.
Returns true if finished, else false