cleanup (goodbye arena)
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-07-13 15:35:44 -04:00
parent 5a2895f9fd
commit 0bec1386f1
18 changed files with 17 additions and 569 deletions

1
.gitignore vendored
View File

@ -29,7 +29,6 @@
/docs/~$NetworkFlow.drawio.dtmp /docs/~$NetworkFlow.drawio.dtmp
#saves #saves
/saves/arena
/saves/random_sp_world /saves/random_sp_world
/saves/defaultLevel* /saves/defaultLevel*

View File

@ -455,6 +455,8 @@ Refactor menu clases under electrosphere.client package
Allow texture map to bind multiple model paths to a single set of mesh->textures Allow texture map to bind multiple model paths to a single set of mesh->textures
Cache texture atlas for terrain
Rework how chunks are written to disk to make them more cache friendly Rework how chunks are written to disk to make them more cache friendly
- IE, write consecutively higher LOD levels the further into the file, so that you can read just the first few bytes if its a far away chunk - IE, write consecutively higher LOD levels the further into the file, so that you can read just the first few bytes if its a far away chunk

BIN
saves/arena/central.db Normal file

Binary file not shown.

View File

@ -1,44 +0,0 @@
package electrosphere.client.culling;
import java.util.List;
import org.joml.Vector3d;
import electrosphere.engine.Globals;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.Scene;
import electrosphere.entity.types.attach.AttachUtils;
@Deprecated
public class ClientEntityCullingManager {
Scene scene;
public ClientEntityCullingManager(Scene scene){
this.scene = scene;
}
public void recursiveHide(Entity target){
if(AttachUtils.hasChildren(target)){
List<Entity> childrenList = AttachUtils.getChildrenList(target);
for(Entity currentChild : childrenList){
recursiveHide(currentChild);
}
}
target.putData(EntityDataStrings.DATA_STRING_DRAW, false);
}
public void recursiveShow(Entity target){
if(AttachUtils.hasChildren(target)){
List<Entity> childrenList = AttachUtils.getChildrenList(target);
for(Entity currentChild : childrenList){
recursiveShow(currentChild);
}
}
target.putData(EntityDataStrings.DATA_STRING_DRAW, true);
}
}

View File

@ -11,7 +11,6 @@ import org.joml.Vector3f;
import electrosphere.audio.AudioEngine; import electrosphere.audio.AudioEngine;
import electrosphere.audio.VirtualAudioSourceManager; import electrosphere.audio.VirtualAudioSourceManager;
import electrosphere.auth.AuthenticationManager; import electrosphere.auth.AuthenticationManager;
import electrosphere.client.culling.ClientEntityCullingManager;
import electrosphere.client.fluid.cells.FluidCellManager; import electrosphere.client.fluid.cells.FluidCellManager;
import electrosphere.client.fluid.manager.ClientFluidManager; import electrosphere.client.fluid.manager.ClientFluidManager;
import electrosphere.client.foliagemanager.ClientFoliageManager; import electrosphere.client.foliagemanager.ClientFoliageManager;
@ -314,7 +313,6 @@ public class Globals {
//client scene management //client scene management
public static Scene clientScene; public static Scene clientScene;
public static ClientSceneWrapper clientSceneWrapper; public static ClientSceneWrapper clientSceneWrapper;
public static ClientEntityCullingManager clientEntityCullingManager;
public static ClientSimulation clientSimulation; public static ClientSimulation clientSimulation;
public static ClientSynchronizationManager clientSynchronizationManager; public static ClientSynchronizationManager clientSynchronizationManager;

View File

@ -206,9 +206,7 @@ public class Main {
Globals.loadingThreadsList.add(serverThread); Globals.loadingThreadsList.add(serverThread);
serverThread.start(); serverThread.start();
} else { } else {
LoadingThread clientThread = new LoadingThread(LoadingThread.LOAD_ARENA); throw new IllegalStateException("Need to add handling for only running server again");
Globals.loadingThreadsList.add(clientThread);
clientThread.start();
} }
//recapture the screen for rendering //recapture the screen for rendering

View File

