Automap (indoor & dungeon) implementation

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
User avatar
Interkarma
Posts: 3619
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma » Tue Aug 16, 2016 11:56 am

To show what I mean about scaling, here's a relative comparison of the tips at 720p.
hqtips-720.jpg
hqtips-720.jpg (105.49 KiB) Viewed 2930 times
And again at 4k UHD.
hqtips-4k.jpg
hqtips-4k.jpg (103.93 KiB) Viewed 2930 times
Unlike the existing tips, these aren't being scaled with the vanilla UI, so can be wildly different depending on native res. I'll try to find a good balance and improve my scaling setup.

User avatar
Nystul
Posts: 1198
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (indoor & dungeon) implementation

Post by Nystul » Tue Aug 16, 2016 2:20 pm

wow! definitely an improvement. ;)

The font seems to miss brackets though

daggerdude
Posts: 28
Joined: Sat May 23, 2015 2:22 pm

Re: Automap (indoor & dungeon) implementation

Post by daggerdude » Thu Aug 18, 2016 5:25 pm

Just leaving feedback from the other thread; I would like simplified or classical markers added, optionally. I'm more on the purist camp, so deleting blocks is another feature i hope to see too. I did like the addition of the extended block view (f3 and f4). I'm not so obtuse as to see this is a 20 year old game and certain changes should be made, but simplified markers are my personal preference. as made clear to me in the other thread, i'm in the minority, so if you do eventually do something great, if not, i guess i'll have to grit my teeth and bear it.

User avatar
Interkarma
Posts: 3619
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma » Fri Aug 19, 2016 3:25 am

Nystul, I've added an option to enable HQ tooltips from the INI under a new [Experimental] section. Will need to run game at least once to get the new settings pushed to your local INI.

The HQ tooltips will look good in 1080p, a bit large in 720p, a bit small in 1440p, and much too small in 4k UHD. I'll work on a scaling system in the future, until then this will remain in the experimental section.

ifkopifko
Posts: 135
Joined: Thu Apr 02, 2015 9:03 am

Re: Automap (indoor & dungeon) implementation

Post by ifkopifko » Sun Aug 21, 2016 1:41 pm

Interkarma wrote:Hey mate. I've been thinking about this and decided to experiment with a higher quality pixel font for just tooltips...
Wow, looks very promising, definitely an improvement. Fine tuning can come later, as I am pretty sure someone will get around to replace the whole UI in the future. :)

User avatar
Xaphir
Posts: 85
Joined: Sat Jul 16, 2016 12:55 pm

Re: Automap (indoor & dungeon) implementation

Post by Xaphir » Mon Aug 22, 2016 9:21 pm

Interkarma wrote:Hey mate. I've been thinking about this and decided to experiment with a higher quality pixel font for just tooltips, as they're effectively separate from the the vanilla UI anyway. The below is still a pixel font, but has 4x pixel density of the current tooltips. It makes things a bit more readable and still keeps the classic look and feel. Would this be a decent compromise if I made an option in the INI?
That looks fantastic. Are you going to do it? Or is that already an option in the experimental section?

Nvm, now I see what you are discussing here. I could have been doing this a long time ago??

User avatar
Interkarma
Posts: 3619
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma » Mon Aug 22, 2016 10:12 pm

Xaphir wrote: That looks fantastic. Are you going to do it? Or is that already an option in the experimental section?

Nvm, now I see what you are discussing here. I could have been doing this a long time ago??
The option just went into Experimental an update or two back, you didn't miss it by very long. :)

User avatar
Interkarma
Posts: 3619
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma » Mon Sep 12, 2016 8:14 am

Nystul, would you be interested in revisiting your automap for exterior locations? I should have very basic quest support before end of year, and the ability to mark local quest targets on the automap would be handy.

It's completely OK if you don't have time, or would rather wait until the quest system is more functional. :) I'm even happy to slap together a basic setup (i.e. replicate Daggerfall's exterior automap) for you to build on later if that helps.

Something else you might be interested in: I'm adding Typogenic to the master branch soon. Typogenic is a signed distance field typeface shader. It can render text directly into the game world similar to Unity's own TextMesh, but remains beautifully clear at any scale. See below for a comparison between Typogenic and Unity's TextMesh at extreme zoom. Cool hey?
Spoiler!
SDFvsTM.JPG
SDFvsTM.JPG (91.07 KiB) Viewed 2732 times
This might come in handy for marking 3D buildings and other features with 3D text that always looks crisp.

And as an outgrowth from the tooltip conversation in this thread, I'm playing with methods to use similar SDF typeface rendering in my UI system. I don't have a timeframe on this yet, however. It may not happen for a while.

User avatar
Nystul
Posts: 1198
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (indoor & dungeon) implementation

Post by Nystul » Mon Sep 12, 2016 12:44 pm

Interkarma wrote:Nystul, would you be interested in revisiting your automap for exterior locations? I should have very basic quest support before end of year, and the ability to mark local quest targets on the automap would be handy.

