Swapping attack tree to use unified animation obj
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-07-28 17:23:02 -04:00
parent 4b0064b761
commit cc2ff6a93a
11 changed files with 112 additions and 171 deletions

View File

@ -133,26 +133,14 @@
"nameThirdPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
},
"animationFirstPersonStartup" : {
"nameFirstPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
},
"animationLoop" : {
"nameThirdPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
},
"animationFirstPersonLoop" : {
"nameFirstPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
},
"animationWindDown" : {
"nameThirdPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
},
"animationFirstPersonWindDown" : {
"nameFirstPerson" : "Jog",
"priorityCategory" : "CORE_MOVEMENT"
},
"sprintSystem" : {
"maxVelocity" : 0.058,
"staminaMax" : 500,
@ -172,9 +160,6 @@
"jumpForce" : 500,
"animationJump" : {
"nameThirdPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonJump" : {
"nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
}
@ -331,7 +316,6 @@
{
"attackMoveId" : "Sword1HSlash1",
"type" : "MELEE_WEAPON_SWING_ONE_HAND",
"attackAnimationName" : "Sword1HSlash1",
"windupFrames" : 5,
"attackFrames" : 5,
"cooldownFrames" : 25,
@ -345,23 +329,25 @@
"driftFrameStart" : 7,
"driftFrameEnd" : 15,
"initialMove" : true,
"animationFirstPersonWindup" : {
"nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonHold" : {
"nameFirstPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonAttack" : {
"animationWindup" : {
"nameFirstPerson" : "Sword1HSlash1",
"nameThirdPerson" : "Sword1HSlash1",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationHold" : {
"nameFirstPerson" : "Sword1HSlash1",
"nameThirdPerson" : "Sword1HSlash1",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationAttack" : {
"nameFirstPerson" : "Sword1HSlash1",
"nameThirdPerson" : "Sword1HSlash1",
"priorityCategory" : "MOVEMENT_MODIFIER"
}
},
{
"attackMoveId" : "Sword1HSlash2",
"type" : "MELEE_WEAPON_SWING_ONE_HAND",
"attackAnimationName" : "Sword1HSlash2",
"windupFrames" : 2,
"attackFrames" : 5,
"cooldownFrames" : 28,
@ -373,23 +359,25 @@
"driftFrameStart" : 1,
"driftFrameEnd" : 10,
"initialMove" : false,
"animationFirstPersonWindup" : {
"animationWindup" : {
"nameFirstPerson" : "Jump",
"nameThirdPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonHold" : {
"animationHold" : {
"nameFirstPerson" : "Jump",
"nameThirdPerson" : "Jump",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonAttack" : {
"animationAttack" : {
"nameFirstPerson" : "Sword1HSlash2",
"nameThirdPerson" : "Sword1HSlash2",
"priorityCategory" : "MOVEMENT_MODIFIER"
}
},
{
"attackMoveId" : "Sword2HSlash1",
"type" : "MELEE_WEAPON_SWING_TWO_HAND",
"attackAnimationName" : "SwordR2HSlash",
"windupFrames" : 2,
"attackFrames" : 5,
"cooldownFrames" : 28,
@ -400,25 +388,15 @@
"driftFrameStart" : 1,
"driftFrameEnd" : 10,
"initialMove" : true,
"animationFirstPersonWindup" : {
"nameFirstPerson" : "HoldItemR2H",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonHold" : {
"nameFirstPerson" : "HoldItemR2H",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonAttack" : {
"animationAttack" : {
"nameFirstPerson" : "SwordR2HSlash",
"nameThirdPerson" : "SwordR2HSlash",
"priorityCategory" : "MOVEMENT_MODIFIER"
}
},
{
"attackMoveId" : "Bow2HFire",
"type" : "RANGED_WEAPON_BOW_TWO_HAND",
"windupAnimationName" : "HoldBowString",
"holdAnimationName" : "HoldBow",
"attackAnimationName" : "HoldBowString",
"damageStartFrame" : 30,
"damageEndFrame" : 60,
"firesProjectile" : true,
@ -429,16 +407,19 @@
"movementEnd" : 0,
"movementGoal" : 0,
"initialMove" : true,
"animationFirstPersonWindup" : {
"animationWindup" : {
"nameFirstPerson" : "Jump",
"nameThirdPerson" : "HoldBowString",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonHold" : {
"animationHold" : {
"nameFirstPerson" : "Jump",
"nameThirdPerson" : "HoldBow",
"priorityCategory" : "MOVEMENT_MODIFIER"
},
"animationFirstPersonAttack" : {
"animationAttack" : {
"nameFirstPerson" : "Jump",
"nameThirdPerson" : "HoldBowString",
"priorityCategory" : "MOVEMENT_MODIFIER"
}
}

View File

@ -472,6 +472,7 @@ Tear out first person rendering pipeline
Partially fix first person attachment to viewmodel
Creature data validation
Unify animation format data on disk
Leverage animation masks to block while moving
# TODO

View File

@ -8,7 +8,6 @@ import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.btree.BehaviorTree;
import electrosphere.entity.state.AnimationPriorities;
import electrosphere.entity.state.client.firstPerson.FirstPersonTree;
import electrosphere.entity.state.collidable.Impulse;
import electrosphere.entity.state.equip.ClientEquipState;
@ -238,52 +237,47 @@ public class ClientAttackTree implements BehaviorTree {
if(parent.containsKey(EntityDataStrings.CLIENT_ROTATOR_TREE)){
RotatorTree.getClientRotatorTree(parent).setActive(true);
}
if(currentMove != null){
if(entityActor != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getWindupAnimationName())){
if(currentMove != null && entityActor != null && currentMove.getAnimationWindup() != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getAnimationWindup())){
entityActor.playAnimation(
currentMove.getWindupAnimationName(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
currentMove.getAnimationWindup(),
true
);
entityActor.incrementAnimationTime(0.0001);
}
FirstPersonTree.conditionallyPlayAnimation(
Globals.firstPersonEntity,
currentMove.getAnimationFirstPersonWindup().getNameFirstPerson(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
currentMove.getAnimationWindup()
);
}
}
} break;
case HOLD: {
if(entityActor != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getHoldAnimationName())){
if(entityActor != null && currentMove.getAnimationHold() != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getAnimationHold())){
entityActor.playAnimation(
currentMove.getHoldAnimationName(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
currentMove.getAnimationHold(),
true
);
entityActor.incrementAnimationTime(0.0001);
}
FirstPersonTree.conditionallyPlayAnimation(
Globals.firstPersonEntity,
currentMove.getAnimationFirstPersonHold().getNameFirstPerson(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
currentMove.getAnimationHold()
);
}
} break;
case ATTACK: {
if(entityActor != null && currentMove != null){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getAttackAnimationName())){
if(!entityActor.isPlayingAnimation() || !entityActor.isPlayingAnimation(currentMove.getAnimationAttack())){
entityActor.playAnimation(
currentMove.getAttackAnimationName(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
currentMove.getAnimationAttack(),
true
);
entityActor.incrementAnimationTime(0.0001);
}
FirstPersonTree.conditionallyPlayAnimation(
Globals.firstPersonEntity,
currentMove.getAnimationFirstPersonAttack().getNameFirstPerson(),
AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER)
currentMove.getAnimationAttack()
);
}
//activate hitboxes

View File

@ -125,14 +125,14 @@ public class ServerAttackTree implements BehaviorTree {
projectileToFire = ItemUtils.getWeaponDataRaw(currentWeapon).getProjectileModel();
}
animationName = currentMove.getAttackAnimationName();
animationName = currentMove.getAnimationAttack().getNameThirdPerson();
//intuit windup from presence of windup anim
currentMoveHasWindup = currentMove.getWindupAnimationName() != null;
currentMoveHasWindup = currentMove.getAnimationWindup() != null;
if(currentMoveHasWindup){
animationName = currentMove.getWindupAnimationName();
animationName = currentMove.getAnimationWindup().getNameThirdPerson();
}
//intuit can hold from presence of windup anim
currentMoveCanHold = currentMove.getHoldAnimationName() != null;
currentMoveCanHold = currentMove.getAnimationHold() != null;
//stop movement tree
if(parent.containsKey(EntityDataStrings.SERVER_MOVEMENT_BT)){
BehaviorTree movementTree = CreatureUtils.serverGetEntityMovementTree(parent);
@ -266,8 +266,8 @@ public class ServerAttackTree implements BehaviorTree {
} break;
case ATTACK: {
if(entityPoseActor != null && currentMove != null){
if(!entityPoseActor.isPlayingAnimation() || !entityPoseActor.isPlayingAnimation(currentMove.getAttackAnimationName())){
entityPoseActor.playAnimation(currentMove.getAttackAnimationName(),1);
if(!entityPoseActor.isPlayingAnimation() || !entityPoseActor.isPlayingAnimation(currentMove.getAnimationAttack())){
entityPoseActor.playAnimation(currentMove.getAnimationAttack(),true);
entityPoseActor.incrementAnimationTime(0.0001);
}
}

View File

@ -96,7 +96,7 @@ public class FallTree implements BehaviorTree {
entityActor.playAnimation(fallMovementSystem.getLandState().getAnimation().getNameThirdPerson(),AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
entityActor.incrementAnimationTime(0.0001);
}
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getLandState().getAnimation().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, fallMovementSystem.getLandState().getAnimation());
}
}
}

View File

@ -64,7 +64,7 @@ public class JumpTree implements BehaviorTree {
entityActor.playAnimation(jumpData.getAnimationJump().getNameThirdPerson(),AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
entityActor.incrementAnimationTime(0.0001);
}
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, jumpData.getAnimationFirstPersonJump().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, jumpData.getAnimationJump());
}
currentFrame++;
currentJumpForce = currentJumpForce * jumpFalloff;

View File

@ -294,7 +294,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
entityActor.incrementAnimationTime(0.0001);
}
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonStartup().getNameThirdPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationStartup().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
}
//run startup code
velocity = velocity + acceleration * (float)Globals.timekeeper.getSimFrameTime();
@ -328,7 +328,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
entityActor.incrementAnimationTime(0.0001);
}
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonLoop().getNameThirdPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationLoop().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
}
if(velocity != maxNaturalVelocity){
velocity = maxNaturalVelocity;
@ -356,7 +356,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
entityActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
entityActor.incrementAnimationTime(0.0001);
}
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationFirstPersonWindDown().getNameThirdPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
FirstPersonTree.conditionallyPlayAnimation(Globals.firstPersonEntity, groundMovementData.getAnimationWindDown().getNameFirstPerson(), AnimationPriorities.getValue(AnimationPriorities.CORE_MOVEMENT));
}
//velocity stuff
velocity = velocity - acceleration * (float)Globals.timekeeper.getSimFrameTime();

View File

@ -84,9 +84,9 @@ public class CreatureDataValidator {
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());
animations.add(move.getAnimationAttack());
animations.add(move.getAnimationHold());
animations.add(move.getAnimationWindup());
}
}
if(data.getEquipPoints() != null){
@ -100,16 +100,12 @@ public class CreatureDataValidator {
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){

View File

@ -16,13 +16,9 @@ public class AttackMove {
/*
Animation stuff
*/
String windupAnimationName;
String holdAnimationName;
String attackAnimationName;
TreeDataAnimation animationFirstPersonWindup;
TreeDataAnimation animationFirstPersonHold;
TreeDataAnimation animationFirstPersonAttack;
TreeDataAnimation animationWindup;
TreeDataAnimation animationHold;
TreeDataAnimation animationAttack;
/*
Damage stuff
@ -65,51 +61,27 @@ public class AttackMove {
}
/**
* Gets the name of the animation to play in 3rd person for the windup
* @return the animation name
* Gets the animation to play for the windup
* @return the animation
*/
public String getWindupAnimationName() {
return windupAnimationName;
public TreeDataAnimation getAnimationWindup() {
return animationWindup;
}
/**
* Gets the name of the animation to play in 3rd person for the hold
* @return the animation name
* Gets the name of the animation to play for the hold
* @return the animation
*/
public String getHoldAnimationName() {
return holdAnimationName;
public TreeDataAnimation getAnimationHold() {
return animationHold;
}
/**
* Gets the name of the animation to play in 3rd person for the attack
* @return the animation name
* Gets the animation to play for the attack
* @return the animation
*/
public String getAttackAnimationName() {
return attackAnimationName;
}
/**
* Gets the animation data for the 1st person windup
* @return the animation data
*/
public TreeDataAnimation getAnimationFirstPersonWindup(){
return animationFirstPersonWindup;
}
/**
* Gets the animation data for the 1st person hold
* @return the animation data
*/
public TreeDataAnimation getAnimationFirstPersonHold(){
return animationFirstPersonHold;
}
/**
* Gets the animation data for the 1st person attack
* @return the animation data
*/
public TreeDataAnimation getAnimationFirstPersonAttack(){
return animationFirstPersonAttack;
public TreeDataAnimation getAnimationAttack() {
return animationAttack;
}
/**

View File

@ -20,15 +20,12 @@ public class GroundMovementSystem implements MovementSystem {
//startup data
TreeDataAnimation animationStartup;
TreeDataAnimation animationFirstPersonStartup;
//loop data
TreeDataAnimation animationLoop;
TreeDataAnimation animationFirstPersonLoop;
//wind down data
TreeDataAnimation animationWindDown;
TreeDataAnimation animationFirstPersonWindDown;
//sprint data
SprintSystem sprintSystem;
@ -51,7 +48,7 @@ public class GroundMovementSystem implements MovementSystem {
}
/**
* Gets the animation to play in 3rd person for startup
* Gets the animation to play for startup
* @return The animation data
*/
public TreeDataAnimation getAnimationStartup() {
@ -59,15 +56,7 @@ public class GroundMovementSystem implements MovementSystem {
}
/**
* Gets the animation to play in 1st person for startup
* @return The animation data
*/
public TreeDataAnimation getAnimationFirstPersonStartup(){
return animationFirstPersonStartup;
}
/**
* Gets the animation to loop in 3rd person
* Gets the animation to loop
* @return The animation data
*/
public TreeDataAnimation getAnimationLoop() {
@ -75,29 +64,13 @@ public class GroundMovementSystem implements MovementSystem {
}
/**
* Gets the animation to loop in 1st person
* @return The animation data
*/
public TreeDataAnimation getAnimationFirstPersonLoop(){
return animationFirstPersonLoop;
}
/**
* Gets the animation to play in 3rd person to wind down
* Gets the animation to play to wind down
* @return The animation data
*/
public TreeDataAnimation getAnimationWindDown() {
return animationWindDown;
}
/**
* Gets the animation to play in 1st person to wind down
* @return The animation data
*/
public TreeDataAnimation getAnimationFirstPersonWindDown(){
return animationFirstPersonWindDown;
}
/**
* Gets the sprint system data
* @return The sprint system data

View File

@ -2,34 +2,58 @@ package electrosphere.game.data.creature.type.movement;
import electrosphere.game.data.common.TreeDataAnimation;
/**
* A jump tree's data
*/
public class JumpMovementSystem implements MovementSystem {
/**
* The name for this movement tree system
*/
public static final String JUMP_MOVEMENT_SYSTEM = "JUMP";
//The type of tree
String type;
/**
* The animation to play when jumping
*/
TreeDataAnimation animationJump;
TreeDataAnimation animationFirstPersonJump;
/**
* The number of frames to apply the jump force
*/
int jumpFrames;
/**
* The force to apply while jump state
*/
float jumpForce;
/**
* Gets the number of frames to apply jump force for
* @return The number of frames
*/
public int getJumpFrames(){
return jumpFrames;
}
/**
* Gets the force to jump with
* @return The force
*/
public float getJumpForce(){
return jumpForce;
}
/**
* Gets the animation to play while jumping
* @return The animation
*/
public TreeDataAnimation getAnimationJump(){
return animationJump;
}
public TreeDataAnimation getAnimationFirstPersonJump(){
return animationFirstPersonJump;
}
@Override
public String getType() {
return type;