Author Topic: AI improvement  (Read 2804 times)

0 Members and 1 Guest are viewing this topic.

AI improvement
« on: August 10, 2020, 06:08:31 PM »
Dedicated topic for generic AI improvement. I plan to implement it in WTP mod but, as usual, could be used by anybody.

AI improvement is endless topic. There is no plan to solve any particular problem right away here. Rather just collect some intelligence that helps us steering one way or another.

The two biggest problem with AI improvement is that is it:
a) is very time consuming which is obvious for anyone who ever tried to something like that in production.
b) is uncertain. Each change can be implemented in many ways, there is no clarity whether some particular change is actually good one, a lot of play testing is required.

The a) above is why I generally try to avoid or minimize this work. However, it seems that Thinker + WTP is not challenging enough. Meaning that as in vanilla it is easy to learn AI patterns and exploit them.

Fortunately, AI is allowed to cheat heavily as long as it is not perceived unfair to human player. There are a lot of corners could be cut by cheating and this is good as there is no need to implement some complex algorithms for everything. There is no need to make AI actually to think as human in every aspect.

Therefore, the first question is whether it makes sense to just increase amount of cheating AI already has to elevate challenge? For example, currently human growth and production cost factor is 10 and AI's one is 7 at toughest difficulty. Would it make sense to increase this gap even more?  Lowering cost factor for AI has it's limitation. It is risky to go below 5-6 probably. We can just increase human cost factor instead up to 11-12 or something. Clearly, this is a very stupid bonus that doesn't make AI appear in any way smarter, just stronger. So it is still possible to outgrow it just takes longer. We should not discard it outright because it is how it was made in vanilla and it seemed to worked to some extent so far. The great benefit of this approach is it's implementation ease. It is already in thinker.ini. Please share your opinion on that.

Another approach is to take it slowly - one modification at a time. Like the one I did in my previous versions:
# Version 94
* AI tries to kill spore launcher near their bases.
It seems like a exceptionally valid approach for fun made mod format when nobody has lots of time to spend on it. It also has a great value since it is naturally easy to understand what AI does wrong in their patterns. Like when player feels it doesn't counterattack them much and that allows them to assault bases easier. Then we can tune this particular behavior and give user an impression that something changed to the better! 😂

I recall one my first experience with Thinker when I was moving my severely damaged worm to reinforce my base assault forces and I was about to heal it on the monolith along the way that was sticking out of the ground about 6 tiles away from that enemy base. And before I could heal it that same enemy base dispatched a unity chopper and killed my worm. I was shocked to the level I needed some time to accept and process such villainy. That probably was one of the things that kept me going with Thinker and later build my own on top of it.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: AI improvement
« Reply #1 on: August 10, 2020, 06:46:52 PM »
When attacking AI problems, I believe in attacking low hanging fruit first.  This is why I've spent 2 1/3 years working on SMACX AI Growth mod, and have never hacked the binary at all.  Iteration is the devil.  The game is like a fine woven mesh where when you pull one string, other things happen.  Only ongoing playtesting makes it clear to the designer, what specifically needs to be fixed.

The AI running itself out of SUPPORT, was the severest problem clearly needing to be fixed.  I managed to mitigate it with a combo of changing the SE choices, removing faction penalties, making Clean Reactor available from turn 1, and making a number of predefined units.  It took a lot of iterations to determine what predefined units the AI would and wouldn't build in practice, and what units were and weren't helpful.  In particular, units that were helpful earlier in the game, became liabilities later in the game.  Mainly because they were still Fission units in a Fusion era.

If I were a binary modder, I'd be using Scient's patch to make predefined units with different reactors in different eras.  I'd also go into the code itself, find the place where the AI is making stupid decisions about SUPPORT, and fix it.  It would clearly have a big payoff for the game, and would obviate the need for my Clean Reactor hack.  But hey, I got the job mostly done without any binary modding at all.  That's the principle of low hanging fruit.

I don't believe in giving AIs more resources and no more intelligence.  I've played dozens of games like that over the years, and my conclusion is that approach sucks.  It's what frustrated programmers do because they don't know what to do, and don't want to spend the effort on a real solution.  I agree that the latter is hard, and the only "high hanging fruit" approach I'm ever personally going to take, is to make a brand new commercial game that I sell and get paid for.  Because the problem is that hard, and I've wasted my life on plenty of hard technical problems in the past, that I never got paid a dime for.  At some point, an endeavor has no basic sustainability, and can make you 50 years old before you know it.  While living out of a car, lol.  Don't do it.

