Creating SDF Fonts For Daggerfall Unity

Introduction

All the way back in September, I upgraded font rendering in Daggerfall Unity to support Signed Distance Field (SDF) fonts. This enabled smooth high-resolution font replacements which can operate under the same “layout rules” as classic Daggerfall’s pixel fonts, with a substantial improvement to reading comfort as this comparison screenshot demonstrates.

 

Rather than storing individual display pixels of a text glpyh, SDF fonts store a distance value that can be turned into display pixels later at any resolution using a custom graphics shader. Unlike regular pixel fonts that become quite pixelated at high resolutions, SDF text can use those distance values to generate sharp detail even at UHD resolutions and beyond. If you’re interested in the inner workings of Signed Distance Fields, there are loads of great resources out on the web. This tutorial doesn’t look very deeply at SDF concepts, only the process of creating new SDF fonts for Daggerfall Unity.

 

Resources

There are a few resources you will need to work through this tutorial.

You can use whatever font or tools you like to generate your SDF font atlas. This is just the process I’m using that will generate known-good output for Daggerfall Unity. If you do use a different toolchain, the only thing that matters is the output image is a proper SDF texture and the glyphs are laid out in a specific way.

 

Continue reading

Notebook, Enemy Spellcasting, And Bug Fixes

To cap off a great month of progress, we have one more round of builds for October. This was going to be a solely bug-fix build, but amazing work kept on rolling in and I’ve decided to get these new features out to you now rather than wait until November.

 

Enemy Spellcasting (Allofich)

Building on top of my work on the magic & effect system, Allofich has wired up foes to hurl spells back at the player. This means ancient liches and vampires are serious threats again, imps are more than just a nuisance, and scorpions and spiders will just wreck your happy feelings with paralysis.

A lot of work was required in enemy AI to select spells based on touch or range. Enemies might stand their ground and hurl a fireball, or approach and attack player with a touch spell. And unlike in classic where the monster’s entire payload of spells are released instantly, they now make more intelligent decisions and release spells at sensible casting intervals. I can’t put into words just how amazing Allofich’s work on this has been. Magic in Daggerfall Unity suddenly doesn’t feel quite so one-sided, and magical encounters have become very dangerous again.

Here’s a short video where I pick a fight with some denizens of Mannimarco’s lair. Everything goes about as well as expected.

direct link to gfy

 

Continue reading

Daggerfall Unity October 2018

New Builds for October 2018

New builds are available on the Live Builds page now. This has been another huge month for Daggerfall Unity. We’re quickly closing the gap towards major parity with classic Daggerfall and exiting pre-alpha. The magic system has taken another big jump forwards this month with the number of implemented spell effects crossing the 90% complete mark.

I’ve also updated the main Roadmap and shifted a few magic-related items out of 0.5 into 0.7. This is so I can create a stable 0.5 build and start the downhill run towards exiting pre-alpha. I don’t think we’ll spend very long in 0.6, 0.7, and 0.8. These milestones have become more a formality at this point.

Alright, let’s unpack what’s new in October!

 

Automap SDF Fonts (Nystul)

The new SDF font system is now functional in automap UI. Now the fonts look smooth whether you’re zoomed all the way in or out of the map.

 

Advanced Climbing System (MeteoricDragon)

Daggerfall Unity isn’t just about reproducing classic 1:1 with quality of life features and mod support. We’re also adding depth to parts of the game that needed a bit more love in classic. If you’re the type of Daggerfall player who enjoys the Acrobat class, you probably want to make sure this option is enabled at Advanced > Enhancements.

 

The Advanced Climbing System allows characters with a high Climbing skill to not only scale walls, but to move in any direction, wrap around corners, cling to the wall, grab walls in the air, and leap off walls. A Khajiit with a high Climbing skill and magic can scale over practically any surface in the game. You can even climb out of water now, rather than face certain drowning.

direct link to gfy

In latest builds, you can rappel down walls by walking backwards off the top. I remember looking everywhere for that rope mentioned in Daggerfall’s manual, only to discover it wasn’t in the game. Well, who needs ropes when you can rappel?

direct link to gfy

If you’re a classic purist who prefers just scaling walls, all of these features are optional. Simply disable the Advanced Climbing System in settings and things are back to classic. The Advanced Climbing System is currently enabled by default for testing – and because it’s really fun to play with.

 

Continue reading

Daggerfall Unity September 2018

New Builds For September 2018

First builds of the month are now ready on Live Builds page. There are some great new features this time around, so let’s take our time unpacking them.

 

SDF Font Rendering

One common feature request is to improve quality of fonts in the game. This isn’t a trivial problem to solve as Daggerfall’s text formatting is hard-coded in books, quests, popups, etc. to line-wrap at certain points. There’s a very tight relationship between Daggerfall’s regular pixel font widths and how many characters appear per row. For any font upgrade to fit seamlessly within classic user interface, it must take this into account.

My solution was to completely overhaul the way UI renders text and support Signed Distance Field (SDF) fonts in addition to classic pixel fonts. This works by first performing a virtual layout for text elements then rendering either a standard pixel-font character or SDF-font character into the layout using a fast GPU shader. The end result is smooth high-resolution fonts at any resolution that follow the same layout rules.

You can toggle SDF font rendering in the startup UI or at any time in game with shortcut Shift+F11. SDF fonts are modable by dropping replacements into the StreamingAssets/Fonts folder. I will post an article dedicated to creating an SDF font atlas suitable for Daggerfall Unity soon. SDF fonts will be visible wherever text appears in the game – with the exception of text that’s “baked in” to UI elements. This needs to be modded out a different way and is unrelated to text rendering.

Below are some examples of book text at 4k resolution (click for full size).

 

 

Continue reading

Daggerfall Unity August 2018

