Live data from Hacker News

Age of Empires Definitive Edition's pathing and movement

richg42.blogspot.com

41–50 of 94 posts

Re: Age of Empires Definitive Edition's pathing and movement

#42

Something has puzzled me about pathfinding in games. There is a well-known algorithm[1] for finding an optimal path: you start at the destination, assign that a cost of 0, make a queue from the points that can reach it directly, compute for each of those points the minimum "cost of directly reaching a marked point + cost written on the marked point", and then, while the queue is nonempty, taking the point with the ch…

'Perfect pathfinding' sucks with swarms. The first unit gets to the choke point; the rest about-face and start marching off the long way around the forest (because that's now the shortest path with the primary path blocked). Happened all the time in Warcraft I, and was astonishingly annoying.

Re: Age of Empires Definitive Edition's pathing and movement

#43
post #32
post #6

>DE's pathing system's findPath() function was speeded up by approx 3-4x faster vs. Age1's How would that make any impact at all given that the game ran just fine on 1997 hardware?

The fact that you don't need to optimize something doesn't mean you shouldn't.

It does, actually. At least don't do it on my dime. Obviously learning is another ballgame.

Re: Age of Empires Definitive Edition's pathing and movement

#44
post #6

>DE's pathing system's findPath() function was speeded up by approx 3-4x faster vs. Age1's How would that make any impact at all given that the game ran just fine on 1997 hardware?

They also increased the iteration time to search for more complex paths, so I’m sure this helps with that.

Re: Age of Empires Definitive Edition's pathing and movement

#45

Something has puzzled me about pathfinding in games. There is a well-known algorithm[1] for finding an optimal path: you start at the destination, assign that a cost of 0, make a queue from the points that can reach it directly, compute for each of those points the minimum "cost of directly reaching a marked point + cost written on the marked point", and then, while the queue is nonempty, taking the point with the ch…

'Perfect pathfinding' sucks with swarms. The first unit gets to the choke point; the rest about-face and start marching off the long way around the forest (because that's now the shortest path with the primary path blocked). Happened all the time in Warcraft I, and was astonishingly annoying.

Yes, pathfinding is different than path following. That is, finding an optimal path is one problem, and having units follow that path in a dynamic world while reacting accordingly is something else entirely.

Re: Age of Empires Definitive Edition's pathing and movement

#47

Talk about a thankless job! That's an extensive list of bugs and working on someone else's (very old) playground is incredibly difficult.

I imagine its more of a passion project. If I had free time, I would love to delve into the internals of the game that I played so many times as a kid.

Side note: Age of Empires 2 was the first computer game that got me truly hooked on to computers. I was never interested in the shoot em ups, but a strategy game, with such gorgeous graphics (for the time) and compelling semi-historical storyline... it was enchanting!

Re: Age of Empires Definitive Edition's pathing and movement

#48
post #32
post #6

>DE's pathing system's findPath() function was speeded up by approx 3-4x faster vs. Age1's How would that make any impact at all given that the game ran just fine on 1997 hardware?

The fact that you don't need to optimize something doesn't mean you shouldn't.

Avoiding premature optimization is one of the most important best practices of modern software development.

Re: Age of Empires Definitive Edition's pathing and movement

#49
post #4

I would've guessed that bad pathfinding in these old games was caused by very aggressive optimizations to improve performance but then the author starts off by saying: >DE's pathing system's findPath() function was speeded up by approx 3-4x faster vs. Age1's So the old code was just that bad? It's a bit odd, you'd expect such a critical piece of code in an RTS to be reasonably well written and optimized.

I'm mostly confused why the author bothered to do this. Age1 ran on computers that were, quite literally, one to two orders of magnitude slower than the ones this remake will run on, and as far as I remember nobody complained about performance issues. So why spend time (when the author argues they were time constrained) optimizing this part of the game for speed in particular?

I can totally understand the need for a rewrite given all else the author writes about the algorithm, but the focus on speed as the first-line item is kind of confusing.

Re: Age of Empires Definitive Edition's pathing and movement

#50

Something has puzzled me about pathfinding in games. There is a well-known algorithm[1] for finding an optimal path: you start at the destination, assign that a cost of 0, make a queue from the points that can reach it directly, compute for each of those points the minimum "cost of directly reaching a marked point + cost written on the marked point", and then, while the queue is nonempty, taking the point with the ch…

'Perfect pathfinding' sucks with swarms. The first unit gets to the choke point; the rest about-face and start marching off the long way around the forest (because that's now the shortest path with the primary path blocked). Happened all the time in Warcraft I, and was astonishingly annoying.

It seems like a harder problem than that as well - you might want some of the units in the back of the swarm to go the long way because they'd wait a long time at the choke.

But maybe you don't want to do that - those units in the back are squishy and need to stick with the units at the front of the choke.

But maybe that's ok - the alternative path isn't too far away and it's not a risky move to make.

Maybe that's too complicated. Probably best to make the swarm operate as if other moving units don't exist (to make pathing predictable) and let the player micromanage via waypoints/grouping.

Post reply on HN