Page 6 of 6

Re: [Mod] Minimap WIP

Posted: Mon May 03, 2021 9:38 pm
by l3lessed
No, there is no direct way to use the automap and have it update too.

The automap outside is completely created from scratch as it's own mesh that is placed under the ground/out of site. From there, when ever you open the minimap, it runs through a ton of code to compute everything and rebuild the mesh, and then creates the render texture, the automap camera that shoots its viewpoint to the render texture, and then renders it on your display and pauses the game to stop any bugs with cameras while in automap.

The automap inside uses the 3d model of the interior, but the moment you enable it without pausing, it causes the player to start flying into the black void. This again is because of how the camera system creates and assigns a second camera of automapping. So, because it isn't paused, it causes tons of camera/player bugs.

Point being, because the render texture and camera are created on the fly, when the map is opened, I cannot use either of those properties/objects. I also I can't continually push the automap update without causing more movement bugs/issues. I just tried, and pushing it with pausing off causes the player to lock in places, since now you're tied to the automap camera and not main camera.

For the NPC idea, that makes perfect sense, and what I was thinking. I didn't know where to look for the NPC data, but I'll starting digging into streaming assets.

As for the buildings, I am so close. I only need to get the RMB Block position property, so I can know where the specific exterior block is in the unity world space coordinate system. Anyone else have any ideas on how to get the block position or, if there is a method to get the building position data translated into the unity 3d space position? I've been digging through the block generation data, and I have got all the way to being able to grab all buildings in a block, grab all exterior blocks around me, filter for only special buildings like taverns, and pull building position within the block. I just can't figure out how the RMB block ulong positions are being translated into unity 3d space positions for placement. I've tried copying a number of position formulas within the differing model placement scripts, but I'm still not finding the correct output/ way to do this.

Re: [Mod] Minimap WIP

Posted: Mon May 03, 2021 11:35 pm
by l3lessed
Okay, npc dots are in. I need to optimize it, so it only adds the gui indicator mesh to the npc one time.

The easiest way I found to do this was grab all the transforms from the building directory of the area; This is mislabelled, as it grabs anything with a transform, not only buildings, within the single location you're inn.

I then use a for each to loop through the transforms and only grab objects with a collider capsule (AKA mobile npcs), then I create the sphere, set the materials, and set the npcs capsule collider as the parent transform.

Also, when you set a transform parent, make sure to turn worldPositionStays property to false in the SetParent method. If you do not, the engine won't understand the custom DFU world space and will move it every where and mess it up.

Now comes the harder parts. I need a system to track npcs so dead/destroyed npc objects have their spheres removed and ensure all new npcs only get 1 minimap mesh assigned to their capsule.

Now, if I can just sort out the building issue, the basic coding issues with creating a fully functional minimap, with NPC and building GUI, will be done. At that point, it is just cleaning, refactoring code and adding any needed smaller features, like gui controls.

I still need to find a way to handle grabbing building models 3d space location. Maybe I should see if I can transform the block into a game object and grab its position that way? I don't know at this point, so I'll keep throwing code at the wall until something sticks.

Re: [Mod] Minimap WIP

Posted: Tue May 04, 2021 1:24 am
by l3lessed
Okay, here it is with indicators for all npc types(villagers, flats, and mobile enemy npcs, like guards, rats, bandits and so on).

Also, each npc type has its own color to easily indicate what is what if things start getting hectic npc wise.

Ignore the bug, where the player indicator disappears in the end of the video. I fixed it.

Now, just to figure out this building position issue.