So my advice is: identify a clear and obvious problem.  Fix it.  Iterate and test.  Don't be in a hurry to screw with things.  See what the results are like in the field.

There's also an important demographic question: hard to who?  I got into an acerbic argument with someone on r/alphacentauri the other day.  I was shocked that after playing the stock game for 15 years, they were still challenged by it.  WTF?  My lines of inquiry, insulted their intelligence, and they weren't terribly forthcoming about how they actually play the game.  I accused them of being a "sandboxer", someone who actually isn't interested in winning the game or doing especially well at it, but just likes to move all the terraforming toys around and so forth.  I actually didn't elaborate on that, but that's what I meant.  There are people who play games, and there are people who play with software toys.  I think I ran into one of the latter, but at this point, I can't prove it, because I pissed them off.  This person completely violated my expectations as a designer, that an experienced player "needs more challenge".  Well that's not true for somebody out there.

So do I need more challenge?  And what challenge do I need?

I'm not kicking the snot out of SMACX AI Growth mod lately.  I mean, I always will win if I persist, but I definitely have to exert effort and am not chewing the game up immediately.  Is that good enough for a lot of players in the real world out there?  I have no real data on this.  I get anecdotal responses from a few people that yes, I have improved the challenge level of the game and it is now less stale for them.  Is that good enough?  What would make me think it is not good enough, especially since I'm not getting paid to do any of this?

I continue to play the game and have not completely lost interest in it.  This is remarkable.  I feel like there's something I still want to know about what's going on.  I also seriously doubt there's anything better out there.  I believe I'd have to make it, and I haven't managed that yet.  I'm in a sort of never-ending "pre-development contemplation" on that.

I wonder if my play style bias, makes SMACX AI Growth mod seem harder to me than it really is.  I'm waiting to get the field report from someone, where they blew through the game like it was standing still.  Considering the number of exploit loopholes I've closed, like well, all of the stuff Thinker Mod loves so much, who knows maybe my mod is not cakewalkable now?  But I don't really know.  Not enough field reports.

Re: AI improvement
« Reply #2 on: August 10, 2020, 07:25:42 PM »
I don't think the exact level of toughness matter. That is why there are difficulty levels so everybody can find their own comfortable level. Our AI improvement efforts are irrelevant for those not yet reached the toughest level. It does for others. We will just extend the toughest level to be tougher while everybody will still find their comfortable niche between very easy and very hard.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: AI improvement
« Reply #3 on: August 10, 2020, 08:17:22 PM »
But how many people need AI stronger than Transcend?  You do, I do, Induktio does... I just don't have a lot of information from players in the field, of what they think's wrong with the game.  Not all of my modding has been directed towards AI improvement, it has also been directed at "irritances".  I've smoothed out what I could.  That seems to have been noticed by some people.

The game industry in general has a problem that "better AI" is difficult to monetize.  There don't seem to be enough paying customers to justify the effort.

One can do anything one wants as a matter of personal ambition.  But there's a point at which it's not sustainable anymore.  Hence it is wise to pursue "low hanging fruit".

Re: AI improvement
« Reply #4 on: August 10, 2020, 08:40:08 PM »
Err, everybody on this forum? 😉
The same exact people are giving me pointers about what is wrong with AI including you. I've already collected a huge amount of them. Some small number even implemented already. I agree that when this forum dies my mod will die with it. I'll switch doing something else.

Update. The mod will die it terms of continuous development. I will still enjoy playing it myself.

Offline Nevill

Re: AI improvement
« Reply #5 on: August 11, 2020, 10:02:14 AM »
Less philosophizing, more reporting.  ::)
Another approach is to take it slowly - one modification at a time. Like the one I did in my previous versions:
# Version 94
* AI tries to kill spore launcher near their bases.
It seems like a exceptionally valid approach for fun made mod format when nobody has lots of time to spend on it. It also has a great value since it is naturally easy to understand what AI does wrong in their patterns.
1) AI doesn't protect its bases enough. By which I mean a secret project base in the 2200s can be defended by a lone Synthmetal garrison. During a vendetta. On an exposed frontier base.

You can stack defensive bonuses however high you want, but you can't multiply 2-3 armor by enough modifiers to pose a challenge when there are 10+ weapons in play.

