bugfixes
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
3a9eb0591d
commit
4d9047d8cf
@ -1075,6 +1075,13 @@ Voxel and Heightmap generators based on noise functions in files
|
||||
Set all client terrain rigid bodies are kinematic
|
||||
Add caves
|
||||
Tweaking test2 noise definition
|
||||
Add sleep to server socket thread
|
||||
|
||||
(11/19/2024)
|
||||
Fix draw cells not deleting once all children have reported generation
|
||||
Fix server data cells unloading before ready state
|
||||
Fix terrain chunk generation trying to generate rigid body for no-vertex cell
|
||||
Fix server homogenous chunk check on generation with variadic weights
|
||||
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,12 @@ public class DrawCell {
|
||||
/**
|
||||
* Number of frames to wait before destroying the chunk entity
|
||||
*/
|
||||
public static final int FRAMES_TO_WAIT_BEFORE_DESTRUCTION = 15;
|
||||
public static final int FRAMES_TO_WAIT_BEFORE_DESTRUCTION = 25;
|
||||
|
||||
/**
|
||||
* Number of child cells per parent cell
|
||||
*/
|
||||
static final int CHILD_CELLS_PER_PARENT = 8;
|
||||
|
||||
/**
|
||||
* Enum for the different faces of a draw cell -- used when filling in data for higher LOD faces
|
||||
@ -215,7 +220,7 @@ public class DrawCell {
|
||||
*/
|
||||
public void alertToGeneration(){
|
||||
this.generationAlertCount++;
|
||||
if(this.generationAlertCount > 8){
|
||||
if(this.generationAlertCount >= CHILD_CELLS_PER_PARENT){
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -759,11 +759,12 @@ public class CollisionEngine {
|
||||
//make uncollidable
|
||||
if(PhysicsEntityUtils.containsDBody(e)){
|
||||
DBody rigidBody = PhysicsEntityUtils.getDBody(e);
|
||||
if(rigidBody == null){
|
||||
throw new Error("DBody key set to null rigid body! " + rigidBody);
|
||||
}
|
||||
this.deregisterCollisionObject(rigidBody,PhysicsEntityUtils.getCollidable(e));
|
||||
e.removeData(EntityDataStrings.PHYSICS_COLLISION_BODY);
|
||||
if(rigidBody != null){
|
||||
this.destroyDBody(rigidBody);
|
||||
}
|
||||
this.destroyDBody(rigidBody);
|
||||
}
|
||||
if(ServerPhysicsSyncTree.hasTree(e)){
|
||||
ServerPhysicsSyncTree.detachTree(e, ServerPhysicsSyncTree.getTree(e));
|
||||
|
||||
@ -483,10 +483,10 @@ public class PhysicsEntityUtils {
|
||||
*/
|
||||
public static void clientAttachTerrainChunkRigidBody(Entity terrain, TerrainChunkData data){
|
||||
DBody terrainBody = CollisionBodyCreation.generateBodyFromTerrainData(Globals.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
|
||||
if(terrainBody != null){
|
||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, new Collidable(terrain,Collidable.TYPE_TERRAIN, false));
|
||||
PhysicsEntityUtils.setDBody(terrain,terrainBody);
|
||||
}
|
||||
Collidable collidable = new Collidable(terrain,Collidable.TYPE_TERRAIN, false);
|
||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
|
||||
PhysicsEntityUtils.setDBody(terrain,terrainBody);
|
||||
terrain.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
|
||||
}
|
||||
|
||||
|
||||
@ -512,10 +512,12 @@ public class PhysicsEntityUtils {
|
||||
*/
|
||||
public static void serverRepositionEntities(CollisionEngine collisionEngine){
|
||||
List<Entity> toReposition = new LinkedList<Entity>();
|
||||
if(collisionEngine.getCollidables() == null){
|
||||
List<Collidable> collidableList = collisionEngine.getCollidables();
|
||||
if(collidableList == null){
|
||||
collisionEngine.getCollidables();
|
||||
throw new Error("Collision engine collidables are null!");
|
||||
}
|
||||
for(Collidable collidable : collisionEngine.getCollidables()){
|
||||
for(Collidable collidable : collidableList){
|
||||
Entity entity = collidable.getParent();
|
||||
DBody body = PhysicsEntityUtils.getDBody(entity);
|
||||
if(body != null && body.isEnabled() && !body.isKinematic()){
|
||||
@ -551,6 +553,9 @@ public class PhysicsEntityUtils {
|
||||
* @param body The body
|
||||
*/
|
||||
public static void setDBody(Entity entity, DBody body){
|
||||
if(body == null){
|
||||
throw new Error("Trying to set null DBody!");
|
||||
}
|
||||
entity.putData(EntityDataStrings.PHYSICS_COLLISION_BODY, body);
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ public class TerrainChunk {
|
||||
if(Globals.clientScene.containsEntity(rVal)){
|
||||
String modelPath = ClientTerrainManager.queueTerrainGridGeneration(data, atlas, notifyTarget, toDelete);
|
||||
EntityCreationUtils.makeEntityDrawablePreexistingModel(rVal, modelPath);
|
||||
if(levelOfDetail == ClientDrawCellManager.FULL_RES_LOD){
|
||||
if(levelOfDetail == ClientDrawCellManager.FULL_RES_LOD && data.faceElements.size() > 0){
|
||||
PhysicsEntityUtils.clientAttachTerrainChunkRigidBody(rVal, data);
|
||||
CollisionObjUtils.clientPositionCharacter(rVal, new Vector3d(EntityUtils.getPosition(rVal)), new Quaterniond());
|
||||
} else {
|
||||
|
||||
@ -21,6 +21,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Lowest level networking class for the server
|
||||
@ -96,6 +97,11 @@ public class Server implements Runnable {
|
||||
} catch (IOException ex) {
|
||||
LoggerInterface.loggerNetworking.ERROR("Socket error on client socket!",ex);
|
||||
}
|
||||
try {
|
||||
TimeUnit.MILLISECONDS.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
LoggerInterface.loggerEngine.DEBUG("Failed to sleep", e);
|
||||
}
|
||||
}
|
||||
this.isOpen = false;
|
||||
LoggerInterface.loggerNetworking.INFO("Server socket thread ended");
|
||||
|
||||
@ -54,7 +54,7 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
/**
|
||||
* The number of frames without players that must pass before a server data cell is unloaded
|
||||
*/
|
||||
static final int UNLOAD_FRAME_THRESHOLD = 500;
|
||||
static final int UNLOAD_FRAME_THRESHOLD = 100;
|
||||
|
||||
/**
|
||||
* Tracks whether this manager has been flagged to unload cells or not
|
||||
@ -173,8 +173,6 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
LoggerInterface.loggerEngine.DEBUG("Creating new cell @ " + x + " " + y + " " + z);
|
||||
//create data cell
|
||||
this.createServerDataCell(targetPos);
|
||||
///generates physics for the cell in a dedicated thread then finally registers
|
||||
this.runPhysicsGenerationThread(targetPos);
|
||||
//add to loaded cells
|
||||
cellPlayerlessFrameMap.put(groundDataCells.get(getServerDataCellKey(targetPos)),0);
|
||||
//add player
|
||||
@ -224,8 +222,6 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
loadedCellsLock.acquireUninterruptibly();
|
||||
//create data cell
|
||||
createServerDataCell(targetPos);
|
||||
//generates physics for the cell in a dedicated thread then finally registers
|
||||
runPhysicsGenerationThread(targetPos);
|
||||
//add to loaded cells
|
||||
cellPlayerlessFrameMap.put(groundDataCells.get(getServerDataCellKey(targetPos)),0);
|
||||
//add player
|
||||
@ -344,8 +340,6 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
loadedCellsLock.acquireUninterruptibly();
|
||||
//create data cell
|
||||
this.createServerDataCell(targetPos);
|
||||
//generates physics for the cell in a dedicated thread then finally registers
|
||||
this.runPhysicsGenerationThread(targetPos);
|
||||
//add to loaded cells
|
||||
cellPlayerlessFrameMap.put(groundDataCells.get(this.getServerDataCellKey(targetPos)),0);
|
||||
//add player
|
||||
@ -370,7 +364,7 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
//TODO: improve to make have less performance impact
|
||||
loadedCellsLock.acquireUninterruptibly();
|
||||
for(ServerDataCell cell : this.groundDataCells.values()){
|
||||
if(cell.getPlayers().size() < 1){
|
||||
if(cell.isReady() && cell.getPlayers().size() < 1){
|
||||
int frameCount = cellPlayerlessFrameMap.get(cell) + 1;
|
||||
cellPlayerlessFrameMap.put(cell,frameCount);
|
||||
if(frameCount > UNLOAD_FRAME_THRESHOLD){
|
||||
@ -501,8 +495,6 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
loadedCellsLock.acquireUninterruptibly();
|
||||
//create data cell
|
||||
this.createServerDataCell(worldPos);
|
||||
//generates physics for the cell in a dedicated thread then finally registers
|
||||
this.runPhysicsGenerationThread(worldPos);
|
||||
//add to loaded cells
|
||||
cellPlayerlessFrameMap.put(groundDataCells.get(this.getServerDataCellKey(worldPos)),0);
|
||||
loadedCellsLock.release();
|
||||
@ -614,6 +606,8 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
LoggerInterface.loggerEngine.DEBUG("Create server data cell with key " + cellKey);
|
||||
cellPositionMap.put(rVal,new Vector3i(worldPos));
|
||||
serverContentManager.generateContentForDataCell(parent, worldPos, rVal, cellKey);
|
||||
//generates physics for the cell in a dedicated thread then finally registers
|
||||
this.runPhysicsGenerationThread(worldPos);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ public class PhysicsDataCell {
|
||||
//
|
||||
//fill in weights and types maps
|
||||
//
|
||||
fillInData();
|
||||
this.fillInData();
|
||||
|
||||
Vector3d realPos = new Vector3d(
|
||||
worldPos.x * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET,
|
||||
|
||||
@ -223,7 +223,13 @@ public class TestGenerationChunkGenerator implements ChunkGenerator {
|
||||
}
|
||||
if(firstType == -2){
|
||||
firstType = values[x][y][z];
|
||||
} else if(homogenous && firstType != values[x][y][z]){
|
||||
} else if(
|
||||
homogenous &&
|
||||
(
|
||||
firstType != values[x][y][z] ||
|
||||
(weights[x][y][z] > -1.0f && weights[x][y][z] < 1.0f)
|
||||
)
|
||||
){
|
||||
homogenous = false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user