Hi there,
I'm a CS student interested in training an AI to play my favourite game so the factory can grow even when I'm not playing. There's a couple of things that would make this nice, and I'm wondering if factorio supports them:
- Speed up play: It would really speed up training if I could run factorio at 10x or 100x speed
- Headless communication: I believe this already exists via a headless server
- Player control: I believe this exists via LuaPlayer although I'd rather write the training script in a non-Lua language and have my script talk to factorio. Maybe I can write a mod that communicates to an external script which actually does the controlling?
- Some way of getting information about the state of the game: I'm guessing this is also trivially feasible via the Lua interface.
Apologies for the slightly rambly post, I'm confident I could get the machine learning parts to work but I'm not sure how easy it will be to get the ML parts to chat to factorio. Thanks for all your help!
Does headless factorio have an API for playing the game? - Looking to train an AI to do so
Re: Does headless factorio have an API for playing the game? - Looking to train an AI to do so
/c game.speed = 100beyarkay wrote: Thu Nov 23, 2023 7:12 pm - Speed up play: It would really speed up training if I could run factorio at 10x or 100x speed
- Headless communication: I believe this already exists via a headless server
- Player control: I believe this exists via LuaPlayer although I'd rather write the training script in a non-Lua language and have my script talk to factorio. Maybe I can write a mod that communicates to an external script which actually does the controlling?
- Some way of getting information about the state of the game: I'm guessing this is also trivially feasible via the Lua interface.
Yes.beyarkay wrote: Thu Nov 23, 2023 7:12 pm - Headless communication: I believe this already exists via a headless server
You can write you AI in any language and have a binding layer in Lua, injecting the commands via RCON and getting info from the world back with RCON.beyarkay wrote: Thu Nov 23, 2023 7:12 pm - Player control: I believe this exists via LuaPlayer although I'd rather write the training script in a non-Lua language and have my script talk to factorio. Maybe I can write a mod that communicates to an external script which actually does the controlling?
- Some way of getting information about the state of the game: I'm guessing this is also trivially feasible via the Lua interface.
mod communicating with the outside world
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Re: Does headless factorio have an API for playing the game? - Looking to train an AI to do so
Check this https://github.com/gotyoke/Factorio-AnyPct-TAS
Its not "ai" but could be great inspiration
Its not "ai" but could be great inspiration
Re: Does headless factorio have an API for playing the game? - Looking to train an AI to do so
i'm working exactly on that: creating a restfull api for factorio via rcon, if you want we can team up: you work on your AI and I work on my API with a focus on what you need, you have what you want and I have a tester for my API. win/win (do you have discord?)beyarkay wrote: Thu Nov 23, 2023 7:12 pm Hi there,
I'm a CS student interested in training an AI to play my favourite game so the factory can grow even when I'm not playing. There's a couple of things that would make this nice, and I'm wondering if factorio supports them:
- Speed up play: It would really speed up training if I could run factorio at 10x or 100x speed
- Headless communication: I believe this already exists via a headless server
- Player control: I believe this exists via LuaPlayer although I'd rather write the training script in a non-Lua language and have my script talk to factorio. Maybe I can write a mod that communicates to an external script which actually does the controlling?
- Some way of getting information about the state of the game: I'm guessing this is also trivially feasible via the Lua interface.
Apologies for the slightly rambly post, I'm confident I could get the machine learning parts to work but I'm not sure how easy it will be to get the ML parts to chat to factorio. Thanks for all your help!