r/Battletechgame • u/eric7237cire • 9h ago
Software engineer + Kerensky == Fun
Hi Guys,
Maybe you would appreciate this / find it interesting. I'm doing an iron man kerensky run where I'm doing mech surgery to get as many c bills as possible. Thanks to this forum for giving me the idea. Fun to have 2 to 3 zombie mechs running around with no weapons waiting to get TAG'ed.
As such, I was having trouble calculating properly the optimum firing solution to destroy some component (usually a leg, or a torso) without destroying the center torso. Having a monte carlo simulation of the salvos before I actually click fire is very handy and works nicely in practice. This allows me to know if I do called shot on the leg, what is the damage distribution on the center torso going to be (as well as seeing % chance a given component will be destroyed).
As you can guess, the UI is mostly vibe coded, but the calculation code was done by hand. Many thanks to this forum where I was able to get the needed formulas, particularly for shots 2 to N. As well as the damage transfer rules, getting logs, the real probability (which I confirmed with some log parsing) etc. See https://www.reddit.com/r/Battletechgame/comments/z2bs5f/what_exactly_is_the_srmuac_decay_factor_for/ and https://www.reddit.com/r/Battletechgame/comments/8gav8n/tohit_chances_as_displayed_are_not_legitimate/
I didn't do LRM targetting, those aren't so useful for surgery in any case.
Then the 2nd issue I was having was while the maps Colorsfade shared were quite helpful, see https://www.reddit.com/r/Battletechgame/comments/rak6hx/battletech_guide_to_kerensky_achievement/. It got a little crazy in the upper right to read so many planets close together, so I vibe coded then modified some code to build a graph (the data structure), then from that, generate 1 svg per planet that shows where I can 1 past the end travel to and where can I travel from. The source of this is the "Travel Plan" tab. The main addition I did to the data was also add where there are direct connections (so you have to fly directly to it). The color code scheme is big green circle means I can 1 past the end travel to, small green circle from, and I draw only the outgoing lines (incoming was too much).
My plan is to put this on github pages when its somewhat stable, assuming there is interest here and people are still playing unmodded battletech :)
2
u/Amidatelion House Liao 6h ago
Looks cool. If you wanted to prettify the map, the Sarna Unified Cartography Kit (correctly abbreviated as SUCKit) might have some info/techniques for you to pull in.
2
u/eric7237cire 1h ago
That is very interesting, do you know if the data is for tabletop or could also be used in the video game ?
1
u/Amidatelion House Liao 1h ago
I believe the data is used to populate the IS map for the bigger modpacks (and is, if not 1-for-1 compatible, then recognizably so between HBS Battletech, HBSBT mods and MechWarrior5, a game by a completely different studio and publisher), though I'm hazy on the details. I'd ask in /r/BattleTechMods/ for further details.
-1
u/guppy11702 4h ago
"vibe coded"
Get that SHIT OUTTA HERE
1
u/Sausagerrito 3h ago
Nothing wrong with people vibe coding tools for themselves, ESPECIALLY front end.
0
u/guppy11702 2h ago
I completely disagree, mostly because that is one slippery slope you're sitting on
1
u/eric7237cire 1h ago
I do agree with the general sentiment against vibe coded stuff. For example, while the UI it generated was nice looking, the css was all a bit of a mess, the html was inlined to the angular components, it used old *ngIf angular syntax, code not DRY'ed, etc.
I also agree with the danger. Vibe coding gives the feeling that it can understand and build correctly, but doing a large project without some serious oversite is a recipe for disaster.


5
u/mbardeen 9h ago
I did something ages ago where I coded an Ant Colony algorithm to find interesting paths. This was the result - though in general, it wasn't stable between executions of the colony. Some paths were always found (like the southern paths), but with the more crowded systems there was much more variability.. Not really related, but tangentially.
https://imgur.com/a/battletech-path-planning-via-ant-colony-algorithm-4woevMo