Possible solution: teach AI how to upgrade units, or reevaluate its defences once every few years, especially on bases that warrant such an approach (frontier bases, developed bases, Secret Project sites). I read that some code is already in place to make them evaluate how much the base needs protection, but it clearly isn't working too well.

2) AI tends to waste their support minerals on by building useless units. Gaians protecting their bases with scout patrols that crumple like a house of cards, Miriam building a bunch of synthmetal defenders and never touching them again for the next 50 years, checking off some "I have protection" checkbox that doesn't really apply. They just eat minerals and contribute nothing.

Possible Solution: teach AI to build clean units; make Clean Reactor available early and free/cheap for purely defensive units. It would still take an ability slot.

3) AI is poor at handling drones; doesn't know how to use Police well. You can observe it by giving an AI faction a -TALENT debuff, or free Genejacks, and watch it choke as it can't handle the first citizen being a drone, even if a unit inside the base would fix that.

4) AI is very poor at using air units that aren't suicide bombers (rockets). I don't know how to fix that. For some reason they really prefer Interceptors over regular units, even when those have a -50% debuff.

5) AI builds lots of transports and then... makes them just sit there on bases? What is up with that? Pre-thinker AI had some kind of bug that made them build a ridiculous amount of transports they didn't use.

6) AI research is very uneven. They do well in the early game up until tiers 4-5, and then forget to prioritize energy, have nothing to work with as a result, and research a new tech once every 30 years (not helped by them favoring Fundie when they are at war, and they go to war ALL THE TIME). Trying to fix that by lowering techcosts for AIs results in Zakharov getting ridiculous, as his Network Nodes, SE choices and already reduced techcosts make him an outlier that is the only one who can compete with the player. I've read that the code has AI put different priorities on resources at different stages of the game, but I think a focus on energy needs to happen sooner.

I've tried a few games in the scenario editor where I gave AI factions free orbital transmitters, resulting in them getting more energy the further the game got. The boost was a bit too much, but it was the only thing I could think of when they just wouldn't farm energy by themselves.

Re: AI improvement
« Reply #6 on: August 11, 2020, 06:26:15 PM »
Thank you, man. You are, as always, the practical one.

1) AI doesn't protect its bases enough.

That is a well known one. Unfortunately, not an isolated fix. As you said it requires evaluation tuning.

2) AI tends to waste their support minerals on by building useless units.

Possible Solution: teach AI to build clean units; make Clean Reactor available early and free/cheap for purely defensive units. It would still take an ability slot.

I wouldn't say they are 100% useless just less useful than other possible alternatives. Same thing here: evaluation tuning.

Clean reactor solution is more of a cheat to make existing AI performing better, not AI enhancement by itself. Plausible solution but it doesn't change situation drastically - doesn't make AI smarter.

3) AI is poor at handling drones; doesn't know how to use Police well. You can observe it by giving an AI faction a -TALENT debuff, or free Genejacks, and watch it choke as it can't handle the first citizen being a drone, even if a unit inside the base would fix that.

Interesting. Cannot say anything on that as I didn't observe it myself. Is this for the first citizen only or for any drones in any base size? Does AI completely ignore drone facilities?

4) AI is very poor at using air units that aren't suicide bombers (rockets). I don't know how to fix that. For some reason they really prefer Interceptors over regular units, even when those have a -50% debuff.

Really? What is this "prefer" percentage in practice? I never noticed this myself. I guess one can get this perception because in vanilla AI tends to place air assaulters next to front line (for obvious reason) and they quite often die on runways due to enemy massive air strikes. So they are left with bunch of interceptors those are capable to defend themselves even on a runway and don't easily lose to air assault.

5) AI builds lots of transports and then... makes them just sit there on bases? What is up with that? Pre-thinker AI had some kind of bug that made them build a ridiculous amount of transports they didn't use.

That I've noticed too. Although, I am not sure if this is vanilla or Thinker as it overrides all unit movement.

6) AI research is very uneven. They do well in the early game up until tiers 4-5, and then forget to prioritize energy, have nothing to work with as a result, and research a new tech once every 30 years (not helped by them favoring Fundie when they are at war, and they go to war ALL THE TIME). Trying to fix that by lowering techcosts for AIs results in Zakharov getting ridiculous, as his Network Nodes, SE choices and already reduced techcosts make him an outlier that is the only one who can compete with the player. I've read that the code has AI put different priorities on resources at different stages of the game, but I think a focus on energy needs to happen sooner.