@ -1,378 +0,0 @@
package electrosphere.engine.loadingthreads;
import org.joml.Vector3d;
import electrosphere.engine.Globals;
import electrosphere.game.server.world.ServerWorldData;
import electrosphere.logger.LoggerInterface;
import electrosphere.server.content.ServerContentManager;
import electrosphere.server.fluid.manager.ServerFluidManager;
import electrosphere.server.saves.SaveUtils;
import electrosphere.server.terrain.manager.ServerTerrainManager;
import electrosphere.util.FileUtils;
public class ArenaLoading {
protected static void loadArenaGameServer(Object[] params){
//init server arena terrain manager separately
initServerArenaTerrainManager();
//init the data of the world
initServerArenaWorldData();
//init data cell manager
// LoadingUtils.initTerrainDataCellManager();
//for testing purposes
FileUtils.recursivelyDelete("/Users/satellite/temp/saves/arena");
//init database connection
SaveUtils.initSave("arena");
//connect to database
SaveUtils.loadSave("arena");
//init authentication
LoadingUtils.initAuthenticationManager();
//initialize the server thread (server only)
LoadingUtils.initServerThread();
//init gridded datacell manager
LoadingUtils.initGriddedRealm();
//initialize the "virtual" objects simulation
//not really relevant in arena mode
// initMacroSimulation();
//initialize the "real" objects simulation
LoadingUtils.initMicroSimulation();
//create arena entities
creatingRandomEntities();
//set simulations to ready if they exist
LoadingUtils.setSimulationsToReady();
LoggerInterface.loggerEngine.INFO("[Server]Finished loading arena world");
}
private static void initServerArenaTerrainManager(){
Globals.serverTerrainManager = ServerTerrainManager.constructArenaTerrainManager();
Globals.serverFluidManager = ServerFluidManager.constructArenaFluidManager(Globals.serverTerrainManager);
}
private static void initServerArenaWorldData(){
Globals.serverWorldData = ServerWorldData.createArenaWorld();
Globals.serverContentManager = ServerContentManager.createServerContentManager(false);
Globals.spawnPoint = new Vector3d(1,0.1,1);
// Globals.serverTerrainManager.getChunk(0, 0).addModification(new TerrainModification(0,0,5,5,5));
}
private static void creatingRandomEntities(){
// String unitCubeModelPath = Globals.assetManager.registerModel(ModelUtils.createUnitCube());
// Entity unitCube = EntityUtils.spawnDrawableEntity(unitCubeModelPath);
// EntityUtils.getEntityPosition(unitCube).set(10,2,10);
// String goundPlaneModelPath = "Models/groundplanemassiveuv.fbx";
// Entity groundPlane = EntityUtils.spawnDrawableEntity(goundPlaneModelPath);
// EntityUtils.getEntityPosition(groundPlane).set(10f,2f,10f);
// EntityUtils.getEntityRotation(groundPlane).rotateAxis((float)Math.PI/2, new Vector3f(1,0,0));
// EntityUtils.getEntityScale(groundPlane).set(5);
// String unitsphereModelPath = "Models/unitsphere.fbx";
// Entity unitsphere = EntityUtils.spawnDrawableEntity(unitsphereModelPath);
// EntityUtils.getEntityPosition(unitsphere).set(10f,2f,10f);
// EntityUtils.getEntityScale(unitsphere).set(1);
// String smallCubePath = "Models/SmallCube.fbx";
// Entity originCube = EntityUtils.spawnDrawableEntity(smallCubePath);
// EntityUtils.getEntityPosition(originCube).set(0, 0, 0);
//
// originCube = EntityUtils.spawnDrawableEntity(smallCubePath);
// EntityUtils.getEntityPosition(originCube).set(1, 0, 0);
//
// originCube = EntityUtils.spawnDrawableEntity(smallCubePath);
// EntityUtils.getEntityPosition(originCube).set(0, 0, 1);
// Entity font = FontUtils.makeFont(7, 1);
// EntityUtils.getEntityPosition(font).set(new Vector3f(0.2f,0.2f,0.0f));
// for(int i = 0; i < 10; i++){
// Random rand = new Random();
// Entity creature = CreatureUtils.spawnBasicCreature(0, 0.01f, 0.01f);
// EntityUtils.getEntityPosition(creature).set(rand.nextFloat() * 10, rand.nextFloat() * 10, rand.nextFloat() * 10);
// EntityUtils.getEntityScale(creature).set(0.01f);
// }
//trees \:D/
// for(int i = 0; i < 10; i++){
// Random rand = new Random();
// String treePath = "Models/tree1.fbx";
// Entity tree = EntityUtils.spawnDrawableEntity(treePath);
// EntityUtils.getPosition(tree).set(rand.nextFloat() * 150 + 10, 0, rand.nextFloat() * 150 + 10);
//// EntityUtils.getEntityRotation(tree).rotateAxis((float)-Math.PI/2.0f, new Vector3f(1,0,0));
// }
// for(int i = 0; i < 250; i++){
// Random rand = new Random();
// String treePath = "Models/falloak1.fbx";
// Entity tree = EntityUtils.spawnDrawableEntity(treePath);
// EntityUtils.getPosition(tree).set(rand.nextFloat() * 105 + 1, 0, rand.nextFloat() * 105 + 1);
// EntityUtils.getRotation(tree).rotateLocalX(-(float)Math.PI/2.0f).rotateZ(rand.nextFloat());
// // EntityUtils.getEntityRotation(tree).rotateAxis((float)-Math.PI/2.0f, new Vector3f(1,0,0));
// }
// Random rand = new Random();
// for(int i = 0; i < 1000; i++){
// String wheatPath = "Models/wheat2.fbx";
// Entity wheatStalk = EntityUtils.spawnDrawableEntity(wheatPath);
// EntityUtils.getPosition(wheatStalk).set(rand.nextFloat() * 20, 0, rand.nextFloat() * 20);
// EntityUtils.getRotation(wheatStalk).rotateLocalX(-(float)Math.PI/2.0f);
// EntityUtils.getScale(wheatStalk).set(1, 1, 2);
// }
// String buildingPath = "Models/building1.fbx";
// Entity building = EntityUtils.spawnDrawableEntity(buildingPath);
// EntityUtils.getPosition(building).set(5,1.2f,5);
// EntityUtils.getScale(building).set(0.5f);
// EntityUtils.getRotation(building).rotateLocalY((float)(Math.PI));
// ActorUtils.applyBlenderTransformer(building);
//spawn evil goblin
// Entity goblin = CreatureUtils.spawnBasicCreature("goblin");
// CollisionObjUtils.positionCharacter(goblin, new Vector3f(4, 0, 4));
// EntityUtils.getScale(goblin).set(0.005f);
// //give evil goblin sword
// Entity goblinSword = ItemUtils.spawnBasicItem("Katana");
// AttachUtils.attachEntityToEntityAtBone(goblin, goblinSword, "Bone.031");
// // attach ai to evil goblin
// MindlessAttacker.attachToCreature(goblin);
// OpportunisticAttacker.attachToCreature(goblin);
//sword
// Entity sword = ItemUtils.spawnBasicItem("Katana");
// EntityUtils.initiallyPositionEntity(sword, new Vector3d(1,0.4f,2));
// EntityUtils.getRotation(sword).set(new Quaternionf().rotationY((float)(Math.PI/2.0)));
// Entity leafBlock = EntityCreationUtils.createClientSpatialEntity();
// EntityCreationUtils.makeEntityDrawable(leafBlock, "Models/foliageBlockTemplate1Test1.fbx");
// EntityUtils.getPosition(leafBlock).set(3,3,3);
//floating island 1
// Entity island1 = ObjectUtils.spawnBasicObject("floatingisland1");
// EntityUtils.getRotation(island1).set(new Quaternionf().rotationX(-(float)(Math.PI/2.0)));
// EntityUtils.getScale(island1).set(0.3f);
// EntityUtils.initiallyPositionEntity(island1, new Vector3d(5,0.5,5));
//work on ez volumetrics shader
// Entity myCube = EntityUtils.spawnDrawableEntity("Models/unitcube.fbx");
// EntityUtils.getActor(myCube).maskShader("Cube", "Shaders/clouds1/clouds1.vs", "Shaders/clouds1/clouds1.fs");
// Globals.assetManager.addShaderToQueue("Shaders/clouds1/clouds1.vs", "Shaders/clouds1/clouds1.fs");
// myCube.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true);
// EntityUtils.getPosition(myCube).set(3,1,3);
//work on smoke shader
// Entity myCube = EntityUtils.spawnDrawableEntity("Models/unitcube.fbx");
// EntityUtils.getActor(myCube).maskShader("Cube", "Shaders/smoke1/smoke1.vs", "Shaders/smoke1/smoke1.fs");
// Globals.assetManager.addShaderToQueue("Shaders/smoke1/smoke1.vs", "Shaders/smoke1/smoke1.fs");
// myCube.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true);
// EntityUtils.getPosition(myCube).set(3,1,3);
// SceneLoader loader = new SceneLoader();
// loader.serverInstantiateSceneFile("Scenes/testscene1/testscene1.json");
// Entity chunk = TerrainChunk.createTerrainChunkEntity();
// Random rand = new Random();
// for(int i = 0; i < 100; i++){
// Entity leaves = EntityUtils.spawnDrawableEntity(AssetDataStrings.LEAVES_MODEL);
// float rad = rand.nextFloat();
// float angle = (float)(rand.nextFloat() * 2.0 * Math.PI);
// Vector3d position = new Vector3d(Math.cos(angle) * rad + 4,1 + (rand.nextFloat() - 0.5),Math.sin(angle) * rad + 4);
// Quaternionf rotation = new Quaternionf(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), rand.nextFloat()).normalize();
// ServerEntityUtils.repositionEntity(leaves, position);
// EntityUtils.getPosition(leaves).set(position);
// EntityUtils.getRotation(leaves).slerp(rotation, 0.3f);
// leaves.removeData(EntityDataStrings.DRAW_SOLID_PASS);
// leaves.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true);
// }
// Globals.entityManager.registerBehaviorTree(new BehaviorTree() {
// int i = 0;
// public void simulate(){
// if(i < 100){
// i++;
// CollisionObjUtils.getCollidable(sword).addImpulse(new Impulse(MathUtils.ORIGIN_VECTOR, new Vector3d(-1,0,0), 0.001, Collidable.TYPE_CREATURE));
// EntityUtils.getPosition(sword).set(1,0.2f,2);
// }
// }});
// Globals.entityManager.registerBehaviorTree(new BehaviorTree() {
// int i = 0;
// public void simulate(){
// if(i < 10000){
// i++;
// if(i % 100 == 0){
// Entity sword = ItemUtils.spawnBasicItem("Katana");
// EntityUtils.getPosition(sword).set(new Vector3f(1,1.4f,2));
// EntityUtils.getRotation(sword).set(new Quaternionf().rotationY((float)(Math.PI/2.0)));
// }
// }
// }});
// Entity crateEntity = ObjectUtils.clientSpawnBasicObject("crateWooden");
// ClientEntityUtils.initiallyPositionEntity(crateEntity, new Vector3d(5,5,5));
// ObjectUtils.serverSpawnBasicObject(Globals.realmManager.getRealms().iterator().next(),new Vector3d(5,5,5),"crateWooden");
// DebugVisualizerUtils.spawnVectorVisualizer(new Vector3d(0,0,0), new Vector3d(-1,-1,-1));
// Entity shorts = ItemUtils.spawnBasicItem("boots1");
// EntityUtils.getPosition(shorts).set(new Vector3f(2,0.1f,2));
// // Entity hair = ItemUtils.spawnBasicItem("hairshort1");
// // EntityUtils.getPosition(hair).set(new Vector3f(2,0.1f,1));
// Entity bow = ItemUtils.spawnBasicItem("bow1");
// EntityUtils.getPosition(bow).set(new Vector3f(2,0.1f,1));
//crate
// Entity crate = EntityUtils.spawnDrawableEntity("Models/crate2.fbx");
// EntityUtils.getPosition(crate).set(5,0.5,5);
// EntityUtils.getScale(crate).set(new Vector3f(0.5f));
// //center flame
// Entity fire = ParticleUtils.spawnStaticBillboardParticle();
// EntityUtils.getPosition(fire).set(new Vector3f(1,0.2f,1));
// EntityUtils.getScale(fire).set(0.6f);
// Actor fireActor = EntityUtils.getActor(fire);
// fireActor.maskShader("particleBillboard", "Shaders/flame1/flame.vs", "Shaders/flame1/flame.fs");
// Globals.assetManager.addShaderToQueue("Shaders/flame1/flame.vs", "Shaders/flame1/flame.fs");
// // //campfire
// Entity campfire = EntityUtils.spawnDrawableEntity("Models/campfire1.fbx");
// EntityUtils.getPosition(campfire).set(1,0,1);
// EntityUtils.getRotation(campfire).rotationX(-(float)Math.PI/2.0f);
// campfire.putData(EntityDataStrings.DRAW_OUTLINE, true);
// //flame
// Entity cube = EntityUtils.spawnDrawableEntity("Models/flame1.fbx");
// //shader mask
// EntityUtils.getActor(cube).maskShader("Sphere", "Shaders/flame2/flame.vs", "Shaders/flame2/flame.fs");
// Globals.assetManager.addShaderToQueue("Shaders/flame2/flame.vs", "Shaders/flame2/flame.fs");
// EntityUtils.getScale(cube).set(0.8f);
// EntityUtils.getPosition(cube).set(1,0.08f,1);
// EntityUtils.getRotation(cube).rotationX(-(float)Math.PI/2.0f);
// //texture mask
// EntityUtils.getActor(cube).addTextureMask(RenderUtils.generateVolumetricTextureMask("Sphere"));
// //set draw volumetric
// cube.putData(EntityDataStrings.DRAW_VOLUMETRIC, true);
// Globals.assetManager.addShaderToQueue("Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs");
// Entity grass = EntityUtils.spawnDrawableEntity("Models/grass1.fbx");
// //shader mask
// EntityUtils.getActor(grass).maskShader("Cube", "Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs");
// EntityUtils.getPosition(grass).set(3,0,1);
// queue grass shader
// Globals.assetManager.addShaderToQueue("Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs");
// for(int x = 0; x < 10; x++){
// for(int y = 0; y < 10; y++){
// Entity grass = EntityUtils.spawnDrawableEntity("Models/grass1.fbx");
// //shader mask
// EntityUtils.getActor(grass).maskShader("Cube", "Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs");
// EntityUtils.getPosition(grass).set(3 + x / 5.0f,0.0,1 + y / 5.0f);
// }
// }
// //water cube
// Entity water = EntityUtils.spawnDrawableEntity("Models/watercube1.fbx");
// EntityUtils.getActor(water).maskShader("Cube", "Shaders/water1/water.vs", "Shaders/water1/water.fs");
// Globals.assetManager.addShaderToQueue("Shaders/water1/water.vs", "Shaders/water1/water.fs");
// // EntityUtils.getPosition(water).set(5,0.51,5);
// // EntityUtils.getRotation(water).rotationX((float)Math.PI/4.0f);
// EntityUtils.getPosition(water).set(5,-0.1,5);
// EntityUtils.getScale(water).set(1,1,1);
// //texture mask
// EntityUtils.getActor(water).addTextureMask(RenderUtils.generateVolumetricTextureMask("Cube"));
// //set draw volumetric
// water.putData(EntityDataStrings.DRAW_VOLUMETRIC, true);
// water.removeData(EntityDataStrings.DRAW_SOLID_PASS);
// water.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true);
// //shrine 2
// Entity shrine = EntityUtils.spawnDrawableEntity("Models/shrine2.fbx");
// EntityUtils.getPosition(shrine).set(15,0,15);
// EntityUtils.getRotation(shrine).rotationX((float)-Math.PI/2.0f);
// shrine.putData(EntityDataStrings.DRAW_OUTLINE, true);
// goblin = CreatureUtils.spawnBasicCreature("Goblin");
// CollisionObjUtils.positionCharacter(goblin, new Vector3f(3, 0, 4));
// EntityUtils.getScale(goblin).set(0.005f);
//
// goblin = CreatureUtils.spawnBasicCreature("Goblin");
// CollisionObjUtils.positionCharacter(goblin, new Vector3f(4, 0, 3));
// EntityUtils.getScale(goblin).set(0.005f);
//
// goblin = CreatureUtils.spawnBasicCreature("Goblin");
// CollisionObjUtils.positionCharacter(goblin, new Vector3f(3, 0, 3));
// EntityUtils.getScale(goblin).set(0.005f);
// UnitUtils.spawnTextGoblin(10, 0, 10);
// StructureUtils.spawnBasicStructure("building1", new Vector3f(5,2.4f,5), new Quaternionf());
// Entity bow = ItemUtils.spawnBasicItem("Bow");
// EntityUtils.getPosition(bow).set(1, 1, 2);
// NavMeshPathfinder.navigatePointToPointInMesh(G*lobals.navMeshManager.getMeshes().get(0), new Vector3d(10,0,5), new Vector3d(5,0,10));
// NavMesh mesh = new NavMesh();
// NavCube cube = new NavCube(5,0,0,10,5,5);
// mesh.addNode(cube);
// Globals.navMeshManager.addMesh(mesh);
// Entity fallOak = FoliageUtils.spawnBasicFoliage("FallOak1");
// EntityUtils.getPosition(fallOak).set(1,0,3);
//
// Entity spark = ParticleUtils.spawnBillboardParticle("Textures/animetree1leaves1.png", 150000, new Vector3f(0,0,0), 0, 0);
// EntityUtils.getPosition(spark).set(new Vector3f(3,3,3));
// EntityUtils.getScale(spark).mul(1f);
// System.out.println(Globals.drawCellManager.)
// Entity deer = CreatureUtils.spawnBasicCreature("Deer");
// EntityUtils.getPosition(deer).set(5, 0.25f, 3);
// Model deerModel = Globals.assetManager.fetchModel("Models/deer1.fbx");
// deerModel.describeHighLevel();
// CollisionObjUtils.positionCharacter(fallOak, new Vector3f(1, 0, 3));
//
//
// Entity testHomie = CreatureUtils.spawnBasicCreature("Human");
// EntityUtils.getScale(testHomie).set(0.005f);
// CreatureUtils.positionCharacter(testHomie, new Vector3f(10,1,10));
//
// Entity sword = ItemUtils.spawnBasicItem("Katana");
// AttachUtils.attachEntityToEntityAtBone(testHomie, sword, "Bone.020");
// CollisionObjUtils.spawnCollisionPlane(new Vector3f(1,1,1), new Vector3f(8,2,10), new Quaternionf()); // .rotateLocalX(0.75f)
// CollisionObjUtils.spawnCollisionCube(new Vector3f(1,1,1), new Vector3f(10,1,10), new Quaternionf());
// CreatureUtils.positionCharacter(Globals.playerCharacter, new Vector3f(10,3,10));
// StructureUtils.spawnBasicStructure("building1", new Vector3f(10,2.4f,15), new Quaternionf().rotateLocalY((float)Math.PI));
}
}

