Text And Localization – First Look

Text, text, text! There’s so much text in Daggerfall – from “Rat just died” all the way up to multi-page books. Before it’s possible to tackle many gameplay elements, something must be done about all this text. All the better if the text engine provides localization features at the same time.

Rather than start from scratch, I have integrated the excellent free Unity asset Smart Localization into Daggerfall Tools for Unity. On this solid foundation, I’m building import tools to convert Daggerfall’s various text sources into a format that can be easily localized and consumed at runtime.

Let’s take a look at the basic workflow. Everything starts with creating a “Localization Workspace” in your project Assets. By the way, it’s possible to work on translations without Unity installed, more on this towards the end.

SmartLocalizationSetup

What you see above is the Smart Localization workspace. I have already created 3 languages for English – en, French – fr, and German – de. There is also a Root Language File, which needs a bit more explanation.

The Root Language is a database of native key/object pairs that can be morphed into other supported languages. In addition to strings, the Root Language also supports images, sounds, and other game objects.

I am writing one-click importers that transfer text data out of Daggerfall’s various files (even the .exe) into their own text namespace. See below for an example after importing the contents of TEXT.RSC.

RootKeyImportFromDaggerfall

There’s a fair bit going on here, so I’ll break down all the parts.

Type is the type of asset being worked with. These are all STRING for now, but GAME_OBJECT, AUDIO, and TEXTURE are also supported.

Key is the unique key for this resource. As we’re importing from Daggerfall, the tool maintains each unique key in its own namespace. RSC means that TEXT.RSC was the source and the following digits are the unique ID for that text record. Each distinct resource will have its own three-letter namespace (BOK, IMG, SND, etc.) and unique ID.

Comment is the actual value, or contents, of that record. Anyone that has worked with Daggerfall’s text data will be familiar with the % codes. What’s a little different are how the control bytes are parsed into text format, for example [0xFD] for end of line. This is done because the control bytes are not valid characters for XML (which is how everything is saved to disk) and they are not generally human readable. The [0x00] format makes it very clear where control bytes are used and simple for a human to edit. It’s also trivial to parse these back into byte format.

A little more on those control bytes for anyone unfamiliar with them. They are basically for TTY-styled formatting. They control things like text position, justification, and font, and are very specific to the native Daggerfall GUI at 320×200 resolution. It’s very likely that future developers will prefer not to use the control bytes for their modern scalable UI. However, I pass through the control bytes exactly as-is and its up to the end developer how they wish to use them. If you would like read more about Daggerfall’s text then this article would be of use.

Once the Root Lanuage is ready, it’s time to create our translations. As the text is already in English – en it’s just a simple matter of opening that language and copying all values from Root.

TranslationEN

Now the great thing about Smart Localization is that it supports CSV import/export. This means you can export out your language data to CSV file to edit in Excel or similar tool.

SpreadsheetEN

Because everything is uniquely keyed, translation teams can build “master” CSV files that implementors can use to quickly add/update languages in their projects. For example, below is the CSV for German – de from their TEXT.RSC file.

SpreadsheetDE

And then imported into Unity ready to use in a game project.

TranslationDE

One issue with existing translations is that localization teams have needed to squeeze more complicated character sets down into Daggerfall’s 8-bit format. The good news is this is no longer necessary – you are no longer limited by Daggerfall’s engine. The bad news is that a lot of text will probably need to be rewritten for true character set translations for modern platforms. I will work with international Daggerfall fans to ensure they can use native character sets in the translation tool chain.

So we can create a giant resource database and spin-off various translations. How does this get used in a game project?

Accessing localized resources is very easy. For example, to retrieve a localized text string above, you would use the following code. Other resources are just as easy.

string textValue = LanguageManager.Instance.GetTextValue("RSC.1004");

As the native IDs are preserved, it will be easy for upstream developers to call for the correct translations as linked from quests and elsewhere. You can also add custom values for your own project, just need to give them a unique key.

Fell free to hit me up in the comments or via email if you have any question.

Daggerfall Tools for Unity 1.2!

