Create ROM Object
rom.init.RdA ROM object contains all the static data for running a game. ROM elements can be set with this function or after the fact, e.g. with ROM$framerate = 30.
See vignette("engine") for more info.
Arguments
- screen.width
Width of the game screen in pixels; see render.scene.
- screen.height
Height of the game screen in pixels.
- keybinds
Vector of keys and their corresponding action; see
inputs.process().- startup
Function run by the game when initialized with
ram.init(). Must returnRAM.- custom
Function run by the game on every frame with
ram.tick(). Must returnRAM.- sprites
List of all sprites (matrices) used by the game; see render.animate.
- palette
Vector of how each value of 0, 1, 2, 3, etc. in a sprite should be drawn by
render.matrix().- framerate
Frames per second the game should run at. 60 recommended, 30 may be useful if
render.ram()takes a significant amount of time.- backup_duration
How frequently the RAM backs itself up in seconds; see ram.rollback. Shouldn't need to be changed from the default.
- input_delay
Seconds to add to the timestamp of every input. Makes inputs get processed slightly after they were sent, to reduce the frequency of rollbacks. Shouldn't need to be changed.
Game Code
ROM$custom updates the RAM every frame in ram.tick(). All game code should be either in ROM$custom or in helper functions stored in the ROM, demonstrated below.