Combat Simulation

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
Unnamed
Space Floater
Posts: 38
Joined: Sun Aug 16, 2015 5:05 pm

Combat Simulation

#1 Post by Unnamed »

Hi! I felt like I should drop by once again. I don't follow development actively as you tend to discuss too much for my taste :wink: .
I only read half of the discussions about combat simulations and weapon targetting, but it's evident that you need help with that. Too bad no one of us is a theoretical physicist with experience in statistical physics. Oh wait, I am!
So let's first start with some assumptions:
  • The movement of space ships is complicated due to tactical decisions, therefore it's best to instead assume random movement (random walk)
  • Space ships are point particles. This should be a good approximation if the typical distance between them is much larger than their size. It's also important to note that they can either attack in all directions or can turn so fast that their facing direction doesn't matter.
  • Space ships move independent of each other.
Fleets will try to maneuver themself into beneficial positions and outmaneuver the opposing fleets. This may can be approximated by random movement with a certain mean velocity. Using weapons with a large effective range partially compensates bad mobility.
More parameters are necessary. I suggest to add two more meters: an effective velocity or 'combat velocity' for ships (I think there was a combat velocity long time ago) and an effective weapon range for weapons.
Stealth can be incorporated easily: stealth reduces the effective weapon range by an amount that is equal to the difference between the target's stealth and the attacker's detection. E.g. if the target stealth is 100 and the detection is 50 the effective range will be reduced by 50. A detection that is higher than the target's stealth will not increase the effective weapon range.
Also the new weapon meter allows more variations of weapons:
  • High damage, low range (e.g. plasma cannons)
  • Low damage, high range (e.g. lasers, flak)
And due to the new effective velocity meter different ship hulls can be more distinctive, e.g. make organic ships fast and robotic ships slow.

Next a method to calculate the probability of attacking a certain target with a certain weapon is required.
I propose that this attack probabilities are equal to the amount of time that the target is within the effective weapon range of the attacking ship while both are performing a random walk with mean velocities equal their respective effective velocities. This probability is then divided by the total number of valid targets. However, this will be difficult to calculate. I guess the expression for the probability it will involve a non-gaussian path integral that is difficult to calculate. As these attack probabilities have to be calculated very often during a combat turn, explicit expressions are necessary. Even calculating a rather simple integral numerically will take too much time. I guess I have to do more assumptions and approximations until an explicit expression can be found.
This method should be easy to implement as it will only change the way how attack probabilities are calculated from a uniform distribution to a more complex one.
Some remarks on this idea:
  • The attack probability will be maximized if the effective velocity of the target and the attacking ship are equal.
  • In the limit of infinitely large effective weapon range the attack probability will be 1/N (uniform distribution, just like it is right now).
  • There is no anisotropy in the sense that only the absolute difference of effective velocities matter. For example if two ships A and B have the same weapon but different effective velocities their attack probabilities will both be equal, for A attacking B and B attacking A respectively. So fast ships will also have a lower probability of attacking slow ships. Maybe you don't want this behaviour? A kinda hacky solution would be to limit the effective velocity of the attacking ship to the effective velocity of the target.
  • The sum over all attack probabilities is equal or lower than 100% which means it is likely that some weapons will not attack.
  • Positions in space will be handled in an abstract way, not explicitly.
  • There is no need for something like a ship size variable as large ships should coincide with being slow.
Another idea is to explicitly simulate fleet movements on 2D map. Most relevant locations lie (almost) on a plane, so 2 dimensions should be sufficient. Within this approach the hamiltonian dynamics will be solved with a potential that is constructed via some rules for each ship respectively.
The rules will vary for each ship. For example it makes sense for a heavily armoured ship to approach enemy ships head on while for a ship armed with long range weapons it makes sense to stick to other ships form their fleet and to keep distance to opponents. However, these rules may be rather complicated. This behaviour should be able to be set in the design window.
This method will not necessarily require a larger amount of combat turns in order to utilize the advantages is has. Instead there could still be 3 "attack turns" and a larger amount of "movement turns" (like 9 or 18?). It will still require a larger amount of computation time than the first idea, that should only matter for large number of combats and large amounts of ships involved though.

So any thoughts on that matter? Any ideas for further assumptions/approximations? I'll have to do more simplifications anyway.
I haven't started doing any calculations yet, so now is a good time for complaints :wink: .

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

Re: Combat Simulation

#2 Post by Ophiuchus »

Unnamed wrote: Wed Mar 13, 2019 10:07 pmI only read half of the discussions about combat simulations
We do not really aim for combat simulations (in the sense of having striving something resembling "real"). We have a combat system which suffices mostly. What we really need help with is somebody implementing a combat simulator.

And that something basically which says: here are all the ships in the battle, what is the combat result?

Why we need that? Because it would help AI a lot in judging the quality of its fleet design and maybe we could use that for its ship design. And maybe ML

It would also help inexperienced players as well and with every change in the game everybody becomes more inexperienced ;)
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!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Combat Simulation

#3 Post by Geoff the Medio »

Unnamed wrote: Wed Mar 13, 2019 10:07 pmSo let's first start with some assumptions:
  • The movement of space ships is complicated due to tactical decisions, therefore it's best to instead assume random movement (random walk)
  • Space ships are point particles. This should be a good approximation if the typical distance between them is much larger than their size. It's also important to note that they can either attack in all directions or can turn so fast that their facing direction doesn't matter.
  • Space ships move independent of each other.
So you're basically assuming a spherical cow in a vacuum?

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Combat Simulation

