Fix arena mode infinite load
This commit is contained in:
parent
efa2afa822
commit
a5a669da90
13
docs/src/debug/LoadingHalting.md
Normal file
13
docs/src/debug/LoadingHalting.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Debug Loading Halting
|
||||
|
||||
A very common issue is that the loading for the client never completes for a certain gamemode.
|
||||
The goal of this doc is to track causes for this so that it can be debugged faster in the future.
|
||||
(Hint, it's probably under initDrawCellManager in ClientLoading.java)
|
||||
|
||||
|
||||
### 02-25-2024
|
||||
Arena was not loading because handling of edge-of-world chunks was not being handled correctly
|
||||
for a world of 2x2x2, when loading the chunk at (1,0,0) you need data for chunk (2,0,0)
|
||||
(2,0,0) is out of bounds of the world size, but the drawcellmanager would not mark the chunk data as present because it wasn't properly checking for bounds
|
||||
This was fixed by properly checking for bounds in drawcellmanager; however, it then started failing to fetch data for (2,0,0) and NPEing
|
||||
Fixed by guarding in the method that generates chunk data
|
||||
@ -215,8 +215,10 @@ public class DrawCell {
|
||||
worldPos.z + 1 < Globals.clientWorldData.getWorldDiscreteSize()
|
||||
){
|
||||
currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(worldPos.x + 1, worldPos.y + 1, worldPos.z + 1);
|
||||
weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(0, 0, 0);
|
||||
types[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getType(0, 0, 0);
|
||||
if(currentChunk != null){
|
||||
weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(0, 0, 0);
|
||||
types[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getType(0, 0, 0);
|
||||
}
|
||||
} else {
|
||||
weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
types[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
|
||||
@ -165,13 +165,14 @@ public class DrawCellManager {
|
||||
for(int k = 0; k < 2; k++){
|
||||
Vector3i posToCheck = new Vector3i(worldPos).add(i,j,k);
|
||||
if(worldPos.x >= 0 &&
|
||||
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
worldPos.y >= 0 &&
|
||||
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
worldPos.z >= 0 &&
|
||||
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.y >= 0 &&
|
||||
posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.z >= 0 &&
|
||||
posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
!containsChunkDataAtWorldPoint(posToCheck.x,posToCheck.y,posToCheck.z)
|
||||
){
|
||||
containsChunkDataAtWorldPoint(posToCheck.x,posToCheck.y,posToCheck.z);
|
||||
containsNecessaryChunks = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public class ServerWorldData {
|
||||
rVal.worldMaxPoint = new Vector3f(200,0,200);
|
||||
rVal.dynamicInterpolationRatio = 100;
|
||||
rVal.worldSizeDiscrete = 2;
|
||||
rVal.worldSizeDiscreteVertical = 1;
|
||||
rVal.worldSizeDiscreteVertical = 2;
|
||||
rVal.randomDampener = 0.0f;
|
||||
rVal.isArena = true;
|
||||
return rVal;
|
||||
|
||||
@ -17,6 +17,7 @@ public class TerrainProtocol {
|
||||
protected static void handleTerrainMessage(TerrainMessage message){
|
||||
switch(message.getMessageSubtype()){
|
||||
case RESPONSEMETADATA:
|
||||
System.out.println(message.getworldSizeDiscrete());
|
||||
Globals.clientWorldData = new ClientWorldData(
|
||||
//Vector3f worldMinPoint, Vector3f worldMaxPoint, int dynamicInterpolationRatio, float randomDampener, int worldDiscreteSize
|
||||
new Vector3f(message.getworldMinX(),0,message.getworldMinY()),
|
||||
|
||||
@ -2,6 +2,7 @@ package electrosphere.net.server;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.Main;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.net.NetUtils;
|
||||
import electrosphere.net.parser.net.message.NetworkMessage;
|
||||
import electrosphere.server.saves.SaveUtils;
|
||||
@ -54,10 +55,10 @@ public class Server implements Runnable{
|
||||
NetUtils.setPort(serverSocket.getLocalPort());
|
||||
}
|
||||
} catch(BindException ex){
|
||||
System.err.println("Failed to bind server socket!");
|
||||
LoggerInterface.loggerNetworking.ERROR("Failed to bind server socket!",ex);
|
||||
ex.printStackTrace();
|
||||
} catch (IOException ex) {
|
||||
System.err.println("Failed to start server socket!");
|
||||
LoggerInterface.loggerNetworking.ERROR("Failed to start server socket!",ex);
|
||||
ex.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
@ -69,7 +70,7 @@ public class Server implements Runnable{
|
||||
clientMap.put(newSocket.getInetAddress().getHostAddress(), newClient);
|
||||
new Thread(newClient).start();
|
||||
} catch (IOException ex) {
|
||||
System.err.println("Socket error on client socket!");
|
||||
LoggerInterface.loggerNetworking.ERROR("Socket error on client socket!",ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user