-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add routine to prevent bots from getting stuck to bot behavior trees
- Loading branch information
perturbed
committed
Feb 11, 2017
1 parent
fa49484
commit 60e1feb
Showing
4 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
selector | ||
{ | ||
{ | ||
behavior unstick | ||
|
||
condition alertedToEnemy | ||
{ | ||
action fight | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
selector | ||
{ | ||
behavior unstick | ||
|
||
sequence | ||
{ | ||
condition alertedToEnemy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
selector | ||
{ | ||
behavior unstick | ||
|
||
condition alertedToEnemy | ||
{ | ||
action fight | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Subroutine to try to prevent bots from getting stuck | ||
|
||
condition(stuckTime > 10000) | ||
{ | ||
selector | ||
{ | ||
condition(stuckTime > 20000) | ||
{ | ||
action suicide | ||
} | ||
|
||
decorator timer(3000) | ||
{ | ||
decorator return(STATUS_FAILURE) | ||
{ | ||
action jump | ||
} | ||
} | ||
condition(stuckTime > 17500) | ||
{ | ||
action moveInDir(MOVE_FORWARD) | ||
} | ||
condition(stuckTime > 15000) | ||
{ | ||
action moveInDir(MOVE_RIGHT) | ||
} | ||
condition(stuckTime > 12500) | ||
{ | ||
action moveInDir(MOVE_BACKWARD) | ||
} | ||
sequence | ||
{ | ||
action moveInDir(MOVE_LEFT) | ||
action moveTo(E_SELF) // cancel old target which may be causing the bot to walk into a wall, etc. | ||
} | ||
} | ||
} |