Compare commits
2 Commits
077cffa2e2
...
512998eb24
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
512998eb24 | ||
|
|
86edabf4de |
@ -170,17 +170,30 @@ Cellular Automata Fluid Dynamics System
|
||||
- Advect force
|
||||
- Advect density
|
||||
- Diffuse density
|
||||
- Do not bound to single chunks
|
||||
|
||||
Fluid Chunk System
|
||||
- Basic model creation
|
||||
- Streaming chunks over network
|
||||
- Only add compression when it starts to become an issue
|
||||
|
||||
Fix character movement
|
||||
- Walking left or right while turning camera is very jittery
|
||||
|
||||
Fix Frustum Culling for skybox
|
||||
|
||||
Free camera system that can detatch from player entity
|
||||
|
||||
Fix Character creation preview not working
|
||||
|
||||
|
||||
Clean up main method/class
|
||||
|
||||
Bring LWJGL version up to latest
|
||||
|
||||
Include Remotery library
|
||||
|
||||
Physics-controlled objects system
|
||||
|
||||
Shader library system
|
||||
- Abiltiy to include the shader library in individual files (ie implement #include)
|
||||
|
||||
@ -342,3 +355,12 @@ dynamic camp/house system - npcs will gradually join your camp the longer you st
|
||||
dynamic warfare system
|
||||
- Guard towers that need to be captured by factions before enabling assault on real settlements
|
||||
- Raids against villages
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Known bugs
|
||||
- Draw cell manager iso values dont make sense and should scale empty cells based on neighbor cells
|
||||
- Draw cell manager logic doesn't fill in border cells properly (the logic to check if a border cell exists always succeeds as long as the potential location is within world bounds, not if it actually exists in cache)
|
||||
- Control handler re-polls for mouse coordiantes for each control handler group it processes, so only the first group gets the mouse movement event properly
|
||||
@ -113,9 +113,7 @@ public class FluidCell {
|
||||
* Fills in the internal arrays of data for generate terrain models
|
||||
*/
|
||||
private void fillInData(){
|
||||
if(worldPos.x == 1 && worldPos.y == 0 && worldPos.z == 0){
|
||||
System.out.println("aaaa");
|
||||
}
|
||||
|
||||
//
|
||||
//fill in data
|
||||
//
|
||||
@ -293,8 +291,10 @@ public class FluidCell {
|
||||
currZ >= 0 && currZ < ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE &&
|
||||
(1 + weights[x][y][z]) < weights[currX][currY][currZ]
|
||||
){
|
||||
System.out.println("set neighbor weight");
|
||||
weights[x][y][z] = -(1 - weights[currX][currY][currZ]);
|
||||
if(weights[x][y][z] >= 0){
|
||||
weights[x][y][z] = -0.01f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ public class ClientFunctions {
|
||||
updateSkyboxPos();
|
||||
Globals.clientSceneWrapper.destroyEntitiesOutsideSimRange();
|
||||
InstanceUpdater.updateInstancedActorPriority();
|
||||
Globals.cameraHandler.updateGlobalCamera();
|
||||
// updateCellManager();
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ public class CameraHandler {
|
||||
float pitch = 50;
|
||||
Vector3f cameraRotationVector = new Vector3f();
|
||||
Vector3f radialOffset = new Vector3f(0,1,0);
|
||||
boolean trackPlayerEntity = true;
|
||||
|
||||
public void handleMouseEvent(MouseEvent event){
|
||||
|
||||
@ -89,6 +90,10 @@ public class CameraHandler {
|
||||
// cameraRotationVector.normalize();
|
||||
// System.out.println(yaw + " " + pitch);
|
||||
}
|
||||
if(trackPlayerEntity && Globals.playerEntity != null){
|
||||
Vector3d entityPos = EntityUtils.getPosition(Globals.playerEntity);
|
||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z).add(CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera)));
|
||||
}
|
||||
//update view matrix offset
|
||||
float xFactor = (float)Math.cos(yaw / 180.0f * Math.PI);
|
||||
float yFactor = (float)Math.sin(yaw / 180.0f * Math.PI);
|
||||
@ -110,4 +115,17 @@ public class CameraHandler {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
//set player tracking
|
||||
public void setTrackPlayerEntity(boolean track){
|
||||
trackPlayerEntity = track;
|
||||
}
|
||||
|
||||
//get trackPlayerEntity
|
||||
public boolean getTrackPlayerEntity(){
|
||||
return trackPlayerEntity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -193,6 +193,15 @@ public class ControlHandler {
|
||||
|
||||
public static final String DEBUG_FRAMESTEP = "framestep";
|
||||
public static final String DEBUG_OPEN_DEBUG_MENU = "openDebugMenu";
|
||||
|
||||
|
||||
public static final String FREECAM_UP = "freecamUp";
|
||||
public static final String FREECAM_DOWN = "freecamDown";
|
||||
public static final String FREECAM_FORWARD = "freecamForward";
|
||||
public static final String FREECAM_BACKWARD = "freecamBackward";
|
||||
public static final String FREECAM_LEFT = "freecamLeft";
|
||||
public static final String FREECAM_RIGHT = "freecamRight";
|
||||
public static final String FREECAM_MOUSE = "freecamMouse";
|
||||
|
||||
|
||||
public static enum ControlsState {
|
||||
@ -200,6 +209,7 @@ public class ControlHandler {
|
||||
TITLE_MENU,
|
||||
MAIN_GAME,
|
||||
IN_GAME_MAIN_MENU,
|
||||
IN_GAME_FREE_CAMERA,
|
||||
INVENTORY,
|
||||
NO_INPUT,
|
||||
}
|
||||
@ -232,6 +242,7 @@ public class ControlHandler {
|
||||
List<Control> typingControlList = new LinkedList<Control>();
|
||||
List<Control> inventoryControlList = new LinkedList<Control>();
|
||||
List<Control> alwaysOnDebugControlList = new LinkedList<Control>();
|
||||
List<Control> freeCameraControlList = new LinkedList<Control>();
|
||||
|
||||
ControlHandler(){
|
||||
controls = new HashMap<String, Control>();
|
||||
@ -341,6 +352,18 @@ public class ControlHandler {
|
||||
set state
|
||||
*/
|
||||
handler.setHandlerState(ControlsState.TITLE_MENU);
|
||||
|
||||
/*
|
||||
* Free camera
|
||||
*/
|
||||
handler.addControl(FREECAM_UP, new Control(ControlType.KEY,GLFW_KEY_SPACE));
|
||||
handler.addControl(FREECAM_DOWN, new Control(ControlType.KEY,GLFW_KEY_LEFT_CONTROL));
|
||||
handler.addControl(FREECAM_FORWARD, new Control(ControlType.KEY,GLFW_KEY_W));
|
||||
handler.addControl(FREECAM_BACKWARD, new Control(ControlType.KEY,GLFW_KEY_S));
|
||||
handler.addControl(FREECAM_LEFT, new Control(ControlType.KEY,GLFW_KEY_A));
|
||||
handler.addControl(FREECAM_RIGHT, new Control(ControlType.KEY,GLFW_KEY_D));
|
||||
handler.addControl(FREECAM_MOUSE, new Control(ControlType.MOUSE_MOVEMENT,0));
|
||||
|
||||
|
||||
/*
|
||||
Save to file
|
||||
@ -395,6 +418,12 @@ public class ControlHandler {
|
||||
// pollMenuNavigationControls();
|
||||
break;
|
||||
|
||||
case IN_GAME_FREE_CAMERA:
|
||||
runHandlers(freeCameraControlList);
|
||||
runHandlers(mainGameDebugControlList);
|
||||
runHandlers(alwaysOnDebugControlList);
|
||||
break;
|
||||
|
||||
case INVENTORY:
|
||||
runHandlers(inventoryControlList);
|
||||
runHandlers(menuNavigationControlList);
|
||||
@ -416,6 +445,7 @@ public class ControlHandler {
|
||||
setTypingControls();
|
||||
setInventoryControls();
|
||||
setAlwaysOnDebugControls();
|
||||
setFreecamControls();
|
||||
}
|
||||
|
||||
void setMainGameControls(){
|
||||
@ -1121,6 +1151,48 @@ public class ControlHandler {
|
||||
controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
||||
|
||||
}
|
||||
|
||||
void setFreecamControls(){
|
||||
freeCameraControlList.add(controls.get(FREECAM_UP));
|
||||
controls.get(FREECAM_UP).setOnRepeat(new ControlMethod(){public void execute(){
|
||||
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||
playerCameraCenterPos.add(0,0.1f,0);
|
||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||
}});
|
||||
|
||||
|
||||
freeCameraControlList.add(controls.get(FREECAM_DOWN));
|
||||
controls.get(FREECAM_DOWN).setOnRepeat(new ControlMethod(){public void execute(){
|
||||
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||
playerCameraCenterPos.add(0,-0.1f,0);
|
||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||
}});
|
||||
|
||||
|
||||
freeCameraControlList.add(controls.get(FREECAM_FORWARD));
|
||||
controls.get(FREECAM_FORWARD).setOnRepeat(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));
|
||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||
}});
|
||||
|
||||
freeCameraControlList.add(controls.get(FREECAM_BACKWARD));
|
||||
controls.get(FREECAM_BACKWARD).setOnRepeat(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));
|
||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||
}});
|
||||
|
||||
freeCameraControlList.add(controls.get(FREECAM_MOUSE));
|
||||
controls.get(FREECAM_MOUSE).setOnMove(new Control.MouseCallback(){public void execute(MouseEvent event){
|
||||
Globals.cameraHandler.handleMouseEvent(event);
|
||||
}});
|
||||
|
||||
freeCameraControlList.add(controls.get(DATA_STRING_INPUT_CODE_IN_GAME_MAIN_MENU));
|
||||
|
||||
}
|
||||
|
||||
void setTypingControls(){
|
||||
|
||||
@ -1352,6 +1424,10 @@ public class ControlHandler {
|
||||
public void setHandlerState(ControlsState state){
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public ControlsState getHandlerState(){
|
||||
return state;
|
||||
}
|
||||
|
||||
public ControlsState getState(){
|
||||
return state;
|
||||
|
||||
@ -18,8 +18,8 @@ import electrosphere.engine.loadingthreads.LoadingThread;
|
||||
import electrosphere.game.config.UserSettings;
|
||||
import electrosphere.game.server.world.MacroData;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.menu.ImGuiWindowMacros;
|
||||
import electrosphere.renderer.RenderingEngine;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindowMacros;
|
||||
import electrosphere.server.simulation.MacroSimulation;
|
||||
|
||||
|
||||
|
||||
@ -177,7 +177,6 @@ public class ClientLoading {
|
||||
|
||||
*/
|
||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity(new Vector3f(1,0,1), new Vector3f(0,0,1));
|
||||
// Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityAirplaneTrackingCameraEntity(new Vector3f(1,0,1), new Vector3f(0,0,1));
|
||||
|
||||
|
||||
|
||||
|
||||
@ -62,16 +62,7 @@ public class CameraEntityUtils {
|
||||
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3f(0,1,0));
|
||||
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
||||
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
||||
BehaviorTree entityTrackingTree = new BehaviorTree() {
|
||||
@Override
|
||||
public void simulate(float deltaTime) {
|
||||
if(Globals.playerEntity != null){
|
||||
Vector3d entityPos = EntityUtils.getPosition(Globals.playerEntity);
|
||||
CameraEntityUtils.setCameraCenter(rVal, new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z).add(getOrbitalCameraRadialOffset(rVal)));
|
||||
}
|
||||
}
|
||||
};
|
||||
Globals.clientScene.registerBehaviorTree(entityTrackingTree);
|
||||
Globals.cameraHandler.setTrackPlayerEntity(true);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,16 @@
|
||||
package electrosphere.renderer.ui.imgui;
|
||||
package electrosphere.menu;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import electrosphere.audio.VirtualAudioSource;
|
||||
import electrosphere.controls.ControlHandler.ControlsState;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.renderer.RenderingEngine;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiLinePlot;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiBarPlot;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiLinePlot.ImGuiLinePlotDataset;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||
import imgui.ImGui;
|
||||
@ -25,24 +30,26 @@ public class ImGuiWindowMacros {
|
||||
private static ImGuiLinePlot globalFrametimePlot;
|
||||
private static Map<String,ImGuiLinePlotDataset> globalFrametimeDatasets;
|
||||
|
||||
//server sim time graph
|
||||
private static ImGuiWindow serverFrametimeWindow;
|
||||
private static ImGuiBarPlot serverFrametimePlot;
|
||||
private static double serverFrametimeTrackerStorage = 0;
|
||||
|
||||
//audio debug menu
|
||||
private static ImGuiWindow audioDebugMenu;
|
||||
private static boolean showAllVirtualAudioChildren = false;
|
||||
private static boolean showMappedVirtualAudioChildren = true;
|
||||
|
||||
//player entity details
|
||||
private static ImGuiWindow playerEntityWindow;
|
||||
|
||||
//fluid details
|
||||
private static ImGuiWindow fluidWindow;
|
||||
|
||||
/**
|
||||
* Initializes imgui windows
|
||||
*/
|
||||
public static void initImGuiWindows(){
|
||||
createMainDebugMenu();
|
||||
createFramerateGraph();
|
||||
createServerFrametimeGraph();
|
||||
createAudioDebugMenu();
|
||||
createPlayerEntityDebugWindow();
|
||||
createFluidDebugWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,46 +94,12 @@ public class ImGuiWindowMacros {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a server frametime breakdown graph
|
||||
*/
|
||||
private static void createServerFrametimeGraph(){
|
||||
serverFrametimeWindow = new ImGuiWindow("Server Frametime Graph");
|
||||
serverFrametimePlot = new ImGuiBarPlot("Server Frametime plot");
|
||||
serverFrametimeWindow.addElement(serverFrametimePlot);
|
||||
serverFrametimeWindow.setOpen(false);
|
||||
RenderingEngine.addImGuiWindow(serverFrametimeWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a tracker for server frametime for a given method
|
||||
*/
|
||||
public static void startServerFrametimeTrackerFlame(double startValue){
|
||||
serverFrametimeTrackerStorage = startValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes tracking a single run of a specific method
|
||||
* @param valueName The name of the method
|
||||
* @param endValue the end time that the method finished on
|
||||
*/
|
||||
public static void clockServerFrametimeTrackerFlame(String valueName, double endValue){
|
||||
serverFrametimePlot.addToDatapoint(valueName, endValue - serverFrametimeTrackerStorage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the server frametime values so they can be re-filled
|
||||
*/
|
||||
public static void clearServerFrametime(){
|
||||
serverFrametimePlot.clearDatapoints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create audio debug menu
|
||||
*/
|
||||
private static void createAudioDebugMenu(){
|
||||
audioDebugMenu = new ImGuiWindow("Audio");
|
||||
audioDebugMenu.callback = new ImGuiWindowCallback() {
|
||||
audioDebugMenu.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
//audio engine details
|
||||
@ -175,38 +148,84 @@ public class ImGuiWindowMacros {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
audioDebugMenu.setOpen(false);
|
||||
RenderingEngine.addImGuiWindow(audioDebugMenu);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create player entity debug menu
|
||||
*/
|
||||
private static void createPlayerEntityDebugWindow(){
|
||||
playerEntityWindow = new ImGuiWindow("Player Entity");
|
||||
playerEntityWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
//player entity details
|
||||
ImGui.text("Player Entity Details");
|
||||
if(Globals.playerEntity != null){
|
||||
ImGui.text("Position: " + EntityUtils.getPosition(Globals.playerEntity));
|
||||
}
|
||||
if(ImGui.button("Toggle Player Camera Lock")){
|
||||
Globals.cameraHandler.setTrackPlayerEntity(!Globals.cameraHandler.getTrackPlayerEntity());
|
||||
}
|
||||
}
|
||||
});
|
||||
playerEntityWindow.setOpen(false);
|
||||
RenderingEngine.addImGuiWindow(playerEntityWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create fluid debug menu
|
||||
*/
|
||||
private static void createFluidDebugWindow(){
|
||||
fluidWindow = new ImGuiWindow("Fluids");
|
||||
fluidWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
//audio engine details
|
||||
ImGui.text("Fluids Debug");
|
||||
if(ImGui.button("Toggle Simulation")){
|
||||
Globals.serverFluidManager.setSimulate(!Globals.serverFluidManager.getSimulate());;
|
||||
}
|
||||
}
|
||||
});
|
||||
fluidWindow.setOpen(false);
|
||||
RenderingEngine.addImGuiWindow(fluidWindow);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inits the main debug menu
|
||||
*/
|
||||
private static void createMainDebugMenu(){
|
||||
mainDebugWindow = new ImGuiWindow("Debug");
|
||||
mainDebugWindow.callback = new ImGuiWindowCallback() {
|
||||
mainDebugWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
//show global framerate line graph
|
||||
if(ImGui.button("Show Overall Frametime")){
|
||||
globalFrametimeWindow.setOpen(true);
|
||||
}
|
||||
//show server frametime bar graph
|
||||
if(ImGui.button("Show Server Frametime Breakdown")){
|
||||
serverFrametimeWindow.setOpen(true);
|
||||
}
|
||||
//show audio debug
|
||||
if(ImGui.button("Show Audio Debug Menu")){
|
||||
audioDebugMenu.setOpen(true);
|
||||
}
|
||||
//show audio debug
|
||||
if(ImGui.button("Show Player Entity Debug Menu")){
|
||||
playerEntityWindow.setOpen(true);
|
||||
}
|
||||
//show fluids debug
|
||||
if(ImGui.button("Show Fluids Debug Menu")){
|
||||
fluidWindow.setOpen(true);
|
||||
}
|
||||
//close button
|
||||
if(ImGui.button("Close")){
|
||||
mainDebugWindow.setOpen(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
RenderingEngine.addImGuiWindow(mainDebugWindow);
|
||||
}
|
||||
|
||||
@ -47,7 +47,11 @@ public class MenuGeneratorsInGame {
|
||||
div.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), false);
|
||||
Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
||||
Globals.controlHandler.setHandlerState(ControlsState.MAIN_GAME);
|
||||
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
||||
Globals.controlHandler.setHandlerState(ControlsState.MAIN_GAME);
|
||||
} else {
|
||||
Globals.controlHandler.setHandlerState(ControlsState.IN_GAME_FREE_CAMERA);
|
||||
}
|
||||
Globals.controlHandler.hideMouse();
|
||||
return false;
|
||||
}});
|
||||
@ -68,7 +72,11 @@ public class MenuGeneratorsInGame {
|
||||
backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), false);
|
||||
Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
||||
Globals.controlHandler.setHandlerState(ControlsState.MAIN_GAME);
|
||||
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
||||
Globals.controlHandler.setHandlerState(ControlsState.MAIN_GAME);
|
||||
} else {
|
||||
Globals.controlHandler.setHandlerState(ControlsState.IN_GAME_FREE_CAMERA);
|
||||
}
|
||||
Globals.controlHandler.hideMouse();
|
||||
return false;
|
||||
}});
|
||||
|
||||
@ -6,8 +6,8 @@ import electrosphere.engine.Main;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.Scene;
|
||||
import electrosphere.entity.types.hitbox.HitboxManager;
|
||||
import electrosphere.menu.ImGuiWindowMacros;
|
||||
import electrosphere.net.parser.net.message.NetworkMessage;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindowMacros;
|
||||
import electrosphere.server.datacell.interfaces.DataCellManager;
|
||||
|
||||
import java.util.HashSet;
|
||||
@ -156,15 +156,10 @@ public class Realm {
|
||||
* Tells the data cell manager to simulate all loaded cells
|
||||
*/
|
||||
protected void simulate(){
|
||||
ImGuiWindowMacros.clearServerFrametime();
|
||||
//simulate bullet physics engine step
|
||||
ImGuiWindowMacros.startServerFrametimeTrackerFlame(System.currentTimeMillis());
|
||||
collisionEngine.simulatePhysics((float)Globals.timekeeper.getSimFrameTime());
|
||||
ImGuiWindowMacros.clockServerFrametimeTrackerFlame("physics", System.currentTimeMillis());
|
||||
//main simulation
|
||||
ImGuiWindowMacros.startServerFrametimeTrackerFlame(System.currentTimeMillis());
|
||||
dataCellManager.simulate();
|
||||
ImGuiWindowMacros.clockServerFrametimeTrackerFlame("simulate", System.currentTimeMillis());
|
||||
//data cell manager update misc variables (player positions, unload not-in-use cells)
|
||||
if(dataCellManager != null){
|
||||
dataCellManager.unloadPlayerlessChunks();
|
||||
|
||||
@ -58,6 +58,9 @@ public class ServerFluidManager {
|
||||
|
||||
//the terrain manager associated
|
||||
ServerTerrainManager serverTerrainManager;
|
||||
|
||||
//controls whether fluid simulation should actually happen or not
|
||||
boolean simulate = true;
|
||||
|
||||
|
||||
/**
|
||||
@ -292,12 +295,26 @@ public class ServerFluidManager {
|
||||
* Simulates a chunk
|
||||
*/
|
||||
public boolean simulate(int worldX, int worldY, int worldZ){
|
||||
ServerFluidChunk fluidChunk = this.getChunk(worldX, worldY, worldZ);
|
||||
ServerTerrainChunk terrainChunk = this.serverTerrainManager.getChunk(worldX, worldY, worldZ);
|
||||
if(fluidChunk != null && terrainChunk != null && this.serverFluidSimulator != null){
|
||||
return this.serverFluidSimulator.simulate(fluidChunk,terrainChunk,worldX,worldY,worldZ);
|
||||
if(simulate){
|
||||
ServerFluidChunk fluidChunk = this.getChunk(worldX, worldY, worldZ);
|
||||
ServerTerrainChunk terrainChunk = this.serverTerrainManager.getChunk(worldX, worldY, worldZ);
|
||||
if(fluidChunk != null && terrainChunk != null && this.serverFluidSimulator != null){
|
||||
return this.serverFluidSimulator.simulate(fluidChunk,terrainChunk,worldX,worldY,worldZ);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//getter for simulate
|
||||
public boolean getSimulate(){
|
||||
return simulate;
|
||||
}
|
||||
|
||||
//setter for simulate
|
||||
public void setSimulate(boolean simulate){
|
||||
this.simulate = simulate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user