animation priority categories
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-07-28 15:27:57 -04:00
parent ad823fcbb4
commit 126a8f79c8
21 changed files with 260 additions and 77 deletions

View File

@ -43,9 +43,8 @@
], ],
"files" : [ "files" : [
"Data/creatures/human.json", "Data/creatures/human.json",
"Data/creatures/elf.json",
"Data/creatures/goblin.json",
"Data/creatures/animals.json", "Data/creatures/animals.json",
"Data/creatures/test.json" "Data/creatures/test.json"
] ]
} }

View File

@ -131,32 +131,38 @@
"maxVelocity" : 500.5, "maxVelocity" : 500.5,
"animationStartup" : { "animationStartup" : {
"nameThirdPerson" : "Jog", "nameThirdPerson" : "Jog",
"length" : 1, "priorityCategory" : "CORE_MOVEMENT"
"loops" : false
}, },
"animationFirstPersonStartup" : { "animationFirstPersonStartup" : {
"nameFirstPerson" : "Jog" "nameFirstPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
}, },
"animationLoop" : { "animationLoop" : {
"nameThirdPerson" : "Jog" "nameThirdPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
}, },
"animationFirstPersonLoop" : { "animationFirstPersonLoop" : {
"nameFirstPerson" : "Jog" "nameFirstPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
}, },
"animationWindDown" : { "animationWindDown" : {
"nameThirdPerson" : "Jog" "nameThirdPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
}, },
"animationFirstPersonWindDown" : { "animationFirstPersonWindDown" : {
"nameFirstPerson" : "Jog" "nameFirstPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
}, },
"sprintSystem" : { "sprintSystem" : {
"maxVelocity" : 0.058, "maxVelocity" : 0.058,
"staminaMax" : 500, "staminaMax" : 500,
"animationStartUp" : { "animationStartUp" : {
"nameThirdPerson" : "Sprint" "nameThirdPerson" : "Sprint",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationMain" : { "animationMain" : {
"nameThirdPerson" : "Sprint" "nameThirdPerson" : "Sprint",
"priorityCategory" : "MOVEMENT_MODIFIER"
} }
} }
}, },
@ -165,10 +171,12 @@
"jumpFrames" : 3, "jumpFrames" : 3,
"jumpForce" : 500, "jumpForce" : 500,
"animationJump" : { "animationJump" : {
"nameThirdPerson" : "Jump" "nameThirdPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonJump" : { "animationFirstPersonJump" : {
"nameFirstPerson" : "Jump" "nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
} }
}, },
{ {
@ -177,14 +185,14 @@
"animation" : { "animation" : {
"nameThirdPerson" : "Fall", "nameThirdPerson" : "Fall",
"nameFirstPerson" : "Fall", "nameFirstPerson" : "Fall",
"priority": 4 "priorityCategory" : "MOVEMENT_MODIFIER"
} }
}, },
"landState" : { "landState" : {
"animation" : { "animation" : {
"nameThirdPerson" : "Land", "nameThirdPerson" : "Land",
"nameFirstPerson" : "Land", "nameFirstPerson" : "Land",
"priority": 4 "priorityCategory" : "MOVEMENT_MODIFIER"
} }
} }
} }
@ -256,9 +264,9 @@
"item" "item"
], ],
"equippedAnimation" : { "equippedAnimation" : {
"nameThirdPerson" : "", "nameThirdPerson" : "Idle1",
"nameFirstPerson" : "", "nameFirstPerson" : "Idle",
"priority" : 4, "priorityCategory" : "MODIFIER_MAX",
"boneGroups" : ["handRight"] "boneGroups" : ["handRight"]
} }
}, },
@ -334,13 +342,16 @@
"driftFrameEnd" : 15, "driftFrameEnd" : 15,
"initialMove" : true, "initialMove" : true,
"animationFirstPersonWindup" : { "animationFirstPersonWindup" : {
"nameFirstPerson" : "Jump" "nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonHold" : { "animationFirstPersonHold" : {
"nameFirstPerson" : "Jump" "nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonAttack" : { "animationFirstPersonAttack" : {
"nameFirstPerson" : "Sword1HSlash1" "nameFirstPerson" : "Sword1HSlash1",
"priorityCategory" : "MOVEMENT_MODIFIER"
} }
}, },
{ {
@ -359,13 +370,16 @@
"driftFrameEnd" : 10, "driftFrameEnd" : 10,
"initialMove" : false, "initialMove" : false,
"animationFirstPersonWindup" : { "animationFirstPersonWindup" : {
"nameFirstPerson" : "Jump" "nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonHold" : { "animationFirstPersonHold" : {
"nameFirstPerson" : "Jump" "nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonAttack" : { "animationFirstPersonAttack" : {
"nameFirstPerson" : "Sword1HSlash2" "nameFirstPerson" : "Sword1HSlash2",
"priorityCategory" : "MOVEMENT_MODIFIER"
} }
}, },
{ {
@ -383,13 +397,16 @@
"driftFrameEnd" : 10, "driftFrameEnd" : 10,
"initialMove" : true, "initialMove" : true,
"animationFirstPersonWindup" : { "animationFirstPersonWindup" : {
"nameFirstPerson" : "HoldItemR2H" "nameFirstPerson" : "HoldItemR2H",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonHold" : { "animationFirstPersonHold" : {
"nameFirstPerson" : "HoldItemR2H" "nameFirstPerson" : "HoldItemR2H",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonAttack" : { "animationFirstPersonAttack" : {
"nameFirstPerson" : "SwordR2HSlash" "nameFirstPerson" : "SwordR2HSlash",
"priorityCategory" : "MOVEMENT_MODIFIER"
} }
}, },
{ {
@ -409,13 +426,16 @@
"movementGoal" : 0, "movementGoal" : 0,
"initialMove" : true, "initialMove" : true,
"animationFirstPersonWindup" : { "animationFirstPersonWindup" : {
"nameFirstPerson" : "Jump" "nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonHold" : { "animationFirstPersonHold" : {
"nameFirstPerson" : "Jump" "nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
}, },
"animationFirstPersonAttack" : { "animationFirstPersonAttack" : {
"nameFirstPerson" : "Jump" "nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
} }
} }
], ],

View File

@ -470,6 +470,8 @@ Attach utils fixes for first person handling
(07/28/2024) (07/28/2024)
Tear out first person rendering pipeline Tear out first person rendering pipeline
Partially fix first person attachment to viewmodel Partially fix first person attachment to viewmodel
Creature data validation
Unify animation format data on disk
# TODO # TODO

View File

@ -1,5 +1,7 @@
package electrosphere.entity.state; package electrosphere.entity.state;
import electrosphere.logger.LoggerInterface;
/** /**
* The list of animation priorities * The list of animation priorities
*/ */
@ -9,43 +11,88 @@ public class AnimationPriorities {
// //
//1 //1
// //
public static final int DEATH = 1; private static final int STATE_FINAL_VALUE = 1;
public static final String STATE_FINAL = "STATE_FINAL"; //A final state for the entity (ie dying/death)
// //
//2 //2
// //
public static final int ATTACK = 2; private static final int MODIFIER_MAX_VALUE = 2;
public static final int BLOCK = 2; public static final String MODIFIER_MAX = "MODIFIER_MAX"; //A modifier to a bone group that is maximum priority (ie if holding an item, the animation to hold the item is top priority)
// //
//4 //4
// //
public static final int FALL = 4;
public static final int JUMP = 4;
public static final int LAND = 4;
// //
//5 //5
// //
public static final int GROUND_MOVE = 5; private static final int MOVEMENT_MODIFIER_VALUE = 5;
public static final String MOVEMENT_MODIFIER = "MOVEMENT_MODIFIER"; //When a state is modifying the core movement tree active currently (think sprinting, jumping, landing, etc)
//
//6
//
private static final int MODIFIER_HIGH_VALUE = 6;
public static final String MODIFIER_HIGH = "MODIFIER_HIGH"; //A modifier to a bone group that is high priority (think holding the arm upright when a sword is equipped)
// //
//7 //7
// //
public static final int ITEM_INTERACTION = 7; private static final int CORE_MOVEMENT_VALUE = 7;
public static final String CORE_MOVEMENT = "CORE_MOVEMENT"; //A core movement tree (ie base ground movement)
//
//8
//
private static final int INTERACTION_VALUE = 8;
public static final String INTERACTION = "INTERACTION"; //An interaction animation (ie grabbing an item, dropping an item, etc)
// //
//10 //10
// //
public static final int IDLE = 10; private static final int IDLE_VALUE = 10;
public static final String IDLE = "IDLE"; //An idle animation
// //
//50 //50
// //
public static final int DEFAULT = 50; private static final int DEFAULT_VALUE = 50;
public static final String DEFAULT = "DEFAULT"; //The default (low) priority
/**
* Gets the value of animation category
* @param type The animation category
* @return the priority
*/
public static int getValue(String category){
switch(category){
case STATE_FINAL:
return STATE_FINAL_VALUE;
case MODIFIER_MAX:
return MODIFIER_MAX_VALUE;
case MOVEMENT_MODIFIER:
return MOVEMENT_MODIFIER_VALUE;
case MODIFIER_HIGH:
return MODIFIER_HIGH_VALUE;
case CORE_MOVEMENT:
return CORE_MOVEMENT_VALUE;
case INTERACTION:
return INTERACTION_VALUE;
case IDLE:
return IDLE_VALUE;
case DEFAULT:
return DEFAULT_VALUE;
default: {
LoggerInterface.loggerEngine.WARNING("Trying to get priority of animation category that doesn't exist! " + category);
return DEFAULT_VALUE;
}
}
}
} }

View File

@ -241,29 +241,50 @@ public class ClientAttackTree implements BehaviorTree {
if(currentMove != null){ if(currentMove != null){
if(entityActor != null){ if(entityActor != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getWindupAnimationName())){ if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getWindupAnimationName())){
entityActor.playAnimation(currentMove.getWindupAnimationName(),AnimationPriorities.ATTACK); entityActor.playAnimation(
currentMove.getWindupAnimationName(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
);
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonWindup().getNameFirstPerson(), AnimationPriorities.ATTACK); FirstPersonTree.conditionallyPlayAnimation(
Globals.firstPersonEntity,
currentMove.getAnimationFirstPersonWindup().getNameFirstPerson(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
);
} }
} }
} break; } break;
case HOLD: { case HOLD: {
if(entityActor != null){ if(entityActor != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getHoldAnimationName())){ if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getHoldAnimationName())){
entityActor.playAnimation(currentMove.getHoldAnimationName(),AnimationPriorities.ATTACK); entityActor.playAnimation(
currentMove.getHoldAnimationName(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
);
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonHold().getNameFirstPerson(), AnimationPriorities.ATTACK); FirstPersonTree.conditionallyPlayAnimation(
Globals.firstPersonEntity,
currentMove.getAnimationFirstPersonHold().getNameFirstPerson(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
);
} }
} break; } break;
case ATTACK: { case ATTACK: {
if(entityActor != null && currentMove != null){ if(entityActor != null && currentMove != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getAttackAnimationName())){ if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getAttackAnimationName())){
entityActor.playAnimation(currentMove.getAttackAnimationName(),AnimationPriorities.ATTACK); entityActor.playAnimation(
currentMove.getAttackAnimationName(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
);
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, currentMove.getAnimationFirstPersonAttack().getNameFirstPerson(), AnimationPriorities.ATTACK); FirstPersonTree.conditionallyPlayAnimation(
Globals.firstPersonEntity,
currentMove.getAnimationFirstPersonAttack().getNameFirstPerson(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
);
} }
//activate hitboxes //activate hitboxes
List<Entity> attachedEntities = AttachUtils.getChildrenList(parent); List<Entity> attachedEntities = AttachUtils.getChildrenList(parent);

View File

@ -221,7 +221,10 @@ public class ServerAttackTree implements BehaviorTree {
} }
if(entityPoseActor != null){ if(entityPoseActor != null){
if(!entityPoseActor.isPlayingAnimation() || !entityPoseActor.isPlayingAnimation(animationName)){ if(!entityPoseActor.isPlayingAnimation() || !entityPoseActor.isPlayingAnimation(animationName)){
entityPoseActor.playAnimation(animationName,AnimationPriorities.ATTACK); entityPoseActor.playAnimation(
animationName,
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
);
entityPoseActor.incrementAnimationTime(0.0001); entityPoseActor.incrementAnimationTime(0.0001);
} }
} }
@ -250,7 +253,10 @@ public class ServerAttackTree implements BehaviorTree {
case HOLD: { case HOLD: {
if(entityPoseActor != null){ if(entityPoseActor != null){
if(!entityPoseActor.isPlayingAnimation() || !entityPoseActor.isPlayingAnimation(animationName)){ if(!entityPoseActor.isPlayingAnimation() || !entityPoseActor.isPlayingAnimation(animationName)){
entityPoseActor.playAnimation(animationName,AnimationPriorities.ATTACK); entityPoseActor.playAnimation(
animationName,
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
);
entityPoseActor.incrementAnimationTime(0.0001); entityPoseActor.incrementAnimationTime(0.0001);
} }
} }

View File

@ -56,7 +56,7 @@ public class ClientBlockTree implements BehaviorTree {
this.stateTransitionUtil = StateTransitionUtil.create(parent, false, new StateTransitionUtilItem[]{ this.stateTransitionUtil = StateTransitionUtil.create(parent, false, new StateTransitionUtilItem[]{
StateTransitionUtilItem.create( StateTransitionUtilItem.create(
BlockState.WIND_UP, BlockState.WIND_UP,
AnimationPriorities.BLOCK, AnimationPriorities.getValue(AnimationPriorities.MODIFIER_HIGH),
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpFirstPersonAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpFirstPersonAnimation();},
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();},
null, null,
@ -64,7 +64,7 @@ public class ClientBlockTree implements BehaviorTree {
), ),
StateTransitionUtilItem.create( StateTransitionUtilItem.create(
BlockState.BLOCKING, BlockState.BLOCKING,
AnimationPriorities.BLOCK, AnimationPriorities.getValue(AnimationPriorities.MODIFIER_HIGH),
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainFirstPersonAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainFirstPersonAnimation();},
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();},
null, null,
@ -72,7 +72,7 @@ public class ClientBlockTree implements BehaviorTree {
), ),
StateTransitionUtilItem.create( StateTransitionUtilItem.create(
BlockState.COOLDOWN, BlockState.COOLDOWN,
AnimationPriorities.BLOCK, AnimationPriorities.getValue(AnimationPriorities.MODIFIER_HIGH),
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownFirstPersonAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownFirstPersonAnimation();},
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();},
null, null,

View File

@ -50,7 +50,7 @@ public class ServerBlockTree implements BehaviorTree {
this.stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{ this.stateTransitionUtil = StateTransitionUtil.create(parent, true, new StateTransitionUtilItem[]{
StateTransitionUtilItem.create( StateTransitionUtilItem.create(
BlockState.WIND_UP, BlockState.WIND_UP,
AnimationPriorities.BLOCK, AnimationPriorities.getValue(AnimationPriorities.MODIFIER_HIGH),
null, null,
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getWindUpAnimation();},
null, null,
@ -58,7 +58,7 @@ public class ServerBlockTree implements BehaviorTree {
), ),
StateTransitionUtilItem.create( StateTransitionUtilItem.create(
BlockState.BLOCKING, BlockState.BLOCKING,
AnimationPriorities.BLOCK, AnimationPriorities.getValue(AnimationPriorities.MODIFIER_HIGH),
null, null,
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getMainAnimation();},
null, null,
@ -66,7 +66,7 @@ public class ServerBlockTree implements BehaviorTree {
), ),
StateTransitionUtilItem.create( StateTransitionUtilItem.create(
BlockState.COOLDOWN, BlockState.COOLDOWN,
AnimationPriorities.BLOCK, AnimationPriorities.getValue(AnimationPriorities.MODIFIER_HIGH),
null, null,
() -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();}, () -> {return this.blockSystem.getBlockVariant(this.currentBlockVariant).getCooldownAnimation();},
null, null,

View File

@ -98,10 +98,10 @@ public class ClientIdleTree implements BehaviorTree {
(Globals.assetManager.fetchModel(entityActor.getModelPath()) != null && Globals.assetManager.fetchModel(entityActor.getModelPath()).getAnimation(idleData.getIdleAnimation()) != null) (Globals.assetManager.fetchModel(entityActor.getModelPath()) != null && Globals.assetManager.fetchModel(entityActor.getModelPath()).getAnimation(idleData.getIdleAnimation()) != null)
){ ){
entityActor.playAnimation(idleData.getIdleAnimation(),AnimationPriorities.IDLE); entityActor.playAnimation(idleData.getIdleAnimation(),AnimationPriorities.getValue(AnimationPriorities.IDLE));
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, idleData.getFirstPersonIdleAnimation(), AnimationPriorities.IDLE); FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, idleData.getFirstPersonIdleAnimation(), AnimationPriorities.getValue(AnimationPriorities.IDLE));
} }
break; break;
case NOT_IDLE: case NOT_IDLE:

View File

@ -93,7 +93,7 @@ public class ServerIdleTree implements BehaviorTree {
if( if(
(!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(Animation.ANIMATION_IDLE_1)) (!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(Animation.ANIMATION_IDLE_1))
){ ){
poseActor.playAnimation(Animation.ANIMATION_IDLE_1,AnimationPriorities.IDLE); poseActor.playAnimation(Animation.ANIMATION_IDLE_1,AnimationPriorities.getValue(AnimationPriorities.IDLE));
poseActor.incrementAnimationTime(0.0001); poseActor.incrementAnimationTime(0.0001);
} }
} }

View File

@ -93,10 +93,10 @@ public class FallTree implements BehaviorTree {
if( if(
!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(fallMovementSystem.getLandState().getAnimation().getNameThirdPerson()) !entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(fallMovementSystem.getLandState().getAnimation().getNameThirdPerson())
){ ){
entityActor.playAnimation(fallMovementSystem.getLandState().getAnimation().getNameThirdPerson(),AnimationPriorities.LAND); entityActor.playAnimation(fallMovementSystem.getLandState().getAnimation().getNameThirdPerson(),AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getLandState().getAnimation().getNameFirstPerson(), AnimationPriorities.LAND); FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getLandState().getAnimation().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
} }
} }
} }

View File

@ -61,10 +61,10 @@ public class JumpTree implements BehaviorTree {
case ACTIVE: case ACTIVE:
if(entityActor != null){ if(entityActor != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(jumpData.getAnimationJump().getNameThirdPerson())){ if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(jumpData.getAnimationJump().getNameThirdPerson())){
entityActor.playAnimation(jumpData.getAnimationJump().getNameThirdPerson(),AnimationPriorities.JUMP); entityActor.playAnimation(jumpData.getAnimationJump().getNameThirdPerson(),AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, jumpData.getAnimationFirstPersonJump().getNameFirstPerson(), AnimationPriorities.JUMP); FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, jumpData.getAnimationFirstPersonJump().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
} }
currentFrame++; currentFrame++;
currentJumpForce = currentJumpForce * jumpFalloff; currentJumpForce = currentJumpForce * jumpFalloff;

View File

@ -39,7 +39,7 @@ public class ServerFallTree implements BehaviorTree {
!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) && !poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) &&
(jumpTree == null || !jumpTree.isJumping()) (jumpTree == null || !jumpTree.isJumping())
){ ){
poseActor.playAnimation(animationToPlay,AnimationPriorities.FALL); poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
poseActor.incrementAnimationTime(0.0001); poseActor.incrementAnimationTime(0.0001);
} }
} }
@ -66,7 +66,7 @@ public class ServerFallTree implements BehaviorTree {
if( if(
!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) !poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay)
){ ){
poseActor.playAnimation(animationToPlay,AnimationPriorities.LAND); poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
poseActor.incrementAnimationTime(0.0001); poseActor.incrementAnimationTime(0.0001);
} }
} }

