Skip to content

Commit

Permalink
fog optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
SoLegendary committed Oct 8, 2024
1 parent eb06636 commit a8f686b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
13 changes: 7 additions & 6 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@

TODO bugs/features:

netherzones are lost if the server ends while its restoring

add in build range limit set where you started, cannot ever move
- all players can build within each others limits

adjust [semiFrozenChunks.add(originPos);] to reduce lag in first-person cam

don't show nether blocks in fog on minimap


Expand All @@ -22,9 +19,13 @@ spiderProd after poison spider upgrade
- cancel button icon/name
- spider produces poison spider if upgraded in progress

(server) fog chunks updated when exploring outside of frustum
(server) fake blocks are updated correctly once explored and looked at again
(server) buildings in fog should disappear on minimap once built
fog changes and optimisations (test in server!)
- fog chunks updated when exploring outside of frustum
- fake blocks are updated correctly once explored and looked at again
- buildings in fog should disappear on minimap once built
- lag in first-person mode
- semifrozen chunks in first-person mode



Misc additions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public static void loadBuildingsAndNetherZones(ServerStartedEvent evt) {
if (level != null) {
BuildingSaveData buildingData = BuildingSaveData.getInstance(level);
NetherZoneSaveData netherData = NetherZoneSaveData.getInstance(level);
ArrayList<BlockPos> placedNZs = new ArrayList<>();

buildingData.buildings.forEach(b -> {
Building building = BuildingUtils.getNewBuilding(b.name, level, b.originPos, b.rotation, b.ownerName, b.isDiagonalBridge);
Expand All @@ -135,9 +136,17 @@ else if (building instanceof Portal portal)
for (NetherZone nz : netherData.netherZones)
if (building.isPosInsideBuilding(nz.getOrigin())) {
ncb.setNetherZone(nz);
placedNZs.add(nz.getOrigin());
System.out.println("loaded netherzone for: " + b.name + "|" + b.originPos);
break;
}
System.out.println("loaded building/nether in serverevents: " + b.originPos);
System.out.println("loaded building in serverevents: " + b.name + "|" + b.originPos);
}
});
netherData.netherZones.forEach(nz -> {
if (!placedNZs.contains(nz.getOrigin())) {
BuildingServerEvents.netherZones.add(nz);
System.out.println("loaded orphaned netherzone: " + nz.getOrigin());
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class NetherZone {
private final int MAX_TICKS = 5;
private final int MAX_CONVERTS_AFTER_CONSTANT_RANGE = 60; // to prevent continuously processing


private final BlockPos origin;
private final Random random = new Random();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public CompoundTag save(CompoundTag tag) {
cTag.putInt("converts", nz.getConvertsAfterConstantRange());
list.add(cTag);

System.out.println("NetherZoneSaveData.save: " + nz.getOrigin() + "|" + nz.getRange() + "/" + nz.getMaxRange() + "|" + nz.isRestoring());
System.out.println("NetherZoneSaveData.save: " + nz.getOrigin() + "|" + (int) nz.getRange() + "/" + (int) nz.getMaxRange() + "|" + nz.isRestoring());
});
tag.put("netherzones", list);
return tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ else if (!isInBrightChunk(originPos)) {
.map(fc -> fc.origin)
.toList().contains(originPos))
continue;
else if (enemyOccupiedChunks.contains(chunkPos))
else if (OrthoviewClientEvents.isEnabled() || enemyOccupiedChunks.contains(chunkPos))
semiFrozenChunks.add(originPos);
}
ChunkRenderDispatcher.RenderChunk renderChunk = chunkInfo.chunk;
Expand Down

0 comments on commit a8f686b

Please sign in to comment.