It's completely OK if you don't have time, or would rather wait until the quest system is more functional. :) I'm even happy to slap together a basic setup (i.e. replicate Daggerfall's exterior automap) for you to build on later if that helps.
yeah would be happy to work on it. I have seen that in DaggerfallModelling there is already a visualization of the location layout which looks very similar to the one used in vanilla daggerfall. So maybe I could build up on some existing classes?

I can replicate the automap classes for external automap. I would also keep it pretty the same as vanilla automap - since the external automap was pretty good I think (although some zooming functionality would be nice^^).
Interkarma wrote: Something else you might be interested in: I'm adding Typogenic to the master branch soon. Typogenic is a signed distance field typeface shader. It can render text directly into the game world similar to Unity's own TextMesh, but remains beautifully clear at any scale. See below for a comparison between Typogenic and Unity's TextMesh at extreme zoom. Cool hey?
Spoiler!
SDFvsTM.JPG
This might come in handy for marking 3D buildings and other features with 3D text that always looks crisp.

And as an outgrowth from the tooltip conversation in this thread, I'm playing with methods to use similar SDF typeface rendering in my UI system. I don't have a timeframe on this yet, however. It may not happen for a while.
yeah, I follow your twitter account so I already saw this and it is amazing! great stuff. This technique can even be used for shadow maps (though out of scope, it is amazing nevertheless)

User avatar
Interkarma
Posts: 3619
Joined: Sun Mar 22, 2015 1:51 am

Re: Automap (indoor & dungeon) implementation

Post by Interkarma » Mon Sep 12, 2016 10:51 pm

Nystul wrote:yeah would be happy to work on it. I have seen that in DaggerfallModelling there is already a visualization of the location layout which looks very similar to the one used in vanilla daggerfall. So maybe I could build up on some existing classes
Here's a high-level overview on how to get that layout like Daggerfall Modelling. This is just a primer, I'll help more with all this as needed.

1. At runtime, grab the player's map location from StreamingWorld.MapPixelX and .MapPixelY. You can then use:

Code: Select all

ContentReader.MapSummary mapSummary;
if (DaggerfallUnity.Instance.ContentReader.HasLocation(mapPixelX, mapPixelY, out mapSummary))
{
     // There's a location at this map pixel
}
else
{
    // No location here, we're in the wilderness
}

2. Once you know there's a location and have the indices in mapSummary, you can retrieve the location layout using:

Code: Select all

DFLocation location = DaggerfallUnity.Instance.ContentReader.MapFileReader.GetLocation(
                                 mapSummary.RegionIndex, mapSummary.MapIndex);
if (!location.Loaded)
{
     // Location not loaded, something went wrong 
}

3. Now we can iterate over the location layout and get the automap image per block:

Code: Select all

// Get location dimensions
int width = location.Exterior.ExteriorData.Width;
int height = location.Exterior.ExteriorData.Height;

for (int y = 0; y < height; y++)
{
     for (int x = 0; x < width; x++)
     {
          // Get the block name
          string blockName = DaggerfallUnity.Instance.ContentReader.BlockFileReader.CheckName(
                               dfUnity.ContentReader.MapFileReader.GetRmbBlockName(ref location, x, y));
                                       
          // Get the block data
          DFBlock block = DaggerfallUnity.Instance.ContentReader.BlockFileReader.GetBlock(blockName);
          
          // Now we can get the automap image data for this block and lay it out
     }
}

4. Automap image data array for block is in DFBlock.RmbBlockDesc.RmbBlockFld.AutoMapData.

The automap image data is a 4096-byte (64x64) array of bytes. Each byte corresponds to a building type from the DFLocation.BuildingTypes enum. This information is from here.

There's a list on the UESP somewhere explaining which RGB values belong to which building types, but I can't put my hands on it right now. I'll track it down or point you to my old source with that information when I can. From here, just need to turn the block automap bytes into an image with the correct colours and layout images in order.


There are some other problems we'll need to solve together. In no particular order:
  • Ratio of player movement in world to correctly position marker on automap. This one is easy.
  • Maybe worth exposing automap from StreamingWorld in some way. It's tracking world location and block data at all times, so makes sense to give you an easy call to get the automap layout from there.
  • Need to expose building names to automap and position name plates correctly on map. I don't currently have a good method to map buildings correctly to automap.
  • Even though I've worked out the building name generation method, I still need to hook all this up to all the per-type source tables. There's also some issues around how Daggerfall links building data across a couple of different tables. I still need to solve that.
  • Need to implement the "info" mode and be able to inspect buildings from the 3D world. Names then need to go on automap.
  • Need to serialize which building names have been revealed to player by location.
  • Support for notes, which also need to be serialized.
  • And no doubt more I'm not thinking of right now. :)
As always, it's perfectly OK just to get something basic working and keep iterating over it in future.

Post Reply