add request timeout mechanism
Some checks failed
studiorailgun/Renderer/pipeline/pr-master There was a failure building this commit

This commit is contained in:
austin 2024-11-07 12:25:31 -05:00
parent 59b899b1d7
commit ae4c0aa4e5
3 changed files with 22 additions and 7 deletions

View File

@ -53,7 +53,7 @@ public class ClientDrawCellManager {
/**
* The distance for sixteenth resolution
*/
public static final double SIXTEENTH_RES_DIST = 48 * ServerTerrainChunk.CHUNK_DIMENSION;
public static final double SIXTEENTH_RES_DIST = 128 * ServerTerrainChunk.CHUNK_DIMENSION;
/**
* Lod value for a full res chunk
@ -237,8 +237,9 @@ public class ClientDrawCellManager {
List<DrawCellFace> highResFaces = this.solveHighResFace(node);
//actually send requests
this.requestChunks(node, highResFaces);
cell.setHasRequested(true);
if(this.requestChunks(node, highResFaces)){
cell.setHasRequested(true);
}
Globals.profiler.endCpuSample();
updated = true;

View File

@ -45,7 +45,12 @@ public class ClientTerrainManager {
/**
* Maximum concurrent terrain requests
*/
public static final int MAX_CONCURRENT_REQUESTS = 500;
public static final int MAX_CONCURRENT_REQUESTS = 500;
/**
* Number of frames to wait before flagging a request as failed
*/
public static final int FAILED_REQUEST_THRESHOLD = 500;
//The interpolation ratio of terrain
public static final int INTERPOLATION_RATIO = ServerTerrainManager.SERVER_TERRAIN_MANAGER_INTERPOLATION_RATIO;
@ -70,7 +75,7 @@ public class ClientTerrainManager {
/**
* Tracks what outgoing requests are currently active
*/
Map<Long,Boolean> requestedMap = new ConcurrentHashMap<Long,Boolean>();
Map<Long,Integer> requestedMap = new ConcurrentHashMap<Long,Integer>();
/**
* Constructor
@ -158,6 +163,15 @@ public class ClientTerrainManager {
for(TerrainMessage message : bouncedMessages){
messageQueue.add(message);
}
//evaluate if any chunks have failed to request
for(Long key : this.requestedMap.keySet()){
int duration = this.requestedMap.get(key);
if(duration > FAILED_REQUEST_THRESHOLD){
this.requestedMap.remove(key);
} else {
this.requestedMap.put(key,duration + 1);
}
}
lock.release();
Globals.profiler.endCpuSample();
}
@ -219,7 +233,7 @@ public class ClientTerrainManager {
worldZ,
stride
));
this.requestedMap.put(this.getRequestKey(worldX, worldY, worldZ, stride), true);
this.requestedMap.put(this.getRequestKey(worldX, worldY, worldZ, stride), 0);
rVal = true;
}
lock.release();

View File

@ -24,7 +24,7 @@ public class TestGenerationChunkGenerator implements ChunkGenerator {
/**
* The size of the realm for testing generation
*/
public static final int GENERATOR_REALM_SIZE = 64;
public static final int GENERATOR_REALM_SIZE = 512;
/**
* The default biome index