View File

@ -5,7 +5,6 @@ import java.util.concurrent.TimeUnit;
import org.joml.Quaterniond; import org.joml.Quaterniond;
import org.joml.Vector3f; import org.joml.Vector3f;
import electrosphere.client.culling.ClientEntityCullingManager;
import electrosphere.client.fluid.cells.FluidCellManager; import electrosphere.client.fluid.cells.FluidCellManager;
import electrosphere.client.foliagemanager.ClientFoliageManager; import electrosphere.client.foliagemanager.ClientFoliageManager;
import electrosphere.client.sim.ClientSimulation; import electrosphere.client.sim.ClientSimulation;
@ -92,8 +91,6 @@ public class ClientLoading {
initArenaGraphicalEntities(); initArenaGraphicalEntities();
//sets micro and macro sims to ready if they exist //sets micro and macro sims to ready if they exist
setSimulationsToReady(); setSimulationsToReady();
//init culling manager and other graphics-focused non-simulation items
initEntityCullingManager();
//make loading window disappear //make loading window disappear
loadingWindow.setVisible(false); loadingWindow.setVisible(false);
//recapture screen //recapture screen
@ -302,13 +299,6 @@ public class ClientLoading {
} }
} }
/**
* Starts up the entity culling manager
*/
private static void initEntityCullingManager(){
Globals.clientEntityCullingManager = new ClientEntityCullingManager(Globals.clientScene);
}
/** /**
* Starts up the foliage manager * Starts up the foliage manager
*/ */

