Avoiding moving units

posted in DreamLand editor
Published January 25, 2024
Advertisement

Another video, this time 1 vs 1 collision when pathfinding is required. There is a bit of overlapping there I think I should disable walking in diagonals if walking takes place near obstacles.

https://youtube.com/shorts/mQCkUjTGzJs?feature=share

Arriving safe and sound at the destination

Now that the problem of avoiding collisions is solved more or less it`s time to work on the next problem: arriving at the destination. A pathfinding algorithm demo usually needs a start position and an end position both of which you fill in by hand. In a game the notion of destination is blurry you dont have a destination with clear coordinates straight away. First of all the destination is decided at runtime, secondly usually you have to arrive at the edge of something, something can be a HQ, a resource patch, a construction site. Moving combat units poses similar challenges.

Previous Entry collision avoidance
Next Entry Patrol
0 likes 2 comments

Comments

JoeJ

If you allow only right angles, the behavior would look long winded and not natural.

You could try to detect a potential future collision earlier, like not just one but two or three tiles ahead. Then you have enough space for a curvy route. Would also help with the current ‘walking back a step to get around’ behavior.

In situations where there is not enough free space to do it that gracefully, you can still fall beck to waiting and moving just one tiles when it becomes free.

However, this is a lot of complexity, logic, and variations of a behavior which should be simple. It becomes a puzzle, requiring different solutions for different patterns of free space. The simulation approach is actually easier to implement at this point.

January 25, 2024 09:19 AM
Calin

I will postpone the change then. I will work on something else instead. Thanks for feedback.

January 25, 2024 11:36 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement