Logo Platform
logo amplifiers simplified

AI Modding

Reply
Copied to clipboard!
12 years ago
Aug 18, 2012, 10:53:29 PM
Changes to the last version:



1. Removed AIParametersHero.xml because it did not actually do what I promised it would. The AI will generally use it's heros for both systems and fleets, switch that up during the game and has a way higher likelyhood to use them on fleets.

That's why I now made it distribute the hero-abilities to always be fleet-hero-alike utilizing AIParametersHeroAbility.xml I even actually tested it this time! smiley: wink



2. Taught the AI to design better ships using Support-Modules, Omni-Defenses and, depending on the Ship-Class, even armor.



3. Implemented a workaround to the bug, that the AI cannot deal with more tonnage. Miniaturization now makes all Ship-Modules smaller instead of increasing their capacity. There might be slight deviations for the intermediate-values but with all upgrades you will be able to fit the same amount on the ships. (a little bit more if you consider +tonnage modules)
BetterAI_1.1.zip
0Send private message
12 years ago
Aug 19, 2012, 12:26:51 AM
Has anyone found out why the AI keeps building and sending out so many scouts? I did not find anything that flags a scout for different AI-behaviour. But it certainly is there somewhere. The AI treats them differently, as it does with Colony-Ships aswell.



I feel the sheer amount of Scouts the AI produces gotta hurt it somewhere. I'd really like to make them stop it.
0Send private message
12 years ago
Aug 19, 2012, 12:35:34 AM
I've never noticed the AI going berserk with their scouts. Sure, they build more than a few, but they need to keep tabs on the others. I wouldn't worry about the upkeep costs hurting the AI because it gets a huge discount anyway.
0Send private message
12 years ago
Aug 19, 2012, 1:46:49 AM
Damn Ali, I was going to sit down tonight and redesign miniaturization to decrease weapon module weight, now I feel like I'm copying you. I was also planning on converting the tonnage modules over to % base too. Great minds think alike eh? How much % did you decrease modules by as it looks like all five of miniaturization decrease by same amount, I assume this means that each upgrade stacks with the previous one? hmm you use -10% per module, I'm rather surprised the value is that high.



Also what exactly do you mean by:



distribute the hero-abilities to always be fleet-hero-alike




From what I can tell, it indeeds reduces it by 10% each time, is that your intention? The effect is actually reduced each time the modifier is applied as it is 10% of the previous value. To be honest I'm not entirely sure what the idea amount would theoretically be, not that is wrong knocking off 10% each time.



Edit: After the first upgrade of 10%, the original hull starts pulling ahead, after the 5th the orignial design has pulled ahead by about 20 pounds roughly (or is my math wrong)





Therefore 10%, 11(.1111)%, 12.5%, 14(.2857)% & 16(.66666)%
0Send private message
12 years ago
Aug 19, 2012, 9:20:51 AM
@Insolentius: While they are not exactly "going berserk", they still invest a pretty remarkable amount into it. And it's not about the upkeep but the build-time they spent. Also the whole purpose of what I'm doing here is making it possible to reduce the Boni and still have a tough enemy.



@iblise: The original hull-upgrades are +10, +15, +20, +25 and +30% to the base-hull-size. This adds up to 100% for the last upgrade which exactly doubles the amount of stuff you can fit on a ship.

My approach is -10% to Module-Size per step. At step 5 they are at exactly half size of their original.

I think your confusion comes from the assumptions that these percentages are multiplied with eachother. I assumed that too and this is why in my 1st attempt reduced the Size by more 80% . But they indeed are just added up... or in this case substracted down.



I sat down and calculated the differences between the Mod and the original.

[CODE]

Step: Original: Mod:

1. 110% 111.11%

2. 125% 125%

3. 145% 142.86%

4. 170% 166.67%

5. 200% 200%

[/CODE]

As I said, it's pretty close but as you guessed, not exactly the same.



It is certainly possible to make it exactly the same but it would probably look rather strange to have a tech-descriptions where it says: -9.0909% Weight-Reduction ^^



What I mean by the hero-abilities: The AI uses all of it's heros for mixed purposes. But they tend to put them all on fleets rather than systems sooner or later. I first thought that can be changed by editing AIParametersHero.xml but this did not prove to be true.

