Page 1 of 1

Additions to enable an AI team mate

Posted: Wed Jun 04, 2025 5:16 am
by DunRaider
I'm developing a mod which will make it possible for users to add an AI team mate (e.g. ChatGPT, Claude, open source model) to a multiplayer game through RCON (Factorio version 1.1.110). The idea is not to provide an AI which can use all the advanced features in the game, instead it will have limited capabilities but would in theory be able to get to launching a rocket.

I want the AI to adhere to the rules of the game like a player. This is almost possible but the character (LuaEntity) lacks a crucial function which is the can_place_entity. I have tried to use LuaSurface.can_place_entity and make some approximations of build reach, but it isn't working as I would like. Furthermore, the LuaSurface.can_place_entity doesn't seem to do any check on e.g. whether there are resources on the tiles when drills are placed.

I see two possible solutions to this:
  • Add can_place_entity to LuaEntity. I assume LuaEntity already have the required variables, e.g. build_distance and character_build_distance_bonus which is inherited from LuaControl.
  • Add LuaEntity to LuaSurface.can_place_entity so it take position, build_distance, and character_build_distance_bonus of the character into account.
It seems like build_distance isn't populated when a player isn't connected to the character, but I assume that would be an easy fix (e.g. hardcode it to 10 when it is a character).

Re: Additions to enable an AI team mate

Posted: Tue Jun 17, 2025 12:03 pm
by StrangePan
Before I look into the feasibility of this request, I should inform you that development on Factorio 1.110 is stopped, and all future fixes, features, and modding API requests will be applied to Factorio 2.0.+. Thus, any mods seeking to use this feature will also need to be updated to run on Factorio 2.0.+

Re: Additions to enable an AI team mate

Posted: Wed Jun 25, 2025 8:30 pm
by DunRaider
Hi StrangePan,

Sorry for the late response. It seems like I will have to upgrade to the newest version. I would appreciate it if you would have a look at it.