parshapes fixes, jump/fall state reorg
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
d9d2a74f68
commit
55eacf2c1b
@ -12,13 +12,11 @@
|
||||
+ rearchitecture
|
||||
|
||||
+ fix the vibes
|
||||
Stability
|
||||
Ticketed randomizer node for BTs to more heavily weight attacking and waiting
|
||||
|
||||
+ bug fixes
|
||||
Fix falling tree not always deactivating on server
|
||||
Fix cursor always placing at origin
|
||||
Fix server ground movement tree playing animation over falling animation
|
||||
Fix jump/fall/land animations being buggy and inconsistent between client/server
|
||||
Fix empty item slot not showing underneath dragged item
|
||||
Fix grass rendering distance
|
||||
|
||||
|
||||
@ -707,7 +707,9 @@ Framebuffer + RenderingEngine tests
|
||||
Fix obnoxious opengl state caching bug w/ framebuffers in junit context
|
||||
Recoil on attack block
|
||||
Movement speed penalty on swinging sword
|
||||
Fix fall tree blocking attack starting on server
|
||||
Fix fall tree blocking attack starting on server/Fix falling tree not always deactivating on server
|
||||
ParShapes integration fix
|
||||
Fix server ground movement tree playing animation over falling animation
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
@ -251,7 +251,7 @@ public class ControlHandler {
|
||||
boolean shouldRecaptureScreen = false;
|
||||
|
||||
//controls whether the camera is first or third person
|
||||
boolean cameraIsThirdPerson = false;
|
||||
boolean cameraIsThirdPerson = true;
|
||||
|
||||
//The list of window strings that would block main game controls
|
||||
static String[] controlBlockingWindows = new String[]{
|
||||
|
||||
@ -70,14 +70,16 @@ public class ClientCollidableTree implements BehaviorTree {
|
||||
// }
|
||||
}
|
||||
//bound to world bounds
|
||||
if(newPosition.x < Globals.clientWorldData.getWorldBoundMin().x){
|
||||
newPosition.x = Globals.clientWorldData.getWorldBoundMin().x;
|
||||
}
|
||||
if(newPosition.y < Globals.clientWorldData.getWorldBoundMin().y){
|
||||
newPosition.y = Globals.clientWorldData.getWorldBoundMin().y;
|
||||
}
|
||||
if(newPosition.z < Globals.clientWorldData.getWorldBoundMin().z){
|
||||
newPosition.z = Globals.clientWorldData.getWorldBoundMin().z;
|
||||
if(Globals.clientWorldData != null){
|
||||
if(newPosition.x < Globals.clientWorldData.getWorldBoundMin().x){
|
||||
newPosition.x = Globals.clientWorldData.getWorldBoundMin().x;
|
||||
}
|
||||
if(newPosition.y < Globals.clientWorldData.getWorldBoundMin().y){
|
||||
newPosition.y = Globals.clientWorldData.getWorldBoundMin().y;
|
||||
}
|
||||
if(newPosition.z < Globals.clientWorldData.getWorldBoundMin().z){
|
||||
newPosition.z = Globals.clientWorldData.getWorldBoundMin().z;
|
||||
}
|
||||
}
|
||||
PhysicsUtils.setRigidBodyTransform(Globals.clientSceneWrapper.getCollisionEngine(), newPosition, rotation, body);
|
||||
}
|
||||
|
||||
@ -89,7 +89,6 @@ public class ClientGravityTree implements BehaviorTree {
|
||||
switch(state){
|
||||
case ACTIVE:
|
||||
if(hadGroundCollision()){
|
||||
state = GravityTreeState.NOT_ACTIVE;
|
||||
if(!hadStructureCollision()){
|
||||
}
|
||||
ClientJumpTree jumpTree;
|
||||
|
||||
@ -88,6 +88,10 @@ public class ServerGravityTree implements BehaviorTree {
|
||||
return this.state == GravityTreeState.ACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates the gravity tree
|
||||
* @param deltaTime The time to simulate it for
|
||||
*/
|
||||
public void simulate(float deltaTime){
|
||||
|
||||
//state machine
|
||||
|
||||
@ -44,6 +44,11 @@ public class ClientFallTree implements BehaviorTree {
|
||||
//The state transition util
|
||||
StateTransitionUtil stateTransitionUtil;
|
||||
|
||||
/**
|
||||
* The number of frames this has been active
|
||||
*/
|
||||
int frameCurrent = 0;
|
||||
|
||||
public ClientFallTree(Entity parent, FallMovementSystem fallMovementSystem){
|
||||
this.parent = parent;
|
||||
this.fallMovementSystem = fallMovementSystem;
|
||||
@ -64,10 +69,14 @@ public class ClientFallTree implements BehaviorTree {
|
||||
public void simulate(float deltaTime) {
|
||||
switch(state){
|
||||
case ACTIVE:
|
||||
stateTransitionUtil.simulate(FallState.ACTIVE);
|
||||
if(ClientGravityTree.getClientGravityTree(parent) != null && !ClientGravityTree.getClientGravityTree(parent).isActive()){
|
||||
this.land();
|
||||
break;
|
||||
}
|
||||
if(frameCurrent > 0){
|
||||
stateTransitionUtil.simulate(FallState.ACTIVE);
|
||||
}
|
||||
frameCurrent++;
|
||||
break;
|
||||
case INACTIVE:
|
||||
break;
|
||||
@ -95,6 +104,7 @@ public class ClientFallTree implements BehaviorTree {
|
||||
public void land(){
|
||||
if(state != FallState.INACTIVE){
|
||||
state = FallState.INACTIVE;
|
||||
this.stateTransitionUtil.interrupt(FallState.ACTIVE);
|
||||
Actor entityActor = EntityUtils.getActor(parent);
|
||||
if(entityActor != null){
|
||||
if(
|
||||
@ -113,6 +123,7 @@ public class ClientFallTree implements BehaviorTree {
|
||||
//play third person audio
|
||||
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.LAND, EntityUtils.getPosition(parent));
|
||||
}
|
||||
frameCurrent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,9 +4,11 @@ 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.btree.StateTransitionUtil;
|
||||
import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem;
|
||||
import electrosphere.entity.state.gravity.ServerGravityTree;
|
||||
import electrosphere.entity.state.movement.jump.ServerJumpTree;
|
||||
import electrosphere.game.data.common.TreeDataAnimation;
|
||||
import electrosphere.game.data.creature.type.movement.FallMovementSystem;
|
||||
import electrosphere.server.poseactor.PoseActor;
|
||||
|
||||
@ -17,15 +19,18 @@ public class ServerFallTree implements BehaviorTree {
|
||||
INACTIVE,
|
||||
}
|
||||
|
||||
FallState state = FallState.INACTIVE;
|
||||
//the raw data from disk
|
||||
FallMovementSystem fallMovementSystem;
|
||||
|
||||
String animationFall = "Armature|Fall";
|
||||
String animationLand = "Armature|Land";
|
||||
FallState state = FallState.INACTIVE;
|
||||
|
||||
Entity parent;
|
||||
|
||||
ServerJumpTree jumpTree;
|
||||
|
||||
//The state transition util
|
||||
StateTransitionUtil stateTransitionUtil;
|
||||
|
||||
/**
|
||||
* The number of frames this has been active
|
||||
*/
|
||||
@ -33,25 +38,30 @@ public class ServerFallTree implements BehaviorTree {
|
||||
|
||||
public ServerFallTree(Entity parent, FallMovementSystem fallMovementSystem){
|
||||
this.parent = parent;
|
||||
this.fallMovementSystem = fallMovementSystem;
|
||||
stateTransitionUtil = StateTransitionUtil.create(
|
||||
parent,
|
||||
true,
|
||||
new StateTransitionUtilItem[]{
|
||||
StateTransitionUtilItem.create(
|
||||
FallState.ACTIVE,
|
||||
fallMovementSystem.getFallState(),
|
||||
null
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulate(float deltaTime) {
|
||||
PoseActor poseActor = EntityUtils.getPoseActor(parent);
|
||||
switch(state){
|
||||
case ACTIVE:
|
||||
if(poseActor != null){
|
||||
String animationToPlay = determineCorrectAnimation();
|
||||
if(
|
||||
!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay) &&
|
||||
(jumpTree == null || !jumpTree.isJumping())
|
||||
){
|
||||
poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
|
||||
poseActor.incrementAnimationTime(0.0001);
|
||||
}
|
||||
}
|
||||
if(ServerGravityTree.getServerGravityTree(parent) != null && !ServerGravityTree.getServerGravityTree(parent).isActive()){
|
||||
this.land();
|
||||
break;
|
||||
}
|
||||
if(frameCurrent > 0){
|
||||
stateTransitionUtil.simulate(FallState.ACTIVE);
|
||||
}
|
||||
frameCurrent++;
|
||||
break;
|
||||
@ -78,17 +88,18 @@ public class ServerFallTree implements BehaviorTree {
|
||||
public void land(){
|
||||
if(state != FallState.INACTIVE){
|
||||
state = FallState.INACTIVE;
|
||||
frameCurrent = 0;
|
||||
this.stateTransitionUtil.interrupt(FallState.ACTIVE);
|
||||
PoseActor poseActor = EntityUtils.getPoseActor(parent);
|
||||
if(poseActor != null){
|
||||
String animationToPlay = determineCorrectAnimation();
|
||||
if(poseActor != null && frameCurrent > 3){
|
||||
TreeDataAnimation animationToPlay = this.fallMovementSystem.getLandState().getAnimation();
|
||||
if(
|
||||
!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay)
|
||||
){
|
||||
poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
|
||||
poseActor.playAnimation(animationToPlay);
|
||||
poseActor.incrementAnimationTime(0.0001);
|
||||
}
|
||||
}
|
||||
frameCurrent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,29 +107,11 @@ public class ServerFallTree implements BehaviorTree {
|
||||
return (ServerFallTree)parent.getData(EntityDataStrings.FALL_TREE);
|
||||
}
|
||||
|
||||
String determineCorrectAnimation(){
|
||||
switch(state){
|
||||
case ACTIVE:
|
||||
return animationFall;
|
||||
case INACTIVE:
|
||||
return animationLand;
|
||||
default:
|
||||
return animationLand;
|
||||
}
|
||||
}
|
||||
|
||||
public void setServerJumpTree(ServerJumpTree jumpTree){
|
||||
this.jumpTree = jumpTree;
|
||||
}
|
||||
|
||||
public void setAnimationFall(String animationName){
|
||||
animationFall = animationName;
|
||||
}
|
||||
|
||||
public void setAnimationLand(String animationName){
|
||||
animationLand = animationName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current frame of the attack tree
|
||||
* @return The frame
|
||||
|
||||
@ -16,6 +16,7 @@ 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.gravity.GravityUtils;
|
||||
import electrosphere.game.data.creature.type.movement.JumpMovementSystem;
|
||||
import electrosphere.net.synchronization.annotation.SyncedField;
|
||||
import electrosphere.net.synchronization.annotation.SynchronizableEnum;
|
||||
@ -106,6 +107,9 @@ public class ClientJumpTree implements BehaviorTree {
|
||||
body.setLinearVel(linearVelocity.get0(), 0, linearVelocity.get2());
|
||||
//push parent up
|
||||
body.addForce(0, currentJumpForce, 0);
|
||||
if(currentFrame >= jumpFrames){
|
||||
GravityUtils.clientAttemptActivateGravity(parent);
|
||||
}
|
||||
break;
|
||||
case INACTIVE:
|
||||
break;
|
||||
@ -127,7 +131,7 @@ public class ClientJumpTree implements BehaviorTree {
|
||||
|
||||
public void land(){
|
||||
if(state != JumpState.INACTIVE && currentFrame > 2){
|
||||
state = JumpState.INACTIVE;
|
||||
this.setState(JumpState.INACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,9 +76,8 @@ public class ServerJumpTree implements BehaviorTree {
|
||||
switch(state){
|
||||
case ACTIVE:
|
||||
if(poseActor != null){
|
||||
String animationToPlay = determineCorrectAnimation();
|
||||
if(!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(animationToPlay)){
|
||||
poseActor.playAnimation(animationToPlay,AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
|
||||
if(!poseActor.isPlayingAnimation() || !poseActor.isPlayingAnimation(jumpData.getAnimationJump().getNameThirdPerson())){
|
||||
poseActor.playAnimation(jumpData.getAnimationJump().getNameThirdPerson(),AnimationPriorities.getValue(AnimationPriorities.MOVEMENT_MODIFIER));
|
||||
poseActor.incrementAnimationTime(0.0001);
|
||||
}
|
||||
}
|
||||
@ -124,10 +123,6 @@ public class ServerJumpTree implements BehaviorTree {
|
||||
return state == JumpState.ACTIVE;
|
||||
}
|
||||
|
||||
String determineCorrectAnimation(){
|
||||
return animationJump;
|
||||
}
|
||||
|
||||
public void setAnimationJump(String animationName){
|
||||
animationJump = animationName;
|
||||
}
|
||||
|
||||
@ -353,11 +353,20 @@ public class RenderUtils {
|
||||
//buffer coords
|
||||
ParShapesMesh data = ParShapes.par_shapes_create_parametric_sphere(10, 5);
|
||||
int numPoints = data.npoints();
|
||||
|
||||
//verts
|
||||
FloatBuffer verts = data.points(numPoints * 3);
|
||||
sphereMesh.bufferVertices(verts, 3);
|
||||
|
||||
//indices
|
||||
IntBuffer indices = data.triangles(data.ntriangles() * 3);
|
||||
sphereMesh.bufferFaces(indices, data.ntriangles() * 3);
|
||||
|
||||
//texture coords
|
||||
FloatBuffer texCoords = data.tcoords(numPoints * 3);
|
||||
sphereMesh.bufferTextureCoords(texCoords, 2);
|
||||
|
||||
|
||||
//setup extra structures
|
||||
Material mat = new Material();
|
||||
mat.set_diffuse("Textures/color/transparent_teal.png");
|
||||
@ -382,8 +391,16 @@ public class RenderUtils {
|
||||
//buffer coords
|
||||
ParShapesMesh data = ParShapes.par_shapes_create_cylinder(10, 2);
|
||||
int numPoints = data.npoints();
|
||||
|
||||
//verts
|
||||
FloatBuffer verts = data.points(numPoints * 3);
|
||||
sphereMesh.bufferVertices(verts, 3);
|
||||
|
||||
//indices
|
||||
IntBuffer indices = data.triangles(data.ntriangles() * 3);
|
||||
sphereMesh.bufferFaces(indices, data.ntriangles());
|
||||
|
||||
//texture coords
|
||||
FloatBuffer texCoords = data.tcoords(numPoints * 2);
|
||||
sphereMesh.bufferTextureCoords(texCoords, 2);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user