This is quite a compounded problem and I am not sure the wrong research priorities are even part of it. AI does not change their research priorities!
In WTP AI tech cost is lower on higher difficulties. And AI terraforms like crazy - a lot of boreholes and mirrors. I don't think they are behind in the energy intake with similar number of bases. Need some example play tests to illustrate this problem.
I also don't remember overtaking AI (at least by much) in technologies. Meaning any developed enough faction regardless of their RESEARCH inclination.
You can also see yourself overtaking them due to your exemplary play skill. Which is fine but don't constitute an inherent AI flaw that we can target.

Offline dino

Re: AI improvement
« Reply #7 on: August 11, 2020, 11:22:59 PM »
Remember how you increased native life activity, so the player is forced to waste some more minerals on production and support of units in the early game ?

This kind of pressure should be extended to the whole game, player can safely play builder game with almost no army until he is ready to take on AI.
All it takes to buy few dozens of turns to prepare for a war with threatening AI, while heaving no army is to avoid contact and appease them with few techs.

My idea:
1) Calculate ratios of military power score ( probably the score used to determine mil ranking on the info screen would be fine ) of player vs all AI factions.
2) If the score ratio is higher than 3:1, AI is neighbouring the player and is not in pact, it should immidiately pronounce vendetta.
3) If in vendetta, any diplomacy should be refused by the AI until the ratio drops to 2:1, once it drops to 2:1 this feature should stop overriding diplomacy code.

The ratio that makes AI attack unconditionally could be adjustable in the ini file.

Some modifiers could also be used, for example:
+1 , 0 , -0.5 based on ai_fight (1,0,-1),
-0.5 if player runs ideologicaly opposite policy,
+1 if player runs ideologically compatible policy,
+0.5 if peace treaty,

This way the player wouldn't be allowed to buildup for 100 turns with no army, while AIs are wasting resources on units production and support.

Offline EmpathCrawler

Re: AI improvement
« Reply #8 on: August 11, 2020, 11:59:27 PM »
I agree with bvanevery that support mismanagement is a big problem for the AI. It's probably why that particular support system was abandoned in later Civ games. If they could understand to disband fission synthmetal sentinels clogging their bases it would be a big improvement.


Another big one is diplomacy, which induktio has touched upon a while ago. The AI is far too ideological and aggressive. A tiny faction should not declare suicidal vendettas because of social engineering disagreements, nor should a single faction be allowed to soar ahead on the power graph without the others putting aside their differences and forming a coalition.


Pessimistically I'm not sure if there's a point in trying to squeeze out a lot of AI performance due to crawlers. A human is always going to exploit crawlers far more efficiently than the AI. Once you hit Industrial Automation, there isn't much the AI can do about it if you go nuts.

Re: AI improvement
« Reply #9 on: August 12, 2020, 01:01:19 AM »
I agree that AI vendetta timing is even more appalling than its combat tactics. There is lots and lots of tuning to do. I disagree, though, with some rigid simple parameters. They constitute an easy learnable pattern that human can recognize and exploit. That just replaces vanilla pattern with different one.

I have in mind some flexible response that is beneficial to AI and less player centrist. Meaning it should attack as soon as it sees benefits of it taking everything into account: own allies, opponent allies, economical/technical/military advantage, faction bonuses, available SE, etc. I don't think I will be able to implement this all at once but maybe by adding each factor one by one.

Some things I have in mind:

Evaluate comparative strength every turn. Mostly as you proposed but accounting for as many things as possible: pacts, technologies, economics, faction bonuses. Again, most likely one thing at a time.

Production priorities, of course. Emphasizing on units if needed.

Place combat units smart even at peace time. Meaning more on a border. Also both defenders and attackers.

Attack neighbor if they are significantly weaker. Otherwise strengthen borders, make pact with other factions. Stop useless wars.

Re: AI improvement
« Reply #10 on: August 12, 2020, 01:05:15 AM »
Another big one is diplomacy, which induktio has touched upon a while ago. The AI is far too ideological and aggressive. A tiny faction should not declare suicidal vendettas because of social engineering disagreements, nor should a single faction be allowed to soar ahead on the power graph without the others putting aside their differences and forming a coalition.

There is an optimal behavior and there is purposefully imbalanced one to emphasize AI leader personalities. I think it worth keeping SE preferences as is just mix it out with more practical things like comparable military strength as well. Otherwise, if we optimize AI completely we will lost the lore of leader personalities.

Offline dino

