Automap (exterior) implementation

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
Post Reply
User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: Automap (exterior) implementation

Post by Nystul »

Interkarma wrote:@interkarma:
My feeling is that Daggerfall is using normalized coordinates from building's model origin inside block. You've noticed how well player position in world lines up to building footprint on automap when the coordinates are handled correctly (great work on that by the way). I'll work on adding building coordinates to block metadata and that should be enough for a first pass.

It could be DF uses a completely different method I just haven't found yet, but the above should be perfectly workable as a starting point. If/when a better method is found, I'll hand back those coordinates instead.
ok thanks :)
Interkarma wrote:
Nystul wrote:
  • a way to render text into a Texture2D (ideally a helper function in DaggerfallFont class to render to Texture2D, I will see how far I can get - might need some help there)
Rendering direct into the automap texture might not be the best as zoom&rotate feature will distort text, and it will rotate with map (so text ends up at 45 degrees for example). It will also make it a lot harder to edit names on the map or place custom labels like in DF.

I think it would be better to use the DagUI features already present (like TextLabel) to render text. A little math will be needed to position text correctly on map rotation, but that isn't hard. This also allows you to take advantage of the higher pixel density of the canvas for better text quality at more zoom levels. If text fuzzes up too badly at smallest levels, we can just disable text after user zooms out far enough.

We might even be able to improve text readability a bit while keeping same look and feel (better fonts, better scaling, etc.). Something to keep in mind for later.

I'll try to get those building coordinates in for you as soon as I'm able. :)
my plan would have been to render each building name "plate" to a separate Texture2D and place them in the correct position. that way moving the camera and zooming in/out would work without any changes required to the plates once they are in place. when rotating it should suffice to rotate the transform of each plate.
Not sure if the DagUI elements behave the same way in relation to the automap camera. If so there is no reason not to use those...

edit: ok so I tested DagUI TextLabel and placement and scaling can not be changed how it seems once it is attached to the render panel of the automap.
for example trying to scale with

Code: Select all

label.AutoSize = AutoSizeModes.None;
label.Scale = new Vector2(20.0f, 20.0f);
label.Update();
does not have any effect how it seems

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

Re: Automap (exterior) implementation

Post by Interkarma »

Nystul wrote: my plan would have been to render each building name "plate" to a separate Texture2D and place them in the correct position. that way moving the camera and zooming in/out would work without any changes required to the plates once they are in place.
Perfect, we're basically on the same page then. :) TextLabel already renders to a separate Texture2D internally (see labelTexture, SetText(), and CreateLabelTexture()) and draws that every frame in Draw(). Usually just need to provide position as it inherits scale from parent.

I can help with the scaling side of things. Have a look at how DaggerfallBaseWindow parents HQ defaultToolTip vs. LQ defaultToolTip in constructor. I agree the approach needs to be clearer though.

Let me get the building coords handed over to you and then we can fix up the text scaling as needed.

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

Re: Automap (exterior) implementation

Post by Nystul »

alright - lets do so ;) thanks for your help

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

Re: Automap (exterior) implementation

Post by Interkarma »

I need to do more work on this, but recent commit should get the ball rolling. I've added static method RMBLayout.GetBuildingData() which hands back an array of RMBLayout.BuildingSummary structs for all buildings in that block.

Check the comments on RMBLayout.BuildingSummary struct for more information on how Daggerfall maintains varied building names on blocks. The gist is that each location also carries a set of building data that will overwrite/merge with building data from blocks. So none of the buildings at block level have name seeds, as this comes from location data.

I will of course handle this at some point, but I wanted to give you the basics to get started right away. You can at least use Position and BuildingType from BuildingSummary to start adding test nameplates to automap. The Position is relative to block origin in world coordinates, and should land in centre of building footprint. Just need to translate Position back to automap coordinates. Let me know if any problems.

I'll keep working on required items like adding colliders for individual buildings (so external Info clicks can work) and linking up building data from locations. This means the implementation we have now will change at some point to support real building names, but that's probably expected at this stage anyway. :)

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

Re: Automap (exterior) implementation

Post by Nystul »

managed to get the positions of the buildings into my coordinate system, looks good so far - thanks for the helper function:

Image

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

Re: Automap (exterior) implementation

Post by Interkarma »

Nice! :D

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

Re: Automap (exterior) implementation

Post by Nystul »

taking shape...
(currently I am using the Texture2D element of the TextLabel - was not able to get the TextLabel itself working with the automap camera - since I use the Texture2D the text is currently only white - though rotation/zooming rocks already)

Image

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

Re: Automap (exterior) implementation

Post by Interkarma »

Taking shape indeed. Impressive work!

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

Re: Automap (exterior) implementation

Post by Nystul »

thanks ;)

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Automap (exterior) implementation

Post by King of Worms »

Very nice map mods Nystul, this is what Daggerfall needs :) thanks for updates

Post Reply