The huge 1.2 world update is finally live! The tools have come so far since 1.1 and a big thank you is in order to everyone who tested Developer Preview versions and sent me feedback. You’ve all helped 1.2 become more than it could have been without you.

DaggerfallUnity

What’s New!

Core

  • Now requires Unity 4.6. (and not yet compatible with 5.0).
  • Vast streaming world can be created procedurally at runtime.
  • Blazing-fast billboard system for dense trees.
  • Tilemap shader for retro-style ground textures.
  • Enter any valid building or dungeon.
  • Random encounter tables in dungeons.
  • MIDI synthesizer with custom SoundFont support.
  • Hundreds of bug fixes and small improvements.

Demo

  • Complete streaming world demo scene included with all code.
  • Weather effects with Weather Manager.
  • Helpers to change lighting based on time of day, season, dungeon.
  • Contextual Song Manager to play music appropriate to player.
  • Ambient Effects Player to play sound effects in dungeons, etc.
  • A player compass.
  • Footstep Manager to change footstep sounds in winter.
  • Example enemy and player scripts for basic combat setup.
  • Many more small helpers and one-shot classes to learn from.

Get The Release!

Watch The 1.2 Feature Video!

Play The Demo!

Controls

General

  • Mouse move to look.
  • W, S, A, D to move.
  • SHIFT (hold) to run.
  • SPACE to jump.
  • LEFT-CLICK mouse to open doors, enter dungeons, operate switches, etc.
  • ESC to exit game (standalone).

Weapons

  • Z to toggle weapons.
  • Right-click and drag mouse to swing weapon.

Transport

  • R (while outside) for random location, season, time of day, and weather.
  • R (while in dungeon) to recall back to dungeon start.
  • 1-7 for preset location (keeps current season, weather, etc.).

Music

  • P to toggle songs on/off.
  • [ to play previous song in context playlist.
  • ] to player next song in context playlist.

Timescale

  • – to reduce timescale (0-8 steps).
  • = to increase timescale (0-8 steps).

Other

  • I to toggle mouse invert on/off.
  • H to toggle high speed on/off.
  • L to toggle debug text on/off.

Daggerjam!

Just a bit of stupid fun with Daggerfall Tools for Unity. Daggerjam should be a thing!

The Developer Preview build has been updated to 1.2.40. This build includes the latest Streaming World code, MIDI synthesizer, and demo scenes. The final 1.2 release will be ready soon.

Atlas Editor Window

Just a quick post today. I’ve added a simple editor window for searching locations, to be available in 1.2 release. After selecting a region, you can either filter locations by type (city, dungeon, etc.) or enter a partial string which is matched against all locations in the region. The search string is not case sensitive and will match any part of location name.

I plan to add more features to this later, such as a map preview and setting location to StreamingWorld.

AtlasEditorWindowUpdate

 

LypyL’s Unity Multiplayer Test 2

Good news, everyone! LypyL has created a second multiplayer demo for us to enjoy. It was amazing to share a dungeon run with him earlier.

Incredible to think… This is the first time it’s truly been possible to explore a Daggerfall dungeon with friends. Although still in early stages the potential for this is incredible. Great work LypyL!

Edit 21/03/2015: Updated link to later build.

Daggerfall Tools for Unity – Streaming World Multiplayer V.2.3 by LypyL

New Stuff

  • Daggerfall, Wayrest, Sentinel & Orsinium Castles are explorable. Use fast travel to leave.
  • (local) enemies in dungeons.
  • Fast travel menu with 35 locations.
  • Music.
  • Player Skin selection.

Controls

  • Click to capture mouse (webplayer).
  • ESC to uncapture mouse (webplayer).
  • Mouse move to look.
  • W, S, A, D to move.
  • SHIFT (hold) to run.
  • SPACE to jump.
  • LEFT-CLICK mouse to open doors, operate switches, etc.
  • Q toggle no clip/fly.
  • E climb mode (when facing wall).
  • Z toggle weapon.
  • Right-click and drag mouse to swing weapon.
  • New: F1 fast travel.
  • New: F2 toggle music.
  • New: F3 previous track.
  • New: F4 next track.