Closed joshgoebel closed 2 years ago
Ok, let's add BOOT()
function.
Can we get an INIT() for regular cartridges using Lua etc?
Can we get an INIT() for regular cartridges using Lua etc?
Yes, the callback will work everywhere, if we add it, INIT()
or BOOT()
doesn't matter.
Can we get an INIT() for regular cartridges using Lua etc?
Yes, the callback will work everywhere, if we add it,
INIT()
orBOOT()
doesn't matter.
INIT() would be my preference - that's the function name used by many other 'game engines' (eg Defold, Godot, Pico, Love2d, Unreal. 'Boot' implies loading the system itself (and out of the user's control).
'Boot' implies loading the system itself
You boot a cartridge in my thinking... I think many early systems didn't have much of an OS, so I actually think it's a nice throwback name... but also I think if many other engines use 'INIT' that would be enough of an argument for me.
I see this as useful for, but entirely separate from the WASM work... so if someone else wanted to pick this up and run with it, that'd be fine. It's also not required for WASM, but just a "very nice to have"... so may not be something I get to myself.
Added BOOT()
callback to all the supported scripts and WASM aeffb6d4ca72db22540bcc3c56ab81230f5583bd
Many compile languages can't have a concept "top-level" code (all the code must be in functions)... so there is no opportunity to perform start-ups tasks... having to do a manual check in
TIC
isn't terrible, but is kind of an ugly pattern IMHO. If we supported ainit
orstart
orboot
hook or something like PICO-8 we would eliminate this problem.For example from my Zig cartridge:
It could be nice if this wasn't necessary and we could instead do: