Req: Longer build sequences

General discussion related to the game goes here.

Moderators: Balthagor, Moderators

Post Reply
User avatar
Zuikaku
General
Posts: 2394
Joined: Feb 10 2012
Human: Yes

Req: Longer build sequences

Post by Zuikaku »

The build sequences which AI uses for building units are stored in AIParams file. Every build sequence consists of 16 elements/instructions which AI executes one after another.

In my experience these sequences are too short and thus cause some serious problems in longer games. Naval build sequences tend to cause most serious problems. As naval sequence is only 16 instructions long, if we minimize battleship production to only one per sequence we end up with 1/16 of AI fleet consisting of battleships. That sole situation is very unhistoricall since there were minimum 30-60 lighter units produced per one battleship. But that's not the main problem. The problems start to multiply in longer games. battleships have build times 3-6 times more than other lighter units (which is correct). Since light units are built faster, their places in que are steadily replaced by BBs. After a while all of shipyard capacities are reserved for BB production. And since BB production is MG costly this drains MGs to zero very quickly and this hampers unit supply, unit building and unit repair. If AI is at war and there are damaged BBs to repair as well MG situation becomes unresolvable for AI. Add to that carrier production and problems are onl becoming worse. And we are talking here about minimal production of 1CV and 1 BB per build sequence.

The elegant solution is to remove BBs and CVs from build sequence but that creates another problems.

My suggestion is to increase build sequences to 32 at least in order to achieve more optimal AI fleet composition and reduce drain of MGs as the game progresses.

Question to the devs:
1. Can AI handle longer build sequences if we just add more instructions over original 16 or will there be an error in that case?
2. If above is not possible can you modify engine to support longer build sequnces?
Please teach AI everything!
User avatar
George Geczy
General
Posts: 2688
Joined: Jun 04 2002
Location: BattleGoat Studios
Contact:

Re: Req: Longer build sequences

Post by George Geczy »

Thanks for the suggestions on this. I was actually just working on this recently because in GR we make more use of specialties (engineering, colonization, survey, etc) and so it was getting harder to make sure that the queue's were filled with units that had a variety of these special elements. We've added additional support for more specialties (beyond just the "mobile unit", "missile carrier", and "engineering" that SRU supported), but even that is a bit hacky.

For GR and SRNG I've added more random consideration to look at specialties, but that doesn't solve any of the problem you're calling out above.

The build sequence length of 16 is currently hard wired, so it is not possible to mod an increase on that for SRU. Anything past 16 entries is ignored. But for SRNG (and GR) we can certainly work to improve this. The current system has become increasingly unwieldy and inflexible, and it's worse in GR where we reduced the number of unit classes.

Time to give this some more thought.
User avatar
Zuikaku
General
Posts: 2394
Joined: Feb 10 2012
Human: Yes

Re: Req: Longer build sequences

Post by Zuikaku »

I was hoping that the engine won't ignore entries above 16 and it will all be painless and easy.

Thanks for clarifying this.
Please teach AI everything!
User avatar
George Geczy
General
Posts: 2688
Joined: Jun 04 2002
Location: BattleGoat Studios
Contact:

Re: Req: Longer build sequences

Post by George Geczy »

I'm responding here to keep discussion in the original thread, but this is basically for implementation in SR Next Generation (and Galactic Ruler).

We looked at just increasing the number of build sequence entries, but this still has a number of issues as described above. So we discussed a couple of possible design changes that would work without causing too many engine issues or modder confusion.

So this is our current proposal which we are working on testing out this week: "&&BUILDSEQUENCE2"

The BuildSequence2 will still have the same line order:
For each of Land/Air/Sea (and for GR, Space), there are three lines - Defensive, Mixed, Offensive.
This is unchanged from the original AIPARAMS spec.

Each line is redesigned completely - there are now 64 columns in each line.

First 32 columns : these represent a column for each Military Class (Infantry/Artillery/Tank/etc/etc)
Next 32 columns : these represent a column for each Specialty Flag. Right now, specialty flags include Engineering, MissileCap, Mobile, Carrier and for GR FTL, Survey, Colonization, Dropship.

For the Military Class columns - these represent the percentage (as a floating point value) of how often that particular class should be built. To work properly, the numbers should add up to 1.0 (100%) total.

For the Specialty Flag numbers - these represent how often that specialty should be prioritized by the AI build. Each one is considered independently on a scale from 0.0 to 1.0 (0% to 100%).

Sooo.... let's say that in SRNG you would like half of your unit construction to be infantry, twenty percent to be recon, ten percent to be tanks, and the rest to be split between the other 4 land classes.
The first columns of your build sequence will look like this:
0.5, 0.2, 0.1, 0.05, 0.05, 0.05, 0.05
These numbers add up to 1.0 (100%), so we're good. All the rest of the 32 class columns would be zero's.