Thing is they would eventually fly around with fleets having a high-level system-hero on them that has only system skills and doesn't help the fleet at all. So as a workaround to that, I at least ensured, that the AI always distributes the Hero-Abilities to support their fleets. This will mostly make their hybrid-heros much more usefull for them because those would mostly run 50:50 System/Fleet-Skills.
0Send private message
12 years ago
Aug 19, 2012, 9:52:06 AM
Hello Ail,



I cannot dl your file while I can dl file from other threads. Have you blocked it in some way?





Regards
0Send private message
12 years ago
Aug 19, 2012, 10:05:26 AM
Why would I do that? But I can tell, that I've been having troubles with downloading files here as well. It would tell me that I need to log in, when I was logged in and once I did that, I should do it again.

I think clearing the cache helped but I'm not really sure.
0Send private message
12 years ago
Aug 19, 2012, 10:29:14 AM
I am having the same issue. I will do as you advise. BTW do you know in which file I can change the lasers accuracy?
0Send private message
0Send private message
12 years ago
Aug 19, 2012, 12:32:49 PM
@davea: I have revised the StarSystemImprovement.xml and removed all the Industry gt 50 conditions. The AI already uses a built logic that prevents it from building stuff when it would take too long.

Don't know the threshoulds but it should block all but Industry2 anyways and for Industry2 requiring 50 Industry to me seems too much. I think it's fine to build on 30 Industry as it will mean a good boost anyways.



I will now list the things I'd like to debate about.



I suggest to add $(ClassStarSystem:Population) lt $(ClassStarSystem:MaxSystemPopulation) to any food-improvement. The AI will build these even there currently is no need for them and while it speeds things up once a new planet is explored or something is terraformed, it could still build it just then and not have it stand around doing nothing all the time. If possible I'd like to OR it with TechA31 which unlocks the food->industry stuff.

Does anyone know if I can check if a tech is researched?



StarSystemImprovementIndustry4 is the one that reduces the industry cost of buildings. I don't really feel it's worth it, considering how late it comes and how much upkeep it costs.



StarSystemImprovementMoney3 is the one that reduces buyout-cost. I feel that this is a building that makes sense to have exactly 1 time in your whole empire cause when buying ships, you can and will do that only on one system anyways. If there is any way to make it unique that would be great.



StarSystemImprovementMoney5 is the one that gives +15% money at a cost of 9. Obviously should require at least 60 money so it won't cost more than it helps.



StarSystemImprovementMoney6 gives 2 money/pop and buyout-bonus for 11. Should require 6 pop but I doubt a system with less than that would build it anyways because of the massive build-time a system that low should have.



StarSystemImprovementScience4 and 6 same as Money5 pretty much.



On the Approval-Buildings you added !($(StarSystemApprovalStatusEcstatic)). While it seems to make sense, I'm not sure if I agree with that. The reason is that the AI will adjust it's tax-rate depending on how their Approval looks like. So if they could get another Approval-Building they might increase their tax-rate and still be ecstatic. With the limitiation they might not increase their tax in order to stay ecstatic.



Defense: I think you suggested it yourself. Use $(ClassStarSystem:StarSystemStatusBlocus) instead or in addition to the Pop-Limit.



Ship-Improvements: Well, if a system does not build buildings, it will most likely be building ships. And I don't see that preventing them to build these for other reasons than having a massive build-time would not help as it would make their ships worse.



Information/Influence: Without a way to check if an increase in Influence would actually cover up other systems, I agree to prevent the AI from ever building those is a good thing. On the other hand the 1st one can be really helpful during cold-war phase in the beginning to prevent enemies from reinforcing their Influenceless colonies. Still think that without any chance to know if it will get another system in the radius it is saver to just neglect it.
0Send private message
12 years ago
Aug 19, 2012, 3:03:38 PM
Hi all,



I have scouted this thread and every post.

I understood that what you are doing is:



1. Increasing our knowledge of accessible formulas, game values, that could fit into the various AIParameters fields.

2. Then tweaking & testing,to give priorities to various vanilla techs and buildings; that is, tweaking priorities.





I think you have exchanged well about the various leads and are on the process of fixing a few things.

My "but" is that, it shouldn't be the "AI" we would like to have", since we are modders here and will surely end up with various mods and techs.

As such, the tweaked values could still be "an example" to base/clone our own buildings and techs from, but this AI will surely have defects, and maybe enormous ones; it may be broken in a cut/paste without the modder knowing about it, and another wave of AI modders should then come to "tweak again".



The advantage we have is that the current (vanilla) AI can easily be exploited, so we could think it would only go to improve.

But we cannot be sure of it. Every AI modders ends with another context to test and unless the bug is obvious, it's hard to know if things go better.

So to be careful, you only tweak a slight thing at a time, meaning if you hardly notice a difference, at least you don't feel like having broken things.





My point is:

My way of coding AIs is to think of them as humans; robots charged with the tasked of not only playing like a human would, but "being" human.

This means that mistakes are still possible - they are not really playing chess - but this also means fixing not only some "stupid things" an AI could do, but also fixing some kind of behaviour, like retaliating to a player (avoiding the easy diplomatic exploits we have at our disposal), having its grand plan and being able to change it if it sees another player is nearly fulfilling victory, etc.



Being able to change stance, and so on.

According to this plan, this would need to extend knowledge not only on formulas, but also "events".





An example:

I know we can add values and attributes to the Empire and Star Systems. These values could be used as new AIParameters.

This is the way you can strengthen the AI ways more.



But how many dynamic triggers do we have an access to?

I would like to know if someone has "mapped" the various formulas, the various triggers.

I need your help in having a "dictionary" of sorts... that will be useful to all of us.

Of the "generic" triggers and dynamic values we can access via XML, not anything about the current techs or vanilla buildings.



I know we can add anything like a trait or a tech, that could modify anything like an imperial specific value, that the AI could use later on.

I think this really is the path of not only tweaking, but having a more dynamic AI, able to surprise us and not only be tweaked for vanilla but also for our mods.





That could mean two projects, one to tweak for vanilla, and the other to build a dynamic AI more able to impress us ingame.

This needs deep understanding or our available options, attributes, formulas and values, and I would encourage a mapping of them in a clear document of sorts.
0Send private message
12 years ago
Aug 19, 2012, 3:06:39 PM
Ail wrote:
@davea: I have revised the StarSystemImprovement.xml and removed all the Industry gt 50 conditions. The AI already uses a built logic that prevents it from building stuff when it would take too long.




The main reason for this is that some of the cheap shipbuilding stuff, such as hardened frames, seems to get built even on tiny systems or early systems. By putting this condition, I was forcing the AI to wait until/if the system was further developed. I think this works pretty well.



I suggest to add $(ClassStarSystem:Population) lt $(ClassStarSystem:MaxSystemPopulation) to any food-improvement.


That seems fine, although I am not sure it will help much. Systems seem to spend most of their time with pop just a little bit less than pop cap, since the AI will usually open a new planet as soon as pop reaches pop cap.



Does anyone know if I can check if a tech is researched?


Don't know.



StarSystemImprovementMoney3 is the one that reduces buyout-cost. I feel that this is a building that makes sense to have exactly 1 time in your whole empire cause when buying ships, you can and will do that only on one system anyways. If there is any way to make it unique that would be great.


The buyout building is late game, so I don't build it much. But when I have battles on two fronts which are widely separated, I perform the buyout at a planet which is near the front. Even if it is a small world, it saves travel time. So I would not be in favor of making this unique.



Although, as a tangent, I like the idea of the Civilization IV/V series which has "national wonders" and "world wonders". As you may know, national wonders can be built once for each civ, and world wonders can only be built once per game. There is also a limit on the number of wonders you can have in one city. This gives individual cities a little more personality, which is completely lacking in ES. If there is a way to make a building into a national/world wonder, that would be great. We can add personality buildings easily.



StarSystemImprovementMoney5 is the one that gives +15% money at a cost of 9. Obviously should require at least 60 money so it won't cost more than it helps.




A lot of buildings require a calculation of tax rate or trade bonus, etc to determine if they are worthwhile. Xenotourism is the easiest example. I am not sure we should code these equations. I think something like "pop > 10" is simple, and close enough. This at least prevents from being built when a system is just starting to grow.



