(As a basic example, I give you this little conundrum, atop this other base, against all possible opponents then further complicated by the economies of supply and demand, which I can attest is a problem that does not quietly suffer a full brute force solution even in the middle tiers. For me, it was just an intellectual exercise, that outlived my actual interest in the game by many months, finding a less memory-intensive and nuanced bracketting system that yet sought out 'joker' combinations that stood out from the obvious crowd...)
Actually that looks fairly trivial compared to stuff they did a long time ago.
With an intelligent solution, it's not bad, but I mentioned Brute Force.
Let us imagine we're only interested in Blue vehicles (top of the Green<Blue middling tier, and capable of using Yellow/Green/Blue mods and weapons) so willing to
assume that sub-blue vehicles aren't worth bothering with, with their generally inferior stats and ability, whilst staying away from the Red+ tier that gets darned expensive).
From the Chopper with 6 slots to the the tractor has 15 slots of capacity, you can try to fit in 36 different mods (the 12 blue ones are the best, but they take up two slots, so you can't ignore the Y/G ones), and any slots you don't want to fill with Mods you might want to (or need to, due to the mods you have chosen) put Y/G/B weapons (15 possible types, but can be simplified to the three*(slots filled) combined Attack plus Defence scores you need to "denullify", and any remainder Attack+Defence you can just make subvariants with all overflow bonus as attack through to all overflow bonus as defence, then when you try to 'build' your vehicle you can choose which combination of the five Blue weapons does what you need, but you can ignore that for now. And for cargo-carrying (or highway robbery) purposes, you need at least one capacity kept spare to do anything useful, so not-totally-filled-slots combos are important.
Take the Tractor. 15 capacity, fully Brute Forced you'd permute a 15-bit bitstream. You can actually do some intelligent jumping based on capacity overloading prohibiting many of the permutations, so it isn't 2
15 combinations. You can also do some intelligent pruning by keeping note of other deficit (sub-zero) stats, not just the Cap, and comparing to the available 'buying power' from the rest of the bitstream yet-to-be-decided. But it's still a bit intensive.
Thus you get all possible vehicles. To save time later, store the 'template' of this valid (but yet to be tested) vehicle 'build' as a record of some kind. Vehicle ID (of five, so three bits maximum, but that's only if you're cutting the bitwise footprint of the record to the bone), plus which mods (15 bits) plus what (surplus) Attack and or Defence you have (or derivable), plus untouched capacity value. You might as well just store
all the resulting buffed/nerfed stats (which you have ensured do not fall below zero) on the record, to avoid having to recalculate each time you pull it. If you value storage space over CPU cycles you can asking for recalculation, each time, but you'll be calling those calculations a lot.
I can't remember exactly how many 'valid vehicle combinations' there were, but ISTR that (in a non-combative, recordless dry-run) my counter tallied up a figure was in the
trillions, and that may well have been the long-measure trillions that I like to use, not the short-measure one I'd be using in conversation with others.
So, now, if you're looking for an optimal vehicle, you need to 'send it out' against opponents. Potential trading vehicles (defensively) against prospective Highwaymen (offensively) we already have on record, Highwaymen (aggressively) against (passive) Traders and Highwaymen vs Guards in offensive vs offensive battle. So for each vehicle you add to the stack, you need to pit it against all vehicles already on the stack in all combinations of combat (though you could ignore trying a vehicle as a Trader that had zero capacity left, unless you just wanted to send out 'spoiler' vehicles) and keep a tally of win/lose/draw totals in
each capacity, within that vehicle's record (with the corresponding result increment in the opponent's tally, already having been previously tried against its predecessor permutations, now needing to remember how well it does against its successor ones).
A trillion-or-so successors fighting each other (and themselves, I suppose). Factorial of a trillion or more. Doesn't really bare thinking about (long
or short trillions!).
So that idea is clearly out, and I didn't even try it. (It can be done for Yellow-tierers, as that was my proof of concept, but forget a full Blue vs Blue (every possible valid combination) matchup tournament.)
The way I optimised it was to use "ziggurated batches". Some arbitrary number of vehicles (at a time) would be "zeroth level" matched, every vehicle from this subset against every vehicle from this subset, enough to contain (say) twenty different vehicles per 'role' per vehicle types represented. Once I hit that limit, I culled off all vehicles combos that were not in the top ten (of any particular role for any particular vehicle), and put them into the newly-created 1st level, emptying the zeroth level cohort and rezeroing the promoted vehicles' win/lose/draw statistics, and restarting filling the zeroth from the next permutation. Except that when the first-level cohort numbered more than
twice the zeroth one limit, I matched all first-levelers so accumulated against each other and (by the same top-ten-in-anything measure) bumped the ones that I needed up to the second-level tier (clearing their w/l/d stats and the first-level 'waitlist'). Etc. The second-level tier had three times the base capacity (really, the multiple was level#+1 from a zero-base... It could have been straight level# from a 1-base, but that' s how I coded it.) Until the very last permutations passed into the zeroth level, when promotion and re-fighting happened straight off at each level to get the (worthy) stragglers competing with each other until the "ten best FOOs" lists got generated at the top. Not actually proven every-combo-vs-every-combo, but the test at Yellow and Green level complexities (against the raw results of the more brutal of brute force run-throughs) indicated something of a reasonable match between the results of the two methods.
Again, can't quite remember the limits I applied, but with the (increasingly generous capacities of each new layer of the ziggurat, even given the much larger amount of culling/non-promotion) I think it topped out at Level 8 or perhaps 9 in the "final all vs all" competition, after a
very long continuous run. (I truly regret not having put a SIGINT catcher into the code, to sanely dump all existing data to file, ready to be picked up again on the next start-up, perhaps even to let me move it onto new hardware. But once the latest version of it was running, it was running, and I didn't like to stop it.)
How to do it
less brute-forcedly? Assign a number (100? 1000?) separate, or at least faux-concurrent, agents a vehicle. Let them pick and choose
a mod to add, and check it for viability (no sub-zero stats), and let them choose another mod (or combination of weapon buffs) if necessary to bring it back into validity. Take the best (by 'top-ten'ness, maybe twenty...), split and multiply across the 'design teams' for another adjustment (add, remove, change - plus further changes that might be needed to make this variant also valid). Rinse, repeat. Noting that this random walk may well miss out on huge areas of evolutionary landscape where a true 'killer' combination actually resides, that intelligent study might well have discovered.
Maybe I'll try that, though, and compare it to whatever results I can still pick up from my prior experiment. (But I aint running
that again... Not without the abort/continue safety net, at least.
)
((And this is before working out the 'genetic algorithm' bit, I know, but my point was on the brutalist approach.))