View File

@ -13,7 +13,7 @@ import electrosphere.net.parser.net.message.TerrainMessage;
import electrosphere.net.server.ServerConnectionHandler; import electrosphere.net.server.ServerConnectionHandler;
import electrosphere.renderer.ui.elements.Window; import electrosphere.renderer.ui.elements.Window;
import electrosphere.server.content.ServerContentManager; import electrosphere.server.content.ServerContentManager;
import electrosphere.server.fluid.generation.ArenaFluidGenerator; import electrosphere.server.fluid.generation.DefaultFluidGenerator;
import electrosphere.server.fluid.manager.ServerFluidManager; import electrosphere.server.fluid.manager.ServerFluidManager;
import electrosphere.server.saves.SaveUtils; import electrosphere.server.saves.SaveUtils;
import electrosphere.server.terrain.generation.OverworldChunkGenerator; import electrosphere.server.terrain.generation.OverworldChunkGenerator;
@ -45,7 +45,7 @@ public class DebugSPWorldLoading {
Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager); Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager);
FileUtils.serializeObjectToSavePath(saveName, "./world.json", Globals.serverWorldData); FileUtils.serializeObjectToSavePath(saveName, "./world.json", Globals.serverWorldData);
//create mock fluid sim manager //create mock fluid sim manager
Globals.serverFluidManager = new ServerFluidManager(Globals.serverTerrainManager, 2000, 50, 0.0f, 0, new ArenaFluidGenerator()); Globals.serverFluidManager = new ServerFluidManager(Globals.serverTerrainManager, 2000, 50, 0.0f, 0, new DefaultFluidGenerator());
} }
//load just-created save //load just-created save
SaveUtils.loadSave(saveName); SaveUtils.loadSave(saveName);

