Good day engineers,
I am attempting to create a bot to play factorio in Python with the use of reinforcement learning. But I am dealing with some dilemmas:
How can I move the player around? In mod API I did not find any command like "move(player, x, y)". Nearest I can get is a teleport. But moving is not all. What about placing entities? I did find command LuaSurface.create_entity but it is more like spawn not a simulation of player placement, so the item is not removed from players inventory and distance is also ignored. So I am looking for some way to control player through a mod API. EDIT: SOLVED
As far as I know, a mod can r/w to file which I can use to connect a bot (python) and factorio mod. Idea is that python writes command (in LUA https://lua-api.factorio.com/latest/) to file and mod reads this command from a file, execute the command and delete command. But I assume this approach will not perform enough as I plan to run factorio with game speed as high as possible. So my question is: is there any way to send commands to mod remotely?
Eventually, I can use direct x to send keystrokes to the game but I assume it will not be precise enough and use a mod to only receive information about the game like player and entities location and state.
Thanks for any advices.
External link →