New Builds For August 2018

New builds are now available on the Live Builds page.

What’s New

  • Implemented custom class creator UI (Numidium) – Note: most advantages/disadvantages still pending implementation as part of effect system rollout
  • Implemented outdoor swimming (MeteoricDragon)
  • Implemented item power information on “Info” messagebox popup (Allofich)
  • Magic items and their powers are now generated in random loot and in merchant shelves (Allofich) – Note: magic item powers are not functional in game yet

Bug Fixes & Improvements

  • Improvements to smooth height changes (MeteoricDragon)
  • Easier to mute sound or music volume (MeteoricDragon)
  • Fixes to crush detection to prevent accidental deaths (MeteoricDragon)
  • Smooth status change feedback added to health, fatigue, spell points bars (MeteoricDragon)
  • Bug fixes to arrow weight handling (Hazelnut)
  • Fix exterior music playing in dungeons and other interiors (Allofich)
  • Fix for music volume incorrectly influencing UI windows (Allofich)
  • Fix for doors rotating incorrectly on load (Allofich)
  • Fix for opening books imported from classic saves (Allofich)
  • Restored several variant changes in item templates overwritten by a previous change
  • Fix for quest parser not detecting end of final message block if empty line not present
  • Clothes in stores now have a random variant assigned
  • Fix for mouse not being captured after alt+tab – clicking in game window should recapture mouse
  • Fixes to “add armor” and “add cloth” console command to correctly use player gender and race

In Progress

  • Implement Illusion effect back-end behaviour – still needs to be wired to front-end effect (Allofich)
  • Certain time-limited items such as summoned items now supported in back-end (Allofich)
  • Started work on potion back-end for recipe handling

Looking to the near future, my personal workload has started to shrink again and I will continue work on rolling out spell effects soon. I somewhat prematurely celebrated my larger July projects wrapping up, only to have some of the smaller projects drag on much longer than expected. We should see a return to more regular incremental updates to magic & effects very soon.

On the plus side, the other developers have continued to work on systems and fix bugs. I’m particularly excited to see the custom class creator and outdoor swimming in this round of builds, as well as magic item drops for loot and stores.

Something that’s hard to describe in point form is all the incremental changes forming the rungs of a ladder towards a fully functional magic system. All of these seemingly minor back-end changes such as potion recipe handling and magic item drops, and magic crafting stations, are all important building blocks towards our goal.

I received a little bit of disappointed feedback when potion and magic item crafting stations came online before potions and magic items were ready to go. And I imagine the feedback will be similar now that magic items are dropping but not yet fully functional. The thing to keep in mind is that once all of these threads come together, the final stages of fully opening up spells, magic item, potions, advantages/disadvantages, diseases, etc. will coalesce very quickly.

I’ve linked the Black Triangles story before, and it’s well worth a read if you haven’t already. It perfectly describes all the work that goes into making the back-end of a game functional while not much interesting is happening on the surface. The same is true of Daggerfall Unity as the various moving parts begin to mesh.

 

For more frequent updates on Daggerfall Unity, follow me on Twitter @gav_clayton.

Daggerfall Unity July 2018

New Builds For July 2018

These are the first round of public builds after upgrading to Unity 2018. There are some general changes in these builds related to updated engine version you should be aware of.

  • Some mods might not work under new builds. Check the Released Mods forum for an update and please let the creator know if any problems running their mod in latest version.
  • Enhanced Sky is probably the main mod known not to work with this new version. You will just see a pink background instead of the sky. Nystul is currently working on an update for Enhanced Sky compatible with latest version of the game.
  • For Windows users, the “output_log.txt” file is now in your persistent data path (same place as settings.ini and save games). Please refer to this link to find where your Player log is saved based on OS. The included manual still needs to be updated with this information.
  • For Windows users, you will also see a couple of new files “UnityPlayer.dll” and “UnityCrashHandler32/64.exe”. You can ignore these and just run “DaggerfallUnity.exe” as normal.

What’s New

Besides the update to Unity 2018 for builds, there are some new features and bug fixes.

  • Improved near death experience (MeteoricDragon) – Introduces a subtle pulsing warning when player is at extremely low health. Can disable from Advanced settings at startup.
  • Magic Item & Potion Maker crafting stations in progress (Hazelnut) – Work has started on these crafting stations and the general UI is now available. They are not yet completed and currently cannot produce magic items or potions.
  • NPCs no longer stop when player’s weapon is drawn (MeteoricDragon).
  • Reputation propagation is now implemented (Allofich/Hazelnut). This means when you complete quests for certain reputation groups, your reputation gains/losses will influence related groups as per classic.
  • Sorcerers no longer regen spell points, just like classic – recharge now available at Mages Guild (MeteoricDragon).
  • Fixes for enhanced scroll list bugs (Hazelnut).
  • Fixes for sound effects not respecting global sound effect volume (MeteoricDragon).
  • Discovered locations are now imported from classic saves (Allofich).
  • Console command “add [item] [qty]” now supports “add gold [qty]” For example, “add gold 1000” will give player 1000 gold pieces.
  • Console command “reset_assets” will clear mesh and texture caches and refresh scene by performing an in-place quicksave then quickload. This uses the “QuickLoad” slot, so make another save if you don’t want to overwrite this slot.
  • Console command “setmqstage 1” no longer forces player level 1. You can now use this command to restart main quest at any level. Caution this will also reset reputations and global variables.
  • Bug fix for travel map opening map IMG files in read-write mode. This would cause a black screen when opening travel map on some systems depending where game files were stored. Changed this to use read-only mode as intended.

If you’re on the forums, you can discuss this release in this forum thread.

 

For more frequent updates on Daggerfall Unity, follow me on Twitter @gav_clayton.