Is a factorio AI theoretically possible?

This is the place to request new mods or give ideas about what could be done.
Post Reply
turoni
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 04, 2016 9:42 pm
Contact:

Is a factorio AI theoretically possible?

Post by turoni »

Hi all

I want to get into factorio modding because I would like to write an AI player for factorio.
A quick google search didn't bring me to any active projects but I didn't really investigated it that thoroughly.

I know it might be too big too start with but I have quite some experience programming so I'll just learn what I need and have fun with it.
I followed some of the basic tutorials and I got a bit of the concepts but please excuse me if I mess up the terminology,
I would like to know if it is theoretically possible with the current API:

Can I create or copy the character?
Can I make that entity move around,
place objects and
craft recipes?
If no, can I programmaticly do the same for your character?
Can I load data about the everything visible by this copied character so he knows where resources and enemies are?


Yes or no on these questions would be great, I'll figure out the rest by myself.
Knowing it is there is enough.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Is a factorio AI theoretically possible?

Post by Choumiko »

Should definitely be possible. You will probably have to simulate some things in lua (for example i don't think there's an API for making a player mine a resource and after the normal time to add the item to the inventory, reduce durability of the tool, etc)

It's not going to be easy or very performant i guess :D

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Is a factorio AI theoretically possible?

Post by meems »

hi turoni,
welcome to the quietest board in factorio, host to a million players, yet you will never feel so alone.
lul
actually its like badger watch here. the modders spend most of their time buried deep in their burrows, completely cut off from the rest of the universe, working furiously on their own ideas. Every word they accidentally read on the forum hurts them, because its time wasted that could have been spent working on their own mods. Occasionally and briefly they come out to flaunt their new mod, and that's when you have to be ready with your spring loaded net to catch them. They will be most upset that you want to talk to them about SOMETHING OTHER THAN THEIR MODS, but thru gritted teeth they might give you a polite answer.

lul.

I think the answer to most of your questions is yes, but you better wait to get conformation from one of the badgers. Your AI will be running from your own LUA code, while you will have to find out how to plug in the inputs to factorio, but that should be easy.

Coding a good AI will be a hard and involved challenge. But if you can do it, lots of modders will want to be your friend, including me.

Have you got an empty mod template set up, ready to start?

turoni
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 04, 2016 9:42 pm
Contact:

Re: Is a factorio AI theoretically possible?

Post by turoni »

Thank you for the warm welcome and the warning.
I don't want to setup any expectations since I have no experience with either modding or lua but I have some ideas that I'd like to try and mainly have fun learning everything.
meems wrote: Have you got an empty mod template set up, ready to start?
I am gonna start implementing the basic tutorial: https://wiki.factorio.com/Tutorial:Modd ... al/Gangsir

I skimmed trough this and it should have a lot of very usefull stuf already.


If it is not possible to emulate a player I'll skip that part for now, my main concern is to keep the bot "fair".
Meaning no magical creation of resources, everything that is placed should be taken from an inventory.

I think the item placement will work, any advice on reading info about what's on the map would be apreciated.
I've found that there are chuncks but not a lot of information about these:
can I get what entity is placed on them, can I see if it is ground, water or a resource?

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Is a factorio AI theoretically possible?

Post by bobingabout »

I don't know about making a character move around and all that, but you should definitely be able to script a god type AI player, basically a base would spontaneously grow, but you could make it happen with scripts.


in fact, featured on a FFF not too long ago was a base that expanded itself via the use of scripted blueprint placements. it was all done via roboports, so given a small starting point, it should be possible to have an AI building a base like this.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Linux_user404
Burner Inserter
Burner Inserter
Posts: 19
Joined: Tue Mar 15, 2016 3:37 pm
Contact:

Re: Is a factorio AI theoretically possible?

Post by Linux_user404 »

I like the AI idea for factorio. There are some implementations that might be quite interesting.
1) Watch the bot do it. So you can program the AI, adjust some parameters and then just watch it at lets say 10 times speed.
2) In separate spawns scenario you can play with bots and maybe add some interactions between them(connect the bases with rails).
3) Add an AI to spawn with you and give him advises on what to focus on, so he would assist you building your base(like "go there add setup and outpost on that iron").
4) AI assistant that would abuse blueprints and robots as soon as he gets them to build the base of his design.

British_Petroleum
Filter Inserter
Filter Inserter
Posts: 321
Joined: Tue Dec 23, 2014 7:21 am
Contact:

Re: Is a factorio AI theoretically possible?

Post by British_Petroleum »

Hey Turoni did you ever get anywhere with this? I would love to see something like this. But yes, as others mentioned, I can imagine it's a huuuge task

Post Reply

Return to “Ideas and Requests For Mods”