View File

@ -56,7 +56,7 @@ public class ServerJumpTree implements BehaviorTree {
if(poseActor != null){ if(poseActor != null){
String animationToPlay = determineCorrectAnimation(); String animationToPlay = determineCorrectAnimation();
if(!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay)){ if(!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay)){
poseActor.playAnimation(animationToPlay,AnimationPriorities.JUMP); poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
poseActor.incrementAnimationTime(0.0001); poseActor.incrementAnimationTime(0.0001);
} }
} }

View File

@ -291,10 +291,10 @@ public class ClientGroundMovementTree implements BehaviorTree {
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
entityActor.playAnimation(animationToPlay,AnimationPriorities.GROUND_MOVE); entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonStartup().getNameThirdPerson(), AnimationPriorities.GROUND_MOVE); FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonStartup().getNameThirdPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
} }
//run startup code //run startup code
velocity = velocity + acceleration * (float)Globals.timekeeper.getSimFrameTime(); velocity = velocity + acceleration * (float)Globals.timekeeper.getSimFrameTime();
@ -325,10 +325,10 @@ public class ClientGroundMovementTree implements BehaviorTree {
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
entityActor.playAnimation(animationToPlay,AnimationPriorities.GROUND_MOVE); entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonLoop().getNameThirdPerson(), AnimationPriorities.GROUND_MOVE); FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonLoop().getNameThirdPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
} }
if(velocity != maxNaturalVelocity){ if(velocity != maxNaturalVelocity){
velocity = maxNaturalVelocity; velocity = maxNaturalVelocity;
@ -353,10 +353,10 @@ public class ClientGroundMovementTree implements BehaviorTree {
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
entityActor.playAnimation(animationToPlay,AnimationPriorities.GROUND_MOVE); entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
entityActor.incrementAnimationTime(0.0001); entityActor.incrementAnimationTime(0.0001);
} }
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonWindDown().getNameThirdPerson(), AnimationPriorities.GROUND_MOVE); FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonWindDown().getNameThirdPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
} }
//velocity stuff //velocity stuff
velocity = velocity - acceleration * (float)Globals.timekeeper.getSimFrameTime(); velocity = velocity - acceleration * (float)Globals.timekeeper.getSimFrameTime();

