Select and move in game

I’m trying to make a game in wich I can select one or multiple NPCs and then click in any place int the map and they will move there, but I don’t have any idea of how to make it. does anyone have some tutorial or tip that can help me?

Hey there @Nilo_Can! Welcome to the community! So I have a tutorial series here from Ryan Laley about creating an RTS! If you’re making an RTS it’d be best to start from episode 1 where he goes over setting up the camera.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

However if you just want to get to selecting units this episode and the next has you covered:

Hey @SupportiveEntity will these tutorials work in Unreal Engine 5? Also curious about Unreal Engine limitations in regard to agent count. Since some Rts games have lots of units. Like how SC2 can have up to 2000 units in an 8 player game. Can the engine handle numbers like that or are networking adjustments necessary?

@Hellishcaos In short unreal isn’t setup to work with RTS games out of the box. The ex devs of sc2 making an rts in UE5 basically wrote their own backend networking solution to get something of larger scale.

Future implementations of mass ai might help but there stilll is the problem of base actor classes being rather heavy. It would need some massive optimizations from a skinning standpoint to have thousands of units on-screen.
Perhaps vertex animations could save you some overhead but you still have pathfinding to deal with.
Rama not long ago demonstrated a custom built multi-threaded ai path-finding solution that would work well with rts games, so I guess you would need similar tech.

The main question would be if you would go with normal networking or a lockstep solution.
Unreals networking would be too much overhead for anything with many units.

Alright that gives me something to work with. Do you happen to know any coding tutorials Or heck, even stuff on the topic of Lockstepping and perhaps some stuff on optimizations that could help to handle the load?

In my case I feel the lockstepping solution would likely be preferable, though that still leaves the question of data transference between multiple players. But we take things step by step lol.

And thank you for your expertise as well.

Well for many units flow fields seem the way to go from an optimization route. This could probably be calculated on a separate thread (using FRunnable)

You would need a clone of the terrain info (what vector where in x and y) as you cant access the game world in parallel operations.

As for lockstep you would need to use full deterministic math for all calculations to not get rounding errors that could cause desync. (Just a theory not an expert on lockstep implementations)

Someone has already implemented lockstep into UE4 but it’s probably a private project

1 Like

That get’s a good bit deeper. Raven went over more than I would have in this case, but UE isn’t really built for massive entity networking and the system for data oriented games (MASS) is still being built, so you’d have to handle most of the networking entirely custom for something of that scale. Lockstep would be the best move at huge scales, and Raven went into that already.

With baseline replication you’ll start running into scale issues relatively quickly with more than a thousand fully replicated actors needing to be relevant at once. That said if you’re clever with the replication system you could make it work for something smaller like CNC, Company of Heroes, or Iron harvest.

1 Like