If you’re looking at this project and asking yourself “what on earth is this and why does it exist?”. Fair question. I’m part of a roleplay where larger battles occasionally break out. These battles can involve both player characters (PCs) and non-player characters (NPCs), and the rules dictate that during the initial clash each battle gets divided into smaller fights that reflect the overall size ratio of the two armies. Though watching NPCs fight other NPCs is about as exciting as watching paint dry, so we decided to drop any groups that would be NPC-only. Simple enough, right? Except now, we have a new problem. The ratio between the two sides isn’t always a clean 2:1. It might be something awkward like 23:13. Rounding it isn’t an option either, since one side could end up mathematically losing a fraction of a character, which feels unfair.
Additional constraints are:
If you’ve read this far, you probably have a sense of how complex this gets. Doing it by hand before every fight is tedious and error-prone, so I built this little tool. You can try it out here .
I’m a software engineer by trade, but JavaScript is not exactly my home turf. This is a gloriously hacky solution I cobbled together on a holiday morning. Refactoring and better comments are on the wishlist (the existing ones are mostly there so I don’t fully lose track of what I’ve been doing).
Additionally, I must admit, to my shame, that I used the help of AI for the UI styling. Design is even further outside my comfort zone than JS, and frankly it would’ve cost me another full day to get there on my own. The result is perfectly passable, and my ego has mostly recovered.