View File

@ -253,7 +253,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
poseActor.playAnimation(animationToPlay,AnimationPriorities.GROUND_MOVE); poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
poseActor.incrementAnimationTime(0.0001); poseActor.incrementAnimationTime(0.0001);
} }
} }
@ -308,7 +308,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
poseActor.playAnimation(animationToPlay,AnimationPriorities.GROUND_MOVE); poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
poseActor.incrementAnimationTime(0.0001); poseActor.incrementAnimationTime(0.0001);
} }
} }
@ -360,7 +360,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
(jumpTree == null || !jumpTree.isJumping()) && (jumpTree == null || !jumpTree.isJumping()) &&
(fallTree == null || !fallTree.isFalling()) (fallTree == null || !fallTree.isFalling())
){ ){
poseActor.playAnimation(animationToPlay,AnimationPriorities.GROUND_MOVE); poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
poseActor.incrementAnimationTime(0.0001); poseActor.incrementAnimationTime(0.0001);
} }
} }

View File

@ -241,7 +241,7 @@ public class ItemUtils {
if(actor != null && item.getData(EntityDataStrings.ANIM_IDLE) != null){ if(actor != null && item.getData(EntityDataStrings.ANIM_IDLE) != null){
String idleAnim = (String)item.getData(EntityDataStrings.ANIM_IDLE); String idleAnim = (String)item.getData(EntityDataStrings.ANIM_IDLE);
if(!actor.isPlayingAnimation(idleAnim)){ if(!actor.isPlayingAnimation(idleAnim)){
actor.playAnimation(idleAnim,AnimationPriorities.ITEM_INTERACTION); actor.playAnimation(idleAnim,AnimationPriorities.getValue(AnimationPriorities.INTERACTION));
actor.incrementAnimationTime(0.0001); actor.incrementAnimationTime(0.0001);
} }
} }
@ -256,7 +256,7 @@ public class ItemUtils {
if(actor != null && item.getData(EntityDataStrings.ANIM_IDLE) != null){ if(actor != null && item.getData(EntityDataStrings.ANIM_IDLE) != null){
String idleAnim = (String)item.getData(EntityDataStrings.ANIM_IDLE); String idleAnim = (String)item.getData(EntityDataStrings.ANIM_IDLE);
if(!actor.isPlayingAnimation(idleAnim)){ if(!actor.isPlayingAnimation(idleAnim)){
actor.playAnimation(idleAnim,AnimationPriorities.ITEM_INTERACTION); actor.playAnimation(idleAnim,AnimationPriorities.getValue(AnimationPriorities.INTERACTION));
actor.incrementAnimationTime(0.0001); actor.incrementAnimationTime(0.0001);
} }
} }

View File

@ -32,6 +32,11 @@ public class TreeDataAnimation {
*/ */
Integer priority; Integer priority;
/**
* The priority category this animation is in
*/
String priorityCategory;
/** /**
* The list of bone groups this animation applies to * The list of bone groups this animation applies to
*/ */
@ -77,6 +82,14 @@ public class TreeDataAnimation {
return priority; return priority;
} }
/**
* Gets the priority category of this animation
* @return The priority category
*/
public String getPriorityCategory(){
return priorityCategory;
}
/** /**
* Gets the bone groups this animation applies to * Gets the bone groups this animation applies to
* @return The list of bone groups this animation applies to * @return The list of bone groups this animation applies to

View File

@ -3,7 +3,14 @@ package electrosphere.game.data.creature.type;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import electrosphere.game.data.common.TreeDataAnimation;
import electrosphere.game.data.creature.type.attack.AttackMove;
import electrosphere.game.data.creature.type.bonegroups.BoneGroup; import electrosphere.game.data.creature.type.bonegroups.BoneGroup;
import electrosphere.game.data.creature.type.equip.EquipPoint;
import electrosphere.game.data.creature.type.movement.FallMovementSystem;
import electrosphere.game.data.creature.type.movement.GroundMovementSystem;
import electrosphere.game.data.creature.type.movement.JumpMovementSystem;
import electrosphere.game.data.creature.type.movement.MovementSystem;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
/** /**
@ -17,6 +24,7 @@ public class CreatureDataValidator {
*/ */
public static void validate(CreatureData data){ public static void validate(CreatureData data){
CreatureDataValidator.validateBoneGroups(data); CreatureDataValidator.validateBoneGroups(data);
CreatureDataValidator.validateAnimations(data);
} }
@ -68,4 +76,65 @@ public class CreatureDataValidator {
} }
} }
/**
* Validates the bone groups
* @param data The creature data
*/
static void validateAnimations(CreatureData data){
List<TreeDataAnimation> animations = new LinkedList<TreeDataAnimation>();
if(data.getAttackMoves() != null){
for(AttackMove move : data.getAttackMoves()){
animations.add(move.getAnimationFirstPersonAttack());
animations.add(move.getAnimationFirstPersonHold());
animations.add(move.getAnimationFirstPersonWindup());
}
}
if(data.getEquipPoints() != null){
for(EquipPoint point : data.getEquipPoints()){
animations.add(point.getEquippedAnimation());
}
}
if(data.getHealthSystem() != null && data.getHealthSystem().getDyingState() != null){
animations.add(data.getHealthSystem().getDyingState().getAnimation());
}
for(MovementSystem system : data.getMovementSystems()){
if(system instanceof GroundMovementSystem){
GroundMovementSystem groundMovementSystem = (GroundMovementSystem)system;
animations.add(groundMovementSystem.getAnimationFirstPersonLoop());
animations.add(groundMovementSystem.getAnimationFirstPersonStartup());
animations.add(groundMovementSystem.getAnimationFirstPersonWindDown());
animations.add(groundMovementSystem.getAnimationLoop());
animations.add(groundMovementSystem.getAnimationStartup());
animations.add(groundMovementSystem.getAnimationWindDown());
}
if(system instanceof JumpMovementSystem){
JumpMovementSystem jumpMovementSystem = (JumpMovementSystem)system;
animations.add(jumpMovementSystem.getAnimationFirstPersonJump());
animations.add(jumpMovementSystem.getAnimationJump());
}
if(system instanceof FallMovementSystem){
FallMovementSystem fallMovementSystem = (FallMovementSystem)system;
if(fallMovementSystem.getFallState() != null){
animations.add(fallMovementSystem.getFallState().getAnimation());
}
if(fallMovementSystem.getLandState() != null){
animations.add(fallMovementSystem.getLandState().getAnimation());
}
}
}
for(TreeDataAnimation animation : animations){
if(animation != null){
if(animation.getPriority() == null && animation.getPriorityCategory() == null){
//same bone used in multiple groups
String message = "Animation does not have priority defined!\n" +
"Creature name: " + data.getCreatureId() + "\n" +
"Animation first person name: " + animation.getNameFirstPerson() + "\n" +
"Animation third person name: " + animation.getNameThirdPerson() + "\n"
;
LoggerInterface.loggerEngine.WARNING(message);
}
}
}
}
} }

View File

@ -173,10 +173,13 @@ public class Actor {
} }
//Get the animation's priority //Get the animation's priority
int priority = AnimationPriorities.DEFAULT; int priority = AnimationPriorities.getValue(AnimationPriorities.DEFAULT);
if(animation.getPriority() != null){ if(animation.getPriority() != null){
priority = animation.getPriority(); priority = animation.getPriority();
} }
if(animation.getPriorityCategory() != null){
priority = AnimationPriorities.getValue(animation.getPriorityCategory());
}
//Gets the mask //Gets the mask
List<String> boneMask = null; List<String> boneMask = null;

View File

@ -161,10 +161,13 @@ public class PoseActor {
} }
//Get the animation's priority //Get the animation's priority
int priority = AnimationPriorities.DEFAULT; int priority = AnimationPriorities.getValue(AnimationPriorities.DEFAULT);
if(animation.getPriority() != null){ if(animation.getPriority() != null){
priority = animation.getPriority(); priority = animation.getPriority();
} }
if(animation.getPriorityCategory() != null){
priority = AnimationPriorities.getValue(animation.getPriorityCategory());
}
//Gets the mask //Gets the mask
List<String> boneMask = null; List<String> boneMask = null;