17.08.2025 - 16:54
Welcome to the nerd corner ![]() Introduction You've seen the title correctly, I made a custom battle simulator. You can add custom units, strategies, general bonuses, upgrades and even building bonuses. Most of you will probably use the script I provided to "download" the unit roster of scenarios though to plug it into the sim, just so you know, you can edit these things manually in the files as well (scripts folder).
Note: Not a final release, subject to changes. Disclaimer: The script I made for downloading the unit roster from maps is basically pulling data from the html, that's all it does. It does not grant you any benefit in the game, it just makes "copy-pasting" the units' stats into the simulator from a custom map 3 seconds instead of 3 days. Dire's maps take more than 5000 lines of json... So technically this is not against the game rules, as it is more like a macro, but I obfuscated the script to make it harder to reverse engineer, just in case; other than that, the code is open source. How to use The basic functionality and layout of the simulator is almost identical to https://atwar-game.com/sim/. You drag units in, you set up the parameters for each stack, you hit Run Simulation. Simple. There are a few key differences though... (scroll down) ![]() 1. Unit Set (new) On the top, you have to select the unit set that you'd like to use. Check out the tutorial on the github page if you want to know how to populate it easily with any custom map's units. Changing it will reload all the controls, so do this first. ![]() 2. Unit List (updated) When the unit set is properly loaded, you will see the units pop up on the left panel. The main difference to the original sim is that here you have a search option (necessary with 200+ unit maps) and the units are grouped into General, Ground, Naval, Air and Building - similarly to how they work in-game. In the settings, you can enable alphabetic sorting too, otherwise it's taking the default order (the order in which the map maker added the units, not ordered by cost like in-game). If you see a unit in the 'Other' group pop up, that either means: A) the unit type has a typo in it or otherwise does not exist, like "grund_staelth" instead of "ground_stealth" (you can still use it, but specific buffs may not work as expected) B) there is a new unit type in the game (unlikely) that is not yet added to the custom sim ![]() 3. Customizable Upgrades (new) The original sim does not take upgrades into account AT ALL and the underlying simulator itself does not include them either, I've tested this thoroughly. You can customize the upgrades each stack (player) has for that battle, split into global and general upgrades; obviously the general upgrades only work if there's also a General unit in the stack. By default, every upgrade is enabled. You can disable them by clicking on the "enable upgrades" checkbox on the stack control. You can access this panel to tailor the upgrades as you want by clicking on the little gear icon near "enable upgrades". It also shows how many upgrades you have enabled right now for that stack. ![]() 4. Error Handling - Icons (new) Before running the simulation, make sure that you check if any of these icons appear on the top right. Hover the mouse over them to see what they mean. The typical scheme is... Blue (info) - does not affect the math, but you might have messed something up or forgot to do something Yellow (warning) - potentially mess up the numbers in the end, or otherwise affecting the simulation negatively, although not completely ruining it Red (error) - invalidates the simulation, there's a serious error in the configuration/setup that you should look into ![]() Bugfixes & Improvements The official sim has a number of key issues that I fixed here, so this simulator works better even for the default units: - Building: Defence type units now properly add the defense bonus - multiple building bonuses of the same type stack (this is how it works in-game, whether it is intended or not) - dragging a building into a stack is now adding 1 unit instead of 5 by default - minor display bugs fixed like "against against Destroyer" - stacks can only have "in defence line" or "in city" if they are also set to "defending"; the original sim messes this up because an attacking Militia shouldn't be getting the "+1 defense in city" buff from Imperialist - in certain situations this leads to invalid calculations - dragging units into the control is a little more intuitive (includes the unit name, not only the image) - the little icons on the top help you understand the simulator better and immediately see if you set things up incorrectly - upgrades are now factored into the calculation - you cannot have multiple stacks defending (leads to faulty calculation), and if every stack is allied to each other, that will show an error message (though you can still run the simulation, but it does not make any sense) - the allies control now simultaneously adds/removes the allied stack on both sides, making it easier to track with more than 2 stacks - multiple generals with different names correctly apply the general bonuses multiple times <<< Update #2 - the 50% minimum roll for scenario units is now accounted for in the calculation <<< Update #3 It is not working properly / Future plans If you believe you have found a bug, error or oversight in the custom sim, send me a letter in game or on discord (patrick0365). The same applies if you have any ideas to improve it. I mostly want to refactorize the code and improve its performance, but I do have some features that I think of adding in the future. For instance: running multiple small-scale simulations in sequence to automatically build a map for custom units (like the one Witch-Doctor created manually here) Finally, some thanks to Clovis who laid down the backbone of this calculator years ago, it's just a continuation of his work really. Further thanks to the following people for testing game mechanics in-depth, providing valuable insights and spotting critical bugs in the custom sim: Enjoy ![]()
---- ![]()
载入中...
载入中...
|
||||||||||||||||
载入中...
载入中...
|
||||||||||||||||
载入中...
载入中...
|
||||||||||||||||
载入中...
载入中...
|
||||||||||||||||
17.08.2025 - 18:14
Can't wait to use this for every battle!
---- https://prnt.sc/W3aEpwbpEwEU
载入中...
载入中...
|
||||||||||||||||
载入中...
载入中...
|
||||||||||||||||
载入中...
载入中...
|
||||||||||||||||
18.08.2025 - 07:03
Nooooooo! My secrets to unit creation have been exposed! I am doomed lmao!
载入中...
载入中...
|
||||||||||||||||
载入中...
载入中...
|
||||||||||||||||
18.08.2025 - 07:58
i deserve 2020 Poty you brazilian cingani dont think u can get away with that. i will raid ur favela tonight
---- ![]() ![]()
载入中...
载入中...
|
||||||||||||||||
18.08.2025 - 08:25
---- ![]()
载入中...
载入中...
|
||||||||||||||||
18.08.2025 - 16:27
Now this is cool
---- ''Everywhere where i am absent, they commit nothing but follies'' ~Napoleon ![]()
载入中...
载入中...
|
||||||||||||||||
19.08.2025 - 09:59
Update #1 If you guys only want to use a better battle simulator with the default units (like buildings and upgrades working, better configuration options and such). You don't have to download anything, I published a basic schematic on github.io that you can use: https://pat313.github.io/AtWar-Custom-Battle-Simulator/
---- ![]()
载入中...
载入中...
|
||||||||||||||||
19.08.2025 - 11:14
Can you add Endsieg units to the battle simulator? Endsieg is a map that is still being played alongside WW1. Well, and Pacific Front (WW2).
---- .
载入中...
载入中...
|
||||||||||||||||
19.08.2025 - 11:23
Originally i wanted to add Pyrrhus' endsieg and Aetius' ww1, but people nowadays play Estus' ww1 and Dire's neuordnung (these 2 are already added), and the latter two get constant updates so it might mislead people. The idea with the two links was to give a fully customizable local version that you can download and plug any units into it anytime, while the cloud based version can be used as a more advanced battle sim (w/ default units) where buildings and other stuff work properly. Sure I can add the most played maps but those are also the most frequently updated ones so it might become invalid when the maps get updated from time to time. Edit: Now endsieg and og ww1 are incuded.
---- ![]()
载入中...
载入中...
|
||||||||||||||||
载入中...
载入中...
|
||||||||||||||||
02.09.2025 - 04:27
Update #2 There was a major oversight in the sim that derived from the faulty logic of the game's own sim (Clovis' code¹) where multiple generals with the same role id - AKA "named gens" phenomenon² - did not grant the general buffs multiple times, only once. This also affected the API payload and the calculations. It has now been fixed. 1. Clovis' code: originally, the custom sim's code was taken from the game's own simulator, but since the game does not have multiple general units by default, it was not reflected semantically in the code; it was a simple bool (has General? yes/no instead of counting the generals, plus the general upgrades were not dynamically changeable) 2. Named gens phenomenon: scenario players may know it well that - as you can see it in the game by expanding the 'Stack Bonuses' option - if there are multiple Player General type units in the same stack, all the bonuses you get from the general (+1 def to all units, +1 HP to Ground: Secondary Defence, etc.) are all applied as many times as the amount of distinctively named* generals found in that stack The next update is going to address a significant bug where units with higher than 15 atk/def always roll at least 50% in battles.
---- ![]()
载入中...
载入中...
|
||||||||||||||||
今天 - 07:03
Update #3 This should've been included in the last update, but it caused me some headache; it may not even be the final version (see explanation below). Fixed a minor bug where the alliance mapping was broken due to another change in the code. This caused the alliance setup to be never working, and the stacks were always fighting every other stack. Now the allies control for the stacks should be working correctly, like before. Another major issue I tried to tackle was the 50% min roll phenomenon¹. As you may know, if a unit has 10 attack or defence, that means it can roll an integer between 1 and 10 during the corresponding battles. If you play scenarios you should've noticed already though, that units above a certain atk/def will always have a min roll of half of that value¹. The stack bonus² may work oddly due to this (if you have a 20 attack unit and the stack bonus² "nerfs" the rolls, you will see a lot of '10s' in that battle - given the logic, this is "normal"). Nerd section Since the simulator is fixed at having a minimum roll of 1, I made an extension method and used the power of algebra to get closer to the mean value of the actual in-game behavior. In practice this means the atk/def/crit values you're seeing visually on the UI are not always what is get sent directly to the API. So we modify the max roll and the crit, to mathematically get as close to the real mean value we would be getting in game as possible. A unit with 16 attack and 0% crit will have a range of 8-16 in terms of rolls, so the mean is 12, not the expected 8.5 ((1 + 16) / 2). In this example, the max roll we should be sending to the simulator's API would be 23, since (1 + 23) / 2 = 12. IF YOU'RE A MAP MAKER, YOU SHOULD BE WARY OF THIS (looking at you Estus). I'm not sure this actually works correctly, I might have made some mistakes in the math, with the criticals specifically. You can find this piece of code in scripts/adjustAtkCrit.js. If you want to verify the math, use a javascript interpreter online or various other methods. There are commented out examples on the usage that I deliberately left in there >> printExample(16, 0.05); >> a unit with 16 attack/defence and 5% crit chance. Please also be aware that the simulator is only taking in integers, I cannot use fractionals, leading to slight inaccuracies - the only way to solve this is sending multiple simulations with different inputs and then merge the data into the final result (which I don't want to do, as I believe the current solution is accurate enough... just so you know, this is solvable too). 1. 50% min roll phenomenon: I have no idea whether this is a bug or a memory management issue or purposefully built this way, but when a unit's attack or defence value in the game reaches 4 bits (a value of 16) the minimum roll of that unit in battles turns from 1 into half of the max value, rounded down; this is affected by upgrades, strategies, the general bonus and Defence type buildings (according to extensive testing, the range seems to dynamically "hop" into the top half of the range and treat it normally, but further investigation might be needed to know for sure whether it converts the lower values into 8s - in this case - or just crop the values of 1-7 completely). 2. Stack bonus: Clovis already put a lot of math-heavy explanations on this in the last 10 years, you can find that on the forum, it's built into this simulator as well (...) the amount of units on the offensive and defensive side of a battle will alter the RNG of the rolls.
---- ![]()
载入中...
载入中...
|
你确定吗?