Skip to content

Commit

Permalink
feat!: Replace Pathfinding with FlexiblePathfinding (part 2) (#89)
Browse files Browse the repository at this point in the history
* feat!: integrate classes from FlexibleMovement
* feat!: add assets from FlexibleMovement
* chore!: remove left-over actions using Pathfinding
* chore!: remove behavior node prefabs that got a replacement
* chore!: remove dead code and broken references
* chore: rename all remaining occurrences of FlexibleMovementComponent to MinionMoveComponent

* test: add descriptions to BehaviorTests
* test: fix test by waiting for chunk generation

Co-authored-by: Josephine Rueckert <jd.rueckert@googlemail.com>
  • Loading branch information
skaldarnar and jdrueckert authored Jan 21, 2022
1 parent d3600d1 commit 317dd65
Show file tree
Hide file tree
Showing 56 changed files with 1,717 additions and 560 deletions.
2 changes: 1 addition & 1 deletion assets/behaviors/common/attackFollowedEntity.behavior
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
}
},
move_to
move_to
]
}
]
Expand Down
2 changes: 1 addition & 1 deletion assets/behaviors/common/doRandomMove.behavior
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
set_target_nearby_block : { moveProbability: 65 }
},
move_to
move_to
]
}

2 changes: 1 addition & 1 deletion assets/behaviors/common/follow.behavior
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
}
},
move_to
move_to
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion assets/behaviors/common/restrictedStray.behavior
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
set_target_nearby_block_restricted : { moveProbability: 65 }
},
{
move_to: { distance: 2}
move_to: { distance: 2}
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion assets/behaviors/creatures/worker.behavior
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
sequence: [
{
move_to: {
move_to: {
distance: 0.7
}
},
Expand Down
15 changes: 15 additions & 0 deletions assets/behaviors/naiveMoveTo.behavior
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
sequence : [
{
selector : [
find_path
]
},
{ move_along_path: {
child : {
move_to: {}
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
sequence: [
set_target_to_followed_entity,
find_path,
setup_continuous_pathfinding,
{
timeout: {
time: 3,
child: {
move_along_path_continuous: {
move_along_path: {
child: {
move_to: {}
move_to: {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
move_along_path: {
child: {
move_to: {}
move_to: {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{
move_along_path: {
child: {
move_to: {}
move_to: {}
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions assets/behaviors/reliableMoveTo.behavior
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
loop : {
child : {
success : {
child: {
timeout : {
"time": 0.7,
"child": {
lookup: {
tree: "Behaviors:naiveMoveTo"
}
}
}
}
}
}
}
}
12 changes: 0 additions & 12 deletions assets/prefabs/behaviorNodes/ensureTargetPresent.prefab

This file was deleted.

12 changes: 0 additions & 12 deletions assets/prefabs/behaviorNodes/findPathTo.prefab

This file was deleted.

11 changes: 11 additions & 0 deletions assets/prefabs/behaviorNodes/finddummypathtonode.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"BehaviorNode": {
"type": "FindDummyPathToNode",
"name": "Find Dummy Path",
"category": "movement",
"shape": "rect",
"description": "Finds a dummy path to target consisting of the current and target location",
"color": [180, 180, 180, 255],
"textColor": [0, 0, 0, 255]
}
}
11 changes: 11 additions & 0 deletions assets/prefabs/behaviorNodes/findpathtonode.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"BehaviorNode": {
"type": "FindPathToNode",
"name": "Find Path",
"category": "movement",
"shape": "rect",
"description": "Finds a path to target using FlexiblePathfinding",
"color": [180, 180, 180, 255],
"textColor": [0, 0, 0, 255]
}
}
12 changes: 0 additions & 12 deletions assets/prefabs/behaviorNodes/moveAlongPath.prefab

This file was deleted.

12 changes: 0 additions & 12 deletions assets/prefabs/behaviorNodes/moveTo.prefab

This file was deleted.

11 changes: 11 additions & 0 deletions assets/prefabs/behaviorNodes/movealongpathnode.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"BehaviorNode": {
"type": "MoveAlongPathNode",
"name": "Move Along Path",
"category": "movement",
"shape": "rect",
"description": "Move sequentially along this entity's path",
"color": [180, 180, 180, 255],
"textColor": [0, 0, 0, 255]
}
}
11 changes: 11 additions & 0 deletions assets/prefabs/behaviorNodes/movetonode.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"BehaviorNode": {
"type": "MoveToNode",
"name": "Move To",
"category": "movement",
"shape": "rect",
"description": "Move to this entity's immediate move target using the FlexibleMovement mode",
"color": [180, 180, 180, 255],
"textColor": [0, 0, 0, 255]
}
}
11 changes: 11 additions & 0 deletions assets/prefabs/behaviorNodes/validatepathnode.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"BehaviorNode": {
"type": "ValidatePathNode",
"name": "Validate Path",
"category": "movement",
"shape": "rect",
"description": "Validate that this entity can traverse its current path",
"color": [180, 180, 180, 255],
"textColor": [0, 0, 0, 255]
}
}
6 changes: 6 additions & 0 deletions assets/prefabs/characters/amphibious.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "Behaviors:testcharacter",
"MinionMove": {
"movementTypes": ["walking", "leaping", "swimming"]
}
}
6 changes: 6 additions & 0 deletions assets/prefabs/characters/flying.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "Behaviors:testcharacter",
"MinionMove": {
"movementTypes": ["flying"]
}
}
8 changes: 8 additions & 0 deletions assets/prefabs/characters/swimming.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "Behaviors:testcharacter",
"MinionMove": {
"movementTypes": [
"swimming"
]
}
}
38 changes: 38 additions & 0 deletions assets/prefabs/characters/testcharacter.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"MinionMove": {
"movementTypes": ["walking", "leaping"]
},
"NameTag": { "text": "testcharacter" },
"Behavior" : {
"tree" : "naiveMoveTo"
},
"persisted" : true,
"location" : {},
"Character": {},
"CharacterHeldItem" : { },
"Network" :{},
"Health" : {
"maxHealth": 1,
"currentHealth": 1,
"excessSpeedDamageMultiplier": 0,
"destroyEntityOnNoHealth" : true
},
"Trigger" : {
"detectGroups" : ["engine:debris", "engine:sensor"]
},
"CreatureNameGenerator" : {
"genderRatio" : 0.5,
"nobility" : 0.5,
"theme": "DWARF"
},
"AliveCharacter": {},
"CharacterMovement" : {
"groundFriction" : 16,
"speedMultiplier" : 0.3,
"distanceBetweenFootsteps" : 0.2,
"distanceBetweenSwimStrokes" : 2.5,
"height" : 0.9,
"radius" : 0.3,
"jumpSpeed" : 12
}
}
12 changes: 12 additions & 0 deletions assets/prefabs/items/moveto.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"parent": "engine:iconItem",
"DebugMoveTo": {},
"DisplayName": {
"name": "Path to"
},
"Item" : {
"name" : "Walk to block",
"icon" : "engine:items#walkToJob",
"usage" : "ON_BLOCK"
}
}
4 changes: 4 additions & 0 deletions assets/ui/debug.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "FlexibleMovementDebugLayout",
"skin": "engineDefault"
}
8 changes: 4 additions & 4 deletions module.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"optional": true,
"because": "tests/ClusterDebugger"
},
{
"id": "FlexiblePathfinding",
"minVersion": "1.0.0"
},
{
"id": "Health",
"minVersion": "2.0.0-SNAPSHOT"
Expand All @@ -20,10 +24,6 @@
"id": "Inventory",
"minVersion": "1.1.0"
},
{
"id": "Pathfinding",
"minVersion": "1.0.0"
},
{
"id": "ModuleTestingEnvironment",
"minVersion": "0.3.0",
Expand Down

This file was deleted.

Loading

0 comments on commit 317dd65

Please sign in to comment.