View File

@ -9,7 +9,6 @@ public class LoadingThread extends Thread {
public static final int LOAD_TITLE_MENU = 0; //loads the main game title menu public static final int LOAD_TITLE_MENU = 0; //loads the main game title menu
public static final int LOAD_MAIN_GAME = 1; //loads the main game public static final int LOAD_MAIN_GAME = 1; //loads the main game
public static final int LOAD_ARENA = 2; //loads the arena
public static final int LOAD_CHARACTER_SERVER = 3; //loads the character creation menus on the client public static final int LOAD_CHARACTER_SERVER = 3; //loads the character creation menus on the client
public static final int LOAD_CLIENT_WORLD = 4; //loads the client world public static final int LOAD_CLIENT_WORLD = 4; //loads the client world
public static final int LOAD_DEBUG_RANDOM_SP_WORLD = 5; //loads a random singleplayer debug world public static final int LOAD_DEBUG_RANDOM_SP_WORLD = 5; //loads a random singleplayer debug world
@ -50,10 +49,6 @@ public class LoadingThread extends Thread {
ServerLoading.loadMainGameServer(this.params); ServerLoading.loadMainGameServer(this.params);
} break; } break;
case LOAD_ARENA: {
ArenaLoading.loadArenaGameServer(this.params);
} break;
case LOAD_CHARACTER_SERVER: { case LOAD_CHARACTER_SERVER: {
ClientLoading.loadCharacterServer(this.params); ClientLoading.loadCharacterServer(this.params);
} break; } break;

View File

@ -1,73 +0,0 @@
package electrosphere.menu.mainmenu;
import electrosphere.auth.AuthenticationManager;
import electrosphere.engine.Globals;
import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.renderer.ui.elements.Button;
import electrosphere.renderer.ui.elements.FormElement;
import electrosphere.renderer.ui.elements.Label;
import electrosphere.renderer.ui.elements.TextInput;
import electrosphere.renderer.ui.elementtypes.ClickableElement;
import electrosphere.renderer.ui.elementtypes.Element;
import electrosphere.renderer.ui.events.ClickEvent;
public class MenuGeneratorsArena {
public static Element createArenaHostLoginMenu(){
FormElement rVal = new FormElement();
int screenTop = 150;
//label (address)
Label usernameLabel = new Label(1.0f);
usernameLabel.setText("Username");
rVal.addChild(usernameLabel);
//text entry (address)
TextInput usernameInput = new TextInput(100,screenTop + 125,1.0f);
usernameInput.setText("");
usernameInput.setMinWidth(200);
usernameInput.setMaxWidth(200);
rVal.addChild(usernameInput);
//label (port)
Label passwordLabel = new Label(1.0f);
passwordLabel.setText("Password");
rVal.addChild(passwordLabel);
//text entry (port)
TextInput passwordInput = new TextInput(100,screenTop + 275,1.0f);
passwordInput.setText("");
passwordInput.setMinWidth(200);
passwordInput.setMaxWidth(200);
rVal.addChild(passwordInput);
//button (connect)
Button connectButton = new Button();
Label connectLabel = new Label(1.0f);
connectLabel.setText("Login");
connectButton.addChild(connectLabel);
rVal.addChild(connectButton);
connectButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
Globals.clientUsername = usernameInput.getText();
Globals.clientPassword = AuthenticationManager.getHashedString(passwordInput.getText());
LoadingThread clientThread = new LoadingThread(LoadingThread.LOAD_CHARACTER_SERVER);
Globals.loadingThreadsList.add(clientThread);
clientThread.start();
return false;
}});
//button (back)
// Button backButton = new Button();
// Label backLabel = new Label(100,screenTop + 425,1.0f);
// backLabel.setText("Back");
// backButton.addChild(backLabel);
// rVal.addChild(backButton);
// backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
// WindowUtils.replaceMainMenuContents(MenuGenerators.createMultiplayerMenu());
// return false;
// }});
return rVal;
}
}

View File

