Unreal Engine 4 Tutorial - RTS Part 19: Enemy Units

preview_player
Показать описание

In this series we are creating the common mechanics found in RTS games, everything from unit selection, AI combat, and base building.

In Part 19 we setup our enemy units and the ability to attack them.

SUPPORT ME

PRIVATE 1-2-1 SESSIONS

JOIN THE COMMUNITY

FOLLOW ME
Рекомендации по теме
Комментарии
Автор

You do great tutorials and I hope you know that you are appreciated.

ceejay
Автор

Great tutorial! I have a minor issue. The soldier keep attacking even if I move to another place without enemy.

geoffrey
Автор

I am trying to make a game like steel division 2, where the visibility of the unit is also tied to multible other variables like size and camoflage. How exactly would you appoach it when an enemy unit walks towards a friendly unit, like how do they make each other known so that they can determin weather they have bin exposed? My idea would be a collider but considering that humans can see quite far the collider would have to be really big and thenn every house, tree, rock also would fill up the collision events making it unperformant?

pietpanzerpanzer
Автор

Okay my tree are already considered as enemy xD

Wouldn't it be more simple to set teams instead of a boolean, I mean enum based or int team id based switch ?

--

About the notify, I had troubles in the past using them. I don't like linking gameplay mecanics to the framerate, cause when you got a framerate that skip the notify, you just never trigger it.
My way to avoid that matter was to create a timer event that had the time value I wanted for the attack to trigger while the animation play. I kept using the notify for more visual events, like particle triggering, sounds, etc, but linking gameplay mecanics to it is wrong to me.

To make the timer simple to use, I made it with a curve if I remember well. But it would maybe be better to create a blackboard task, as we did for the collect, with parameters for the attack time etc.

--

I see you don't have your unit bouncing all arround when you place the building, how did you fix it ? Mine is still bouncing all arround whenever I got a building in build-mod passing on them.

Spetnaz
Автор

I'm sorry I know this is a old series but once I start attacking enemies I can't stop attacking them, I can't switch to other enemies. Any idea why?

trainedcatsmuggler
Автор

Found an issue xD, actually you can hit your own units.

Just added a "and not player unit" on the branch with the right click on actor. But will be better to check, later, "if enemy" with some diplomacy team related mecanics.

I also got another issue, but I can't figre out where it comes from, either from my code or your code, right now my worker units collect with infinite range, I think I broke something on my ai behavior I'll check that tomorrow.

EDIT:
- I found where the issue was for the collect with infinite range. Well, I don't understand the issue, but I found it.

The issue came from the unit I used, I made a new worker unit without making the begin play stuff we made on the one in the tutorial, and the update widgetframe too, and had no widget at all. By adding the code we made and the widget, now it moves correctly to the collectable actor before starting to collect.

Spetnaz
Автор

So at 12:20, do you have to make an event tree for each unit if they have different attack animations?

armchairgeneral