An AI for Factorio?!

Post all other topics which do not belong to any other category.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

An AI for Factorio?!

Post by ssilk »

DaveMacW said (https://forums.factorio.com/forum/vie ... 900#p78900)
DaveMcW wrote:It's easy to write an AI for Factorio. The most challenging part of the game is designing efficient layouts, which can be pre-programmed into the AI.

It wouldn't take much effort to write an AI that outperforms most humans.

If PVP or PVE ever becomes interesting it might get harder for the AI.
I don't query this now. I thought it would be a good moment to think a bit deeper into this question.

My questions:
1. What does "An AI for Factorio" really mean?
2. Is this really useful? Would someone use it? Or does it spoil the "pure game"?
3. How could there be an AI, which - generally and with a little bit help by the modder - can play with all types of mods?
4. How important is the role of good, efficient (and smart) layouts (blueprints)?


My opionions
to question 1:
I think to three general types:
- Completely acting alone, works like a character (or in god-mode), useful for PVP games. I don't see, that this is a realistic target yet, cause such an AI would be easily played out.
- Coop. Like above but you can give it some kind of orders. The side effect is some kind of Interface for the orders, which would also an interesting thing for the "normal" coop-game (but is of course fast over-engineered).
- Helper-AI. I think this is the most realistic (cause simplest type) and also most fun. It is part of the game, you can build the AI and it is then able to do things instead of you (like "Connect this resource with these furnaces"), but maybe uses only robots and maybe you can build several of these in the game.
- Better enemy AI. More intelligent path-finding. More fun with them, following some kind of strategy.

to question 2:
I think yes. Especially as helper-AI this is like in music: Instead of manually pressing all the sliders and buttons on a mixer-console, there are automatics, which can do that for you and which is much more efficient. The game is so big and takes so long, that I always (and said it from beginning) would appreciate any speedup, and AI is such a thing.

to question 3:
I think the answer is in the next question.

to question 4:
I think this is very important. We need a library for "good layouts". A really big number of some hundred blueprints, sorted by usage, input-output item/fluid and so on in some different variations and subtypes. The AI then just needs to find and combine those blueprints and needs to know, how to build it. I think this is a realistic target.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
aka13
Filter Inserter
Filter Inserter
Posts: 795
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: An AI for Factorio?!

Post by aka13 »

Imho, if playing against an AI, the AI should have predetermined spawn placing and predetrmined base size - some sort like Starcraft AI. It would fortify itself over a specific locations with very rich resourse fields, and send waves after the players. The longer you take not searching for these settlements, the more ressources they will have dumped into fortification, defense and offense - and the less loot you could propably get in form of raw recources.

Also, the concept of space engineers with AI-controlled caravans/railroads going through the desert is also nice - you could set up an ambush and wait; There could be different types of convoys, alarm systems for destroying the fortifications on convoys path, etc. That all should not require an AI at all, only scripted events.
Pony/Furfag avatar? Opinion discarded.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: An AI for Factorio?!

Post by ssilk »

aka13 wrote:Imho, if playing against an AI, the AI should have predetermined spawn placing and predetrmined base size - some sort like Starcraft AI. It would fortify itself over a specific locations with very rich resourse fields, and send waves after the players. The longer you take not searching for these settlements, the more ressources they will have dumped into fortification, defense and offense - and the less loot you could propably get in form of raw recources.
I need to point out, that this assumes, that we have a limited map.

Is that a precondition for an PvP-AI? Cause we have lots of AI knowledge out there with limited maps, but only small, if the map is unlimited... I think that enables some more different strategies.

( Well, I think that is also true in general: With PvP the map needs to be limited somehow, otherwise I could just build 5000 tiles away and the other player will never find me. :) )
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
aka13
Filter Inserter
Filter Inserter
Posts: 795
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: An AI for Factorio?!

Post by aka13 »

What I mean is, since the map is unlimited, letting the AI go free could result in 2 things - either it goes full offensive and builds the entire map over, not leaving the player time to play "relaxed". It would lead to the problem which happens at turn 100-150 in civilization games - either you already are dominating everyone, and it gets boring, or you have no chances catching up to the leader anymore. Or, the AI goes full retard, shits itself and does random things not really contributing to any sort of gameplay and just trashing the map.

The idea of convoys moving from point a to point b is that it could be simply adjusted to players level - let's say we have a tunnel exit and a tunnel entrance, and a train moving regularly between them. In the beginning it could be a locomotive and a cargo wagon, just destroy a rail, or block its path, and plunder it. After you have accquired specific technologies it could get a convoy guarding it, plus a repair bot team following it, maybe sort of anti-air defense against construction bots.

The other option would be AI controlled fortresses with random location, which you could encounter. Same thing as biters nests - running around in early game would spawn "easy" fortresses, running in lategame would spawn bigger and tougher ones. They could same to biters send offensive waves toward players. I see no way for a starcraft-like deathmatch scenarios in PVP or AI way for factorio. At best something as in minecraft, where users try to lock down their homes and "duel" in arenas. That's a sandbox game after all.
Pony/Furfag avatar? Opinion discarded.
aka13
Filter Inserter
Filter Inserter
Posts: 795
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: An AI for Factorio?!

