From 58d1d86262bf2ad1107f98a89816a65bcc995f0e Mon Sep 17 00:00:00 2001 From: austin Date: Wed, 20 Mar 2024 22:00:40 -0400 Subject: [PATCH] More stuff --- .../fluidsim/fluidsimarchoverview.md | 14 +++++--- docs/src/progress/renderertodo.md | 34 +++++++++++-------- .../client/fluid/cells/FluidCell.java | 17 +++------- src/main/java/electrosphere/engine/Main.java | 5 ++- .../engine/assetmanager/AssetManager.java | 4 +++ .../entity/types/fluid/FluidChunk.java | 1 + .../meshgen/TerrainChunkModelGeneration.java | 2 +- .../fluid/generation/ArenaFluidGenerator.java | 4 --- .../FluidCellularAutomataSimulator.java | 6 ---- .../generation/ArenaChunkGenerator.java | 12 ------- 10 files changed, 43 insertions(+), 56 deletions(-) diff --git a/docs/src/architecture/fluidsim/fluidsimarchoverview.md b/docs/src/architecture/fluidsim/fluidsimarchoverview.md index e150f4b1..fbe61e62 100644 --- a/docs/src/architecture/fluidsim/fluidsimarchoverview.md +++ b/docs/src/architecture/fluidsim/fluidsimarchoverview.md @@ -1,7 +1,13 @@ @page fluidsimarchoverview Fluid Simulation Architecture Overview # Summary of Parts -The fluid sim begins with a function to create a running threadpool for calculations. -Once the current server frame gets to the point that it should start calculating the fluid frame (we want to put this at the beginning of the server frame if possible), it calls a function that propagates all current fluid chunks to the threadpool. -The threadpool then distributes the chunks amongst the threads and performs simulation for a frame. -This simulation periodically has to synchronize data between the chunks. \ No newline at end of file +The fluid system is structured very similar to the terrain manager. + +Make sure to explain: +setting iso levels based on neighbor levels +Client side interpreting 0 as -1 when receiving chunk from network (for rendering purposes) +Overwriting same cache value on client side +client side chunk destroying old model incl from asset manager on update +Generic fluid simulator and specifically cellular automata ver +How to add a fluid generator/destructor via the fluid simulator +Rules of the cellular automata currently \ No newline at end of file diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index e20a54f8..98c6896d 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -161,35 +161,29 @@ Optimize instance logic (currently sorting the list of objects to push to buffer For dynamic wind later will need to use UBOs or something like that. Fix grass flickering (it's frustum culling being inconsistent, try commenting it out in InstancedActor and see what happens :| ) (well we won't have that problem anymore lol) +(03/20/2024) +Free camera system that can detatch from player entity + +(03/20/2024) +Half pass at cellular automata fluid dynamics system + - Diffuse density + - Streaming chunks over network + - Basic model creation # TODO -Cellular Automata Fluid Dynamics System - - Advect force - - Advect density - - Diffuse density - - Do not bound to single chunks - -Fluid Chunk System - - Basic model creation - - Streaming chunks over network - - Only add compression when it starts to become an issue - Fix character movement - Walking left or right while turning camera is very jittery + - Can lock on moving Fix Frustum Culling for skybox -Free camera system that can detatch from player entity - Fix Character creation preview not working Clean up main method/class -Bring LWJGL version up to latest - Include Remotery library Physics-controlled objects system @@ -238,6 +232,14 @@ Light Manager - Point shadows ??? +Cellular Automata Fluid Dynamics System + - Advect force + - Advect density + - Diffuse density + - Do not bound to single chunks + - Only add compression when it starts to become an issue + + skybox work - make it prettier - be able to manage its colors through a clean interface @@ -291,6 +293,8 @@ Upgrade terrain editing user experience further - Lock to axis tools - Server validation for client request to change terrain +Bring LWJGL version up to latest + diff --git a/src/main/java/electrosphere/client/fluid/cells/FluidCell.java b/src/main/java/electrosphere/client/fluid/cells/FluidCell.java index 3021cfc9..3b0ceccb 100644 --- a/src/main/java/electrosphere/client/fluid/cells/FluidCell.java +++ b/src/main/java/electrosphere/client/fluid/cells/FluidCell.java @@ -9,6 +9,7 @@ import electrosphere.collision.CollisionEngine; import electrosphere.engine.Globals; import electrosphere.entity.ClientEntityUtils; import electrosphere.entity.Entity; +import electrosphere.entity.EntityDataStrings; import electrosphere.entity.EntityUtils; import electrosphere.entity.types.fluid.FluidChunk; import electrosphere.renderer.shader.ShaderProgram; @@ -33,22 +34,9 @@ public class FluidCell { float[][][] weights = new float[ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE]; - static Texture groundTextureOne = new Texture("/Textures/Ground/Dirt1.png"); - static Texture groundTextureTwo = new Texture("/Textures/Ground/Dirt1.png"); - static Texture groundTextureThree = new Texture("/Textures/Ground/Dirt1.png"); - static Texture groundTextureFour = new Texture("/Textures/Ground/Dirt1.png"); - //the value of an empty fluid cell weight that is not neighbored by a fluid value public static final float ISO_SURFACE_EMPTY = -1; - static { -// groundTextureOne = new Texture("/Textures/Ground/GrassTileable.png"); -// groundTextureTwo = new Texture("/Textures/Ground/Dirt1.png"); -// groundTextureThree = new Texture("/Textures/Ground/Dirt1.png"); -// groundTextureFour = new Texture("/Textures/Ground/Dirt1.png"); - } - - FluidCell(){ } @@ -99,6 +87,9 @@ public class FluidCell { CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); collisionEngine.destroyEntityThatHasPhysics(modelEntity); EntityUtils.cleanUpEntity(modelEntity); + //destruct model + String modelPath = (String)modelEntity.getData(EntityDataStrings.DATA_STRING_MODEL_PATH); + Globals.assetManager.deregisterModelPath(modelPath); } /** diff --git a/src/main/java/electrosphere/engine/Main.java b/src/main/java/electrosphere/engine/Main.java index 28a691b2..ca9695aa 100644 --- a/src/main/java/electrosphere/engine/Main.java +++ b/src/main/java/electrosphere/engine/Main.java @@ -376,7 +376,10 @@ public class Main { - + /// + /// G A R B A G E C H E C K + /// + System.gc(); diff --git a/src/main/java/electrosphere/engine/assetmanager/AssetManager.java b/src/main/java/electrosphere/engine/assetmanager/AssetManager.java index a40cc7a9..abb3c1e8 100644 --- a/src/main/java/electrosphere/engine/assetmanager/AssetManager.java +++ b/src/main/java/electrosphere/engine/assetmanager/AssetManager.java @@ -176,6 +176,10 @@ public class AssetManager { public void registerModelToSpecificString(Model m, String s){ modelsLoadedIntoMemory.put(s,m); } + + public void deregisterModelPath(String path){ + modelsLoadedIntoMemory.remove(path); + } public void queueOverrideMeshShader(String modelName, String meshName, String vertPath, String fragPath){ MeshShaderOverride override = new MeshShaderOverride(modelName,meshName,vertPath,fragPath); diff --git a/src/main/java/electrosphere/entity/types/fluid/FluidChunk.java b/src/main/java/electrosphere/entity/types/fluid/FluidChunk.java index f7d72a90..4086020f 100644 --- a/src/main/java/electrosphere/entity/types/fluid/FluidChunk.java +++ b/src/main/java/electrosphere/entity/types/fluid/FluidChunk.java @@ -31,6 +31,7 @@ public class FluidChunk { rVal.putData(EntityDataStrings.FLUID_IS_FLUID, true); rVal.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true); rVal.removeData(EntityDataStrings.DRAW_SOLID_PASS); + rVal.putData(EntityDataStrings.DATA_STRING_MODEL_PATH, modelPath); return rVal; } diff --git a/src/main/java/electrosphere/renderer/meshgen/TerrainChunkModelGeneration.java b/src/main/java/electrosphere/renderer/meshgen/TerrainChunkModelGeneration.java index f3d87a4c..5ff6f13e 100644 --- a/src/main/java/electrosphere/renderer/meshgen/TerrainChunkModelGeneration.java +++ b/src/main/java/electrosphere/renderer/meshgen/TerrainChunkModelGeneration.java @@ -607,7 +607,7 @@ public class TerrainChunkModelGeneration { terrainGrid[x+0][y+1][z+0], terrainGrid[x+0][y+1][z+1], terrainGrid[x+1][y+1][z+1], terrainGrid[x+1][y+1][z+0] ); //polygonize the current gridcell - polygonize(currentCell, 0, triangles, vertMap, verts, normals, trianglesSharingVert); + polygonize(currentCell, 0.01f, triangles, vertMap, verts, normals, trianglesSharingVert); } } } diff --git a/src/main/java/electrosphere/server/fluid/generation/ArenaFluidGenerator.java b/src/main/java/electrosphere/server/fluid/generation/ArenaFluidGenerator.java index 7651db00..2ae2add2 100644 --- a/src/main/java/electrosphere/server/fluid/generation/ArenaFluidGenerator.java +++ b/src/main/java/electrosphere/server/fluid/generation/ArenaFluidGenerator.java @@ -21,10 +21,6 @@ public class ArenaFluidGenerator implements FluidGenerator { } } } - - if(worldX == 0 && worldY == 0 && worldZ == 0){ - weights[7][5][7] = 1f; - } return chunk; } diff --git a/src/main/java/electrosphere/server/fluid/simulator/cellularautomata/FluidCellularAutomataSimulator.java b/src/main/java/electrosphere/server/fluid/simulator/cellularautomata/FluidCellularAutomataSimulator.java index d5c636c4..1b85b494 100644 --- a/src/main/java/electrosphere/server/fluid/simulator/cellularautomata/FluidCellularAutomataSimulator.java +++ b/src/main/java/electrosphere/server/fluid/simulator/cellularautomata/FluidCellularAutomataSimulator.java @@ -22,12 +22,6 @@ public class FluidCellularAutomataSimulator implements ServerFluidSimulator { //if true, alerts the server data cell to broadcast a new update message to all clients within it boolean update = false; - if(worldX == 0 && worldY == 0 && worldZ == 0){ - if(weights[8][3][8] < MAX_WEIGHT){ - weights[8][3][8] = MAX_WEIGHT; - } - } - for(int x = 0; x < ServerTerrainChunk.CHUNK_DIMENSION; x++){ for(int y = 0; y < ServerTerrainChunk.CHUNK_DIMENSION; y++){ for(int z = 0; z < ServerTerrainChunk.CHUNK_DIMENSION; z++){ diff --git a/src/main/java/electrosphere/server/terrain/generation/ArenaChunkGenerator.java b/src/main/java/electrosphere/server/terrain/generation/ArenaChunkGenerator.java index 08a42682..3ae49686 100644 --- a/src/main/java/electrosphere/server/terrain/generation/ArenaChunkGenerator.java +++ b/src/main/java/electrosphere/server/terrain/generation/ArenaChunkGenerator.java @@ -31,18 +31,6 @@ public class ArenaChunkGenerator implements ChunkGenerator { } } } - if(worldX == 0 && worldY == 0 && worldZ == 0){ - for(int x = 5; x < 11; x++){ - for(int z = 5; z < 11; z++){ - if((x == 10 || x == 5 || z == 10 || z == 5)){ - weights[x][0][z] = 1.0f; - weights[x][1][z] = 1.0f; - values[x][0][z] = 1; - values[x][1][z] = 1; - } - } - } - } ServerTerrainChunk rVal = new ServerTerrainChunk(worldX, worldY, worldZ, weights, values); return rVal; }