Page 1 of 1

LiveSplit help with Factorio variables?

Posted: Thu Dec 22, 2016 7:04 pm
by Ekelbatzen
Hi,

I want to help speedrunners do an autosplitter for Factorio and could also use some help from some dev programmers.

Background:
LiveSplit is a timer for speedrunners which supports scripts to watch game memory and do splits automatically.
A good indicator for when to split would be completion of research.
Now I don't know what to look for in those millions of game variables and before I search blindly, some dev help would be appreciated.

The question:
How is a single research value represented in the code/memory? Is it binary, an enum, a weird int?

I can understand if you don't want to give infos about your codebase, I think a mod which uses the api to help LiveSplit would also be possible, but that would be more complex.

Re: LiveSplit help with Factorio variables?

Posted: Thu Dec 22, 2016 7:20 pm
by prg
Just use game.write_file() in an on_research_finished event handler, then watch for changes to the resulting file?

Re: LiveSplit help with Factorio variables?

Posted: Thu Dec 22, 2016 7:23 pm
by Ekelbatzen
Writing files is slow, also I would want to avoid writing a mod if possible.

Re: LiveSplit help with Factorio variables?

Posted: Mon Dec 26, 2016 7:05 am
by Rseding91
Ekelbatzen wrote:Writing files is slow, also I would want to avoid writing a mod if possible.
Writing files takes virtually zero time and the API already exists to do it fully without needing to add or change anything.

Re: LiveSplit help with Factorio variables?

Posted: Mon Dec 26, 2016 9:32 am
by cpeosphoros
Rseding91 wrote:
Ekelbatzen wrote:Writing files is slow, also I would want to avoid writing a mod if possible.
Writing files takes virtually zero time and the API already exists to do it fully without needing to add or change anything.
I can attest for that. Writing a line to a file takes less than 1 millisecond: viewtopic.php?f=135&t=38996

Re: LiveSplit help with Factorio variables?

Posted: Mon Dec 26, 2016 11:10 pm
by Ekelbatzen
I experimented with using the logger and such, but I solved it now differently.
It would also be difficult for the user to define where the file will be located at, since these scripts mostly only offer checkbox settings.

I found boolean variables for single researches, but could not find easy pointers with a pointer scan.
Now my script watches the UI research text on the top right.
It may be language dependent and break every update, but the speedrunner won't have to install the mod additionally to the script, besides me still not trusting slow hard drives which have a bad day.