Native User Interface Intro

The portable UI being developed for Daggerfall Tools for Unity 1.4 is coming together. Rather than use a uGUI simulacrum of the Daggerfall interface, I decided to re-implement Daggerfall’s native UI screen by screen, making it as true to Daggerfall as possible.




This has involved a fair amount of work to ensure everything is rendered at true native resolutions and scales proportionately to any screen size. Here’s an early test clip where I’m playing with the scaling, which runs in real-time.

[gfycat data_id=”PoliticalPitifulEgg”]

Another challenge was pixel-perfect text rendering. The internal UI in Daggerfall Tools for Unity uses Daggerfall’s pixel fonts exactly, which required a custom text renderer. Below is the book reader UI flicking through The Real Barenziah. The formatting codes from Daggerfall are followed so precisely that badly formatted text even overflows in the same places it does in game.

[gfycat data_id=”ImprobableGreedyIriomotecat”]

Behind the scenes, the GUI runs on a state machine stack where windows can be pushed and popped as required. Each window is a hierarchy of components (panels, buttons, labels, etc.) that all follow the same consistent layout behaviour and handle fundamental UI tasks like firing messages when clicked. Everything is rendered and hit-tested internally at Daggerfall’s native 320×200 resolution.

Communication between windows uses a custom messaging system that runs independently of platform. The messages themselves can even work a bit like command strings in that they’re able to pass parameters directly inside the message.

And the best news is that you aren’t bound to using this GUI in your projects. It exists inside the Demo namespace, which means that nothing in the core library or API has any dependency on it. You’re free to use this GUI or ignore it completely to implement your own interface using whatever UI platform you’re most comfortable with.

There’s still a lot of work to do before it’s ready for Daggerfall Tools for Unity 1.4, but everything is taking shape very quickly.

Posted in Daggerfall Tools for Unity, Visual Diary.

One Comment

Comments are closed.