Additions to enable an AI team mate

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
DunRaider
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 07, 2020 7:45 am
Contact:

Additions to enable an AI team mate

Post 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).
Post Reply

Return to “Modding interface requests”