I kind of used the browser restrictions as a starting point; right away I realized there are certain things that can only be done on response to user input, and that I could finagle my way around that with a game mechanic that forces players to click repeatedly. I figured pumping out some sort of watercraft was an obvious direction, which is where that core mechanic came from. I'm not sure what led me to u-boats specifically, but Silent Hunter III is one of my favourite niche old games so maybe that's part of it.
I think you mentioned that you looked at the code I was using? If it looks a little weird, that's because most of it was written in TypeScript and compiled into Javascript.