sim work + debug menus
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
parent
3b46a3ebe9
commit
0136a78992
@ -1698,7 +1698,8 @@ Ability to explicitly spawn new characters into macro data and have them then sp
|
||||
|
||||
(05/10/2025)
|
||||
Debug ability to send characters off map
|
||||
|
||||
More windows for debugging work
|
||||
GriddedDataCellManager simulates cells that contain creatures
|
||||
|
||||
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ public class ImGuiEntityMacros {
|
||||
//tree node values
|
||||
private static boolean showDataTab = false; //show all data names stored in the entity
|
||||
private static boolean showActorTab = false; //show the actor tab
|
||||
private static boolean showServerTab = false; //show server data
|
||||
private static boolean showHitboxTab = false; //show the hitbox tab
|
||||
private static boolean showInstancedActorTab = false; //show the instanced actor tab
|
||||
private static boolean showPoseActorTab = false; //show the pose actor tab
|
||||
@ -153,6 +154,9 @@ public class ImGuiEntityMacros {
|
||||
if(ImGui.checkbox("Data View", showDataTab)){
|
||||
showDataTab = !showDataTab;
|
||||
}
|
||||
if(EntityLookupUtils.isServerEntity(detailViewEntity) && ImGui.checkbox("Server Details", showServerTab)){
|
||||
showServerTab = !showServerTab;
|
||||
}
|
||||
if(EntityUtils.getActor(detailViewEntity) != null && ImGui.checkbox("Actor Details", showActorTab)){
|
||||
showActorTab = !showActorTab;
|
||||
}
|
||||
@ -201,6 +205,7 @@ public class ImGuiEntityMacros {
|
||||
ImGui.treePop();
|
||||
}
|
||||
ImGui.nextColumn();
|
||||
ImGuiEntityServerTab.drawServerView(showServerTab, detailViewEntity);
|
||||
ImGuiEntityActorTab.drawActorView(showActorTab,detailViewEntity);
|
||||
ImGuiEntityInstancedActorTab.drawInstancedActorView(showInstancedActorTab, detailViewEntity);
|
||||
ImGuiEntityHitboxTab.drawHitboxTab(showHitboxTab,detailViewEntity);
|
||||
|
||||
@ -83,6 +83,8 @@ public class ImGuiEntityPhysicsTab {
|
||||
ImGui.text("Torque: " + physicsBody.getTorque());
|
||||
ImGui.text("Move Vector: " + CreatureUtils.getFacingVector(detailViewEntity));
|
||||
ImGui.text("Velocity: " + CreatureUtils.getVelocity(detailViewEntity));
|
||||
ImGui.text("Enabled: " + physicsBody.isEnabled());
|
||||
ImGui.text("Kinematic: " + physicsBody.isKinematic());
|
||||
}
|
||||
//synchronized data
|
||||
if(
|
||||
@ -105,6 +107,8 @@ public class ImGuiEntityPhysicsTab {
|
||||
ImGui.text("Torque: " + serverPhysicsBody.getTorque());
|
||||
ImGui.text("Move Vector (Server): "+ CreatureUtils.getFacingVector(serverEntity));
|
||||
ImGui.text("Velocity (Server): " + CreatureUtils.getVelocity(serverEntity));
|
||||
ImGui.text("Enabled: " + serverPhysicsBody.isEnabled());
|
||||
ImGui.text("Kinematic: " + serverPhysicsBody.isKinematic());
|
||||
}
|
||||
} else if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
||||
//detailViewEntity is a server entity
|
||||
@ -123,6 +127,8 @@ public class ImGuiEntityPhysicsTab {
|
||||
ImGui.text("Torque: " + clientPhysicsBody.getTorque());
|
||||
ImGui.text("Move Vector (Client): " + CreatureUtils.getFacingVector(clientEntity));
|
||||
ImGui.text("Velocity (Client): " + CreatureUtils.getVelocity(clientEntity));
|
||||
ImGui.text("Enabled: " + clientPhysicsBody.isEnabled());
|
||||
ImGui.text("Kinematic: " + clientPhysicsBody.isKinematic());
|
||||
}
|
||||
}
|
||||
//Collidable editing
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package electrosphere.client.ui.menu.debug.entity;
|
||||
|
||||
import electrosphere.client.ui.menu.debug.server.ImGuiServerDataCell;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.server.datacell.ServerDataCell;
|
||||
import imgui.ImGui;
|
||||
|
||||
/**
|
||||
* Display entity data related to server
|
||||
*/
|
||||
public class ImGuiEntityServerTab {
|
||||
|
||||
/**
|
||||
* Physics view
|
||||
*/
|
||||
protected static void drawServerView(boolean show, Entity detailViewEntity){
|
||||
if(show && ImGui.collapsingHeader("Server Details")){
|
||||
ImGui.indent();
|
||||
ServerDataCell serverDataCell = Globals.entityDataCellMapper.getEntityDataCell(detailViewEntity);
|
||||
if(serverDataCell == null){
|
||||
ImGui.text("Entity's data cell is null!");
|
||||
} else {
|
||||
if(ImGui.button("View Data Cell")){
|
||||
ImGuiServerDataCell.viewCell(serverDataCell);
|
||||
}
|
||||
}
|
||||
ImGui.unindent();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package electrosphere.client.ui.menu.debug.server;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.EntityTags;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||
import electrosphere.server.datacell.ServerDataCell;
|
||||
import imgui.ImGui;
|
||||
|
||||
/**
|
||||
* Window for viewing data about a server data cell
|
||||
*/
|
||||
public class ImGuiServerDataCell {
|
||||
|
||||
/**
|
||||
* The current cell to view information about
|
||||
*/
|
||||
private static ServerDataCell currentCell;
|
||||
|
||||
/**
|
||||
* window for viewing information about the server data cell
|
||||
*/
|
||||
protected static ImGuiWindow serverDataCellWindow;
|
||||
|
||||
/**
|
||||
* Client scene entity view
|
||||
*/
|
||||
protected static void createServerDataCellWindow(){
|
||||
serverDataCellWindow = new ImGuiWindow("Server Data Cell Details");
|
||||
serverDataCellWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
if(currentCell == null){
|
||||
ImGui.text("Current cell is null!");
|
||||
} else {
|
||||
ImGui.text("Total entities: " + currentCell.getScene().getEntityList().size());
|
||||
ImGui.text("Creatures: " + currentCell.getScene().getEntitiesWithTag(EntityTags.CREATURE));
|
||||
ImGui.text("Ready: " + currentCell.isReady());
|
||||
}
|
||||
}
|
||||
});
|
||||
serverDataCellWindow.setOpen(false);
|
||||
Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(serverDataCellWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the window to view a specific server data cell
|
||||
* @param serverDataCell The cell
|
||||
*/
|
||||
public static void viewCell(ServerDataCell serverDataCell){
|
||||
if(serverDataCellWindow == null){
|
||||
ImGuiServerDataCell.createServerDataCellWindow();
|
||||
}
|
||||
ImGuiServerDataCell.currentCell = serverDataCell;
|
||||
serverDataCellWindow.setOpen(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -156,5 +156,10 @@ public class ViewportDataCellManager implements DataCellManager {
|
||||
public void evaluateMacroObject(MacroObject object) {
|
||||
throw new Error("ViewportDataCellManager does not support macro objects currently");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsCell(ServerDataCell cell) {
|
||||
return cell == this.serverDataCell;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.threads.ThreadCounts;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityCreationUtils;
|
||||
import electrosphere.entity.EntityTags;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.ServerEntityUtils;
|
||||
import electrosphere.entity.state.server.ServerPlayerViewDirTree;
|
||||
@ -461,6 +462,20 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
return playerChangedChunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the tracking data for each cell
|
||||
*/
|
||||
private void updateTrackingData(){
|
||||
Globals.profiler.beginCpuSample("GriddedDataCellManager.updateTrackingData");
|
||||
loadedCellsLock.lock();
|
||||
for(ServerDataCell cell : this.groundDataCells.values()){
|
||||
GriddedDataCellTrackingData trackingData = this.cellTrackingMap.get(cell);
|
||||
trackingData.setCreatureCount(cell.getScene().getEntitiesWithTag(EntityTags.CREATURE).size());
|
||||
}
|
||||
loadedCellsLock.unlock();
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unloads all chunks that haven't had players in them for a set amount of time
|
||||
@ -712,6 +727,7 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
loadedCellsLock.unlock();
|
||||
this.unloadPlayerlessChunks();
|
||||
this.updatePlayerPositions();
|
||||
this.updateTrackingData();
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
|
||||
@ -722,7 +738,12 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
*/
|
||||
private boolean shouldSimulate(ServerDataCell cell){
|
||||
GriddedDataCellTrackingData trackingData = this.cellTrackingMap.get(cell);
|
||||
return cell.getPlayers().size() > 0 && trackingData.getClosestPlayer() < SIMULATION_DISTANCE_CUTOFF;
|
||||
return
|
||||
//has player
|
||||
(cell.getPlayers().size() > 0 && trackingData.getClosestPlayer() < SIMULATION_DISTANCE_CUTOFF) ||
|
||||
//has creature
|
||||
(trackingData.getCreatureCount() > 0)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@ -1207,4 +1228,9 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsCell(ServerDataCell cell) {
|
||||
return this.groundDataCells.values().contains(cell);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -15,6 +15,11 @@ public class GriddedDataCellTrackingData {
|
||||
*/
|
||||
double closestPlayer;
|
||||
|
||||
/**
|
||||
* The number of creatures in the cell
|
||||
*/
|
||||
int creatureCount;
|
||||
|
||||
/**
|
||||
* Gets the distance from the cell to the closest player
|
||||
* @return The distance
|
||||
@ -30,5 +35,21 @@ public class GriddedDataCellTrackingData {
|
||||
public void setClosestPlayer(double closestPlayer) {
|
||||
this.closestPlayer = closestPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of creatures in this data cell
|
||||
* @return The number of creatures
|
||||
*/
|
||||
public int getCreatureCount() {
|
||||
return creatureCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of creatures in this cell
|
||||
* @param creatureCount The number of creatures in the cell
|
||||
*/
|
||||
public void setCreatureCount(int creatureCount) {
|
||||
this.creatureCount = creatureCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -63,6 +63,13 @@ public interface DataCellManager {
|
||||
*/
|
||||
public ServerDataCell getCellAtWorldPosition(Vector3i position);
|
||||
|
||||
/**
|
||||
* Checks if this manager contains a given cell
|
||||
* @param cell The cell
|
||||
* @return True if this manager contains this cell, false otherwise
|
||||
*/
|
||||
public boolean containsCell(ServerDataCell cell);
|
||||
|
||||
/**
|
||||
* Calls the simulate function on all loaded cells
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user