You must be logged in to post messages.
Please login or register

Scenario Design
Moderated by Yeebaagooon, TAG

Hop to:    
Welcome! You are not logged in. Please Login or Register.14 replies
Age of Mythology Heaven » Forums » Scenario Design » Pathfinding
Bottom
Topic Subject:Pathfinding
Lewonas
Mortal
posted 31 December 2013 06:03 PM EDT (US)         

PATHFINDING
Version 2.0


Download The Effects!



What is this?
With the pathfinding system you are able to create Waypoints for units which they need to follow in a particular order. The units can attack nearby enemies if you want to, which will halt the unit's progress towards the next waypoint for a limited amount of time. The unit will proceed moving towards this waypoint when:

  1. No enemy units are present within the unit's Aggro Range;

  2. The unit hasn't attacked an enemy unit over a certain period of time. This is called the Response Time or Accuracy.

Waypoint
A waypoint exists of coordinates of a specific location where a unit needs to move to. A waypoint basically is a checkpoint. The unit follows a route which is outlined by a number of waypoints.

Let's say there are four waypoints: A, B, C and D. A unit can walk in three different routes:

  1. The unit walks from A-B-C-D and stops.

  2. The unit patrols over the waypoints from A-B-C-D and back to A-B-C-D and so on.

  3. The unit patrols over the waypoints from A-B-C-D-C-B-A and so on.

You only have to create a route once which you can give an appropiate name. You can give the route to any number of units you want and they will start following it.


Aggro Range
The aggro range determines how far the unit will chase an enemy unit before giving up. When the unit starts to attack an enemy unit, the unit's position will be stored into a variable. If the unit's aggro range is set on 30 meters and the unit walks more than 30 meters away from that position, the unit will give up the fight and move back to the position where he launched the attack. Once he's reached that position, he will continue moving towards the next waypoint. The same theory applies when the unit has lost sight of the enemy unit(s).


Accuracy
Accuracy determines how long a unit needs to wait before he continues to move towards the next waypoint after having given up a fight (see Aggro Range). Accuracy had to be implemented to fix a bug (the pathfinding system looks at the unit's action ids to determine if a unit is attacking something or not. Action ids have a little delay before they're updated. So what happened is that the system thinks the unit has stopped attacking and tries to send it towards the next waypoint while the unit actually still wanted to attack an enemy unit).



[c]Current Effects



Pathfinding - Set Unit Alive
This effect marks the unit as alive or dead. Dead units are ignored by the pathfinding system.

Parameters
Source Unit: The unit with pathfinding.
Alive (true/false): Marks the unit as alive or dead.


Pathfinding - Add Unit
This effect adds an unit to the pathfinding system. Dead units are ignored by the pathfinding system.

Parameters
Source Unit: The unit with pathfinding.
Patrols (true/false): Marks if the unit needs to patrol on the waypoints.
Route ABCA (true/false): Determines if the unit needs to follow the route in ABCA order (true) or ABCBA order (false).
Attack Move: The unit will attack enemy units on sight if enabled.
Waypoint radius: Determines how close the unit needs to get to a waypoint before he can proceed towards the next one.
Aggro range: Sets unit's aggro range in meters.
Return after attack (true/false): Determines if the unit will return to the location he launched the attack from or if he will immediately proceed towards the next waypoint after having attacked an enemy unit.


Pathfinding - Create Waypoints
This effect creates waypoints that plan out a route.

Parameters
New Waypoints (true/false): Is this a new route?
Waypoints Name: The route name.
Waypoint 1-5: Set the waypoints to your liking.


Pathfinding - Bind Waypoints To Unit
This effect binds a route to the unit that he will start to follow.

Parameters
Source Unit: The unit with pathfinding.
Waypoints Name: The route name.


Pathfinding - Start
This effect handles all unit movement commands.

Parameters
Accuracy: Determines how long a unit needs to wait before he continues to move towards the next waypoint after having given up a fight.




What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]

[This message has been edited by Lewonas (edited 01-05-2014 @ 06:01 AM).]

AuthorReplies:
Lewonas
Mortal
posted 31 December 2013 06:06 PM EDT (US)     1 / 14       
I just wanted to share this cool little system with you guys. What do you think about it? How would you improve it? Do you have any suggestions? Something else?

