[Idea] AI Empires

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

[Idea] AI Empires

Post by Fumblesneeze »

Hey Guys, first post here, but have been lurking for a while.

I am playing with the idea of making new AI controlled factions. I'm a programmer and love doing AI but so far never had a good playground, but from what I've seen so far X:R could be just what I was looking for.

Generally, what I am looking to create is basically another "player" - a faction that will trade, build, fight and explore. PLUS MORE. It would be possible to make this AI give out missions by itself, and even better, with some more work, take missions by other AI factions.

For example, one AI has good relations with the other factions but one new station someone built is bad for business - the AI doesn't want to ruin the relations so it gives out a mission to kill that station. Another AI faction could've become more of a pirating faction - their relations are bad, which gives them the freedom to capture ships and also to take that mission - if the money is good enough to make up for the losses.

Back to the technical side, this is still a rough idea and I need to do a lot of research on how much of the core scripts can be incorporated and what else would need to be done.


I also am going to see if I can get a neural network going in the game engine. If that is possible this network would be the core decision-maker while deterministic scripts do the actual work and crunch the numbers to get suitable input. This would create the possibilities of these different styles of factions.


The coarse Roadmap looks like this:
  • Create a custom faction (determine if this can be done using script, otherwise hard code it in the mod file for now)
  • Create a sandbox universe (clear the whole universe for now, leaving only one zone, clear all stations and units as well)
  • Create a basic deterministic AI that will simply command it's property (e.g. tradeship -> search for a good trade and do it. fighter -> defend property, etc.)
  • Crunch universe data into a neural network input and act on output (if this can't be done, parametrize the scripts so it will be customizable still)
  • Implement Diplomacy between AI factions and missions

Feel free to comment, criticise, etc. If you think this is a great idea and want to offer your help that would be great, too.
User avatar
Chobittsu
Posts: 2210
Joined: Wed, 14. Apr 10, 21:12
x4

Post by Chobittsu »

Interesting concept if implemented correctly. Problem is Egosoft hasn't released all the tools modders need for total overhauls or big scripting
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

That is true. And as long as they are busy with top priority fixes they probably won't do so, but I expect that more and more things get available over time and I will just see what I can make with the tools available at the time ;)

So far, using mission director, xml patch files and even savegame editing there is a lot that can be done already.
User avatar
nonnex
Posts: 366
Joined: Wed, 28. Aug 13, 12:42
x4

Post by nonnex »

Sounds good.
As sayed before, the given posibilities are very good so far. The XML patching is quite powerful and it's only matter of time till we get nice tools for more comprehensive stuff. Good luck with your project!
snwboardn21
Posts: 236
Joined: Sun, 13. Nov 05, 02:08
x4

Post by snwboardn21 »

Sounds a lot like what conflicts tried to do in X3.

This is what I was hoping we were going to get with vanilla Rebirth. I will definitely keep an eye on what you figure out. Hope you are able to stay engaged with it.
"It is better to keep ones mouth shut and be thought a fool, than to open it and remove all doubt"
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

You can add new faction definitions.

Traders already go out in search of profitable trades.

If when you set up your faction, you assign all of the initial trade ships to a station, and all of the shipyard output ships to faction stations they will all go around making profitable trades on behalf of their parent stations.


From what I've seen in the scripts, nothing outside of story missions changes the relations between factions.

You could add into the fight scripts a calculation that drops faction standings when a factions property is damaged by more than a certain % by another factions property.

So if there is a trader ship belonging to faction A and it's getting attacked by pirates and a patrol from faction B comes along and destroys it (also dealing 1% damage to faction A's ship) then faction A would like faction B a fraction of a percent better because they destroyed an attacker but didn't do enough damage to their property to cause it to drop. However if faction B accidently destroyed faction A's ship or did a certain % of damage(10%? 20%?) then faction B would lose standing with faction A.

Then you'd just need to do some serious formula work for the other stuff. Like ways to numerically assess the strength the acting faction and that of other factions. Deciding which targets to attack, win conditions, surrender conditions, etc.

Oh and throw in a little bit of RNG to make things interesting... Some ships/stations have VIP's aboard that increase the rep multipliers, a faction has hawkish leadership come to power, etc.

I don't think you'd really need to use a neural net for it, unless it's an educational excercise :)
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

I don't think you'd really need to use a neural net for it
I don't think I need it either, it's just that I was wondering if it could be done and from what I've seen I thought that it actually might be doable, and that kind of blew my mind. ;)
making profitable trades on behalf of their parent stations
Where do those profits go to?
Then you'd just need to do some serious formula work for the other stuff. Like ways to numerically assess the strength the acting faction and that of other factions. Deciding which targets to attack, win conditions, surrender conditions, etc.
Yes! Very exciting! :D
Sounds a lot like what conflicts tried to do in X3.
It is similar in it's roots, that X doesn't have driving forces in the universe besides the player.