What will happen is that the AI will select, based on probability, the frequency of build of each of those classes. Note that this is raw numbers of units, not build days in the queue. We could weight this by build days as well, to address the "battleships take long to build and fill up the queue" factor, so speak up if you think this is worth considering. Otherwise we would do this by class (capital ships get a small percentage of construction requests) only, and then among the capital ships it will select ships based on the various other build criteria. Also note that this is to be done by the infamous RNG, so it is possible that you'd get a whole bunch of tanks in a row, etc, but overall the numbers would come out matching the desired percentages in a relatively random pattern.

The second set of columns, specialty flags, will indicate how often you want the unit weighting to prioritize those specialties. So let's say that you want about 10 percent to be engineers, 20 percent to have missile capacity, half your units to be mobile priority (non leg etc), and 5 percent to have a carrier capacity. Your specialty columns would look like:
0.1, 0.2, 0.5, 0.05

This means that for each unit added to the queue it will have that much percentage of turning on that specialty preference. Note that if there are no units in the class with those specialties (ie, no infantry with missile capacity, or no Artillery with Engineering) then the preference has no effect. It may also prioritize a mix (missile cap *and* engineering) if both are selected.

So that's the first version of the proposed changes. Possible adjustments:
- As mentioned above, apply an additional factor for unit build days - although since build days are already an element in the UNITWEIGHTING AI system, that may not be necessary and could be a bit unintuitive.
- Possible pull out the specialty flags to apply *per class* instead of overall - so you can specify a certain mix of desired specialties for your Infantry class separate from your tank class. Again, may not be necessary (since tank class would not usually have engineers etc), but could allow more fine tuning.

Looking for thoughts and feedback!

-- George.
Rosalis
Colonel
Posts: 417
Joined: Sep 07 2019
Human: Yes

Re: Req: Longer build sequences

Post by Rosalis »

I think the most important part for the ai is preventing losses, so you can keep the wars interesting. You can build 50% infantry but if you loose 50% on the first push and the other 50% needs repairs, you gonna need more infantry. How many you build in the past is irrelevant. You gonna need those fast building (and repairing) light infantry to protect and defend the other branches. Unless it's air that's causing the losses, but yeah your prolly too late by then. Maybe powerfull allies could trade you the AA or deploy some. Gonna need some faster response of the ai.

Good story tho, but its not adressing the real issue in my opinion. Maybe its a start i dont know. Having different type of units opens up possibilties. Instead of building the best unit, deploying the right unit for the right mission is also important. When to defend, when to attack, when to build up. If 80% of military is repairing it might be better to play defensive, but when everything is repaired, it might look to further hot spot request and if succesfull change ai stance accordingly.
Last edited by Rosalis on Jan 05 2022, edited 1 time in total.
User avatar
George Geczy
General
Posts: 2688
Joined: Jun 04 2002
Location: BattleGoat Studios
Contact:

Re: Req: Longer build sequences

Post by George Geczy »

Rosalis wrote: Jan 05 2022 You can build 50% infantry but if you loose 50% on the first push and the other 50% needs repairs, you gonna need more infantry. How many you build in the past is irrelevant.
We did discuss using a "percentage target of forces" system, where you could say that you want 50% of your total existing forces to always be infantry, but this does add a lot of additional complication.

Obviously building 50% infantry only works to keep your forces at 50% infantry if you lose units in proportion to each other class. But I'm thinking (hoping?) that this gets us close enough to the mark.
Rosalis
Colonel
Posts: 417
Joined: Sep 07 2019
Human: Yes

Re: Req: Longer build sequences

Post by Rosalis »

That will only work when some infantry is specialised in defending the cities. For example let ai build 10% special forces, with the specific order to defend the cities. Then your making an improvement (altho marines are more for offensive). Long range artillery same story. Long range AA, very expensive, best kept in cities. Would this be possible?

For example in recent SW map i took Sicily as UN, and West Germany took over europe. I just defended Sicily with about 40 units and ai of west Germany lost about 8k units against me. When the spam of infantry and artillery dryed up it was very easy to take them over and liberate whole of europe with few hundred units, much worse then Germany got in their tech branche, well i puppeted some US states for unit designs in the mean time, so yeah, B2 FTW, thanks California. By that time West Germany was basicly down so yeah thats the time i put those in action to speed up things. I think thats too easy. AI should know when to stop. Also ships should passive repair when its inside friendly naval borders. Its hard enough to maintain a navy as the ai. 20% destroyed, might be an idea to patrol friendly waters. In return cities should have gradations of defence bonus. Abanded city 10% defence bonus, metropolis 100% defence bonus. I think details like this and visuals for player feedback would give a more complete story.