@ -2,15 +2,9 @@ package electrosphere.menu.mainmenu;
import org.lwjgl.util.yoga.Yoga; import org.lwjgl.util.yoga.Yoga;
import electrosphere.engine.Globals;
import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.menu.WindowUtils;
import electrosphere.renderer.ui.elements.Button;
import electrosphere.renderer.ui.elements.FormElement; import electrosphere.renderer.ui.elements.FormElement;
import electrosphere.renderer.ui.elements.Label; import electrosphere.renderer.ui.elements.Label;
import electrosphere.renderer.ui.elementtypes.ClickableElement;
import electrosphere.renderer.ui.elementtypes.Element; import electrosphere.renderer.ui.elementtypes.Element;
import electrosphere.renderer.ui.events.ClickEvent;
/** /**
* Generates menu items for the demo version of the engine * Generates menu items for the demo version of the engine
@ -34,23 +28,6 @@ public class MenuGeneratorsDemo {
titleLabel.setText("ORPG"); titleLabel.setText("ORPG");
rVal.addChild(titleLabel); rVal.addChild(titleLabel);
//button (arena)
Button arenaButton = new Button();
Label arenaLabel = new Label(1.0f);
arenaLabel.setText("Start");
arenaButton.addChild(arenaLabel);
rVal.addChild(arenaButton);
arenaButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
LoadingThread serverThread = new LoadingThread(LoadingThread.LOAD_LEVEL);
Globals.loadingThreadsList.add(serverThread);
Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true;
serverThread.start();
WindowUtils.replaceMainMenuContents(MenuGeneratorsArena.createArenaHostLoginMenu());
return false;
}});
arenaButton.setMarginTop(50);
return rVal; return rVal;
} }

View File

@ -54,22 +54,6 @@ public class MenuGeneratorsTitleMenu {
return false; return false;
}}); }});
//button (arena)
Button arenaButton = new Button();
Label arenaLabel = new Label(1.0f);
arenaLabel.setText("Arena");
arenaButton.addChild(arenaLabel);
rVal.addChild(arenaButton);
arenaButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
LoadingThread serverThread = new LoadingThread(LoadingThread.LOAD_ARENA);
Globals.loadingThreadsList.add(serverThread);
Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true;
serverThread.start();
WindowUtils.replaceMainMenuContents(MenuGeneratorsArena.createArenaHostLoginMenu());
return false;
}});
//button (static level) //button (static level)
Button staticLevelButton = new Button(); Button staticLevelButton = new Button();
Label staticLevelLabel = new Label(1.0f); Label staticLevelLabel = new Label(1.0f);

View File

@ -4,7 +4,7 @@ import electrosphere.server.fluid.manager.ServerFluidChunk;
import electrosphere.server.fluid.models.FluidModel; import electrosphere.server.fluid.models.FluidModel;
import electrosphere.server.terrain.manager.ServerTerrainChunk; import electrosphere.server.terrain.manager.ServerTerrainChunk;
public class ArenaFluidGenerator implements FluidGenerator { public class DefaultFluidGenerator implements FluidGenerator {
@Override @Override
public ServerFluidChunk generateChunk(int worldX, int worldY, int worldZ) { public ServerFluidChunk generateChunk(int worldX, int worldY, int worldZ) {

View File

@ -3,7 +3,7 @@ package electrosphere.server.fluid.manager;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.server.fluid.diskmap.FluidDiskMap; import electrosphere.server.fluid.diskmap.FluidDiskMap;
import electrosphere.server.fluid.generation.ArenaFluidGenerator; import electrosphere.server.fluid.generation.DefaultFluidGenerator;
import electrosphere.server.fluid.generation.FluidGenerator; import electrosphere.server.fluid.generation.FluidGenerator;
import electrosphere.server.fluid.models.FluidModel; import electrosphere.server.fluid.models.FluidModel;
import electrosphere.server.fluid.simulator.ServerFluidSimulator; import electrosphere.server.fluid.simulator.ServerFluidSimulator;
@ -100,7 +100,7 @@ public class ServerFluidManager {
rVal.chunkCache = new ConcurrentHashMap<String, ServerFluidChunk>(); rVal.chunkCache = new ConcurrentHashMap<String, ServerFluidChunk>();
rVal.chunkCacheContents = new CopyOnWriteArrayList<String>(); rVal.chunkCacheContents = new CopyOnWriteArrayList<String>();
rVal.interpolationRandomDampener = 0.0f; rVal.interpolationRandomDampener = 0.0f;
rVal.chunkGenerator = new ArenaFluidGenerator(); rVal.chunkGenerator = new DefaultFluidGenerator();
rVal.serverFluidSimulator = new FluidCellularAutomataSimulator(); rVal.serverFluidSimulator = new FluidCellularAutomataSimulator();
return rVal; return rVal;
} }

View File

@ -7,9 +7,9 @@ import electrosphere.game.server.world.ServerWorldData;
import electrosphere.logger.LoggerInterface; import electrosphere.logger.LoggerInterface;
import electrosphere.server.content.ServerContentManager; import electrosphere.server.content.ServerContentManager;
import electrosphere.server.db.DatabaseUtils; import electrosphere.server.db.DatabaseUtils;
import electrosphere.server.fluid.generation.ArenaFluidGenerator; import electrosphere.server.fluid.generation.DefaultFluidGenerator;
import electrosphere.server.fluid.manager.ServerFluidManager; import electrosphere.server.fluid.manager.ServerFluidManager;
import electrosphere.server.terrain.generation.ArenaChunkGenerator; import electrosphere.server.terrain.generation.DefaultChunkGenerator;
import electrosphere.server.terrain.generation.OverworldChunkGenerator; import electrosphere.server.terrain.generation.OverworldChunkGenerator;
import electrosphere.server.terrain.manager.ServerTerrainManager; import electrosphere.server.terrain.manager.ServerTerrainManager;
import electrosphere.util.FileUtils; import electrosphere.util.FileUtils;
@ -101,7 +101,7 @@ public class SaveUtils {
Globals.serverTerrainManager = new ServerTerrainManager(ServerTerrainManager.WORLD_SIZE_DISCRETE, ServerTerrainManager.VERTICAL_INTERPOLATION_RATIO, 0, 0, new OverworldChunkGenerator()); Globals.serverTerrainManager = new ServerTerrainManager(ServerTerrainManager.WORLD_SIZE_DISCRETE, ServerTerrainManager.VERTICAL_INTERPOLATION_RATIO, 0, 0, new OverworldChunkGenerator());
Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager); Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager);
FileUtils.serializeObjectToSavePath(saveName, "./world.json", Globals.serverWorldData); FileUtils.serializeObjectToSavePath(saveName, "./world.json", Globals.serverWorldData);
Globals.serverFluidManager = new ServerFluidManager(Globals.serverTerrainManager, 3, 1, 0.0f, 0, new ArenaFluidGenerator()); Globals.serverFluidManager = new ServerFluidManager(Globals.serverTerrainManager, 3, 1, 0.0f, 0, new DefaultFluidGenerator());
if(Globals.serverTerrainManager != null){ if(Globals.serverTerrainManager != null){
Globals.serverTerrainManager.save(saveName); Globals.serverTerrainManager.save(saveName);
} else { } else {
@ -173,9 +173,9 @@ public class SaveUtils {
//create server structures //create server structures
if(!saveName.equals("arena")){ if(!saveName.equals("arena")){
Globals.serverWorldData = FileUtils.loadObjectFromSavePath(saveName, "world.json", ServerWorldData.class); Globals.serverWorldData = FileUtils.loadObjectFromSavePath(saveName, "world.json", ServerWorldData.class);
Globals.serverTerrainManager = new ServerTerrainManager(Globals.serverWorldData.getWorldSizeDiscrete(), 1, 0, 0, new ArenaChunkGenerator()); Globals.serverTerrainManager = new ServerTerrainManager(Globals.serverWorldData.getWorldSizeDiscrete(), 1, 0, 0, new DefaultChunkGenerator());
Globals.serverTerrainManager.load(saveName); Globals.serverTerrainManager.load(saveName);
Globals.serverFluidManager = new ServerFluidManager(Globals.serverTerrainManager, 2000, 50, 0, 0, new ArenaFluidGenerator()); Globals.serverFluidManager = new ServerFluidManager(Globals.serverTerrainManager, 2000, 50, 0, 0, new DefaultFluidGenerator());
} }
//if the scene file exists, load it //if the scene file exists, load it
if(FileUtils.checkFileExists("assets/Scenes/" + saveName)){ if(FileUtils.checkFileExists("assets/Scenes/" + saveName)){
@ -215,7 +215,7 @@ public class SaveUtils {
*/ */
public static boolean loadTerrainAndCreateWorldData(String currentSaveName){ public static boolean loadTerrainAndCreateWorldData(String currentSaveName){
Globals.serverTerrainManager = new ServerTerrainManager(2000,50,0.0f,0,new OverworldChunkGenerator()); Globals.serverTerrainManager = new ServerTerrainManager(2000,50,0.0f,0,new OverworldChunkGenerator());
Globals.serverFluidManager = new ServerFluidManager(Globals.serverTerrainManager, 2000, 50, 0.0f, 0, new ArenaFluidGenerator()); Globals.serverFluidManager = new ServerFluidManager(Globals.serverTerrainManager, 2000, 50, 0.0f, 0, new DefaultFluidGenerator());
SaveUtils.loadTerrainAndDB(currentSaveName); SaveUtils.loadTerrainAndDB(currentSaveName);
Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager); Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager);
Globals.serverContentManager = ServerContentManager.createServerContentManager(true); Globals.serverContentManager = ServerContentManager.createServerContentManager(true);