Re: AI improvement
« Reply #11 on: August 12, 2020, 04:45:25 AM »
> I disagree, though, with some rigid simple parameters.

Even if it was predictable it would force the player into dedicating resources into defence and slow his development significantly.
I've only proposed the lowest possible effort version, if you would want to put more work and naunce into it, it's of course only for the better.
The bottom line is, the player shouldn't be allowed to play pure builder game unperturbed, the weakness should be exploited.

Offline Nevill

Re: AI improvement
« Reply #12 on: August 12, 2020, 08:08:55 AM »
Quote
Clean reactor solution is more of a cheat to make existing AI performing better, not AI enhancement by itself. Plausible solution but it doesn't change situation drastically - doesn't make AI smarter.
AI can't deal with SUPPORT. It has cheat-tier INDUSTRY to compensate for it though, but not even churning units 50% faster than a player can help it if it has no minerals to build with. Ultimately, it's a quick hack to enable already existing hacks to work properly.

Trying to make AI rehome units to less-strained bases would just lead to lots of pointless movements, and it will never learn using "military bases" that exist solely for the purpose of support to free other bases from it. In fact, if it ever tries to use them, it can be exploited by the players by creating support overload and causing units to disband.

(also, I hate the disband mechanics with a passion... after capturing a base its units are assigned to the nearest bases, which could cause one to lose an army without a fight by losing several bases those units were assigned to. They get reassigned to other bases that can't support them, and then disband at the beginning of the turn, without the player's input)

Quote
Interesting. Cannot say anything on that as I didn't observe it myself. Is this for the first citizen only or for any drones in any base size? Does AI completely ignore drone facilities?
This is an illustration. The first citizen could be easily suppressed by a police unit, allowing them to build a more permanent arrangement. They go for building RecCommons on a base that riots half the time instead, and turn its sole worker into a Doctor.

Any use of Police is completely incidental. They never switch to gathering energy on purpose to put into Psych, preferring to brute force the problem with specialists. Most drone control is done via direct suppression facilities (RecCommont, Holo Tanks) and basic specialists for when they are not enough.

Quote
Really? What is this "prefer" percentage in practice?
I barely see regular aircraft built... or used when they do build them. The <SAM> units are more common.

Quote
This is quite a compounded problem and I am not sure the wrong research priorities are even part of it. AI does not change their research priorities!
Not research priorities, but resource gathering priorities. I've read the AI prioritizes nutrients in the beginning, minerals towards midgame, and energy in the lategame, though I obviously didn't look at the code to verify that.

Offline EmpathCrawler

Re: AI improvement
« Reply #13 on: August 12, 2020, 01:13:56 PM »
Another big one is diplomacy, which induktio has touched upon a while ago. The AI is far too ideological and aggressive. A tiny faction should not declare suicidal vendettas because of social engineering disagreements, nor should a single faction be allowed to soar ahead on the power graph without the others putting aside their differences and forming a coalition.

There is an optimal behavior and there is purposefully imbalanced one to emphasize AI leader personalities. I think it worth keeping SE preferences as is just mix it out with more practical things like comparable military strength as well. Otherwise, if we optimize AI completely we will lost the lore of leader personalities.


They should keep their personality, but they should also recognize that the fate of their ideology is at stake if they take absurd risks.

I wonder if the AI is getting compelled to interact with the players and other factions when their units encounter each other. That seems to be a trigger. If I'm an AI Gaian and I have 2 bases next door to a sprawling human Morgan, it makes more sense for me to refuse to communicate with Morgan at every chance but try to communicate with Morgan's enemies and suck up to them. It would force the human to take a reputation hit by attacking me if they really want me gone.

Offline EmpathCrawler

Re: AI improvement
« Reply #14 on: August 12, 2020, 01:15:03 PM »

(also, I hate the disband mechanics with a passion... after capturing a base its units are assigned to the nearest bases, which could cause one to lose an army without a fight by losing several bases those units were assigned to. They get reassigned to other bases that can't support them, and then disband at the beginning of the turn, without the player's input)



Love it when my "ally" gifts me a ton of impact rovers during one turn and then my support gets completely [messed up - or loved very much] at whatever base they were nearest to.  ::)

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

Some would ask, how could a perfect God create a universe filled with so much that is evil. They have missed a greater conundrum: why would a perfect God create a universe at all?
~Sister Miriam Godwinson 'But for the Grace of God'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 38.

[Show Queries]