Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #91
    Plugin files for UE4.15, 4.16 and 4.17 have received an update.

    The update is available via the launcher! It adds the following features.



    Support for Mac
    Development and packaging have been tested on Mac. This new plugin update is confirmed to work with Mac and Mac is now listed as a supported platform for all engine versions.



    NEW: Icon categories
    Icons can now be assigned an icon category, for example "resource", "building", etc. Per minimap you can toggle the visibility of icon categories.

    How to use this feature:
    • On an actor's MapIconComponent, fill in a value in its IconCategory field.
    • On the MapViewComponent that defines the minimap's view area, access or change a category's visibility via IsIconCategoryVisible(..) / SetIconCategoryVisible(..)
    The icons will automatically update their visibility based on these settings. If you want other UI or world elements reacting to icon category visibility, the MapViewComponent fires an BP and C++ assignable event OnVisibleCategoriesChanged.

    Click image for larger version  Name:	icon_cat1.png Views:	1 Size:	132.9 KB ID:	1358070
    Click image for larger version  Name:	icon_cat2.png Views:	1 Size:	42.7 KB ID:	1358071


    NEW: Minimap box selection
    Minimap widgets now have an setting to enable box selection. If enabled, the user can click and drag on the minimap to draw a selection box. When the mouse is released, the minimap widget fires an event that supplies a list of icons that was inside the box selection. Only visible icons will be included in the list; icons hidden due to their visibility setting, category setting or fog of war won't be included. Additionally, the event supplies which mouse button was used and whether ctrl and/or shift was pressed when the box selection started.

    Click image for larger version  Name:	box_select3.png Views:	1 Size:	413.2 KB ID:	1358068

    Click image for larger version  Name:	box_select1.png Views:	1 Size:	33.9 KB ID:	1358069


    Click image for larger version  Name:	box_select2.png Views:	1 Size:	57.5 KB ID:	1358067


    Minimap events: LMB and RMB
    The existing Minimap widget event OnMapClicked and MapIconComponent event OnIconClicked now supply a boolean IsLeftMouseButton so that when those events fire, you know whether it was a left mouse or right mouse button click that fired it.



    Fix: Regenerated background not appearing correctly
    Fixed a bug that was causing the minimap to show a default texture (2x2 grid) after calling the MapBackground function RerenderBackground. This only affected projects in a top-down render was shown on the minimap and this render was refreshed in run-time.



    Hope you enjoy this update. Please consider leaving a rating or comment on the marketplace page.
    Last edited by Zhi Kang Shao; 09-22-2017, 06:51 AM.
    Journeyman's Minimap - Available on Marketplace - Forum topic - Video

    Comment


      #92
      I can get the location fine in multiplayer, but if I change the map icon color I can't access that value from the client of the other pawns. I want to show the players to be blue who are on the blue team and to show the red players who are on the red team. Zhi Kang Shao
      Last edited by Osok; 11-07-2017, 12:24 PM.
      Spline-Enabled Fence Pack - "Great pack, huge time-saver, top quality and enough variety to really make the assets unique." -Dark Acre Jack
      Destructible Road Signs - "Seriously awesome. Single blueprint for pretty much all the road signs you'll ever need." -thankstipscom
      Zipline/Teleporter/JumpPad - "This is a very flexible system for any project, and really simple to implement." -lunyBunny
      Wooden Storage Pack - "Very good high quality assets and well worth it." -Deathweave
      Digital Portfolio

      Comment


        #93
        Originally posted by Osok View Post
        I can get the location fine in multiplayer, but if I change the map icon color I can't access that value from the client of the other pawns. I want to show the players to be blue who are on the blue team and to show the red players who are on the red team. Zhi Kang Shao
        Hi Osok,

        Do you replicate a player's team ID already to all clients? What I suggest is let every client set the MapIcon's color. For example in C++:

        MyPawn.h:
        Code:
        UPROPERTY()
        UMapIconComponent* MapIcon;
        
        UPROPERTY(ReplicatedUsing=OnRep_TeamID)
        int32 TeamID;
        MyPawn.cpp:
        Code:
        void AMyPawn::OnRep_TeamID()
        {
            if (TeamID == 0)
                MapIcon->SetIconDrawColor(FLinearColor::Red);
            else
                MapIcon->SetIconDrawColor(FLinearColor::Blue);
        }
        Or in blueprint, whenever the team ID gets replicated (in the RepNotify function) call SetIconDrawColor function in blueprint. Hope that was clear! Let me know if you need more information.
        Journeyman's Minimap - Available on Marketplace - Forum topic - Video

        Comment


          #94
          Thank you, I had to use a repnotify
          Spline-Enabled Fence Pack - "Great pack, huge time-saver, top quality and enough variety to really make the assets unique." -Dark Acre Jack
          Destructible Road Signs - "Seriously awesome. Single blueprint for pretty much all the road signs you'll ever need." -thankstipscom
          Zipline/Teleporter/JumpPad - "This is a very flexible system for any project, and really simple to implement." -lunyBunny
          Wooden Storage Pack - "Very good high quality assets and well worth it." -Deathweave
          Digital Portfolio

          Comment


            #95
            Hi there, I just purchased this plugin and as someone who has been fussing with making my own, it's really great! Thanks! I'm working on a 2.5D sidescroller. I'm having a bit of trouble getting the minimap to work. I can't seem to get the map to follow the player in the Z axis. I had to do some tweaking to get the MM to work...nothing major, but here it is.
            MapBackground: Rotate in Y by -90 degrees. using render target for now, but I plan on drawing a simplified overlay.
            Mapview: parented to spring arm that drives the camera. Set the base yaw to -90 to rotate the map in the correct direction. Also had to move the mapview box to around 4500 in the X(Along with the icon for them to show as centered in the minimap.
            MapIcon: Also Parented to the Spring Arm and moved as stated above.

            I turned off rotation in everything because the background need not rotate. It would be cool if the player Icon did. Not sure how to achieve that without the map rotating.

            My character reavels along the Y axis and jumps along the Z.

            Right now, it seems that my only issue is the minimap not working in the Z axis.
            Any help on this would be appreciated!!!
            Last edited by fluxist8070; 11-15-2017, 11:46 PM.
            My Website | Kamodo Steve: Janitor on Fire | My Game on IndieDB | My Game on Steam Greenlight

            Comment


              #96
              Hi.
              Your minimap plugin looks great but I have two questions before buying:

              1. is there a buildin way to save and reload players progress to a game slot while using explorable for of war?
              2. I have levels which are randomly generated at runtime out of prebuild rooms/sublevels. Is there a way to use prebuild textures for those rooms/sublevels and use those for the minimap?

              Thanks,
              Lars

              Comment


                #97
                Originally posted by fluxist8070 View Post
                Hi there, I just purchased this plugin and as someone who has been fussing with making my own, it's really great! Thanks! I'm working on a 2.5D sidescroller. I'm having a bit of trouble getting the minimap to work. I can't seem to get the map to follow the player in the Z axis.
                Hi fluxist, unfortunately the minimap is made assuming top-down. This decision wasn't just to make my life easier, but also because some calculations can be simplified (thus more efficient) by making that assumption. For side scrolling, the modifications that you made are certainly in the right direction. However, to make the icons move correctly in Z, you must modify the way that the MapViewComponent C++ class calculates icon coordinates. Unfortunately I can't look at this right now. If you are savvy in C++, you may look at MapViewComponent::GetViewCoordinates yourself. Otherwise, since more people have requested this feature, I will take a look at it mid-January after the holiday season. I apologize for the wait for that (and for the delay in reply).

                Laurentius, I have responded to you in e-mail but for other people that have the same question I'll paste it here too.

                Originally posted by Laurentius View Post
                1. is there a buildin way to save and reload players progress to a game slot while using explorable for of war?
                If you work in a C++ project, you can grab the render target that stores what places are currently explored. You can then read or write the pixel into a 1D color array. That color array can be saved and loaded as part of the UE SaveGame or your custom save format. Below is a C++ snippet on how to do that. Unfortunately I don't know if all this functionality is exposed to blueprint.

                How to read fog render target into color array
                Code:
                UTextureRenderTarget2D* RenderTarget = MapFog->GetSourceFogRenderTarget();
                FTextureRenderTarget2DResource* TextureResource = (FTextureRenderTarget2DResource*) RenderTarget->Resource;
                
                TArray<FLinearColor>& OutputBuffer;
                TextureResource->ReadLinearColorPixels(OutputBuffer);
                How to write from color array into fog render target
                Code:
                TArray<FLinearColor>& InputBuffer = ...;
                UTextureRenderTarget2D* RenderTarget = MapFog->GetSourceFogRenderTarget();
                UCanvas* Canvas;
                FVector2D Size;
                FDrawToRenderTargetContext RenderContext;
                UKismetRenderingLibrary::BeginDrawCanvasToRenderTarget(GetOwner(), RenderTarget, Canvas, Size, RenderContext);
                if (Canvas)
                {
                // Put the loaded pixel data into a texture
                UTexture2D* ReconstructedTexture = UTexture2D::CreateTransient(RenderTarget->SizeX, RenderTarget->SizeY, PF_B8G8R8A8);
                uint8* MipData = (uint8*)ReconstructedTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
                const int32 DataSize = RenderTarget->SizeY * RenderTarget->SizeX * 4;
                FMemory::Memcpy(MipData, PixelData.GetData(), DataSize);
                ReconstructedTexture->PlatformData->Mips[0].BulkData.Unlock();
                ReconstructedTexture->PlatformData->NumSlices = 1;
                ReconstructedTexture->NeverStream = true;
                ReconstructedTexture->UpdateResource();
                
                // Draw the texture filling the entire canvas
                Canvas->K2_DrawTexture(ReconstructedTexture, FVector2D::ZeroVector, Size, FVector2D(0, 0), FVector2D(1, 1), FLinearColor::White, EBlendMode::BLEND_Opaque);
                }
                UKismetRenderingLibrary::EndDrawCanvasToRenderTarget(GetOwner(), RenderContext);
                Originally posted by Laurentius View Post
                2. I have levels which are randomly generated at runtime out of prebuild rooms/sublevels. Is there a way to use prebuild textures for those rooms/sublevels and use those for the minimap?
                Yes! What I would suggest for those kinds of rooms or sub levels is to dynamically spawn a MapBackground actor and make its bounds overlap those rooms/levels. Then you can assign your prebuilt textures to the MapBackground. Placing multiple MapBackgrounds to together form the minimap background is intentional and supported. You can then either:
                * Give the MapBackgrounds different priorities, for example an in-door background will show once you enter its volume while the outdoor background shows otherwise.
                * Or give the MapBackgrounds different Z-orders, meaning both will show at the same time and you can control which one shows on top.
                This forum post shows how that would work: https://forums.unrealengine.com/unre...014#post991014
                Last edited by Zhi Kang Shao; 11-25-2017, 07:07 AM.
                Journeyman's Minimap - Available on Marketplace - Forum topic - Video

                Comment


                  #98
                  Thanks for your answers.
                  I bought the plugin and integration is very easy - good job!

                  I'm currently using only blueprints for my game, so I can't use your c++ approach for saving and reloading the fog rendertarget. Maybe this feature could be made available via blueprint by the plugin, too?

                  While using the plugin two small problems are visible:
                  1. I have a single map where the minimap is rotated by -90 degree. All other maps are working good and north is where it should be. Maybe you have an idea what could go wrong here?

                  2. I use scaling for resizing multiple map backgrounds and fog on one map. But this makes aligning them very difficult, because the extent is a multiply of 1024. Is there a better way for resizing them than change the scale?

                  Other than that it works good - even with levels created at runtime.

                  Thanks,
                  Lars
                  Last edited by Laurentius; 12-02-2017, 10:35 AM.

                  Comment


                    #99
                    Originally posted by Laurentius View Post
                    1. I have a single map where the minimap is rotated by -90 degree. All other maps are working good and north is where it should be. Maybe you have an idea what could go wrong here?
                    I found out that the initial rotation of the PlayerStart was influencing the rotation of the minimap - weired behavior, but at least I found out about it.

                    Comment


                      Originally posted by Zhi Kang Shao View Post
                      If you work in a C++ project, you can grab the render target that stores what places are currently explored. You can then read or write the pixel into a 1D color array. That color array can be saved and loaded as part of the UE SaveGame or your custom save format. Below is a C++ snippet on how to do that. Unfortunately I don't know if all this functionality is exposed to blueprint.
                      So I got my hands wet in C++ and heired from the MapFog class and extended it for blueprint nodes for reading/writing a pixel array in order to make the fog(s) serializable via blueprint.
                      All is good now but I had to make some modifications to the code as the PixelFormat was different:
                      Code:
                      UTexture2D* ReconstructedTexture = UTexture2D::CreateTransient(RenderTarget->SizeX, RenderTarget->SizeY, PF_A32B32G32R32F);
                      uint8* MipData = (uint8*)ReconstructedTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
                      const int32 DataSize = RenderTarget->SizeY * RenderTarget->SizeX * 4 * 4;
                      And I changed "GetOwner()" to "this" as "GetOwner()" is always null (at least in my environment).

                      I'm quite happy with this solution as I can now serialize the fog with my save level and use blueprints for this.

                      Comment



                        Hi fluxist, unfortunately the minimap is made assuming top-down. This decision wasn't just to make my life easier, but also because some calculations can be simplified (thus more efficient) by making that assumption. For side scrolling, the modifications that you made are certainly in the right direction. However, to make the icons move correctly in Z, you must modify the way that the MapViewComponent C++ class calculates icon coordinates. Unfortunately I can't look at this right now. If you are savvy in C++, you may look at MapViewComponent::GetViewCoordinates yourself. Otherwise, since more people have requested this feature, I will take a look at it mid-January after the holiday season. I apologize for the wait for that (and for the delay in reply).
                        I'm not savvy in C++. I'm savvy in C#, so maybe I can figure it out. I'd like to be able to see the icons over actors and be able to draw a graphic minimap and use the full screen map feature. I see you won't be able to get to this for a while. If you could help me out, that would be great!
                        My Website | Kamodo Steve: Janitor on Fire | My Game on IndieDB | My Game on Steam Greenlight

                        Comment


                          Hi ,
                          I've just bought this plugin.After add the plugin to several newly-created projects(such as TPS Template\ Top-Down Template) and try to start them on my android device, all of them got packaged failed or app crashed...I'm working with UE4.15, and all other projects can be packaged and deployed successfully. ,pls help...~

                          Code:
                          LogPlayLevel: adb: 01-21 13:40:05.268 26068 26148 D UE4 : [2018.01.21-05.40.05:268][ 0]Assertion failed: Assertion failed: bCreatingCDO || !InOuter || InOuter->IsA(InClass->ClassWithin) [File:D:\Build\++UE4+Release-4.15+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2317]
                          LogPlayLevel: adb: 01-21 13:40:05.268 26068 26148 D UE4 :
                          LogPlayLevel: adb: 01-21 13:40:05.278 26068 26148 D UE4 : [2018.01.21-05.40.05:278][ 0]LogWindows: FAndroidMisc::RequestExit(1)

                          Comment


                            In UE4.18 this isn't quite working for me. I've added a minimap to my UMG hud, and set it to show up on begin play. I added a map icon and map view to my player character and this shows up on screen at the center, but I added a map icon to an actor in the world and it doesn't show but the objective arrow does show and seems to point to the right location. Also I can't for the life of me get the background to be anything other than black. It used to be pretty much drag and drop in 4.15. I emailed you for support a few days ago but didn't get a reply. Also the example project won't build in 4.18.
                            Last edited by TorQueMoD; 02-03-2018, 10:54 PM.
                            -TorQueMoD
                            www.torquemod.com

                            Comment


                              Hi everyone,

                              I apologize for the slow support this and last month. My contract work is currently demanding all of my attention. Please know that I intend to gather and process all feedback I've received.

                              I updated the example project, which was compatible with 4.15-4.17 but not 4.18. The example project now targets UE 4.18 and in the future I'll keep it updated to the newest engine version.
                              Journeyman's Minimap - Available on Marketplace - Forum topic - Video

                              Comment


                                Hello any updates? It's been a month.

                                Comment

                                Working...
                                X