npruehs / ue4-rts

Real-time strategy plugin and showcase for Unreal Engine 4.
MIT License
747 stars 151 forks source link

Fog of War #148

Closed Zimbo1786 closed 3 years ago

Zimbo1786 commented 3 years ago

Hi @npruehs ,

Not sure if a bug or if there is something I am missing, but have been looking into the Fog of War and there are two things I have noticed:

  1. Even if the Fog of War state is set to "Unknown", I can hover over the enemy team and can see where buildings and units are as the hover effects (like health) pop up through the fog as shown below:

image

I imagine this may have to be a flag or check in the hover mode of the selectable component to see if it's owned or not?

  1. Once explored where the enemy team are, I move my character back to my base (and the Fog of War state goes from "Visible" to "Known") for the enemy team, I can still see the enemy character moving in its idle animation as shown below:

image

I've had a look through the code for the VisibleComponent and looking through it, I can see content for around self-owned actors and team actors, but no enemy actors - does this mean we have to add them?

Thanks.

coolyoshi commented 3 years ago

For issue #1, does it happen every time? I noticed similar issue but only happens sometimes for me.

Zimbo1786 commented 3 years ago

Hi @coolyoshi,

Every time for me. I have also tested where I don't hover over, but press the "Alt" button (which is the hotkey I have set to show the healthbars) and the enemy healthbars appear even in the "Visible_Unknown" state.

npruehs commented 3 years ago

I'm looking into this right now. Can you share a few details about your setup, e.g. standalone, listen or dedicated server?

Zimbo1786 commented 3 years ago

Hi @npruehs,

Thanks for replying - I am on a standalone setup. image

npruehs commented 3 years ago

Hey @Zimbo1786,

thanks again for bringing this up. As for your first issue, there were two bugs in the plugin, actually. I've fixed these in 01b1dfe51e73a41fdc04c0f320ce796a2aa4f9f8 and 1fc4dfe48826b51acca87ab2c36e2d003c8da584.

As for your second issue, can you confirm you've unchecked "Don't Hide After Seen" in the RTSVisible component of your characters?

image

Zimbo1786 commented 3 years ago

Hi @npruehs,

No worries - thanks for addressing so quickly. With the commits, I can confirm that not only are the healthbars not showing (either through hovering or through the "Alt" keyboard button, but the character is now hidden when it is "Known". The building has the "Don't Hide after seen" checkbox ticked and still remains in view with the "Known" fog, but the character does not have the checkbox ticked and is hidden as shown below.

  1. Character next to building and other character image

  2. Character has moved away and visibility in area gone from "Visible" to "Known" image

The hover and selectable component elements still show up, but will take your logic that you have applied and see if I can try to put similar logic to hide them as well.

npruehs commented 3 years ago

I've fixed the selection effects in ed03fce7f6a242eb7021162b3a1a27c9d91cf15f.

I think whether or not to show hover effects for partially visible units is debatable. For instance, in games like StarCraft II, you'd probably still want to show a rotating dashed circle around hovered mineral patches in fog of war.

Zimbo1786 commented 3 years ago

Hi @npruehs,

Agree that it should be an optional thing as some games use it and others don’t. Thanks for fixing so quickly and showing the commit.

I’ll close this off and others can reference if needed.