Happy new year everyone!

What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]
Elrich
Hero
posted 31 December 2013 07:36 PM EDT (US)     2 / 14       
This reads as very impressive, Lewonas. I will go over your code next year (tomorrow ).

I wish you a happy and fruitful new year.

In all your science of the mind, seeking blind through flesh and bone
Find the blood inside this stone
Well, I know I've never shown what I feel, I've always known
I plan my vengeance on my own - and I was always alone
Zenophobia
Irrational Fear
posted 31 December 2013 08:30 PM EDT (US)     3 / 14       
what about if you want to apply this to units that aren't already existing on the map? (i.e. armies deployed through triggers)

[This message has been edited by Zenophobia (edited 02-29-2094 @ 10:60 AM).]
Lewonas
Mortal
posted 01 January 2014 07:28 AM EDT (US)     4 / 14       
@Zenophobia: Sure!

@Elrich: Here's the source code if you want to look into it.

What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]
Nickonhawk
The Narrator
posted 01 January 2014 02:43 PM EDT (US)     5 / 14       
Pretty outstanding :P

Youtube Channel
Skyrim... the greatest game ever... without considering Age of Mythology, of course!
Ctrl...Alt...Q...
and Brisingr-know these three things and your task here is accomplished...
pBiggZ
Mortal
(id: P_J_B)
posted 02 January 2014 11:33 PM EDT (US)     6 / 14       
Are these effects multiplayer/online compatible? I could see alot of world of warcraft style "patrolling mob" applications here.

"I NED MOAR RANGE" Pubby8
Lewonas
Mortal
posted 03 January 2014 04:54 AM EDT (US)     7 / 14       
Yes, they should be online compatible. The game may experience some lag if more than 100 units have to be given movement instructions at the same time on a large map. I / You will need to do a stress test to find out where this limit lies. I'm sure it is pretty high.
I could see alot of world of warcraft style "patrolling mob" applications here.
Yeah, sure! I created this system to be somewhat similar to Dota 2's creep movement system. Someone here on the forums needed a movement system like in that game. But yes, it can be used for a lot of different game types. It could definitely be useful in RPG scenarios for what you said and perhaps for bosses as well. You can prevent a boss to be kited around the whole world with this system by setting a limit on the aggro range. Once that limit has been exceeded, the boss will move back and could restore its health to full to reset the boss fight.

I will upload the triggers on AoMH in a few hours.

What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]

[This message has been edited by Lewonas (edited 01-03-2014 @ 04:55 AM).]

pBiggZ
Mortal
(id: P_J_B)
posted 04 January 2014 11:12 PM EDT (US)     8 / 14       
please let me know when those effects are up!

"I NED MOAR RANGE" Pubby8
Lewonas
Mortal
posted 05 January 2014 06:02 AM EDT (US)     9 / 14       
I have submitted them. Link is in the OP, still awaiting approval though.

What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]
candalas
Mortal
posted 06 January 2014 00:09 AM EDT (US)     10 / 14       
thanks a lot for that, it will be very helpful!
i will just download it now and see the new army deploy compatible feature

[This message has been edited by candalas (edited 01-06-2014 @ 00:15 AM).]

Lewonas
Mortal
posted 06 January 2014 05:51 PM EDT (US)     11 / 14       
Great! Have fun with it.

What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]
candalas
Mortal
posted 16 February 2014 12:52 PM EDT (US)     12 / 14       
i just noticed you didnt include the "trigger load" thing in the download
pBiggZ
Mortal
(id: P_J_B)
posted 16 February 2014 03:47 PM EDT (US)     13 / 14       
I wonder if there is a way to keep the AI inert without setting them to defeated. Since my enemy AIs are technically defeated, they cannot be commanded to patrol. :/

"I NED MOAR RANGE" Pubby8
Lewonas
Mortal
posted 18 February 2014 03:27 PM EDT (US)     14 / 14       
@Candalas: Nice catch. I've updated the file description with a link to the trigger loader.

@P_J_B: You can use the Frozen AI for that.

What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Mythology Heaven | HeavenGames