Post by aka13 »

Any sort of map limitation essentially makes it just a custom version of starcraft with poor fighting mechanics, imho.
Pony/Furfag avatar? Opinion discarded.
Koub
Global Moderator
Global Moderator
Posts: 7774
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: An AI for Factorio?!

Post by Koub »

In my opinion, an AI that has predetermined layouts, or that behaves in a kind of scripted way like "you should expand that way, there, at that moment" is not really a AI, just an advanced script.
In my opinion, two games on the same map with the same AI should end up with totally different bases, because of inner decisions of the AI.
Koub - Please consider English is not my native language.
Kevin94
Inserter
Inserter
Posts: 46
Joined: Mon Dec 08, 2014 10:39 pm
Contact:

Re: An AI for Factorio?!

Post by Kevin94 »

Koub wrote:In my opinion, two games on the same map with the same AI should end up with totally different bases, because of inner decisions of the AI.
That doesn't make sense. Factorio is and has to be deterministic, the behavior of an AI will always be reproducable.

I am currently working on a predecessor to an AI: a mod able to generate whole outposts by it self (Oil with refineries, Mining, Defense Structures). I don't know much about AI Algorithms but programming pathfinding for small units is challenging by itself. Maybe I'm to pessimistic in my judgement but I neither believe the devs will implement this in the near future nor a single modder can do this.

Ignoring this, an AI capable of building a base from scrap and fighting with the player, would be awesome and the logical next step in multiplayer evolution.
Koub
Global Moderator
Global Moderator
Posts: 7774
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: An AI for Factorio?!

Post by Koub »

Kevin94 wrote:
Koub wrote:In my opinion, two games on the same map with the same AI should end up with totally different bases, because of inner decisions of the AI.
That doesn't make sense. Factorio is and has to be deterministic, the behavior of an AI will always be reproducable.
Sorry, but I have to disagree : the fact that factorio is deterministic doesn't mean an AI playing the game has to be deterministic. It just means that given an initial condition, a serie of commands will always give the same result. But an AI doesn't have to follow that rule.
Koub - Please consider English is not my native language.
Kevin94
Inserter
Inserter
Posts: 46
Joined: Mon Dec 08, 2014 10:39 pm
Contact:

Re: An AI for Factorio?!

Post by Kevin94 »

Koub wrote: Sorry, but I have to disagree : the fact that factorio is deterministic doesn't mean an AI playing the game has to be deterministic. It just means that given an initial condition, a serie of commands will always give the same result. But an AI doesn't have to follow that rule.
On which non deterministic event can an AI base its decisions if everything in the game (including any random number generation) is deterministic? If an AI is part of the core Factorio Programm or it is a mod, it has to be deterministic. The only unknown variable in this equation is the behavior of normal players and any good AI should adapt to that. And if there is no player in radar range I would expect it to operate strictly reproducable.

Maybe you see the randomness as some good gameplay element, I do not. No only because its impossible to implement, as it conflicts with how multiplayer works, but also because all game elements should behave consistent after reloading, biter attacks are reproducable, script errors of mods are, most game crashes are and so should actions of an future AI.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: An AI for Factorio?!

Post by ssilk »

Koub wrote:In my opinion, an AI that has predetermined layouts, or that behaves in a kind of scripted way like "you should expand that way, there, at that moment" is not really a AI, just an advanced script.
I never saw a AI in any game (and I also (tried to) programm them myself), that was that really clever. And in my opinion not really needed here. A "good enough" solution would help alot.

Currently I see an AI mainly as blueprint-generator, like "build green circuit sub-factory in this area, input belts are here, output are here", "build a train station here, input side down". And so on.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
aka13
Filter Inserter
Filter Inserter
Posts: 795
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: An AI for Factorio?!

Post by aka13 »

SSilk, again, you have not thought out the very foundation of the said AI. We have 2 options - either the AI does a sort of a space race with the player, and plays as a defensive Civ in civilisation game series. Sounds not too complicated, but you forget the problem, that if the same rules apply for the bot, it actually has to go and get the ressources while fighting off biters. The current way of dealing with biters is more or less using the flaws in biter AI by spamming turrets, or rushing in, and trying to unload the shotgun as often as possible until the biters get ya, and then again running away to the turrets. THe whole biter mechanic is one big exploit usage for the player. There is no way an AI, which is not using badzillions of CPU power and has the level of CIA AI routines levels will manage that.

The second big problem is, we do not have a space-race-goal right now. Like, none at all. So what do you want the AI to do? BUild the factory as big as possible? Spam defenses? What does it actually tries to reach? Exterminating the player? If so, it could just craft 10 turrets, 500 mags and rush to the players most polluted area where it places them and continually attacks the player until it wins, meanwhile destroying the factory.

