Battle Simulator / Interface

For what's not in 'Top Priority Game Design'. Post your ideas, visions, suggestions for the game, rules, modifications, etc.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Battle Simulator / Interface

#1 Post by Geoff the Medio »

I'm considering adding a battle simulator system.

The idea would be to let players set up two or more opposing or allied groups of ships, and then run one or many simulated battles between the groups and display the results.

A few interfaces to support this would need to be designed.

To set up the groups, I'm imagining dragging ship designs from lists like on the left side of the design screen into an area for each group. There would then be a way to specify numbers of each design for each group.

Complications might include effects on ships stealth that could come from techs, or applying an empire detection strength at the start of the battle for each group.

Some way to add planets to battles would also seem important, but would seem to require a more complicated interface to set up the relevant planet meters for combat.

Once a single simulated battle is run, a sitrep-style report could be shown.

If running many iteration of the same battle, a statistical summary could be generated. How / what to display for that needs to be designed.

Any comments / suggestions / requests?

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Battle Simulator / Interface

#2 Post by MatGB »

I definitely like the idea—it will obviously make, for example, the job of balancing various hull/part costs easier if you can test them extensively.

Perhaps something separate from the main game so you access it from the main menu using the new saved designs setup, with a design window in there that allows direct access to saved designs, etc. ?
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Oberlus
Cosmic Dragon
Posts: 5758
Joined: Mon Apr 10, 2017 4:25 pm

Re: Battle Simulator / Interface

#3 Post by Oberlus »

Geoff the Medio wrote:I'm considering adding a battle simulator system.
For my own use, I'm working on a standalone, command-line FO combat simulator, in C. It's quite ad hoc because I haven't browsed the FO source to locate/reuse relevant code (did it just for the part names and the relevant characteristics/stats). Fleets of each faction and their empire detection are loaded from text files that do not follow the same syntax than FO ship design files. Got two casual reasons for that: it was easier to code the parser and the chosen format includes the information on the weapon level (such as SR_WEAPON_3_3: plasma gun with two tech refinements). I could have let the program read the weapon tech levels of each empire, but that does not allow to represent ships that have not yet upgraded their weapons (yes, for those very rare situations where you can have some ships with laser 2 and some with laser 3 in the same battle because the first were in combat the whole time or were out of supply on previous turns).
I have most of the code finished (although untested), remaining bits are the code to generate the statistical summary and support for stealth in combat.
Once I finish it I think it could be helpful to anyone fiddling with FO combat balance or to some (few) players, so I'll upload the source (in this thread). At least I hope the discussion could be helpful for others that want to implement a GUI combat simulator integrated in FO.
Geoff the Medio wrote:If running many iteration of the same battle, a statistical summary could be generated. How / what to display for that needs to be designed.
I've been thinking on this (that's why I found this old thread). First things I wanted to know:
- Worst result for each faction and its frequency.
- Best result for each faction and its frequency.
- Most probable result (or range of results) and its frequency.

Then the question arises: What's good or bad for a faction? Losing PPs is bad, making your enemy lose PPs is good. Losing more PPs than your enemy is bad, unless you have way more PPs (so the attrition goes in your advantage) or along the PP loss you get something else (like cutting supply to enemy key systems or destroying/conquering a colony) because you lost many (absolute value) PPs of your fleet but not all of them while the enemy did. So sometimes it is the absolute value what could be of interest, sometimes it is the percentage, and always putting in relation the values for each faction.
For example, what is a better result?: to lose 10 PPs and nothing else (enemy's losses - yours = -10) or to lose 100 PPs and make your enemy lose another 100 PPs (=0) or to lose 200 PPs and make them lose 250 (+50). First one is the less-losses case, but losing 10 PP for nothing is good? Third case inply huge loses for you but greater loses for the enemy, so I guess this is the best case. And if you have half your enemies PPs per turn? And if the ships you are losing are outdated or small and less valuable? And if...
I'm reluctant to try and reflect all that circumstances in the combat simulator. The user can have them in mind and ponder the simpler simulation results. So for now I'm considering as the basic statistic the lost PPs (calculated from the base costs of hulls and parts, upkeep multiplier ignored) for each faction. And I'm discarding those best/worse cases for ambiguous. Instead, user could specify the cases for which s/he wants to see results and frequency (or simulator could produce all stats by default):
- Case with maximum (or minimum) enemy losses.
- Case with maximum (or minimum) own losses.
- Case with maximum (or minimum) enemy's minus own losses.

Also, there is the chance to participate in a battle among more than two factions, which further complicates the issue. I guess for each faction it could be considered that all the rest are just one, but sometimes you'll want to know who is actually losing (the tiny enemy that you don't care about or the huge one that is harassing you).


In any case, what I'm planing to do is to store the resulting values of each individual combat simulation, like this:
LostPPs_A -- LostPPs_B --- LostPPs_C ... --- B-A --- C-A ---- C-B
300/400 -------- 250/300 --------- 150/150 ... ------- -50 ---- -150 ---- -100
330/400 -------- 250/300 --------- 150/150 ... ------- -80 ---- -180 ---- -100
350/400 -------- 220/300 --------- 100/150 ... ----- -130 ---- -250 ---- -130
...

Then I can compute subtotals to get frequencies (e.g. for C 100% loses in 2 out of 3 simulations). And can order each column (independently) and compute percentiles, to give statements like "50% chances to lose 75% or more of your fleet).

I'm interesting on other's ideas about this statistical stuff.

Ophiuchus
Programmer
Posts: 3459
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Battle Simulator / Interface

#4 Post by Ophiuchus »

Geoff the Medio wrote:I'm considering adding a battle simulator system.

The idea would be to let players set up two or more opposing or allied groups of ships, and then run one or many simulated battles between the groups and display the results.
...
Any comments / suggestions / requests?
I think it would be good to have this available programmatically as well (if it doesnt exist yet). For acceptance tests and AI simulation of batles etc. Layers could look like
  • freeorion combat system (the binaries actually used in the backend); probably no effects should be executed while fighting; input is a list of empires, their ships and their targets. Output is a combat log and list of ships we new stats (or simply mutates the ships). This doesnt know about ship designs, only about ship properties.
  • combat system APIs (cpp, maybe a simplified for 1-on-1 battles, maybe also expose via http). APIs probably know about ship designs.
  • combat systems clients (one is the freeorion game, automated acceptance tests, simulation for AI, AI heuristic builder, and the visual simulator)
on top of that one could add a combat log visualisation.


edit: What I meant with acceptance tests is automatically getting a warning if techs are broken. E.g.:
  • 50 Robocruisers with MD,Bombers should win against 50 Robocruisers with MD,MD
  • 30 Robocruisers with MD,Interceptors + 20 Robocruisers with MD,MD should win against 50 Robocruisers with MD,Bombers
  • ...
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Post Reply