Modding sure is nice, but you shouldnt have to rely on that as player (since its often either A or B). Altho im not sure how many players are above the level of the ai honestly if im watching youtube, Improving ai would also lower micromanagement tho.
evildari
Brigadier Gen.
Posts: 629
Joined: Aug 10 2017
Human: Yes

Re: Req: Longer build sequences

Post by evildari »

This: "percentage target of forces" system is much needed!

Would be nice if these sequence would rather be a goal for the unit types and thus just a mean to achieve the goals.
And the game program (automatic minister control) would set the production lines to meet those stated goals.

The usual problem is:
the losses of infantry are way higher than i.e. armor - i need to replace them - so even if i started to use ai- minister - i HAVE to switch them off else i get another unit instead of the much more needed infantry replacement.
Could also be something else . ie. your airplanes got an unlucky oversea transfer accident,are lost at sea and needs replacement.

Bonus for having such forces composition goal as a player-changeable in-game value and not some need-to-edit file.
Double bonus if computer played regions are made able to analyse current situation or (beware of hard ai) predict future needs and set those goals for itself.
my mods
http://www.bgforums.com/forums/viewtopi ... 79&t=25932 (even techs and units for everyone - AI will own you too)
http://www.bgforums.com/forums/viewtopi ... 79&t=29326 (MARSX2)
SGTscuba
General
Posts: 2544
Joined: Dec 08 2007
Location: Tipton, UK

Re: Req: Longer build sequences

Post by SGTscuba »

evildari wrote: Jan 06 2022 This: "percentage target of forces" system is much needed!

Would be nice if these sequence would rather be a goal for the unit types and thus just a mean to achieve the goals.
And the game program (automatic minister control) would set the production lines to meet those stated goals.

The usual problem is:
the losses of infantry are way higher than i.e. armor - i need to replace them - so even if i started to use ai- minister - i HAVE to switch them off else i get another unit instead of the much more needed infantry replacement.
Could also be something else . ie. your airplanes got an unlucky oversea transfer accident,are lost at sea and needs replacement.

Bonus for having such forces composition goal as a player-changeable in-game value and not some need-to-edit file.
Double bonus if computer played regions are made able to analyse current situation or (beware of hard ai) predict future needs and set those goals for itself.
^this basically.

And i'd like to add that maybe overall quantity of production fabs should come into the account. Countries with only a few naval fabs probably wouldn't build a battleship for example, but would build many smaller vessels.
My SR:U Model Project, get the latest and post suggestions here:

http://www.bgforums.com/forums/viewtopi ... 79&t=28040
User avatar
Zuikaku
General
Posts: 2394
Joined: Feb 10 2012
Human: Yes

Re: Req: Longer build sequences

Post by Zuikaku »

This certainly is a great improvement but it is hard to predict the actual impact on the game without actaual testing. It definitely gives more space.

It is closely related to the AI. If SR-TNG will have new AI, how will it react in different situations? Will it "blindly" produce units regardless of the situation? How is it going to handle MG shortages especially related to repair of hundreds of units during the wars? Or lossess? Modernization of the army? There are still more questions than answers. But it is significant improvement.
Please teach AI everything!
User avatar
George Geczy
General
Posts: 2688
Joined: Jun 04 2002
Location: BattleGoat Studios
Contact:

Re: Req: Longer build sequences

Post by George Geczy »

Zuikaku wrote: Jan 09 2022 It is closely related to the AI. If SR-TNG will have new AI, how will it react in different situations? Will it "blindly" produce units regardless of the situation? How is it going to handle MG shortages especially related to repair of hundreds of units during the wars? Or lossess? Modernization of the army? There are still more questions than answers. But it is significant improvement.
One element of the AI that is already part of the engine is that the AI can switch from "quantity" to "quality" based on goods or treasure shortages and also army size, and it can also switch from defensive to offensive. All of those changes will then cause different buildsequence and unitweight values to be used.

Other elements, such as maybe having the AI actually tweak the buildsequence itself, are a much larger scope and harder to define.
User avatar
sparky282
Colonel
Posts: 384
Joined: Dec 31 2011
Human: Yes

Re: Req: Longer build sequences

Post by sparky282 »

I'm guessing the above proposal for SRNG would also stop the building of 1940's battleships in the 2000's?
arakan94
Lieutenant
Posts: 70
Joined: Oct 10 2018
Human: Yes

Re: Req: Longer build sequences

Post by arakan94 »

I am so looking forward to this..
Post Reply

Return to “General Discussion - 2030”