#4 Post by Vezzra »

Geoff the Medio wrote: Thu Mar 14, 2019 9:47 amSo you're basically assuming a spherical cow in a vacuum?
When you talk about a "cow" here, I assume you're not referring to the well known quadrupedal mammalian live form we cheerfully abuse for mass milk production, right? In other words: what do you mean by "spherical cow in a vacuum"...?

;)

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Combat Simulation

#5 Post by Geoff the Medio »


Unnamed
Space Floater
Posts: 38
Joined: Sun Aug 16, 2015 5:05 pm

Re: Combat Simulation

#6 Post by Unnamed »

I don't even try to resemble something realistic. It's still a good starting point to figure out how a possible model could look like, right? You have to do some funny simplifications in order to find a simple model. Don't mind them.
It has to be very simple, because the player should be able to understand what is going on and there has to be a method to estimate the effectiveness of fleets or a simulator.
Don't worry, I'm on vacation soon so I have enough time to implement it.

Btw realistic models are often very hard to solve. Usually you're interested in a certain effect or phenomenon so it's alright to use a greatly simplified model as long as it describes that effect sufficiently well.

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

Re: Combat Simulation

#7 Post by Oberlus »

Unnamed wrote: Wed Mar 13, 2019 10:07 pmany thoughts on that matter? Any ideas for further assumptions/approximations?
Read about Stars! battle engine.

Unnamed
Space Floater
Posts: 38
Joined: Sun Aug 16, 2015 5:05 pm

Re: Combat Simulation

#8 Post by Unnamed »

Oberlus wrote: Thu Mar 14, 2019 10:02 pmRead about Stars! battle engine.
That sounds rather complicated and arbitrary. I guess it is better to stay away from something like this. Maybe not even change anything about the combat simulation. Using the most simple approach also has an advantage albeit its limitations.

I guess I should start with making a simulator. That's the most useful improvement at least.
So basically you could just do the combat simulation like 1000 times and calculate mean values and standard deviation, but calculating it will most likely take too long. I'm sure I can find some better estimations of the combat results that will require much less computation time. I guess the value you're most interested in is the amount of destroyed ships on both sides, right? Finding the mean total damage done/received will probably be much easier but don't really tells you how large the losses on both sides are.

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

Re: Combat Simulation

#9 Post by Ophiuchus »

Unnamed wrote: Sun Mar 17, 2019 10:11 pm I guess I should start with making a simulator. ... I guess the value you're most interested in is the amount of destroyed ships on both sides, right? Finding the mean total damage done/received will probably be much easier but don't really tells you how large the losses on both sides are.
I am not sure how much mean damages information would improve AI. Besides targeting conditions it is easy to come up with some kind of estimate (and that is what is done more or less when AI does ship design).

Usually you want a prediction who wins and at what cost.
The number of destroyed ships is interesting, but it is also interesting which ships are destroyed.
As a starting point that could be the PP cost of the destroyed ships. The real thing would be the value of the ship in future combats, but that is harder to guess and could be very specific to the current enemies. We could maybe feed back results from the simulation for some kind of fixpoint iteration.

From my playing experience i would guess that combat outcomes are usually pretty similar with the current combat system. So going down the statistical road will probably not take 1000 samples for useful numbers. The good thing about the monte carlo approach is that it does not really know the combat engine and the game contents. Because that is both in flux.
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!

User avatar
LienRag
Cosmic Dragon
Posts: 2150
Joined: Fri May 17, 2019 5:03 pm

Re: Combat Simulation

#10 Post by LienRag »

As much as I'd like to play "Master of Kerbal Space Program" it's safe to acknowledge that freeorion is not that game and probably shouldn't try to be.
And obviously the freeorion philosophy of passing any interest towards realism through the sieve of enjoyability and simplicity of the resulting gameplay, and to prioritize these against pure realism.
Still, realism brings two boons that should not be underestimated, immersion and intuitivity, and so should be pursued anytime it doesn't conflicts with higher priorities.

Also, a better combat system able to use efficiently and intuitively new meters (like combat speed, range or even morale) allows for more diverse tactical situations and ship designs, getting rid of "one hull to rule them all" problems that plague any too simple system.

I proposed a system in another topic and I realize now that it's not that different from the one described for Stars! (but how humbled I was by reading Stars! combat mechanism, I still think that mine is a tad better), adding random trajectories for dogfights resolution seems very interesting to me and I would never have thought of that myself.


I'm not saying that Unnamed's decision to prioritize the team's priority by implementing a combat simulator is in any way wrong, but once he'd done that going back to designing an original combat mechanism seems very promising to me.

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

Re: Combat Simulation

#11 Post by Ophiuchus »

LienRag wrote: Wed May 29, 2019 11:06 pm As much as I'd like to play "Master of Kerbal Space Program" it's safe to acknowledge that freeorion is not that game and probably shouldn't try to be.
The reality of freeorion is space-opera, so if we can find fitting fluff everything is splendid. Combat in space is pretty much unimaginable at the moment (if you mastered FTL destroying a planet is probably childrens play) and most probably not as interesting as space-opera combat is.

Just send a big radiomagnetic burst at the right frequencies. There is no way to detect this before it takes effect (yay for lightspeed) and it will harm 99% of the unshielded population so everybody dies a few days after. Also even the idea of "building an empire" does not necessarily make sense in space.

If one e.g. Unnamed created a "more realistic" combat system we would still need a way for AI to use it. So having a way to do combat simulation using the freeorion combat implementation would still be a necessary step.
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