small movement work
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				studiorailgun/Renderer/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	studiorailgun/Renderer/pipeline/head This commit looks good
				
			This commit is contained in:
		
							parent
							
								
									859670d3b6
								
							
						
					
					
						commit
						cacc8dc57f
					
				| @ -129,6 +129,8 @@ | |||||||
|                     "type" : "GROUND", |                     "type" : "GROUND", | ||||||
|                     "acceleration" : 5000.0, |                     "acceleration" : 5000.0, | ||||||
|                     "maxVelocity" : 500.5, |                     "maxVelocity" : 500.5, | ||||||
|  |                     "strafeMultiplier" : 0.7, | ||||||
|  |                     "backpedalMultiplier" : 0.5, | ||||||
|                     "animationStartup" : { |                     "animationStartup" : { | ||||||
|                         "nameThirdPerson" : "Jog", |                         "nameThirdPerson" : "Jog", | ||||||
|                         "priorityCategory"  : "CORE_MOVEMENT" |                         "priorityCategory"  : "CORE_MOVEMENT" | ||||||
|  | |||||||
| @ -503,6 +503,11 @@ State transition utils interrupt support | |||||||
| Block animation cancels immediately on first person model | Block animation cancels immediately on first person model | ||||||
| Bone-attachment fix | Bone-attachment fix | ||||||
| Fix data for viewmodel hand.r equip point | Fix data for viewmodel hand.r equip point | ||||||
|  | Support audio on state transition | ||||||
|  | Audio on block state transitions | ||||||
|  | 
 | ||||||
|  | (08/04/2024) | ||||||
|  | Strafe/backpedal movement speed multipliers | ||||||
| 
 | 
 | ||||||
| # TODO | # TODO | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -135,7 +135,7 @@ public class Globals { | |||||||
|     public static boolean RUN_DEMO = false; |     public static boolean RUN_DEMO = false; | ||||||
|     public static boolean RUN_CLIENT = true; |     public static boolean RUN_CLIENT = true; | ||||||
|     public static boolean RUN_HIDDEN = false; //glfw session will be created with hidden window |     public static boolean RUN_HIDDEN = false; //glfw session will be created with hidden window | ||||||
|     public static boolean RUN_AUDIO = true; |     public static boolean RUN_AUDIO = false; | ||||||
|     public static int clientCharacterID; |     public static int clientCharacterID; | ||||||
|      |      | ||||||
|     // |     // | ||||||
|  | |||||||
| @ -20,7 +20,6 @@ import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState; | |||||||
| import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | import electrosphere.entity.state.client.firstPerson.FirstPersonTree; | ||||||
| import electrosphere.entity.state.movement.FallTree; | import electrosphere.entity.state.movement.FallTree; | ||||||
| import electrosphere.entity.state.movement.SprintTree; | import electrosphere.entity.state.movement.SprintTree; | ||||||
| import electrosphere.entity.state.movement.SprintTree.SprintTreeState; |  | ||||||
| import electrosphere.entity.state.movement.jump.ClientJumpTree; | import electrosphere.entity.state.movement.jump.ClientJumpTree; | ||||||
| import electrosphere.net.parser.net.message.EntityMessage; | import electrosphere.net.parser.net.message.EntityMessage; | ||||||
| import electrosphere.net.synchronization.annotation.SyncedField; | import electrosphere.net.synchronization.annotation.SyncedField; | ||||||
| @ -112,6 +111,9 @@ public class ClientGroundMovementTree implements BehaviorTree { | |||||||
|      */ |      */ | ||||||
|     private ClientGroundMovementTree(Entity e, Object ... params){ |     private ClientGroundMovementTree(Entity e, Object ... params){ | ||||||
|         //Collidable collidable, GroundMovementSystem groundMovementData |         //Collidable collidable, GroundMovementSystem groundMovementData | ||||||
|  |         if(params.length < 2){ | ||||||
|  |             throw new IllegalArgumentException("Tried to create a client ground movement tree without providing both mandatory parameters"); | ||||||
|  |         } | ||||||
|         state = MovementTreeState.IDLE; |         state = MovementTreeState.IDLE; | ||||||
|         parent = e; |         parent = e; | ||||||
|         this.collidable = (Collidable)params[0]; |         this.collidable = (Collidable)params[0]; | ||||||
| @ -188,9 +190,8 @@ public class ClientGroundMovementTree implements BehaviorTree { | |||||||
|     public void simulate(float deltaTime){ |     public void simulate(float deltaTime){ | ||||||
|         float velocity = CreatureUtils.getVelocity(parent); |         float velocity = CreatureUtils.getVelocity(parent); | ||||||
|         float acceleration = CreatureUtils.getAcceleration(parent); |         float acceleration = CreatureUtils.getAcceleration(parent); | ||||||
|         float maxNaturalVelocity = sprintTree != null && sprintTree.getState() == SprintTreeState.SPRINTING ? sprintTree.getMaxVelocity() : CreatureUtils.getMaxNaturalVelocity(parent); |         float maxNaturalVelocity = ServerGroundMovementTree.getMaximumVelocity(parent, this.groundMovementData, facing); | ||||||
|         Actor entityActor = EntityUtils.getActor(parent); |         Actor entityActor = EntityUtils.getActor(parent); | ||||||
| //        Model entityModel = Globals.assetManager.fetchModel(EntityUtils.getEntityModelPath(parent)); |  | ||||||
|         Vector3d position = EntityUtils.getPosition(parent); |         Vector3d position = EntityUtils.getPosition(parent); | ||||||
|         Vector3d facingVector = CreatureUtils.getFacingVector(parent); |         Vector3d facingVector = CreatureUtils.getFacingVector(parent); | ||||||
|         DBody body = PhysicsEntityUtils.getDBody(parent); |         DBody body = PhysicsEntityUtils.getDBody(parent); | ||||||
|  | |||||||
| @ -14,6 +14,7 @@ import electrosphere.collision.collidable.Collidable; | |||||||
| import electrosphere.engine.Globals; | import electrosphere.engine.Globals; | ||||||
| import electrosphere.entity.types.camera.CameraEntityUtils; | import electrosphere.entity.types.camera.CameraEntityUtils; | ||||||
| import electrosphere.entity.types.creature.CreatureUtils; | import electrosphere.entity.types.creature.CreatureUtils; | ||||||
|  | import electrosphere.game.data.creature.type.movement.GroundMovementSystem; | ||||||
| import electrosphere.entity.Entity; | import electrosphere.entity.Entity; | ||||||
| import electrosphere.entity.EntityDataStrings; | import electrosphere.entity.EntityDataStrings; | ||||||
| import electrosphere.entity.EntityUtils; | import electrosphere.entity.EntityUtils; | ||||||
| @ -23,7 +24,6 @@ import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState; | |||||||
| import electrosphere.entity.state.attack.ServerAttackTree; | import electrosphere.entity.state.attack.ServerAttackTree; | ||||||
| import electrosphere.entity.state.movement.ServerFallTree; | import electrosphere.entity.state.movement.ServerFallTree; | ||||||
| import electrosphere.entity.state.movement.ServerSprintTree; | import electrosphere.entity.state.movement.ServerSprintTree; | ||||||
| import electrosphere.entity.state.movement.ServerSprintTree.SprintTreeState; |  | ||||||
| import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing; | import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementRelativeFacing; | ||||||
| import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState; | import electrosphere.entity.state.movement.groundmove.ClientGroundMovementTree.MovementTreeState; | ||||||
| import electrosphere.entity.state.movement.jump.ServerJumpTree; | import electrosphere.entity.state.movement.jump.ServerJumpTree; | ||||||
| @ -63,6 +63,9 @@ public class ServerGroundMovementTree implements BehaviorTree { | |||||||
|     @SyncedField |     @SyncedField | ||||||
|     MovementRelativeFacing facing; |     MovementRelativeFacing facing; | ||||||
| 
 | 
 | ||||||
|  |     //The data for the movement system | ||||||
|  |     GroundMovementSystem groundMovementSystem; | ||||||
|  |      | ||||||
|     ServerSprintTree sprintTree; |     ServerSprintTree sprintTree; | ||||||
|     ServerJumpTree jumpTree; |     ServerJumpTree jumpTree; | ||||||
|     ServerFallTree fallTree; |     ServerFallTree fallTree; | ||||||
| @ -80,11 +83,12 @@ public class ServerGroundMovementTree implements BehaviorTree { | |||||||
|      |      | ||||||
|      |      | ||||||
|     private ServerGroundMovementTree(Entity e, Object ... params){ |     private ServerGroundMovementTree(Entity e, Object ... params){ | ||||||
|         //Collidable collidable |         //Collidable collidable, GroundMovementSystem system | ||||||
|         state = MovementTreeState.IDLE; |         state = MovementTreeState.IDLE; | ||||||
|         facing = MovementRelativeFacing.FORWARD; |         facing = MovementRelativeFacing.FORWARD; | ||||||
|         parent = e; |         parent = e; | ||||||
|         this.collidable = (Collidable)params[0]; |         this.collidable = (Collidable)params[0]; | ||||||
|  |         this.groundMovementSystem = (GroundMovementSystem)params[1]; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public MovementTreeState getState(){ |     public MovementTreeState getState(){ | ||||||
| @ -165,7 +169,7 @@ public class ServerGroundMovementTree implements BehaviorTree { | |||||||
|         if(CreatureUtils.hasVelocity(parent)){ |         if(CreatureUtils.hasVelocity(parent)){ | ||||||
|             velocity = CreatureUtils.getVelocity(parent); |             velocity = CreatureUtils.getVelocity(parent); | ||||||
|             acceleration = CreatureUtils.getAcceleration(parent); |             acceleration = CreatureUtils.getAcceleration(parent); | ||||||
|             maxNaturalVelocity = sprintTree != null && sprintTree.getState() == SprintTreeState.SPRINTING ? sprintTree.getMaxVelocity() : CreatureUtils.getMaxNaturalVelocity(parent); |             maxNaturalVelocity = ServerGroundMovementTree.getMaximumVelocity(parent, this.groundMovementSystem, facing); | ||||||
|         } |         } | ||||||
|         if(ServerPlayerViewDirTree.hasTree(parent)){ |         if(ServerPlayerViewDirTree.hasTree(parent)){ | ||||||
|             ServerPlayerViewDirTree serverViewTree =ServerPlayerViewDirTree.getTree(parent); |             ServerPlayerViewDirTree serverViewTree =ServerPlayerViewDirTree.getTree(parent); | ||||||
| @ -471,6 +475,37 @@ public class ServerGroundMovementTree implements BehaviorTree { | |||||||
|         this.fallTree = fallTree; |         this.fallTree = fallTree; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets the maximum velocity of an entity | ||||||
|  |      * @param entity | ||||||
|  |      * @param groundMovementSystem | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     public static float getMaximumVelocity(Entity entity, GroundMovementSystem groundMovementSystem, MovementRelativeFacing facing){ | ||||||
|  |         float maxVelocity = groundMovementSystem.getMaxVelocity(); | ||||||
|  |         switch(facing){ | ||||||
|  |             case FORWARD: { | ||||||
|  |                 return maxVelocity; | ||||||
|  |             } | ||||||
|  |             case BACKWARD_LEFT: | ||||||
|  |             case BACKWARD_RIGHT: | ||||||
|  |             case BACKWARD: { | ||||||
|  |                 if(groundMovementSystem.getBackpedalMultiplier() != null){ | ||||||
|  |                     return maxVelocity * groundMovementSystem.getBackpedalMultiplier(); | ||||||
|  |                 } | ||||||
|  |             } break; | ||||||
|  |             case LEFT: | ||||||
|  |             case RIGHT: | ||||||
|  |             case FORWARD_LEFT: | ||||||
|  |             case FORWARD_RIGHT: { | ||||||
|  |                 if(groundMovementSystem.getStrafeMultiplier() != null){ | ||||||
|  |                     return maxVelocity * groundMovementSystem.getStrafeMultiplier(); | ||||||
|  |                 } | ||||||
|  |             } break; | ||||||
|  |         } | ||||||
|  |         return maxVelocity; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * <p> Automatically generated </p> |      * <p> Automatically generated </p> | ||||||
|      * <p> |      * <p> | ||||||
|  | |||||||
| @ -399,7 +399,7 @@ public class CreatureUtils { | |||||||
|                 // Generic ground |                 // Generic ground | ||||||
|                 case GroundMovementSystem.GROUND_MOVEMENT_SYSTEM: |                 case GroundMovementSystem.GROUND_MOVEMENT_SYSTEM: | ||||||
|                     GroundMovementSystem groundMovementSystem = (GroundMovementSystem)movementSystem; |                     GroundMovementSystem groundMovementSystem = (GroundMovementSystem)movementSystem; | ||||||
|                     ServerGroundMovementTree moveTree = ServerGroundMovementTree.attachTree(rVal,CollisionObjUtils.getCollidable(rVal)); |                     ServerGroundMovementTree moveTree = ServerGroundMovementTree.attachTree(rVal,CollisionObjUtils.getCollidable(rVal),groundMovementSystem); | ||||||
|                     if(groundMovementSystem.getAnimationStartup() != null){ |                     if(groundMovementSystem.getAnimationStartup() != null){ | ||||||
|                         moveTree.setAnimationStartUp(groundMovementSystem.getAnimationStartup().getNameThirdPerson()); |                         moveTree.setAnimationStartUp(groundMovementSystem.getAnimationStartup().getNameThirdPerson()); | ||||||
|                     } |                     } | ||||||
|  | |||||||
| @ -18,6 +18,12 @@ public class GroundMovementSystem implements MovementSystem { | |||||||
|     float acceleration; |     float acceleration; | ||||||
|     float maxVelocity; |     float maxVelocity; | ||||||
| 
 | 
 | ||||||
|  |     //The multiplier for movement speed when strafing | ||||||
|  |     Float strafeMultiplier; | ||||||
|  | 
 | ||||||
|  |     //The multiplier for movement speed when backpedaling | ||||||
|  |     Float backpedalMultiplier; | ||||||
|  | 
 | ||||||
|     //startup data |     //startup data | ||||||
|     TreeDataAnimation animationStartup; |     TreeDataAnimation animationStartup; | ||||||
| 
 | 
 | ||||||
| @ -79,6 +85,22 @@ public class GroundMovementSystem implements MovementSystem { | |||||||
|         return sprintSystem; |         return sprintSystem; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets the multiplier applied to the movement speed while the creature is strafing | ||||||
|  |      * @return The multiplier | ||||||
|  |      */ | ||||||
|  |     public Float getStrafeMultiplier(){ | ||||||
|  |         return this.strafeMultiplier; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets the multiplier applied to the movement speed while the creature is backpedaling | ||||||
|  |      * @return The multiplier | ||||||
|  |      */ | ||||||
|  |     public Float getBackpedalMultiplier(){ | ||||||
|  |         return this.backpedalMultiplier; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     @Override |     @Override | ||||||
|     public String getType() { |     public String getType() { | ||||||
|         return type; |         return type; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user