Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Brawling Simulator  (Read 1103 times)

SaberCherry

  • Commander
  • ***
  • Posts: 109
    • View Profile
Brawling Simulator
« on: September 14, 2020, 07:52:26 PM »

In light of a recent thread arguing about whether caps or vents were a better addition to a ship for brawling, in which TTO (time to overflux) was used as a metric, I decided to write a simulator.  You can grab it here (now version v0.2):

https://www4.zippyshare.com/v/q8CD1tZc/file.html

(I've never used zippyshare before so please let me know if you have trouble and I'll put it somewhere else)

To use it, you run a command like this:

https://imgur.com/a/yaQzZVB

If that image doesn't show, it would be something like this (on line, space delimited):

java -ea star.Simulate weapons.txt ship:side=a,class=Lasher,name=Foo,hull=1750,armor=300,flux=2100,dissipation=140,upflux=500,downflux=1600,fluxperdamage=1.0,upkeep=56,4xLight_Autocannon,1xLight_Mortar ship:side=b,class=Kite,name=Bar,hull=900,armor=150,flux=1400,dissipation=80,fluxperdamage=0.8,upkeep=40,2xHammer_Torpedo_Single,1xLight_Autocannon

The syntax is such that you define a ship and its vital statistics in the command line.  You can do the same with weapons if you want but you don't need to.  If you want multiple ships on a side you can use the same syntax as with weapons, e.g. for 3 Kites:

3xship:side=b,class=Kite,name=Bar,hull=900,armor=150,flux=1400,dissipation=80,fluxperdamage=0.8,upkeep=40,2xHammer_Torpedo_Single,1xLight_Autocannon

There are a few other flags like "printshots" and "verbose" that are helpful for understanding why the simulator got the result it did.  The assumption is that two ships (or more than 2, if you want, per side) shoot at each other until one side dies; all weapons are fired whenever possible and nothing misses.  Shields are kept up (for ships with shields) initially, lowered at the last second before an impact would cause overflux, and then kept down until flux drops below some margin (by default 50% flux but you can set that with the term "upflux=500" for a ship to make it turn its shields back on when flux drops below 500).  In practice this does not matter much of the time since ships never disengage so basically flux keeps going up unless their weapon drain is lower than dissipation.  The simulator is 100% deterministic when there is 1 ship on each side.  When there are multiple ships per side, every time a weapon starts firing a burst, it picks a random target from the remaining live enemy ships, so the results are nondeterministic.  You can, if you want, tell ships to vent when possible with the term "vent=true" in the ship definition; by default they don't vent.  There are also a couple of pilot skills simulated; you can set "bonusarmor=150" (default is 0) for a ship or "minarmormodifier=0.10" (default is 0.15).

This is not guaranteed to be completely accurate, but in my testing it seems reasonable so while I expect there may be some bugs it works as expected so far.  Currently it supports all weapons in Vanilla but does not model EMP damage since I don't know how that works.  But weapons with limited ammo, bursts, continuous beams, regenerating ammo, etc are all modeled (see weapons.txt which took me a while to write, and may contain mistakes, since I typed it from in-game descriptions rather than using a dump).

Please feel free to look at or modify the code (both .java and .class files are present) and data file.
« Last Edit: September 24, 2020, 10:24:21 AM by SaberCherry »
Logged

DubTre6

  • Commander
  • ***
  • Posts: 100
  • Tri-Tachyon Agricultural Rep.
    • View Profile
Re: Brawling Simulator
« Reply #1 on: September 15, 2020, 07:38:27 AM »

Cheers! I'm curious to run this a few times to test my own hypothesis' so thanks for putting in the hard work. I'll let you know if I find any issues after work.
Logged
8) why fight the paragon when you can BE the paragon 8)

SaberCherry

  • Commander
  • ***
  • Posts: 109
    • View Profile
Re: Brawling Simulator
« Reply #2 on: September 24, 2020, 10:29:59 AM »

This has been updated to v0.2.

Bugfixes:
Beams were being charged per-second flux cost every 100th of a second.
Flux per damage multiplier was not being applied properly.

New features:
Ships will raise their shields if the next shot would otherwise kill them instead of waiting until their flux is lower.  They basically do that in the game, from my observation.
Possible to tell ships to raise shields if there is any incoming high-damage HE (like a torpedo) even when they are trying to shed flux (with the "preventtorpedoes" tag).
Logged

SaberCherry

  • Commander
  • ***
  • Posts: 109
    • View Profile
Re: Brawling Simulator
« Reply #3 on: July 23, 2023, 12:27:45 AM »

...So I guess nobody's ever tried this?  Honestly, I think it's pretty useful.  I'm happy to give more documentation if anyone is interested.
« Last Edit: July 23, 2023, 12:33:26 AM by SaberCherry »
Logged

CapnHector

  • Admiral
  • *****
  • Posts: 1056
    • View Profile
Re: Brawling Simulator
« Reply #4 on: July 23, 2023, 01:26:47 AM »

Well, there are a couple of things, first of all the download link is dead. Second you should definitely document how you handle armor, range, accuracy, flux handling, priority ship gives to its own guns, ship rotation etc. as these are non-trivial and basically determine what the result means. It is extremely useful and impressive if it accounts for all details. I would be very interested in the mechanics.
Logged
5 ships vs 5 Ordos: Executor · Invictus · Paragon · Astral · Legion · Onslaught · Odyssey | Video LibraryHiruma Kai's Challenge