On the Approval-Buildings you added !($(StarSystemApprovalStatusEcstatic)). While it seems to make sense, I'm not sure if I agree with that. The reason is that the AI will adjust it's tax-rate depending on how their Approval looks like. So if they could get another Approval-Building they might increase their tax-rate and still be ecstatic. With the limitiation they might not increase their tax in order to stay ecstatic.


As with many other changes this was to prevent building them early, when the system is already ecstatic. Maybe a general purpose "pop > 10" is better; I am not sure.



Defense: I think you suggested it yourself. Use $(ClassStarSystem:StarSystemStatusBlocus) instead or in addition to the Pop-Limit.


I did not know at the time that this worked. I would prefer to build these on "front line" systems and not "deep interior" systems. I would prefer to avoid building them at all unless there is an active war or systems (outposts) have been lost. But I don't think we can mod either of those tests.



EDIT: protip for testing these changes. Maybe you already knew. If you start an 8-player game and just press "next turn" like 80 times, it takes < 10 minutes. I read a magazine in parallel. Then jailbreak and look at the AI colony worlds. The order in which the improvements show up on screen is the order in which the AI built them. I was very bothered to see buildings like hardened frames or defense buildings show up early. The AI is much better off to build farms, industry, etc early. So a lot of my rules were to prevent these buildings from coming early. If you change the rules, that is of course fine, but please do look at the early build order to see if it seems reasonable.



EDIT2: I have also tried out grubsnik's changes to starsystemimprovements.xml which remove completely useless buildings from the new building picklist. I like it. It is a little painful to merge his changes into mine. If possible, can you merge his changes into your starsystemimprovements.xml? That way, I can just copy your file instead of remerging.
0Send private message
12 years ago
Aug 19, 2012, 3:10:59 PM
Ail wrote:
Ok, I'm uploading what I've done so far. Contents:

Teaches the AI to increase their pop-growth by always using the food-exploit for all planets in systems below maximum-population.


I have played through a long game with this. I am not sure it is possible, but I want to suggest something different. I had conquered a number of AI worlds in the mid-late game and I was surprised to find they had every planet on food exploit. In retrospect, it is doing exactly what you said. If there is even one planet which is one pop below its pop cap, then every exploit is food.



I rarely put more than 1-2 planets on food exploit, and I put the rest on industry as long as there is anything to build. I would rather have industry to build the latest farm building or happiness building, rather than a little more food. Is it possible to adjust this rule, so that a max of 1-2 planets (with the highest current food value) are put on food, and the rest on industry?
0Send private message
12 years ago
Aug 19, 2012, 3:18:56 PM
Hi davea, your two last posts crossed (or buried) mine! smiley: wink





I have played through a long game with this. I am not sure it is possible, but I want to suggest something different. I had conquered a number of AI worlds in the mid-late game and I was surprised to find they had every planet on food exploit. In retrospect, it is doing exactly what you said. If there is even one planet which is one pop below its pop cap, then every exploit is food.




I may say a "beginner" or false thing here, but everytime we capture an AI system, the exploitation seems to end up broken of sorts.

This is because it is possible you do not have access to its specific exploitation tech, and end up with it "defaulted" to something else instead compatible with your own techs.



I don't know if this sounds compatible with your own observations or if I am wrong on this, so please tell me if you have positively investigated this matter and had a result about it.

I never unstood why the AI ended up with all this Atemporal Finance on all planets, or anything overly ineffective.
0Send private message
12 years ago
Aug 19, 2012, 3:32:00 PM
Telpar29 wrote:
But how many dynamic triggers do we have an access to?


Sorry to cut your quote to only one line. But this is the key point. There is almost nothing in the way of dynamic triggers today. We can tweak xml values, but that is pretty much it.
0Send private message
12 years ago
Aug 19, 2012, 3:37:51 PM
Telpar29 wrote:
I may say a "beginner" or false thing here, but everytime we capture an AI system, the exploitation seems to end up broken of sorts. This is because it is possible you do not have access to its specific exploitation tech, and end up with it "defaulted" to something else instead compatible with your own techs. ... I never unstood why the AI ended up with all this Atemporal Finance on all planets, or anything overly ineffective.


