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