A full playerlike AI is of no use for factorio at all.
Pony/Furfag avatar? Opinion discarded.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: An AI for Factorio?!

Post by ssilk »

AI is such vague term. What means AI for Factorio? That's what the thread is about. :)
aka13 wrote:A full playerlike AI is of no use for factorio at all.
Agreed, this is my opinion, too, but I'm not sure if that is seen by all like so.

In my opinion an AI for Factorio has some kind of assistant-character. I see it's main usage for building stuff or help building stuff.

A concrete (simple) implementation would be for example a robot dog, that sees, what I plan to build and brings me the missing items.
A computer, that looks for blueprints in the library, that more or less match my needs.
A computer, that watches input/output items and warns me if I have too less input of a resource.

Like with cars, that include more and more assistant systems, I think it is with Factorio, too.

If there is at any time a PvP-AI, I think it works only on special and limited maps and some scripted behavior.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
aka13
Filter Inserter
Filter Inserter
Posts: 795
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: An AI for Factorio?!

Post by aka13 »

For scenarios, zes, absolutelz. It would be a great addition.
Pony/Furfag avatar? Opinion discarded.
Koub
Global Moderator
Global Moderator
Posts: 7774
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: An AI for Factorio?!

Post by Koub »

My definition of the AI would be : Give it an objective (2k green circuits a minute, build rocket defense, ...) and the AI does what it takes to achieve the goal : explore, reserarch, expand, defend, ...
There are many possible ways achieving a given goal, and I'd like the AI to be able to choose a strategy and implement it.
Koub - Please consider English is not my native language.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: An AI for Factorio?!

Post by ssilk »

But I'm not sure, if that doesn't kill the whole fun with this game. Or are you? I think it is the same problem, why the big automobile producers have many scruples introducing fully automated drivers: They would kill the clientele, that buys the car for having fun with it.

So the solution is, as in the automobile industry: Add more and more assistant systems, and look what happens. :)

BTW: A mod I like: Better vehicle control (1.0.1) https://forums.factorio.com/forum/vie ... =14&t=8976
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: An AI for Factorio?!

Post by n9103 »

This grew from a silly response in the "show your work" topic into a pretty decent piece of lore, IMO.
Didn't see anywhere more relevant to post it, since it's discussing the idea of AIs and the metagame. I've no problem if the Devs want to adopt the idea or scene or anything like that.
I've reworked the first half from a badly-written post into something that could actually be in a book.
The second half, however, I can't seem to work into the text, and thus I'll leave it unfinished as I feel it has some of the richer lore material. Hopefully someone else will get the same spark of inspiration I did and pick up where I left off.

For reference, I refer to AIs as She (blame SHODAN and Jane :p), and new AIs are cloned from an existing AI, as the process that first created one has never been duplicated.
Oh, and I believe that the player character is a member of a trained group of agents, that use the title Factorio, that do essentially what the player is doing. They just start with better resources and support usually.
First part
(Second part, as mentioned above, follows.)
Poorly written
Final thoughts
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.
User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1685
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: An AI for Factorio?!

Post by MeduSalem »

ssilk wrote:I think it is the same problem, why the big automobile producers have many scruples introducing fully automated drivers: They would kill the clientele, that buys the car for having fun with it.
I'd take such a car since I can't drive and I'm afraid of driving. :P But that's offtopic already. But let's just say there's pretty much a customer for everything.
n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: An AI for Factorio?!

Post by n9103 »

Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.
British_Petroleum
Filter Inserter
Filter Inserter
Posts: 321
Joined: Tue Dec 23, 2014 7:21 am
Contact:

Re: An AI for Factorio?!

Post by British_Petroleum »

Has anyone made an AI for factorio? I think playing pvp against an AI would be way more fun than single player.
ColonelSandersLite
Fast Inserter
Fast Inserter
Posts: 208
Joined: Tue Apr 24, 2018 5:42 am
Contact:

Re: An AI for Factorio?!

Post by ColonelSandersLite »

ssilk wrote: Sat May 02, 2015 9:41 am
aka13 wrote:A full playerlike AI is of no use for factorio at all.
Agreed, this is my opinion, too, but I'm not sure if that is seen by all like so.
I definitely disagree. The functional use of an AI is exactly the same as the functional use of a 5,000 spm base or that working Tic-Tac-Toe game I saw over on reddit - It's interesting and appealing to the nerds that play Factorio. Myself included.

Besides which, there is definitely a bigger use for it. People are talking about PvAI and assistants and stuff but screw that. I want to see AI-v-AI, Thunderdome style. Two bots enter, one bot leaves! Biters on + Klonan's M.I.R.V. mod. May the best bot nuke the other bot until he glows in the dark.

ssilk wrote: Fri May 01, 2015 12:32 pm 4. How important is the role of good, efficient (and smart) layouts (blueprints)?
My opinion, for what it's worth, is that creating layouts on the fly would be the core point of such an AI.
Post Reply

Return to “General discussion”