camera movement work + freecam terrain editing
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-05-12 12:42:12 -04:00
parent baf7bf976d
commit 341d5683cf
8 changed files with 96 additions and 8 deletions

View File

@ -0,0 +1,5 @@
@page dungeonsindex Dungeons
Enforce slower walking speed in dungeons (to give movement a more deliberate and weighty feel)
- Slower movement will also help with weapons feel more impactful
Have the engine generate different types of shortcuts to allow you to quickly navigate up/down to the uncleared floors

View File

@ -17,4 +17,5 @@ Discussion of, at a high game-design level, how everything should work and conne
- @subpage fluidindex
- @subpage locomotion
- @subpage economicsindex
- @subpage structuresandbuildings
- @subpage structuresandbuildings
- @subpage dungeonsindex

View File

@ -275,6 +275,15 @@ First Person Camera
# TODO
First person render pipeline
- Dedicated client scene
- Properly compositing onto main texture
- Potentially look at storing the framebuffer for the pipeline in the pipeline class itself
Overhaul of 'attach' semantics
- Having different types of attach tree propagation
- Ability to turn on/off combinations of models at will (already exists, but needs review)
Character movement in particular feels off
- Bring back strafing
- Fix interaction with networking

View File

@ -1215,20 +1215,50 @@ public class ControlHandler {
freeCameraControlList.add(controls.get(FREECAM_FORWARD));
controls.get(FREECAM_FORWARD).setOnRepeat(new ControlMethod(){public void execute(){
ControlMethod freeCamForwardCallback = new ControlMethod(){public void execute(){
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
Vector3f playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
playerCameraCenterPos.add(new Vector3f(playerCameraEyePos).mul(-0.1f));
playerCameraCenterPos.add(new Vector3f(playerCameraEyePos).normalize().mul(-0.1f));
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
}});
}};
controls.get(FREECAM_FORWARD).setOnClick(freeCamForwardCallback);
controls.get(FREECAM_FORWARD).setOnRepeat(freeCamForwardCallback);
freeCameraControlList.add(controls.get(FREECAM_BACKWARD));
controls.get(FREECAM_BACKWARD).setOnRepeat(new ControlMethod(){public void execute(){
ControlMethod freeCamBackwardCallback = new ControlMethod(){public void execute(){
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
Vector3f playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
playerCameraCenterPos.add(new Vector3f(playerCameraEyePos).mul(0.1f));
playerCameraCenterPos.add(new Vector3f(playerCameraEyePos).normalize().mul(0.1f));
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
}});
}};
controls.get(FREECAM_BACKWARD).setOnClick(freeCamBackwardCallback);
controls.get(FREECAM_BACKWARD).setOnRepeat(freeCamBackwardCallback);
freeCameraControlList.add(controls.get(FREECAM_LEFT));
ControlMethod freeCamLeftCallback = new ControlMethod(){public void execute(){
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
Vector3f playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
Vector3f modifiedVec = new Vector3f(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(-90 * Math.PI / 180)).normalize();
playerCameraCenterPos.add(new Vector3f(modifiedVec).mul(0.1f));
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
}};
controls.get(FREECAM_LEFT).setOnClick(freeCamLeftCallback);
controls.get(FREECAM_LEFT).setOnRepeat(freeCamLeftCallback);
freeCameraControlList.add(controls.get(FREECAM_RIGHT));
ControlMethod freeCamRightCallback = new ControlMethod(){public void execute(){
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
Vector3f playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
Vector3f modifiedVec = new Vector3f(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(90 * Math.PI / 180)).normalize();
playerCameraCenterPos.add(new Vector3f(modifiedVec).mul(0.1f));
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
}};
controls.get(FREECAM_RIGHT).setOnClick(freeCamRightCallback);
controls.get(FREECAM_RIGHT).setOnRepeat(freeCamRightCallback);
//terrain controls -- these should have already been defined in the main game controls section
freeCameraControlList.add(controls.get(INPUT_CODE_PLACE_TERRAIN));
freeCameraControlList.add(controls.get(INPUT_CODE_REMOVE_TERRAIN));
freeCameraControlList.add(controls.get(FREECAM_MOUSE));
controls.get(FREECAM_MOUSE).setOnMove(new Control.MouseCallback(){public void execute(MouseEvent event){

View File

@ -287,6 +287,11 @@ public class GroundMovementTree implements BehaviorTree {
}
CreatureUtils.setVelocity(parent, velocity);
//actually update
// body.addForce(
// movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
// linearVelocity.get1(),
// movementVector.z * velocity * Globals.timekeeper.getSimFrameTime()
// );
body.setLinearVel(
movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
linearVelocity.get1(),
@ -316,6 +321,11 @@ public class GroundMovementTree implements BehaviorTree {
velocity = maxNaturalVelocity;
CreatureUtils.setVelocity(parent, velocity);
}
// body.addForce(
// movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
// linearVelocity.get1(),
// movementVector.z * velocity * Globals.timekeeper.getSimFrameTime()
// );
body.setLinearVel(
movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
linearVelocity.get1(),
@ -354,6 +364,11 @@ public class GroundMovementTree implements BehaviorTree {
}
}
CreatureUtils.setVelocity(parent, velocity);
// body.addForce(
// movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
// linearVelocity.get1(),
// movementVector.z * velocity * Globals.timekeeper.getSimFrameTime()
// );
body.setLinearVel(
movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
linearVelocity.get1(),

View File

@ -274,6 +274,11 @@ public class ServerGroundMovementTree implements BehaviorTree {
}
CreatureUtils.setVelocity(parent, velocity);
// //actually update
// PhysicsEntityUtils.getDBody(parent).addForce(
// movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
// linearVelocity.get1(),
// movementVector.z * velocity * Globals.timekeeper.getSimFrameTime()
// );
PhysicsEntityUtils.getDBody(parent).setLinearVel(
movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
linearVelocity.get1(),
@ -319,6 +324,11 @@ public class ServerGroundMovementTree implements BehaviorTree {
velocity = maxNaturalVelocity;
CreatureUtils.setVelocity(parent, velocity);
}
// PhysicsEntityUtils.getDBody(parent).addForce(
// movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
// linearVelocity.get1(),
// movementVector.z * velocity * Globals.timekeeper.getSimFrameTime()
// );
PhysicsEntityUtils.getDBody(parent).setLinearVel(
movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
linearVelocity.get1(),
@ -373,6 +383,11 @@ public class ServerGroundMovementTree implements BehaviorTree {
}
}
CreatureUtils.setVelocity(parent, velocity);
// PhysicsEntityUtils.getDBody(parent).addForce(
// movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
// linearVelocity.get1(),
// movementVector.z * velocity * Globals.timekeeper.getSimFrameTime()
// );
PhysicsEntityUtils.getDBody(parent).setLinearVel(
movementVector.x * velocity * Globals.timekeeper.getSimFrameTime(),
linearVelocity.get1(),

View File

@ -26,7 +26,7 @@ public class LoggerInterface {
*/
public static void initLoggers(){
loggerStartup = new Logger(LogLevel.WARNING);
loggerNetworking = new Logger(LogLevel.WARNING);
loggerNetworking = new Logger(LogLevel.DEBUG);
loggerFileIO = new Logger(LogLevel.WARNING);
loggerGameLogic = new Logger(LogLevel.WARNING);
loggerRenderer = new Logger(LogLevel.WARNING);

View File

@ -0,0 +1,13 @@
package electrosphere.renderer.pipelines;
import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.RenderPipelineState;
public class FirstPersonItemsPipeline implements RenderPipeline {
@Override
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
//todo, render hands to a screenbuffer
}
}