I discovered the mathematically proven best fleet composition

  • I know what you're thinking: "Gee, OGame is a well-balanced strategy game. Surely each fleet composition has upsides and downsides, and is not optimal for every situation?"


    Wrong. And I'm just as surprised as you.


    Don't want to read and study the code below? No problem, have the answer up front: The best fleet composition is 25 Light Fighters : 5 Cruisers : 1 Battlecruiser. The best defense composition is 50 Light Lasers : 11 Heavy Lasers : 1 Plasma Turret.


    First off, let's remember that OGame isn't a strategy game. It's a Big-Fish-Eat-Small-Fish game with timing tactics. A player sending 10,000 Destroyers will perfectly defeat any non-DS fleet that is 1/100th of its value. So, up front, we must make some choices of what we mean by "best". Do we want to cause the opponent the most damage? Do we want to maximize the win rate? And what kind of opponents will we face?


    The choices I made that are necessary to even begin to calculate this are as follows:

    • We seek fleets that maximize the net profit: the value of our opponent's destroyed material minus our own. Defense counts as 0.
    • We seek fleets that maximize the net profit against fleets of equal value. This counter-acts making 10,000 Destroyers as above.
    • We define a fleet's performance based on its worst net profit: that is, we calculate the net profit against perhaps 100 or 1000 different opposing compositions, and we pick the worst performance from there. This makes us search for fleets that perform well against any opponent.
    • We define the value of a fleet as follows: value = max(max(metal, crystal * 2), deut * 3). This formula may surprise you. More on that later.
    • When the presence of some factor strongly influences the result, we break down the results using constraints. For example, whether Deathstars are present in a fleet hugely influences the dynamics.

    Now, you may disagree with the choices above. For example, you may wish to maximize your win rate instead. You may seek a fleet that defeats fleet of bigger value than your own. You may want the fleet that performs the best in the average case, not the worst case. You may calculate the value of a fleet differently. That's fine. Change the C++ code below to suit your preferences and simulate yourself - you may find a different answer. But I've made these choices to reflect how I think the average OGame player plays the game.


    You may think the value formula is weird. For example, you may prefer the naive value = metal + crystal * 2 + deut * 3. This difference is hugely important -- the naive method says a Rocket Launcher is cheaper than a Light Laser, and my method says the opposite! The reason my formula works well is because it estimates the time taken to gather the resources. Under this assumption, a pure Battlecruiser fleet is value-inefficient, because in the time taken to gather 40,000 Crystal, you could also have gathered 80,000 metal -- now you're sitting with 50,000 metal unused! Obviously, if you use the Merchant often, then the naive formula could be better. Your choice.


    OGame's combat rules are well-understood, so you may think the rest is just brute-forcing: testing all possible compositions against all possible opposing ones. The problem is, there are zillions and zillions of different combinations! It would be extremely inefficient to just brute-force them when 60 years of optimization theory has given us much better tools: the gradient ascent algorithm (also called hill climbing algorithm).


    In the gradient ascent algorithm, we start with an educated guess of a good fleet composition. Then, we compute the partial derivatives with respect to the ship types. This results in rather amusing derivatives like dValue / dLightFighters. The column vector of these partial derivatives points towards a local maximum. Think of it as computing the direction to walk to ascend a hill fastest (the steepest slope). We take a few steps, and then recalculate the partial derivatives. And so on. And so on. Until... the next step we attempt to take would take us downhill again. At this point, we're standing on a local maximum. A hilltop in a huge landscape of mountains.


    But gradient ascent isn't good on its own. It tends to get stuck on bad local maxima, e.g. hopeless compositions that can't be saved with a little tweaking. To fix this, we can use multistart gradient ascent. We start in many different places at the same time in the landscape, and gradient ascent them individually. Then, we pick the best one out of our suite of, perhaps, 100 compositions. We study the results, tweak the parameters... and so on.


    To generate these starting points, we can use a simple formula. Imagine that you have 10 coins to spend on ships. 1 coin buys you 150 Light Fighters, or 10 Battleships, according to our formula. We now generate every possible combination of coins being spent on ships. With 10 coins this quickly explodes into trillions of compositions, which is no good. But with 2 or 3 coins? Totally doable. So, we can start our gradient ascent with some rough-hewn compositions, normalized to equal value.

    Results

    The results surprised me. No matter how I tweaked the parameters, the composition 25 Light Fighters : 5 Cruisers : 1 Battlecruiser kept appearing near the top. In fact, the top 5 would often be very close variations of this ratio, found from different starting points and ascended upwards. Curious, I extended the C++ program to compute the canonical defender: what was the best opposing fleet to this magical ratio? That answer also surprised me: it was a very odd combination of Bombers and Heavy Fighters, extreme combinations you would never really find in practice.


    Impressed, I played with this ratio manually against many conceivable opposing compositions. Classic ones like 2:1 BS:BC. 1:1 HF:LF. Pure Battlecruiser. Pure Battleship. Pure everything. To my surprise, the magic ratio wiped the floor with all conceivable opposing compositions. It wrecked pure Light Fighters, thanks to the Cruisers. It wrecked capital ship compositions, thanks to the Light Fighter screen and BCs doing nasty Rapid Fire behind them, Cruisers supporting with extra damage, and the Light Fighters spamming the 30% combat explosion roll. Wow! I challenge you to manually find compositions of equal value that can generate net profit against this composition. It ain't as easy as it seems.


    I played with this composition in the Wurren universe to great effect. I could confidently crash anyone's fleet of similar Military Points Built without even having to simulate, with positive profit each time. And, for the smaller fish, it was often more efficient to only send part of the fleet. For example, since Battleships can one-shot Cruisers, it's more efficient to send the Battlecruisers alone if they have superior numbers than the entire composition. Similarly, against Destroyers, screening with Light Fighters and excluding the Cruisers was often better. (To be fully honest, I strayed from the optimal ratio a bit and mixed in some Battleships. This helped patch up some unsimulated factors, like fleet speed and cargo holds, and helped make some fights perfect instead of just positive).


    I should point out that there was no guarantee there would be a magical ratio. I was prepared that the results would say "there is no optimal fleet", the symptom of which would be a mediocre worst-case score (profit). But no! The top results have impressive profit totals.


    Surprisingly, a pure Battlecruiser fleet is actually one of the worst possible compositions (!). (This is due to its high max-max cost and easy countering with Destroyers and Light Fighters)

    What about defense?

    Worry not! I also simulated and found the best defense. However, different assumptions are appropriate for defense:

    • For defense, we want to cause the most damage to discourage attacks.
    • We also assume that the opponent will bring a much bigger fleet to overwhelm us, say 5x, 10x, or even 50x.

    Under these assumptions, we can calculate an optimal ratio, and from the Profit score of this composition, we can easily calculate how much defense is needed to protect X amount of resources. If the worst-case damage is X against a suite of opposing compositions, then the defense can protect X amount of resources. In theory, a smart player will not attack if they can't get profit out of you!


    I assumed an opposing fleet of 5x value. Higher than this results in the canonical defender always being 10,000 Destroyers, against which no defense will kill even a single ship, degenerating the ranking. You can of course play with this. From these assumptions, we get a optimal ratio of 50 Light Lasers : 11 Heavy Lasers : 1 Plasma Turret. I would often sneak in a Deathstar to defend, too, even though simulating showed it was a bad idea.

    Can I explore this data?

    Sure! Just visit my spreadsheet here. Note the many different Sheets on the bottom simulating different scenarios and constraints. Tips on exploring:

    • Profit is in 1000s according to the max-max formula.
    • Ascent indicates how much the rough-hewn composition was improved by gradient ascent.
    • The second Profit column indicates against which %age of possible defenders results in >0 profit.
    • Wipe indicates what %age of compositions in the opposition would be totally destroyed by our fleet.
    • Flawless indicates what %age of battles not a single ship was lost.
    • The # column indicates the number of different ships in the composition. Notice how the top compositions have 3-4 ship types in them, and the worst ones tend to have 1. Makes sense, right?

    I disagree with your findings. Can I simulate with different assumptions?

    Sure! Just download the C++ source code here, compile it, and make your own changes to it. The output will be a copypasteable table that you can paste into a spreadsheet.


    The code includes basically a full battle simulator, too, so you can make your own tools using this code that does something else using battle simulation.

    Edited once, last by foxove5154 ().

  • Armand S

    Approved the thread.
  • the best fleet comp is more battlecruisers

    Did you read the full post?

    Quote

    For example, since Battleships can one-shot Cruisers, it's more efficient to send the Battlecruisers alone if they have superior numbers than the entire composition. Similarly, against Destroyers, screening with Light Fighters and excluding the Cruisers was often better.

    The assumption is that you're facing a fleet of equal value. This can be easily changed in the simulation code if you like. Change line 49 to something like int_fast64_t defenderNormalize = 5000 * 2; if you'd like to find the optimal fleet against an opposing fleet of twice the value.


    Also, your idea is patently wrong if you're facing a fleet of pure Destroyers, no matter how superior your numbers are, because Destroyers can one-shot Battlecruisers. You'd rather have them one-shot Light Fighters and then lose the next round, than one-shot BCs and lose the next round. Try it.


    But if your point is to point out that OGame is a Big-Fish-Eat-Small-Fish game, that's also in the first post. :)

  • It's clear that you put a lot of effort into this, but you are missing so many elements in your analysis:

    • Fleets are not just about Weapon/Armor/Shield values. You also need to account for cargo space, fuel usage, other utilities, etc. What value is a fleet if you can't afford to fleetsave it, or you can't capture all of the defender's resources with it, or you can't fly fast enough to hit anything?
    • You are completely missing lifeform techs. Lifeform techs dramatically change how good individual ships are, since they can boost a ship's stats by 17+ combat tech levels. For example, Cruisers are significantly better now for super late game players than they were pre-lifeforms, since their stats can be boosted to where they avoid the shield bounce mechanic against RIPs. However, for early game players, without fully developed lifeforms, they are less useful.
    • OGame combats are not often evenly matched. The attacker usually has a significant fleet size advantage (or in cases of ninja's, defender does). I suspect ships with larger shields (BC, Destroyer, Reapers) are better than / used more frequently than your analysis would suggest because in overwhelming numbers, the shield regeneration minimizes losses, vs high fodder fleets where losses are guaranteed.
    • If I understand your methodology correctly, you are randomly generating fleets, and matching them all up against each other, ranking them. I would posit that the majority of those fleet comps are crap, and would never be built. Who cares if a particular composition is better against a bunch of crappy ones that don't exist in the game - against fleets that do exist, it's likely suboptimal. This is the Meta aspect of OGame and all other multiplayer games - it's not about winning in a vacuum, it's about observing the opponents that do exist and adjusting strategy specifically for them.
  • Quote

    but you are missing so many elements in your analysis

    Yes, as I mentioned, in reality I mixed in more Battleships to make up for the poor cargo space capacity of this optimal fleet. Same thing with fleet speed. The Light Fighters to tend to slow it down somewhat (which doesn't matter during Phalanx hits, but does otherwise play an important role).

    Quote

    You are completely missing lifeform techs.

    Yes, good point. Feel free to augment the code for this -- I'm not familiar with Lifeforms tech.


    Quote

    OGame combats are not often evenly matched. The attacker usually has a significant fleet size advantage (or in cases of ninja's, defender does).

    That's true, but as I mentioned in my first post and previous reply, OGame is a Big-Fish-Eat-Small-Fish game, so some starting assumptions had to be made. If you like, try resimulating with int_fast64_t defenderNormalize = 5000 * 2; or * 3 or whatever you like. Just be aware that when you do something like * 20 or so, the results degenerate into preferring pure Destroyers, for obvious reasons. I think * 1 results in the most interesting data, because the top 10 fleets just keep being slight variations of this magical ratio.

    Quote

    you are randomly generating fleets, and matching them all up against each other, ranking them.

    No, this is not accurate:

    • Attackers and defenders start out randomized, but not uniformly. Depending on the run, each ship type gets an ~equal or unequal representation in the amount of resources they cost. For example, 1000 BS + 1000 LF would never show up because of the disparate prices.
    • Then, attackers are optimized with multistart gradient ascent. At the end, few attackers resemble their randomized origins.
    • Defenders are randomized, yes, but remember, our goal is to find the worst-case performance. The majority of fleets in the defenders may be bad, but a single decent one is very likely to be present, which would drop the score. In addition, in these runs, I would often insert 5-6 compositions that I knew were popular or good. Didn't matter -- the magic ratio still came out on top. It's extraordinary IMO that the optimal counter to the magic ratio is a weird combo of Bombers and Heavy Fighters.
  • This is your first ever post on the forums, and you are unfamiliar with Lifeforms. How long have you played OGame, with what style of account (Fleeter/Miner/Expo, etc), and to what account size?

  • because Destroyers can one-shot Battlecruisers

    Apologies, correction: Destroyers cannot one-shot Battlecruisers of equal tech, but it's close: 28% vs. 30%. So in theory with overwhelming numbers, BCs are not bad, especially if you use the Merchant to balance out its cost.

    This is your first ever post on the forums, and you are unfamiliar with Lifeforms. How long have you played OGame, with what style of account (Fleeter/Miner/Expo, etc), and to what account size?

    I played for 1-2 years back in 2008 or so, before Lifeforms. Then I decided to pick it up again in 2023, mostly to have fun and explore the data above. In Wurren, I was a Collector, and my account reached top 180 in that Universe... but I don't remember the points. FWIW, all my hits were on opponents of equal size or below, in line with the overall OGame metagame.

  • You may think the value formula is weird. For example, you may prefer the naive value = metal + crystal * 2 + deut * 3. This difference is hugely important -- the naive method says a Rocket Launcher is cheaper than a Light Laser, and my method says the opposite! The reason my formula works well is because it estimates the time taken to gather the resources. Under this assumption, a pure Battlecruiser fleet is value-inefficient, because in the time taken to gather 40,000 Crystal, you could also have gathered 80,000 metal -- now you're sitting with 50,000 metal unused! Obviously, if you use the Merchant often, then the naive formula could be better. Your choice.

    I just had this pointed out to me. HAHAHAHA


    Yeah, that is complete bullshit, and not how any cost calculations work in this game. This demonstrates a complete lack of understanding in the economics of the game

  • Yeah, that is complete bullshit, and not how any cost calculations work in this game. This demonstrates a complete lack of understanding in the economics of the game

    If you use the Merchant often, or do relatively liquid trades with others, then the formula value = metal + crystal * 2 + deut * 3 (or whatever multipliers you want) works better. Using this formula, and the following parameters:

    • const int_fast32_t* attackerConstraints = CONSTRAINT_WARSHIPS_ONLY_NO_DEATHSTARS;
    • const int_fast32_t* defenderConstraints = CONSTRAINT_WARSHIPS_ONLY_NO_DEATHSTARS;
    • int_fast64_t attackerNormalize = 20000;
    • int_fast64_t defenderNormalize = 20000;
    • Goal goal = Goal::MAXIMUM_NET_PROFIT;
    • Strategy strategy = Strategy::BEST_WORST_CASE;

    then the following output is obtained, indicating the optimal fleet is 569 LF : 416 HF : 149 CR : 71 BS. Note the negative profit of -1324, indicating there is realistically no fleet that will always emerge with positive profit in the worst-case here. It may be interesting to rerun with BEST_10TH_CASE for the 10th percentile.


    What is your preferred formula for estimating the value of a composition? We can try it and see what the output is.

    Quote

    now you're sitting with 50,000 metal unused

    Keep in mind that this 50,000 metal is not "wasted" in the simulations, it acts as a normalization factor. One way to reason about this is that the fleets 100 BC and 90 BC + 26 BS are considered "equal value"; each is constrained by the 4,000,000 crystal cost.


    I encourage you to put in your own assumptions into the code, compile it and explore the output. In particular, one fun thing to do is to put your own fleet composition ratio in as a singleton "defender". The program will then compute the best equal-value (or whatever you like) fleet most optimized to destroy your fleet. This is an interesting way to explore "counters". Here is an example of the output for the popular 2BS : 1BC ratio, against which the optimal equal-value counter is 1 Reaper : 1 Light Fighter (approx).

  • Quote

    The assumption is that you're facing a fleet of equal value. This can be easily changed in the simulation code if you like. Change line 49 to something like int_fast64_t defenderNormalize = 5000 * 2; if you'd like to find the optimal fleet against an opposing fleet of twice the value.

    making it a pointless hypothetical with no applicable value


    which was my point

  • Another interesting tidbit: I played with the numbers a bit, and a pure Battlecruiser fleet can be defeated with positive profit by as little as a fleet 5.5x smaller (in value), That fleet consists of 100 Light Fighters : 1 Reaper, specifically 354 Battlecruisers on average will draw with negative profit against 1335 Light Fighters + 13 Reapers. 5.5x is pretty horribly large, meaning smaller players can do a decent job of standing their ground against players incorporating only BCs. This of course easily changes by mixing in Cruisers, for which I invite someone to simulate against as well. Most likely there will be a strong counter, but not 5.5x.

    making it a pointless hypothetical with no applicable value

    Are you trying to say that the answer to "what is the best fleet composition" is always "it depends"?


    There are tons of dependencies: the choice of value function, the choice of including Deathstars or not, the choice of the suite of defender compositions and the reducer function (worst-case, 10th percentile, etc.) I've listed them all. Which do you disagree with? Give me a set of parameters that you think is more realistic, and we can optimize with those.

  • I'll admit I've not fully read through everything you've posted, though I commend the efforts you've gone through to find these results :thumbsup:

    Interestingly... just through playing and simming lots of different scenarios/fleets I myself landed on the following ratios:

    • 30 LF
    • 10 CR
    • 6 BC
    • 3 Destoryers


    I think the reason for my higher CR ratio is to be able to more easily take out fodder (LF) but also to smash through a heap of RL/LL. And I find BC to be pretty cost effective and powerful even when flying solo.

    The reason for the Destroyers is to be able to more easily counter BC & RIPs.


    Interesting to see how your proposed ratio isn't hugely different from what I work with 👍

  • Interesting post but obviously the conclusions drawn differ a lot compared to what we see in the fleet building meta. Hard to pinpoint what the reason for that is, as this is quite an elaborate analysis - I commend your effort.


    If I had to guess, I'd say it has to do with your definition for fleet performance based on "worst net profit". In reality fleets aren't built for the worst case, but rather to maximise profit in most cases.


    For example, a pure BC fleet - which is highly favoured by many - will do the job against almost anything but will obviously be trashed against an opposing fleet of LFs and dessies. The reason it is so highly favoured is that even though there is a strong counter, that counter is slow, expensive and situational.

  • Yes, interesting! Note that Destroyers do appear in some of the top rows, depending on the input parameters, so the gradient ascent agrees with your composition quite well. For fun, I put your composition as the singleton defender and used the software to search for the best counter. Here are the best two equal-value counters to your ratio, depending on the value function used (explore the data here) :

    • 671 Light Fighters + 87 Cruisers + 41 Battleships wipes and gets 7kk profit vs. 145 Light Fighters + 47 Cruisers + 28 Battlecruisers + 14 Destroyers (your ratio) for value = metal + crystal * 2 + deut * 3
    • 1021 Light Fighters + 140 Cruisers + 32 Destroyers + 25 Reapers wipes and gets 8kk profit vs. 308 Light Fighters + 102 Cruisers + 61 Battlecruisers + 30 Destroyers (your ratio) for value = max(max(metal, crystal * 2), deut * 3)

    Also, I'll point out that your ratio is excellent at wiping out pure Battlecruisers, which appear at the bottom in both value functions.

    Interesting post but obviously the conclusions drawn differ a lot compared to what we see in the fleet building meta. Hard to pinpoint what the reason for that is, as this is quite an elaborate analysis - I commend your effort.


    If I had to guess, I'd say it has to do with your definition for fleet performance based on "worst net profit". In reality fleets aren't built for the worst case, but rather to maximise profit in most cases.


    For example, a pure BC fleet - which is highly favoured by many - will do the job against almost anything but will obviously be trashed against an opposing fleet of LFs and dessies. The reason it is so highly favoured is that even though there is a strong counter, that counter is slow, expensive and situational.

    Indeed, and the way I try to model this in the software is using the BEST_10TH_CASE, BEST_25TH_CASE and BEST_MEDIAN_CASE. Best 10th case works pretty well: it essentially means the fleet is optimized to maximize profit of 90% of the defenders, with the 10% most effective defenders ignored. You may use BEST_MEDIAN_CASE to get the optimized fleet for "most cases" as you say, although I warn that the defenders suite should contain sharp defenders and be weeded from junk, otherwise you'll accidentally optimize against mostly trash fleets.


    Quote

    The reason it is so highly favoured is that even though there is a strong counter, that counter is slow, expensive and situational.

    Indeed and this isn't really modeled well, so some human interpretation of the data is a necessary step. In the end, I ended up making a modified version of this ratio my main fleet (throwing in Battleships). In actual play, because I was eating mostly small fish (but not always), my Light Fighters rarely saw use, because it was more efficient just to crash in the big boys and take fewer losses. They were still nice to scare off bigger fleets, though, and were excellent at screening defense that had too few Heavy Lasers.

  • Yes, "BEST_X_CASE" sounds like a step in the right direction. Is there a way to filter out the cases where the opponent is just garbage or just a composition nobody would actually build? Also it might be an idea to include a mandatory number of cargoes in the opponents - the amount may be somehow proportional to their size.


    One more thing I didn't quite gather is - does your method consider only full-fleet launches or does it consider subsets of the fleet as well. I might have 10x more LF than BCs but most cases I only launch BCs and usually not all of them.

  • Yes, "BEST_X_CASE" sounds like a step in the right direction. Is there a way to filter out the cases where the opponent is just garbage or just a composition nobody would actually build? Also it might be an idea to include a mandatory number of cargoes in the opponents - the amount may be somehow proportional to their size.

    Yes, although it again involves making a lot of choices:

    • You can constrain the defenders suite to contain only warships, for example. I made a few constraints in the program to explore fleets that excluded additional ships like Deathstars and Reapers.
    • You can add your own compositions (and normalize them) to the defenders suite. This is a good idea if you have a good idea of the current metagame, and want to throw in some compositions that are popular, good, or both. To your point, you can also throw in cargoes into these compositions, or even add a mandatory number of cargoes.
    • You could even make the defenders suite be entirely manually curated, I imagine this could be very powerful if you had a good understanding of the current metagame ratios.

    Here is an example snippet on how to construct a basic mix of defenders near line 55 in main.cpp, with an additional mix thrown in:

    Quote

    One more thing I didn't quite gather is - does your method consider only full-fleet launches or does it consider subsets of the fleet as well. I might have 10x more LF than BCs but most cases I only launch BCs and usually not all of them.

    This is actually a feature that I was about to add to the software, but I wanted to publish these results first. Like you say, launching the big boys is often more cost effective because if you have overwhelming numbers, then you might not lose a single one. I could imagine it very useful to learn which subset of your fleet to launch against a specific target to minimize casualties while also launching as few ships as possible.

    Seems like this would fall apart verses hf with bmbrs and reapers or just verses hf and bmbrs

    with Pf's tossed in for giggles

    My memory must have failed me, but I tried optimizing attackers with the constraint "bombers, HF and Reapers" only against the combination and they do horribly, no matter which value function is used. In the sum of weights value, the best fleet is pure Heavy Fighters, and it comes out at a -4.8kk profit loss.

  • depends on what is sitting there to be honest and waves do make up for first wave profit drop.