View File

@ -7,7 +7,7 @@ import electrosphere.server.terrain.models.TerrainModel;
/** /**
* An arena terrain chunk generator * An arena terrain chunk generator
*/ */
public class ArenaChunkGenerator implements ChunkGenerator { public class DefaultChunkGenerator implements ChunkGenerator {
@Override @Override
public ServerTerrainChunk generateChunk(int worldX, int worldY, int worldZ) { public ServerTerrainChunk generateChunk(int worldX, int worldY, int worldZ) {

View File

@ -2,7 +2,7 @@ package electrosphere.server.terrain.manager;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.server.terrain.diskmap.ChunkDiskMap; import electrosphere.server.terrain.diskmap.ChunkDiskMap;
import electrosphere.server.terrain.generation.ArenaChunkGenerator; import electrosphere.server.terrain.generation.DefaultChunkGenerator;
import electrosphere.server.terrain.generation.continentphase.TerrainGenerator; import electrosphere.server.terrain.generation.continentphase.TerrainGenerator;
import electrosphere.server.terrain.generation.interfaces.ChunkGenerator; import electrosphere.server.terrain.generation.interfaces.ChunkGenerator;
import electrosphere.server.terrain.models.TerrainModel; import electrosphere.server.terrain.models.TerrainModel;
@ -98,7 +98,7 @@ public class ServerTerrainManager {
rVal.chunkCache = new ConcurrentHashMap<String, ServerTerrainChunk>(); rVal.chunkCache = new ConcurrentHashMap<String, ServerTerrainChunk>();
rVal.chunkCacheContents = new CopyOnWriteArrayList<String>(); rVal.chunkCacheContents = new CopyOnWriteArrayList<String>();
rVal.interpolationRandomDampener = 0.0f; rVal.interpolationRandomDampener = 0.0f;
rVal.chunkGenerator = new ArenaChunkGenerator(); rVal.chunkGenerator = new DefaultChunkGenerator();
return rVal; return rVal;
} }