Page MenuHomeWildfire Games

Adds a LOS mask to Minimap
Needs ReviewPublic

Authored by vladislavbelov on Aug 24 2019, 12:49 AM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

With the patch and enabled mask (mask="true") all black areas on minimap are transparent, or semi-transparent for explored but not visible areas. It means that minimap is circular now. And someone may put any texture under the minimap (dark paper for example).

How it looks like without background:

With circular and semi-transparent background:

Test Plan
  1. Apply the patch and compile the game
  2. Make sure that minimap looks the same for GLSL on/off with disabled mask
  3. Make sure that minimap looks ok for GLSL on/off with enabled mask
  4. Make sure that there is not significant performance drop

Event Timeline

vladislavbelov edited the summary of this revision. (Show Details)Aug 24 2019, 1:02 AM
vladislavbelov edited the summary of this revision. (Show Details)
vladislavbelov edited the test plan for this revision. (Show Details)

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/ps/CStrInternStatic.h
|   1| /*·Copyright·(C)·2014·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2014"
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/462/display/redirect

Stan added a subscriber: Stan.EditedAug 26 2019, 6:02 PM

Maybe the mask option could be a setting so that users can hide the minimap as well ? Eventually triggered by a hotkey.

Can you make the inner circle not transparent, only the borders ?

source/gui/MiniMap.cpp
453 ↗(On Diff #9462)

Maybe you could call this only once for this line and line 486

495 ↗(On Diff #9462)

Is it still a quad ?

In D2216#92637, @Stan wrote:

Maybe the mask option could be a setting so that users can hide the minimap as well ? Eventually triggered by a hotkey.

I suppose it's possible by the regular hidden setting.

Can you make the inner circle not transparent, only the borders ?

I can, but I think the current version is more flexible. As it doesn't depend on the real map shape. Technically we have only square maps, but with circular LOS and collision detection.

source/gui/MiniMap.cpp
453 ↗(On Diff #9462)

GetMinimapTextureMatrix returns const CMatrix3D* to the owned matrix. So it doesn't make much sense to use a separate variable. Because here we have a modification, so we need a copy, and there we don't need it, as we dereference it to const CMatrix3D&.

495 ↗(On Diff #9462)

Yes.

Nescio added a subscriber: Nescio.Aug 26 2019, 6:50 PM

This looks great!

Can you make the inner circle not transparent, only the borders ?

Just let the gui session files use a circular png.

In D2216#92650, @Nescio wrote:

Just let the gui session files use a circular png.

Yeah, with the patch you're able to use whatever background you want. Because everything is transparent except visible by LOS areas.

elexis added a subscriber: elexis.Aug 26 2019, 7:16 PM

I suppose the GetSetting call is as cheap as a member bool, and it allows that one doesn't have to implement HandleMessage, case GUIM_SETTINGS_UPDATED (otherwise one couldn't change the setting value from JS, we had this problem sometimes for some settings).

Tested the patch quickly, would be good to have the markup to produce the second screenshot presented in case you still have that code. (Or should I see the second screenshot when applying the patch? From reading the code it doesn't look like it.)
(I tried changing this to sprite="stretched:session/portraits/structures/library_scroll.png", which results in LOS not shown, I didn't experiment further)

Technically we have only square maps, but with circular LOS and collision detection.

There are also some square maps, the Corsica ones for instance. (I always wondered if one really wanted to drop support for both map formats. Otherwise one can obtain also the mapshape from the GUIInterface and code two different UIs, the old one for square and a new one for circular, depending on enthusiasm)

(Also the code doesn't have glaring style mistakes)

source/gui/MiniMap.cpp
429 ↗(On Diff #9462)

(const bool useLosAsMask = GetSetting<bool>("mask"); following r22789)

source/ps/CStrInternStatic.h
1

time is running

In D2216#92655, @elexis wrote:

Tested the patch quickly, would be good to have the markup to produce the second screenshot presented in case you still have that code. (Or should I see the second screenshot when applying the patch? From reading the code it doesn't look like it.)
(I tried changing this to sprite="stretched:session/portraits/structures/library_scroll.png", which results in LOS not shown, I didn't experiment further)

Ok, I'll attack a sample.

There are also some square maps, the Corsica ones for instance. (I always wondered if one really wanted to drop support for both map formats. Otherwise one can obtain also the mapshape from the GUIInterface and code two different UIs, the old one for square and a new one for circular, depending on enthusiasm)

The patch doesn't drop square maps, because square map are scaled to fit into the circle GUI.

This would be a nice addition. @vladislavbelov have you looked at @nani s mod? Autociv recent version has enlarging minimap that would be a useful addition too.

This would be a nice addition. @vladislavbelov have you looked at @nani s mod? Autociv recent version has enlarging minimap that would be a useful addition too.

I haven't seen the enlarging minimap yet, but the patch should work with it correctly.

@vladislavbelov this patch is not tested, yet? maybe @Imarok @wraitii and @gameboy might help. btw i am talking about minimap expand https://wildfiregames.com/forum/index.php?/topic/24649-autociv-mod-0ad-enhancer/page/4/ from @nani mod.

Stan updated this revision to Diff 12310.Jun 14 2020, 4:07 PM

Attempt at rebase, it compiles but doesn't work.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2434/display/redirect

Stan added a comment.Jun 14 2020, 4:23 PM

After rebase works fine for me.

gameboy added a comment.EditedJun 16 2020, 2:12 PM

@asterix My friend, have you solved this problem? Is this patch ready to launch?

Nescio removed a subscriber: Nescio.Jun 16 2020, 6:37 PM