Friday Facts #330 - Main menu and File Share Shenanigans

Posted by Twinsen, wheybags on 2020-01-17

The main menu rework Twinsen

Up until I looked at the source code, I was always confused about the differences between "Start campaign", "New game" and "Scenarios". New game seems like the same thing as "Scenarios"->"Freeplay", but are there any differences? We then later added a few more bonus scenarios, but they are hidden in the scenarios menu, with no explanation about what each is, what to expect or if it works in multiplayer. I believe it's very important to communicate to new players information about the game's content. It's also important to show that freeplay is the intended way to play. So all this prompted me to rework the main menu a bit.

I started with the structure. The structure always seemed odd to me, compared to what I'm used to from other games. Important options like "Load game" are lost among options that are never used (like "Replay game").
So I came up with a new structure. It looks like this:

  • Continue
  • Single player
    • New game
    • Load game
  • Multiplayer
    • Host new game
    • Host saved game
    • Browse public games
    • Browse LAN games
    • Connect to address
  • Map Editor
    • New scenario
    • Convert save
  • Settings
    • ...
  • Mods
  • About

The first new thing to notice is the "Continue" button. Since "start the game and continue my last save" is probably the most common thing players will do, it makes sense that there is an option for this right at the top of the main menu. The button will contain the name of your latest save. Pressing it will immediately load the game and get you in game. Due to implementation complications, for now it only handles save games and it will NOT connect you to the last server you played on if your last play session was multiplayer, but I might implement that if it's highly requested.

Next, everything was grouped into either Single player or Multiplayer. There are much fewer options, since "Replay game" was moved as a small button in "Load Game", and every way to start playing the game was moved to the new "New Game" GUI.

The "New game" GUI shows all the ways to play the game. It also groups them nicely, places freeplay on top, shows a description and even a nice image. This GUI is used for new game, multiplayer hosting and map editor, thus simplifying the menu quite a bit.

For modders, scenarios can now contain a description.json file. In the file "order" determines the sorting in the New Game GUI; "multiplayer-compatible" determines whether the scenario is shown when trying to host multiplayer games. "multiplayer-compatible" was added to description.json file of campaigns also.

Steam log-in and "mini-accounts" Twinsen

While working on the main menu, another thing I changed quite a bit is how logging in is handled. With Sanqui's help, we did some small improvements, such as better error handling and error localization, but a more important feature is being able to log in using Steam only. I found it annoying that even though you bought the game on Steam, if you want to play online, you need to make yet another account, whose email and password you are probably going to forget.

For the Steam version of the game, when you try to use any online feature, the game will try to authenticate using Steam.

  • If you have an account and that account is linked to your Steam account, you will be automatically logged in without having to remember your password.
  • If you don't have an account, the game will ask you to choose a username (your nickname in multiplayer games) and then log you in. No password or email or email confirmation required. We call these "mini-accounts"
"Mini-accounts" can be upgraded to normal accounts by going on the website, logging in using Steam, and then adding an email and password. They can be used for the non-steam version of the game.

These changes are ready to be released, so you should see them as soon as we release 0.18, soon™.

File Share Shenanigans wheybags

A few years back, we were using a collection of hard drives stuffed into a leftover workstation as an office shared drive. This drive had all sorts of stuff on it, from unfinished art assets, to a collection of pictures of developers in a wind tunnel, we had it all. The inevitable day came, and we ran out of space on the disks. A decision was made at the time, to buy some new, high density drives, and put them in a QNAP enclosure. This is basically a little computer, with 4 front mounted hard drive bays, and some special software for file shares and management. We figured this should be less hassle since it’s designed to be used by normal people. This was supposed to make our lives easier, as it should be an easy-to-use setup for normal people. It even had a friendly GUI with a little clippy guy!

"It looks like you're trying to setup replicated live snapshots"

Shenanigan #1

After only three months, unfortunately the little guy died. Doesn’t power on, just dead. Of course, we start the return process, but it’s going to take about a month to get the replacement sorted, during which time we will be without access to our files. So, we did what any reasonable capitalists would do, and we bought our way out of the problem once again, by just buying another QNAP NAS to use while we waited. When the warranty replacement arrived, we would use it as a backup target.
Side note: we couldn’t actually read our data off the drives we took out of the broken QNAP. The QNAP OS is just Linux with a custom GUI on top, so you’d expect we could get our files by plugging them into another Linux machine, but no! QNAP have customised their Linux kernel in a way that makes it impossible to read on a normal install (for those interested, they modified LVM to add some more efficient form of snapshotting, from what I can tell). Mmm... delicious vendor lock-in!


All was well with the world of large file storage in Wube software, until one day disaster struck again!
After a solid 14 months this time, the replacement NAS that we had bought also died. At this point, we begin to question our decisions.

ZFS to the rescue

With our original setup, we had a normal PC running the ZFS filesystem. We have decided to just return to this approach. The final lesson is, that sometimes the "buy the solution" easier option is not actually easier at all. Sometimes it’s just best to invest the time and effort to do it right yourself. If you're a technically inclined person who's not afraid of a command line, you should really check out ZFS. Despite some recent misinformed statements by highly influential figures, it is a really great filesystem with advanced features not really available in any other production quality filesystems, like snapshotting, checksumming, and live replication.
Oh, and you should probably avoid QNAP NASes...

As always, let us know what you think on our forum.