Allow eval before run #2618
Labels
discussion
Issues with no clear action or preferred solution
enhancement
Improvement of existing feature or adding something new
Currently in order to use the
eval
command, you have to firstrun
and then hit esc to close the game.For normal development this is fine. However, if this restriction were lifted, it would make it possible to automate tests; for example, you could run something like this:
This would set the keypad to return random values and run 1024 tics of the game. If I could do this with all the Fennel-based TIC-80 games I've found, it would help a lot with testing new versions of Fennel to identify crashes, but I'd imagine that it would also be helpful for testing other changes to TIC-80. In the future perhaps even a
--randomize-input
flag could be added to further facilitate testing.However when I tried a few different attempts of implementing this myself, I ran into dead ends. First I tried making changes in
evalFennel
so that it would callinitFennel
if the Lua VM was not yet initialized. This worked for basic code, but as soon as I went to calltrace
it would segfault abruptly. Then I thought maybe I was solving the problem in the wrong place; it would be better if it could work with any language, so maybe handling it inonEvalCommand
was a better idea. I noticed that a lot of the initialization work was done intic_core_tick
instead oftic_init_vm
, so that had to be moved. But it doesn't seem possible to calltic_init_vm
fromonEvalCommand
anyway.So, two questions:
The text was updated successfully, but these errors were encountered: