wowsb ship tool: the compare system, and a lot of small fixes
This is the biggest update the ship tool has had. Two things happened: I finally built the compare system, and I spent a long time fixing things that were quietly wrong. Some of those were my own mistakes, which I will write about honestly because that is the point of these posts.
The compare system
You can now pick two ships and see their stats side by side. There is a round button in the bottom right corner. Tap it, and the page goes into a mode where tapping a ship card adds it to a compare list instead of opening its stats. Only two ships can be added, and the list tells you what you have picked.
Once two are in, hit Compare and it opens a full side by side view. Every stat group is there: survivability, armour, main guns, secondaries, torpedoes, anti air, concealment. Both columns show their own equipment if you have fitted any, so you can compare two different builds rather than two bare hulls.
Getting the button right took more attempts than I expected. At first I put a small plus on every ship card. That was wrong, because it cluttered the grid and you could not tell what it did. Then the button floated over things, then it covered the compare list. The version that works hides itself at the top of the page, slides up when you reach the ship cards, and gets out of the way again at the footer.
The filter buttons
The filter rows used to put the label beside the buttons, which read badly on a phone. Everything is stacked now, label on top and buttons underneath, which is the same structure used everywhere else on the site.
I also made the icons much bigger and removed the text labels from the Class and Nation filters. They were too small to read, which several people told me. The tooltips still tell you what each one is if you hover.
Equipment: the steering servo was wrong
A player pointed out that High Response Steering Servo was wrong. They were right, and it was wrong in three separate ways.
It was listed as affecting traverse acceleration and traverse deceleration, when it actually reduces turn time. It also showed a survivability penalty that should not have been there. And even after I fixed the values, the effect still did nothing, because the equipment resolver had no entry for turn time at all, so the label did not map to any ship stat.
There was a fourth problem waiting behind those. Turn time is a stat where lower is better, so a negative percentage is a buff. My code did not know that, so the corrected values would have shown up red as if they were a penalty. All four are fixed now: the item reduces turn time, shows as a green buff, and renders the reduced value with the original in brackets next to it.
Two bugs I caused myself
I want to write about these because they were my fault and the fixes are more interesting than the mistakes.
The first was in the CSS. I had two different elements sharing the same class name, so a rule meant for the tiny subtitle on a ship card was also hitting the intro paragraph on the front page. That is why the intro text was stuck at eleven pixels and would not wrap no matter what I set. The same thing happened again with an "empty" class, where a rule meant for the no results message was adding twenty pixels of margin to every empty slot in the compare list. Both are scoped properly now, but it is a good reminder that names like these have to be specific.
The second was worse. While adding something to a file, I anchored my edit on a string that appeared four times, so my code went into the wrong place and broke a function. Then I tried to repair it by guessing at what the function used to contain, which made it worse. Then I ran a git command to undo the damage, and because the repository only had a single commit, it rolled the whole file back to a much older version that had none of the last month of work in it.
I got it back, because most of that file is generated from the ship database by a script I wrote earlier, so running the builder restored the ship list. But the hand written parts had to be put back by hand. The lesson is to check what a destructive command will actually do before running it, and to commit more often. I have started doing that.
Smaller things
The exit button in the stats views kept floating over the content as you scrolled, which was distracting, so now it scrolls away with the page. There is a back to top button instead, which only appears once you have scrolled past the equipment. The equipment panel colours now match the front page filters, and I changed the accent colour used for highlights across the whole site to something softer.
Carrier players will notice a new Carrier Air Group section. This one comes with a warning: the site's data source has no aircraft tables, so those rows are currently empty. The layout is there so it can be reviewed, but there are no real numbers in it yet. I would rather show nothing than guess. Importing the aircraft stats from the raw game dump is the next job.
Version and what is next
The site is on v98 now. Next up is the aircraft data, and then I want to look again at how the compare view handles carriers, since their stat sheets are so different from everything else.
The site is free, fan made, and not affiliated with Wargaming. It lives at wowsbshiptool.netlify.app.