-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Replace Pathfinding with FlexiblePathfinding (part 2) #89
Conversation
No assets have been moved over/back yet, this needs to be done in a second step.
d62a6b4
to
c1be8ba
Compare
@DarkWeird I removed the following behavior node prefabs:
For each of them you seem to have created a replacement in
Can you tell me what these prefabs are used for? Also, I noticed the following changes when comparing the originals and their replacements:
|
Seems this prefabs using for BehaviorsEditor only. |
{ | ||
"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] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just remove all of these prefabs and link them in a central issue to bring them back with support for the behavior tree editor? Having half of them might be more confusing than helpful...
Or are they actually complete (or only a few missing)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There still is the ensureTargetPresent.prefab
which can be removed as we remove the node.
Apart from that we still only have the "old ones" for:
- condition
- jump
- log
- setTargetLocalPlayer
- setTargetToNearbyBlock
Would be nice if @DarkWeird could comment on my questions on the differences/changes between old originals and new replacements. Migrating the above-listed remaining ones in a similar fashion should be easy, but I'd like to understand the changes first before applying them to the rest.
{ | ||
"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 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This thing has so many properties - I hope we can slim it down a bit later
@@ -0,0 +1,4 @@ | |||
{ | |||
"type": "FlexibleMovementDebugLayout", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code of this class is commented out. Either one the first things to revive, or to throw out in a follow up and write down an issue for instead.
MinionMoveComponent flexibleMovementComponent1 = actor.getComponent(MinionMoveComponent.class); | ||
flexibleMovementComponent1.running = false; | ||
if (path == null || path.size() == 0) { | ||
actor.save(flexibleMovementComponent1); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has the changes around MinionMoveComponent#running
which were added in an attempt to understand what's happening and to fix potential issues. It was not there in the original code from FlexibleMovement, so maybe we should revert d136af9
(#89).
} | ||
|
||
@Override | ||
public BehaviorState modify(Actor actor, BehaviorState result) { | ||
final MinionMoveComponent moveComponent = actor.getComponent(MinionMoveComponent.class); | ||
if (moveComponent.path == null) { | ||
// this an action node, so it will always be called with BehaviorState.UNDEFINED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is true, though - I'd like to keep this comment as help for further work on this.
if (result == BehaviorState.RUNNING) { | ||
// this can never happen o.O | ||
return result; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code looks like this action should sometimes return RUNNING
, but I'm not sure when exactly/how to check whether the pathfinding process is currently running or not....
@DarkWeird any clue on this?
// current index along path above | ||
private int pathIndex = 0; | ||
|
||
public boolean running = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not stay in like it is.
src/main/java/org/terasology/module/behaviors/actions/FindPathToNode.java
Outdated
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/actions/FindPathToNode.java
Outdated
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/actions/FindPathToNode.java
Outdated
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/actions/FindPathToNode.java
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/actions/FindPathToNode.java
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/actions/MoveToAction.java
Outdated
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/actions/MoveToAction.java
Outdated
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/debug/DebugMoveToSystem.java
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/debug/FlexibleMovementDebugLayout.java
Outdated
Show resolved
Hide resolved
src/main/java/org/terasology/module/behaviors/systems/MinionMoveSystem.java
Outdated
Show resolved
Hide resolved
Respective action has been removed in Terasology/Behaviors#89
Respective action has been removed in Terasology/Behaviors#89
- style: format `.behavior` files - chore: add TODO ideas and questions in several places - chore: add some debug logging - feature/fix: small adjustments to Behaviors logic Follow-up PR to #89. Related PRs (extracted from this): #94, #96, #97, #99. Contributes to MovingBlocks/Terasology#4981. Depends on Terasology/FlexiblePathfinding#26 and Terasology/FlexiblePathfinding#27.
Follow-up to #88.
Integrates the state of Terasology-Archived/FlexibleMovement@e722d75 into this module.
Follow-ups
@In
(if possible) or initialization inconstruct()
consistenttestcharacter.prefab
itself, duplicates in children of parent character prefabs)