simulation flag

This commit is contained in:
austin 2023-10-22 22:28:14 -04:00
parent e37b48d267
commit c63d776cc7
4 changed files with 31 additions and 22 deletions

8
.vscode/launch.json vendored
View File

@ -32,6 +32,14 @@
"mainClass": "electrosphere.engine.Main",
"projectName": "Renderer",
"args" : "--headless"
},
{
"type": "java",
"name": "Launch Simulation Only",
"request": "launch",
"mainClass": "electrosphere.engine.Main",
"projectName": "Renderer",
"args" : "--simulate"
}
]
}

View File

@ -62,7 +62,6 @@ import electrosphere.renderer.ui.font.RawFontMap;
import electrosphere.script.ScriptEngine;
import electrosphere.server.ai.AIManager;
import electrosphere.server.datacell.EntityDataCellMapper;
import electrosphere.server.datacell.GriddedDataCellManager;
import electrosphere.server.datacell.RealmManager;
import electrosphere.server.db.DatabaseController;
import electrosphere.server.pathfinding.NavMeshManager;
@ -246,6 +245,9 @@ public class Globals {
//macro simulation
public static MacroSimulation macroSimulation;
public static MacroData macroData;
//flag to only run a simulation without full client
public static boolean RUN_SIMULATION_ONLY = false;
//micro simulation
public static MicroSimulation microSimulation;

View File

@ -14,13 +14,10 @@ import electrosphere.controls.ControlHandler;
import electrosphere.engine.cli.CLIParser;
import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.game.config.UserSettings;
import electrosphere.game.server.world.MacroData;
import electrosphere.logger.LoggerInterface;
import electrosphere.net.parser.net.message.TerrainMessage;
import electrosphere.net.parser.net.raw.NetworkParser;
import electrosphere.net.parser.util.ByteStreamUtils;
import electrosphere.renderer.Model;
import electrosphere.renderer.RenderingEngine;
import electrosphere.util.worldviewer.TerrainViewer;
import electrosphere.server.simulation.MacroSimulation;
@ -97,22 +94,21 @@ public class Main {
//world gen testing
//gen terrain
// Globals.serverTerrainManager = new ServerTerrainManager(2000,50,100,0.0f,0);
// Globals.serverTerrainManager.load();
// Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager);
// //gen world
// Globals.macroData = MacroData.generateWorld(0);
// Globals.macroData.describeWorld();
// boolean run = true;
// Globals.macroSimulation = new MacroSimulation();
// while(run){
// Globals.macroSimulation.simulate();
// try {
// TimeUnit.MILLISECONDS.sleep(1000);
// } catch (InterruptedException ex) {
// ex.printStackTrace();
// }
// }
if(Globals.RUN_SIMULATION_ONLY){
//gen world
Globals.macroData = MacroData.generateWorld(0);
Globals.macroData.describeWorld();
boolean run = true;
Globals.macroSimulation = new MacroSimulation();
while(run){
Globals.macroSimulation.simulate();
try {
TimeUnit.MILLISECONDS.sleep(1000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
// if(1==1){
// Globals.audioEngine = new AudioEngine();

View File

@ -17,6 +17,9 @@ public class CLIParser {
Globals.RUN_SERVER = true;
Globals.HEADLESS = true;
} break;
case "--simulate": {
Globals.RUN_SIMULATION_ONLY = true;
} break;
}
}
}