[Mod] Minimap WIP

Show off your mod creations or just a work in progress.
User avatar
Hazelnut
Posts: 2695
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: [Mod] Minimap WIP

Post by Hazelnut »

King of Worms wrote: Thu Apr 15, 2021 11:44 pm The mod creator has a discord link in his signature, maybe if u contact him, he will share the current build so it can be used as a base... if that would be helpful, I can try to ask him
I tried several months ago, got nothing except a minimap tutorial link.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Daniel87
Posts: 246
Joined: Thu Nov 28, 2019 6:25 pm

Re: [Mod] Minimap WIP

Post by Daniel87 »

Hazelnut wrote: Mon Apr 19, 2021 2:19 pm
King of Worms wrote: Thu Apr 15, 2021 11:44 pm The mod creator has a discord link in his signature, maybe if u contact him, he will share the current build so it can be used as a base... if that would be helpful, I can try to ask him
I tried several months ago, got nothing except a minimap tutorial link.
Maybe you can post the tutorial link here? Depending on how complex it is, maybe somebody seeing this wants to tackle it.

l3lessed
Posts: 853
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [Mod] Minimap WIP

Post by l3lessed »

This could be recreated if the author doesn't come back.

Place a camera attached to the player then offset it by the z-axis to move it above them a certain amount. Have that camera display as a small round hid overlay and add your GUI touchups.

The issue I see is getting the camera overlay into the hud system. This would be easy to do via editor only because you could use some workarounds getting the camera to overlay and show on the screen. However, the base engine itself would be harder I think.

If anyone is interested, this is where I would start. Camera stacking: https://docs.unity3d.com/Packages/com.u ... cking.html

If and once you stacked the minimap camera into the player view camera, then call it and find a way to overlay it into the player view as a small round minimap. https://weeklyhow.com/unity-minimap-in- ... inimap.%20

However, the tutorial here uses the editor heavily to setup everything, and this is where you will hit problems. You need to, through code, setup the camera like it is done in the tutorial.
My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 853
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [Mod] Minimap WIP

Post by l3lessed »

Okay, after some messing around myself, I'll recreate this mod. Took me about 10 minutes to create the minimap in the editor. I can save everything as a prefab and then reimport and set it up properly via code.

I think the dev of this mod created the editor version, but probably didn't get to or figure out how to import all the components and set them up using the mod injection system.
My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 853
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [Mod] Minimap WIP

Post by l3lessed »

Okay, officially solved. Once I figured out how the camera, render texture, and canvas UI raw image texture worked together, I was able to setup a minimap camera above the player, push that into the render texture using the camera's target texture, then created and tied that to a canvas raw image space so it can be overlayed and texturized how we wish using alpha layers and a custom border texture.

The Camera and canvas are pretty easy to get in, since they can be setup in the editor and imported as prefabs. The tricky part was the render texture object cannot be imported as a prefab like the camera and the canvas/raw image, so that has to be made on the fly by code when the mod starts. Thankfully, the code is pretty simple to set it up and create it.

One small bug I need to work out. Because I am importing a new canvas space to get the raw image setup, it is duplicating the console. The console is already part of the canvas space, so I think when I create a new canvas, it also recreates the console yet again. I'm trying now to grab the duplicate console and just delete it out using unity Destroy object. Once that is done, I can post a simple basic version for now. Just a square minimap in the corner that follows you. No need GUI outline or mask layer to round/shape it. That is next.
My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 853
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [Mod] Minimap WIP

Post by l3lessed »

Okay, console duplicate removed, camera height offset to give a good down view of houses, but 2d sprites don't show to great because of their flatness. I'm also unsure how much this will impact heavy build performances, especially with 3d trees, seeing as this sets up a whole second render camera and continual updates it. Hopefully, going through the proper render texture and canvas system helps with this.

It only took 71 lines of code and 2 prefabs.

I'll post up a basic version in next few days.
My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 853
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [Mod] Minimap WIP

Post by l3lessed »

Ran it on a base dfu build and it works. Camera needs tweaking, hud positioning needs changed some, and some hot keys added for zoom and enable/disable. Then on to shaping it and adding some type of basic border.

Also, found how to get it to work indoors too. How do you easily detect when a player is indoors versus outdoors?

Might create an immersive version too.

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 853
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [Mod] Minimap WIP

Post by l3lessed »

Okay, I have officially setup the alpha mask layer to allow custom shaped minimaps easily by merely changing the mask .png shape. This should also allow, at some point, transparency options. So, now we have a fill alpha masked, modern minimap. This required manually importing the png mask texture from the streaming assets folder, grabbing the Raw Image property from the minimap Canvas object, and then pushing the mask png texture into the raw image texture property. As I thought, there is no way of doing this straight through the editor and prefabs.

The last thing I need to setup is the resize, zoom in/out in the minimap, and disable/enable inputs. I also found that turning the camera angle by 5 degrees allows you to see the tree sprites better; It still isn't the best since it is only a 5 degree angle offset, but at least you can see the flat sprite now that cast the tree shadows.

Last thing I need to do is setup a way to check if the player is inside and change the properties to display inside maps properly; they require a much different zoom ratio or it zooms so far out that it isn't usable indoors.

I'm going to get in some basic key inputs for controls and then release.

Can someone create me a nice HD and classic round minimap border that would fit into the game? This is the last thing I need for those who want a border for their minimap.
Last edited by l3lessed on Fri Apr 30, 2021 10:52 pm, edited 1 time in total.
My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

BansheeXYZ
Posts: 556
Joined: Fri Oct 23, 2015 8:19 pm

Re: [Mod] Minimap WIP

Post by BansheeXYZ »

Again, something that only shows what's immediately around you is of no help. You're already looking at most of what it shows.

We need to overlay city map quadrants or something like this.
minimapquads9.png
minimapquads9.png (1.21 MiB) Viewed 118 times

l3lessed
Posts: 853
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [Mod] Minimap WIP

Post by l3lessed »

Banshee, no offense, but that isn't really helpful. As I said, that video was the first pass. I literally got it in and made the video without any further changes. As I stated, the camera and everything needed fixed. It was a proof of concept video.

A camera minimap is very different then DF's built in GUI overlay map.

DFU overhead map as a overlay minimap would require allot to get going. First, you need to setup the UI object using the built in daggerfall UI system. You would then have to pull the overlay map from the daggerfall UI system(if it is even acessible), push it to the UI minimap overlay object, and setup a hooked update cycle with both the minimap UI object and the Daggerfall UI map. I'm unsure if it is even possible currently. I would have to look at the daggerfall map system and code to see.

Now, here is the newest version.



I hear you. Having the color indication for building types, like using the original overlay map, would make it far more useful. But, that is a whole differing beast, I may or may not look at. As of now, you have this minimap you can customize view and size wise to your hearts desires.

The last thing I need to do is put in a switch for being indoors that changes the view settings to work properly indoors.
My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply