Download

Journeyman's Minimap - Code Plugin for Minimaps and Fog of War

[USER=“23394”]Zhi Kang Shao[/USER]
Supposing you have a big map, say a continent, which contain several zones…:
What would be the approach switch between looking at the whole continent and looking at the zone you are currently in?
Think similarly to WoW and any other mmo.

My idea is kinda like having multiple MapBackgrounds on different zones and “SOMEHOW” and just switching the views on the big map. Is this possible? (like selectnig a specific mapbackground to render)

edit:
nevermind, just did it…
ps: support seems to be… quite slow

Really need this to be updated to 4.24 please.

I’ve submitted the update on Dec 26th. :slight_smile: Not sure why it didn’t come through yet, perhaps it needs some manual processing by marketplace staff.

Expectations on 4.25 support?

I am using 4.25. I added the minimap to my UMG HUD, and both the map view and map icon to my player character, however, the map is all black except for the icon. Have tried everything I can think of, but I’m new and a bit lost. Any ideas?

UPDATE:
Got it working. I misunderstood the docs. I thought you could just put the component on the player and it would work, but nope, you have also at least put the background actor in the level and then I have it use the player HUD so that the so that it tracks with them.

Hi,

I’m looking for a way to extend the fog of war beyond the defined bounds so it covers the whole map, and not just the bounded area. Right now I have my island covered, but the user can move the camera to a point where the fog stops, and the opacity suddenly changes.

The simple solution would be to increase the bounds of the fog to cover a larger area, but the area I’m covering is already very large, and the bigger the bounds are, the more jagged the edges become (I’m also trying to keep the fog render size small, currently 512x512). As such, I’d just like to do it in the Post Process instead.

Any thoughts on how this could be done easily?

Hi [USER=“23394”]Zhi Kang Shao[/USER] ,
maybe you remember, we worked on Our Ghosts of War for a short period, when I decided to use your plugin for my own RTS project…
I finally added it :slight_smile: and have the following experiences:

  1. The Minimap
  • It works great, no performance drop at all, really game ready out of the box!

  • For increased C++ usage, I had to comment out “protected:” at MapIconComponent.h at line 250, because I need to keep bHideOwnerInsideFog = false for my buildings, but need to set it true for my group of units. Imo better not to restrict access of properties by protected/private too much…

  1. The FoW

I had a couple of serious performance issues, because I have approx 500 moving units in my game and a few hundred buildings too, so first I was really in panic… :frowning:
Luckily, I was able to normalize it :slight_smile:

  • The 1st is really game specific, just a hint for other users : I do not use MapRevealerComponent for my units, instead one component per group of units. (I have a unit group/formation system)

  • I added this line to MapFog.cpp constructor, helps a lot, but results in a sawtooth GPU load:
    PrimaryActorTick.TickInterval = 0.25f;

  • In MapFog.h I increased this value, less responsive, but also results in a huge performance increase (it is also “protected”, no idea why):
    float FogCacheLifetime = 0.5f;

  • Maybe it would be more handy to follow UE4 coding conventions, namely the default values in UE4 are normally set in the cpp file in the constructor, for me at least… :wink:

  • In the MinimapExample project, in FogDemo map, please ungroup the actors, it is impossible to access the component settings otherwise… Imo important for less experienced users.

And a question:
Would it be possible somehow to use more render targets, to spread the update over more frames, to increase update smoothness?

A few screenshots from my test-bed project, with and without FoW, check StatUnitGraph for the sawtooth shape in case of FoW:

https://i.postimg.cc/XrtZN2fn/Screen-Shot00027.png

https://i.postimg.cc/1nQfwf7T/Screen-Shot00029.png

As a summary, it is a really great plugin. codes are clear, made well, that worths the money, even if I bought it when was discounted :slight_smile:

Best regards,
Ivan

how to drag map? when i use mouse wheel axis to change zoom it has error , but i use button to change i safe,

Hello, My game can not finish to load UMapFunctionLibrary if I choose “Use Io Store” in packing sections. Do you have any suggestion, thx

Hi there, thank you so much for the great plugin! Is there going to be a 4.27 update soon? Our project depends on your plugin and we really need a bugfix in 4.27 :slight_smile:

Hi,

This is not working at all.

First, the declaration TArray<FLinearColor>& OutputBuffer; creates an error 'OutputBuffer': references must be initialized.

Second, I assume the ampersand is an error, and that it should just be a normal array that gets taken by reference by the ReadLinearColorPixels function. But when I declare the variable as TArray<FLinearColor> OutputBuffer;, the problem is that when I call TextureResources->ReadLinearColorPixels(OutputBuffer), the function is returning “true” (which means something should be in the array), but OutputBuffer is still empty. What do I need to do here to get something in the output buffer?

OK, I think I solved one problem but now have another.

I figured out the problem with creating the array – there is some delay in ReadLinearColorPixels modifying the OutputBuffer, so the OutputBuffer needs to be a reference to an array that is outside the scope and won’t get destroyed once the reference is no longer in scope. Fine.

But now, I have an issue with writing the color array into the fog render target, and it relates to two problems with Zhi_Kang_Shao’s code for writing the array into the render target. First, he has the following line:

FMemory::Memcpy(MipData, PixelData.GetData(), DataSize);

However, PixelData is undefined, so I get an error.

Second, although he defines InputBuffer, the InputBuffer reference never gets used in his code. I suspect that he’s missing a line of code somewhere that converts the InputBuffer into whatever “PixelData” is, but I don’t know what class PixelData is supposed to be or how to convert the InputBuffer to that. But maybe I’m wrong about that. Either way, PixelData is undefined, and InputBuffer doesn’t get used.

Help!

EDIT:
So, apparently “PixelData” should be “InputBuffer.” I finally got it sorted out. Time to put this in my real game rather than just the test project I set up to play with this plugin.

One important note to anyone implementing a save feature on the fog of war: The code posted by the developer relies on reading and writing to a referenced array of FLinearColors. The functions that do that work in the rendering thread, so that process is going to lag your game thread. If you are saving and loading in the game thread, you are going to be using that array before the rendering thread modifies it, so you will be saving or loading an empty array. The solution I came up with is to call FlushRenderingCommands() after you try to fill the array but before you do anything with that array. That will pause the game thread while the rendering thread catches up. Maybe there’s a better solution, but that one seemed to work for me.

Overall, this is a great plugin; thanks!

I’m concerned that I’m typing into a black hole since this thread doesn’t appear to be monitored. I’ll give it a try anyway:

When I add a MapIconComponent to my character and enable Icon Interactable, the tooltip shows not only my Icon Tooltip Text but also a white box. I can’t find the code that is creating this box. Where do I find it, and how do I disable it (or at least edit it)?!

White box in tooltip

EDIT: It turns out that, when hovering, the plugin changes the cursor to the crosshair cursor. I had modified that cursor to do something other than be a crosshair, and so the white box relates to the modified cursor. Problem solved.