It's just that I feel this universe right now is a) very small and b) boring. Bigger Zones and Sectors as well as more of them will be a necessity.
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

The profits go to the station. You could set a minimum amount to hold in the station accounts and transfer the rest to a faction account that is used for building ships(military budget), new stations(domestic budget), and diplomatic efforts(foreign policy budget [bribes, loans, helping allies, etc]).

Or you could go even more "simulated" and add a faction tax for building and operating in a factions territory (within x km from a highway in a faction owned boarder sector, anywere in a faction owned core sector). You could add a few new lawless sectors for players wanting to avoid the faction taxes :p
KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Post by KRM398 »

Just a question, instead of a complete wipe and new universe being made why not add to this one? That's what Ego did a few times in the past. Your new AI civilization could be a new found race and it will be either friendly to you or not depending on what happened or where you first met. Adding new content to the game is nice too, because I've seen a few people saying the universe seems smaller now so why not just expand it and add more?

New ships to see new sectors to visit, all things we all like, so if you do it think about that, it might become a hit overnight for people looking for something really new and different. :wink:
Raapys
Posts: 159
Joined: Sat, 11. Sep 04, 22:22

Post by Raapys »

Yah, I've always thought the X series needs something like this. Could be Empires, could be private companies. But basically, they make cash from holding sectors and trading, use it to build ships and stations, then fight and conquer other empires. It would really allow for a truly dynamic game, and there would finally be a need for the huge player fleets since he would be able to partake in all of this and potentially change the outcome.

I do think it would be much easier to do it from the ground up though. The balance and everything would have to be right, so doing it with the current sectors and stations would probably just end up a mess.
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

When it is working it is supposed to integrate with the existing content + use any new sectors you might add. I'm only going to wipe so that I can easily set up test cases to see if specific behaviour works or not.

Balance right now is no concern for me: the more OP the AI gets the better :D But I'm not going to make it cheat to get new stuff.
Raapys
Posts: 159
Joined: Sat, 11. Sep 04, 22:22

Post by Raapys »

Sounds great.

Try to make with expandability in mind if possible, though. One empire would be excellent, multiple would be awesome.
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

I've taken the whole day off to do some work on this today.

I am streaming as I do this so if anyone wants to have a chat about modding or wants to listen to me explaining how this AI behaves (as I read through the vanilla files) then feel free to watch. Kind of an experiment here :)

The link is twitch.tv/fumblesneeze.
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

Fumblesneeze wrote:Balance right now is no concern for me: the more OP the AI gets the better :D But I'm not going to make it cheat to get new stuff.
But the AI already cheats to get new stuff. :(

Oh, btw, are you interested in a collaborator(s) for this project?
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

I would like to have a few heads together on this since there is a lot to do in this regard.

From what I've seen most of the ai scripts so far have to be replaced. (or rather new ones added which will be exclusive to these factions)

Only the most basic scripts will be reused like performtraderun, etc, but even then there might be a need to change these, for example when trades fail they just get dismissed right now, the faction ai would need to evaluate this, though: did it fail because the ship got destroyed? -> increase threat value of that zone and update relations with attacker. Did someone else get the trade earlier? If the trade was reserved -> update relations (if you reserve a trade and another faction ignores that reservation and buys it anyways they should lose reputation with the one who reserved it) etc.

If you'd like to collaborate then PM me, we could set up a github or something similar to organise.
timmmmmy
Posts: 24
Joined: Mon, 19. Jan 09, 23:53
x3tc

Post by timmmmmy »

I love this idea! I'm almost certain you're a few months ahead of where the game needs to be but would love to see this become a reality.I actually kind of figured that's how Rebirth would play as so many mods for the previous X's tried to emulate this.Fundamentally speaking though, do we know if the ai even identifies profitable industries to set up or is the game currently about the player being the only one to establish new factories?
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

I haven't found any code about the vanilla ai station building yet, I can tell you more about it when I have. It is fundamentally possible (by measuring demand over time).
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

The AI doesn't build stations on it's own.
Tarazu
Posts: 67
Joined: Thu, 8. Apr 10, 07:59
x4

Post by Tarazu »

A good read for understanding the current economics and the problem this mod should focus on solving IMO :)

http://forum.egosoft.com/viewtopic.php? ... sc&start=0
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

for the only code i could find where ai produce ships. look at trade.shipyard.xml

But its not what youll hope to see :P. it merely build ships randomly and send them to die quietly.

Return to “X Rebirth - Scripts and Modding”