Good point. There are two separate issues here. The first one is when a player of one race (AI or human) builds a race specific building, and then a player of another race (again AI or human) captures it. For example, you play UE and you capture a craver system which has their locust-reducing building. What should happen? Should the building be left there, or destroyed, or converted to the non-race-specific building? I don't think the game "knows" which is the "generic" or non-race-specific building for a given race-specific building. I am pretty sure there are examples where there is no generic building, or certainly a modder could easily create one. I am pretty sure in all cases, the game just leaves the race-specific building there. This is probably a bug which the dev team would have to fix.



The second issue is the selection of exploits such as atemporal finance. Any human or AI player may choose the exploits for a system differently. If I am playing UE and using a lot of retrofit/buyout, I will take a lot of my secondary planets and put them all on atemporal finance. I think the AI does this as well. I am not sure if there is a "bug" or any "tuning" which can be done; choosing dust exploits may be reasonable when the AI owns the system, but you may want different exploits. I do feel that for growing systems, you should have 1-2 food exploits and the rest industry; but each player (and the dev team) may have a different idea here.
0Send private message
12 years ago
Aug 19, 2012, 3:39:37 PM
Heh teach me to look at code when I'm beat after pulling a 12 hr day in the field. I could have sworn last night that it when 10% tonnage increas each time. Looked at it this morning and it's as you said. My bad heh



Would the tech perquisite handle be what your after regarding research. It's not a check exactly but might be a passable work around
0Send private message
12 years ago
Aug 19, 2012, 3:47:55 PM
Sorry to cut your quote to only one line. But this is the key point. There is almost nothing in the way of dynamic triggers today. We can tweak xml values, but that is pretty much it.




That is about true but not accurately true. I mean that we are not able to trigger 'both ways' in most cases.

Let me explain myself smiley: smile





AI Player A discovers a technology. This technology modifies one of the new Empire custom values (like EmpireMissileDefense, "My new missile defense level is 7") and another (like NewWeaponTechs, "I have +1 new armement tech"). This part can be done.

A priority can also receive a dynamic value instead of a set one.

If we happen to find how AI prioritize retrofitting when compared to another action, we could fit this number of "NewWeaponTechs" factored somewhere in the formula calculating this priority.

And we'll have optimized this a little bit.



Another example of dynamic values we have access to are maximum "current" population of star system, current population of star system, etc as was mentioned before.





What you say is also true in that we are lacking "triggers", ways to active some script.

We still have some - the only triggers we have so far, as I can see "for now" with my limited knowledge of all the files and values is that :

- Dynamic context: the AI discovers a tech; we can modify values with that.

- Adaptative values: current population, etc, various dynamic attributes that are set from "current" context instead of a set one.

- But do we have other dynamic contexts? AI colonizes, AI loses a battle, AI wins a battle.. ? and so on.



When I was saying we cannot trigger "both ways" is that we cannot launch an accurate action; but if we base our AIParameters on dynamic values, that are modified by the dynamic contexts we have available, we can go much further.

That is the "grand AI plan" I am supporting.

What do you think about it?





EDIT : But maybe what I am suggesting is just too long a plan... considering our current manpower.
0Send private message
12 years ago
Aug 19, 2012, 5:20:33 PM
Telpar29 wrote:
but if we base our AIParameters on dynamic values, that are modified by the dynamic contexts we have available, we can go much further. That is the "grand AI plan" I am supporting. What do you think about it?


It is a great idea. I hope the dev team will add this type of trigger. If you can find any triggers, please let us know.
0Send private message
12 years ago
Aug 19, 2012, 6:06:20 PM
Telpar29 wrote:


I may say a "beginner" or false thing here, but everytime we capture an AI system, the exploitation seems to end up broken of sorts.

This is because it is possible you do not have access to its specific exploitation tech, and end up with it "defaulted" to something else instead compatible with your own techs.



I don't know if this sounds compatible with your own observations or if I am wrong on this, so please tell me if you have positively investigated this matter and had a result about it.

I never unstood why the AI ended up with all this Atemporal Finance on all planets, or anything overly ineffective.


His observations are with my mod-changes, your's are with the default game. So of course what you see will differ from what he sees.



Thanks for the hint about the building order, davea. This information will come in very handy when testing and analyzing some of the changes I'm going to try.
0Send private message
?

Click here to login

Reply
Comment