October 14th – Interface Foundations

One of the features that we’ve wanted for a long time is a better way for modders to make their own GUIs (graphical user interfaces). Currently, all of Starbound’s interface windows are configured in JSON, but their appearances are largely static and they can only respond to user input in a few fixed ways. On Friday we had been discussing this in the ##starbound-modding IRC channel, trying to figure out the best way to make objects with dynamic displays and lamenting the fact that there wasn’t any good method currently available. So, over the weekend, Kyren took the initiative and made one, which I finally got a chance to test out this evening!

The system she built allows an object to open a configurable interface window when the player interacts with it. This window can contain all the usual window elements, but can also include a canvas widget which gives a Lua script direct access to primitive drawing operations and user input. These ‘scripted consoles’ can monitor and respond to keyboard and mouse input, and draw their own lines, polygons, images, text, etc. Essentially this allows all kinds of custom interfaces and even simple games to be built as mods and run within Starbound!

One of the most obviously fun uses for this is to make in-game games. Here’s a truly awful implementation of Pong that I threw together as a test:

Unfortunately we don’t have the time to go wild on this just yet, but this is a good first step toward a much better GUI system in the future. Some other examples we came up with include controlling turrets in a base, hacking puzzles for missions, and numerical keypad locks for doors. I hope to have more time to develop these at some point. In the meantime, however, it’s available for modders in the nightly build, and they’re already going crazy with great ideas. For example, Neurisko is starting on a full-fledged programmable computer made from scratch:

…and that’s just the beginning! What kinds of things do YOU want to make?