Networking, compression, font rendering, image processing, scripting and audio are implemented with third party libraries, but much of this project is built from the ground up. Not necessarily for a good reason – it started simple and functionality was added when needed. The project has been going so long and substantial time invested in a decent system that wiping it clean and using a third partly library would cost more that it’s worth. The user interface is a good example.
It could be more powerful and better designed, but it’s good enough and better than some used for commercial projects. I have built a screen editor (see image below) that allows creation, reordering, deletion, moving, resizing, customisation, and copying and pasting of controls. There is support for a range of control types including text, text button, check boxes, edit boxes, panels, textured buttons, list boxes and tabbed panels. Unfortunately the screen editor was started in MFC way back when and I still have to deal with its difficulties.
The panels automatically detect if there are corners and tiled edges available and break up the panel into child controls to use them. This allows me to easily make panels with rounded corners or frames of any size.
I’ve just implemented a style system, so each control’s parameters can default to a particular style. If you decide all the controls with the ‘Heading’ style should be a bit larger and have a shadow then it’s a matter of changing a couple of lines in the style script, rather than going through and editing every screen. Screens are serialised as Lua scripts, so if a parameter is not found the style’s value is used instead. This means you can customise controls, while keeping down the file size. When a style is changed it is automatically reflected during the next execution of the screen editor or game.
The controls support layout variables too, so you could have a variable that defined the position of the title on each screen, making minor adjustments painless. There’s no animation support, but it doesn’t look like we’ll need it for Forts.
Adjustments to the coordinate mapping allowed support for correct display in different screen aspect ratios. We’ve targeted 16:9 as our primary user interface aspect ratio, which is the most commonly one used on Steam. Aspects of 16:10 just shows more of the background image above and below the controls, and 4:3 is letter boxed. You can see the guides for these in the screenshot.