PlaceholderGames / 2016-VnD_Game

2nd year computer games development group project
2 stars 0 forks source link

Highlighting the ant #38

Closed BojanStankovic closed 7 years ago

BojanStankovic commented 7 years ago

As we have a crosshair now it would be nice if we could highlight the selected ant with one color (red) and possibly highlight an ant looked at with another (glowing green)

BojanStankovic commented 7 years ago

I'll give this a go. Found few tutorials:

https://www.youtube.com/watch?v=IEHxjw6VEMQ https://www.youtube.com/watch?v=j8gjvKyaQuU

BojanStankovic commented 7 years ago

Well, a first attempt was a massive failure. After creating the material from the tutorial (because the sample content doesn't include it anymore) the only effect I was getting is this strange one:

image

Oh, and the material was reporting a compilation error. I will take more look into how to do this

napiorek commented 7 years ago

After building my map prototype I realized how crucial that highlighting is for our game. It would my massively helpful to know if the ant was highlighted or not.

If visual highlighting the ant turns out to be too difficult to implement, the way around it could be a sound effect as we already have a bool in BP is_highlighted.

BojanStankovic commented 7 years ago

That is 100% true and I will to come up with a way of doing it visually. In the meantime try to create a level as much as you can so we have something to show.

BojanStankovic commented 7 years ago

A simple ant highlight is enabled now, however once the ant is selected it doesn't get deselected when another and is selected. Current implementation is primarily for the development and testing purposes.

BojanStankovic commented 7 years ago

Also, be sure to checkout the branch "I38_Temporary_Ant_Highlighting" of you want to test it

elliotnaylor commented 7 years ago

Works perfectly! I also changed the speed of the ants and the speed the ants spawn (quick fix).

BojanStankovic commented 7 years ago

Tom helped with returning the original colour once the ant is not selected any more. Merged. Closing

BojanStankovic commented 7 years ago

I forgot that the outline for the ant being looked at is missing so I'm re-opening the issue. After an extensive search for the relevant instructions on how to do this I realized it is quite difficult for my level of knowledge so I asked a friend for some help. Thanks to Rodrigo there is now very good tutorial on this topic which can be checked out here: https://www.youtube.com/watch?v=rL7VUeZzRyQ

I added a small tweak in order to outline only the non-occluded meshes. Now it only remains to turn this effect on and off at the runtime.

BojanStankovic commented 7 years ago

Outlining of the ant is now turned on/off depending if the ant is looked at or not. Ready for the review and merging

napiorek commented 7 years ago

Tested the feature and it's great. It bring the whole new experience to the game and it will give the player greater control over the game/ants.

napiorek commented 7 years ago

Found the bug where once the ant is highlighted and activated ( let's say - its digging ) and you hover the cursor over this ant - all the other ants that run through it will be highlighted as they will stay highlighted.

Here is the rec

https://www.youtube.com/watch?v=3WdDpIkMnZQ&feature=youtu.be highlight bug

elliotnaylor commented 7 years ago

This comes under issue #44 as the ant shouldn't be highlighted after it's been used anyway. So once that is fixed this one will be as well

BojanStankovic commented 7 years ago

All of this is true, but I'm bug will still be present. It has to do with how an and stops being highlighted. I'll look into this and fix it.

ghost commented 7 years ago

I was going to add I've noticed the green highlighting bug, but you guys already noticed it.

BojanStankovic commented 7 years ago

I was trying to fix this for last two days but with no progress. The problem is that if two ants get outlined at the same time, only the last one being looked away from gets the outline removed.

I can't see how current logic could handle this. The only thing that comes to mind is to store the outlined ants in the array and on every tick check if they are still in the crosshair area. If they are not then its outline should be removed and the ant should be removed from that array as well. Let me know what do you guys think about this approach

EDIT: The reason why current logic cant handle it is because it doesn't differentiate between individual ants.

P.S. One more approach could be to remove all outlines on every tick first and then add only those that are in the crosshair area. Actually, this one seems promising, I'll give this a go now!

BojanStankovic commented 7 years ago

The last approach worked. This does bring some message log errors because the code is trying to set a boolean of sometimes non-existing objects. However, if I check for the existing object with the 'Is Valid' block it breaks the outlining feature.

For the time being I will leave the errors in and fix them at the later time.

The bug fix is part of the develop. Closing the issue. Any new bugs found regarding this should be reported in a separate issue