Fix singleplayer loading flow
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
9c672af15f
commit
460989eeab
@ -1183,6 +1183,7 @@ Remove explicit garbage collection call
|
|||||||
Actor panel additional functionality
|
Actor panel additional functionality
|
||||||
Better style for character creation menu
|
Better style for character creation menu
|
||||||
Fix AABB calculation from assimp-loaded models
|
Fix AABB calculation from assimp-loaded models
|
||||||
|
Fix singleplayer launching at all
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import electrosphere.entity.types.creature.CreatureTemplate;
|
|||||||
import electrosphere.game.data.creature.type.CreatureData;
|
import electrosphere.game.data.creature.type.CreatureData;
|
||||||
import electrosphere.game.data.creature.type.visualattribute.AttributeVariant;
|
import electrosphere.game.data.creature.type.visualattribute.AttributeVariant;
|
||||||
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
import electrosphere.game.data.creature.type.visualattribute.VisualAttribute;
|
||||||
import electrosphere.net.parser.net.message.CharacterMessage;
|
|
||||||
import electrosphere.renderer.actor.Actor;
|
import electrosphere.renderer.actor.Actor;
|
||||||
import electrosphere.renderer.actor.ActorStaticMorph;
|
import electrosphere.renderer.actor.ActorStaticMorph;
|
||||||
import electrosphere.renderer.actor.ActorUtils;
|
import electrosphere.renderer.actor.ActorUtils;
|
||||||
@ -26,7 +25,6 @@ import electrosphere.renderer.ui.elements.Slider;
|
|||||||
import electrosphere.renderer.ui.elements.StringCarousel;
|
import electrosphere.renderer.ui.elements.StringCarousel;
|
||||||
import electrosphere.renderer.ui.elementtypes.Element;
|
import electrosphere.renderer.ui.elementtypes.Element;
|
||||||
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
||||||
import electrosphere.util.Utilities;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Panel to customize a character
|
* Panel to customize a character
|
||||||
@ -176,7 +174,6 @@ public class CharacterCustomizer {
|
|||||||
createButtonContainer.setMarginLeft(CONTROL_CONTAINER_MARGIN);
|
createButtonContainer.setMarginLeft(CONTROL_CONTAINER_MARGIN);
|
||||||
createButtonContainer.setMarginRight(CONTROL_CONTAINER_MARGIN);
|
createButtonContainer.setMarginRight(CONTROL_CONTAINER_MARGIN);
|
||||||
createButtonContainer.addChild(Button.createButton("Create", () -> {
|
createButtonContainer.addChild(Button.createButton("Create", () -> {
|
||||||
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCreateCharacterMessage(Utilities.stringify(template)));
|
|
||||||
onConfirm.accept(template);
|
onConfirm.accept(template);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@ -55,12 +55,10 @@ public class MenuGenerators {
|
|||||||
//need to log client in
|
//need to log client in
|
||||||
Globals.clientUsername = "username";
|
Globals.clientUsername = "username";
|
||||||
Globals.clientPassword = AuthenticationManager.getHashedString("password");
|
Globals.clientPassword = AuthenticationManager.getHashedString("password");
|
||||||
LoadingThread clientThread = new LoadingThread(LoadingThreadType.CHARACTER_SERVER);
|
LoadingThread serverThread = new LoadingThread(LoadingThreadType.MAIN_GAME, saveName, Globals.clientUsername, Globals.clientPassword);
|
||||||
LoadingThread serverThread = new LoadingThread(LoadingThreadType.MAIN_GAME);
|
|
||||||
Globals.RUN_CLIENT = true;
|
Globals.RUN_CLIENT = true;
|
||||||
Globals.RUN_SERVER = true;
|
Globals.RUN_SERVER = true;
|
||||||
Globals.threadManager.start(serverThread);
|
Globals.threadManager.start(serverThread);
|
||||||
Globals.threadManager.start(clientThread);
|
|
||||||
} else {
|
} else {
|
||||||
SaveUtils.loadSave(saveName.toLowerCase(), false);
|
SaveUtils.loadSave(saveName.toLowerCase(), false);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createSaveCreationMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createSaveCreationMenu());
|
||||||
|
|||||||
@ -4,11 +4,13 @@ import electrosphere.client.ui.components.CharacterCustomizer;
|
|||||||
import electrosphere.client.ui.menu.WindowUtils;
|
import electrosphere.client.ui.menu.WindowUtils;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.CreatureTemplate;
|
||||||
|
import electrosphere.net.parser.net.message.CharacterMessage;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
import electrosphere.renderer.ui.elements.Button;
|
||||||
import electrosphere.renderer.ui.elements.FormElement;
|
import electrosphere.renderer.ui.elements.FormElement;
|
||||||
import electrosphere.renderer.ui.elements.StringCarousel;
|
import electrosphere.renderer.ui.elements.StringCarousel;
|
||||||
import electrosphere.renderer.ui.elementtypes.Element;
|
import electrosphere.renderer.ui.elementtypes.Element;
|
||||||
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
||||||
|
import electrosphere.util.Utilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The menu for character creation
|
* The menu for character creation
|
||||||
@ -64,7 +66,9 @@ public class MenuCharacterCreation {
|
|||||||
public static Element createCharacterCustomizationMenu(){
|
public static Element createCharacterCustomizationMenu(){
|
||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
|
|
||||||
rVal.addChild(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace, (CreatureTemplate template) -> {}));
|
rVal.addChild(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace, (CreatureTemplate template) -> {
|
||||||
|
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCreateCharacterMessage(Utilities.stringify(template)));
|
||||||
|
}));
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import electrosphere.client.ui.menu.MenuGenerators;
|
|||||||
import electrosphere.client.ui.menu.WindowUtils;
|
import electrosphere.client.ui.menu.WindowUtils;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
import electrosphere.entity.types.creature.CreatureTemplate;
|
||||||
|
import electrosphere.net.parser.net.message.CharacterMessage;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
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;
|
||||||
@ -14,6 +15,7 @@ import electrosphere.renderer.ui.elementtypes.Element;
|
|||||||
import electrosphere.renderer.ui.elementtypes.ValueElement.ValueChangeEventCallback;
|
import electrosphere.renderer.ui.elementtypes.ValueElement.ValueChangeEventCallback;
|
||||||
import electrosphere.renderer.ui.events.ClickEvent;
|
import electrosphere.renderer.ui.events.ClickEvent;
|
||||||
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
||||||
|
import electrosphere.util.Utilities;
|
||||||
|
|
||||||
public class MenuGeneratorsMultiplayer {
|
public class MenuGeneratorsMultiplayer {
|
||||||
|
|
||||||
@ -53,7 +55,9 @@ public class MenuGeneratorsMultiplayer {
|
|||||||
createButton.addChild(createLabel);
|
createButton.addChild(createLabel);
|
||||||
rVal.addChild(createButton);
|
rVal.addChild(createButton);
|
||||||
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
createButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
WindowUtils.replaceMainMenuContents(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace, (CreatureTemplate template) -> {}));
|
WindowUtils.replaceMainMenuContents(CharacterCustomizer.createCharacterCustomizerPanel(selectedRace, (CreatureTemplate template) -> {
|
||||||
|
Globals.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCreateCharacterMessage(Utilities.stringify(template)));
|
||||||
|
}));
|
||||||
return false;
|
return false;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,6 @@ import electrosphere.client.ui.menu.mainmenu.MenuCharacterCreation;
|
|||||||
import electrosphere.controls.ControlHandler;
|
import electrosphere.controls.ControlHandler;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||||
import electrosphere.engine.assetmanager.queue.QueuedModel;
|
|
||||||
import electrosphere.engine.signal.Signal.SignalType;
|
import electrosphere.engine.signal.Signal.SignalType;
|
||||||
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
||||||
import electrosphere.entity.DrawableUtils;
|
import electrosphere.entity.DrawableUtils;
|
||||||
@ -31,10 +30,6 @@ import electrosphere.net.NetUtils;
|
|||||||
import electrosphere.net.client.ClientNetworking;
|
import electrosphere.net.client.ClientNetworking;
|
||||||
import electrosphere.renderer.actor.Actor;
|
import electrosphere.renderer.actor.Actor;
|
||||||
import electrosphere.renderer.actor.ActorTextureMask;
|
import electrosphere.renderer.actor.ActorTextureMask;
|
||||||
import electrosphere.renderer.meshgen.GeometryMeshGen;
|
|
||||||
import electrosphere.renderer.model.Mesh;
|
|
||||||
import electrosphere.renderer.model.Model;
|
|
||||||
import electrosphere.renderer.shader.VisualShader;
|
|
||||||
|
|
||||||
public class ClientLoading {
|
public class ClientLoading {
|
||||||
|
|
||||||
@ -56,6 +51,12 @@ public class ClientLoading {
|
|||||||
* @param params no params
|
* @param params no params
|
||||||
*/
|
*/
|
||||||
protected static void loadCharacterServer(Object[] params){
|
protected static void loadCharacterServer(Object[] params){
|
||||||
|
if(params.length < 1){
|
||||||
|
throw new Error("Expected 1 params!");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean useLocalConnection = (boolean)params[0];
|
||||||
|
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING), true);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING), true);
|
||||||
@ -63,7 +64,11 @@ public class ClientLoading {
|
|||||||
//disable menu input
|
//disable menu input
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlHandler.ControlsState.NO_INPUT);
|
Globals.controlHandler.hintUpdateControlState(ControlHandler.ControlsState.NO_INPUT);
|
||||||
//initialize the client thread (client)
|
//initialize the client thread (client)
|
||||||
initClientThread();
|
if(useLocalConnection){
|
||||||
|
LoadingUtils.initLocalConnection(true);
|
||||||
|
} else {
|
||||||
|
ClientLoading.initClientThread();
|
||||||
|
}
|
||||||
//while we don't know what races are playable, wait
|
//while we don't know what races are playable, wait
|
||||||
while(Globals.gameConfigCurrent.getCreatureTypeLoader().getPlayableRaces().size() == 0){
|
while(Globals.gameConfigCurrent.getCreatureTypeLoader().getPlayableRaces().size() == 0){
|
||||||
try {
|
try {
|
||||||
@ -108,6 +113,8 @@ 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();
|
||||||
|
//set simulations to ready if they exist
|
||||||
|
LoadingUtils.setSimulationsToReady();
|
||||||
//make loading window disappear
|
//make loading window disappear
|
||||||
Globals.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
|
Globals.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
|
||||||
WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, false);
|
WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, false);
|
||||||
|
|||||||
@ -199,8 +199,13 @@ public class LoadingUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the server simulations to ready
|
||||||
|
*/
|
||||||
static void setSimulationsToReady(){
|
static void setSimulationsToReady(){
|
||||||
Globals.microSimulation.setReady(true);
|
if(Globals.microSimulation != null){
|
||||||
|
Globals.microSimulation.setReady(true);
|
||||||
|
}
|
||||||
if(Globals.macroSimulation != null){
|
if(Globals.macroSimulation != null){
|
||||||
Globals.macroSimulation.setReady(true);
|
Globals.macroSimulation.setReady(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,41 +1,68 @@
|
|||||||
package electrosphere.engine.loadingthreads;
|
package electrosphere.engine.loadingthreads;
|
||||||
|
|
||||||
|
import electrosphere.client.ui.menu.MenuGenerators;
|
||||||
|
import electrosphere.client.ui.menu.WindowStrings;
|
||||||
|
import electrosphere.client.ui.menu.WindowUtils;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.signal.Signal.SignalType;
|
||||||
|
import electrosphere.entity.scene.SceneGenerator;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
|
import electrosphere.renderer.ui.elements.Window;
|
||||||
|
import electrosphere.server.saves.SaveUtils;
|
||||||
|
|
||||||
public class ServerLoading {
|
public class ServerLoading {
|
||||||
|
|
||||||
|
|
||||||
protected static void loadMainGameServer(Object[] params){
|
protected static void loadMainGameServer(Object[] params){
|
||||||
//initialize the terrain manager (server only)
|
if(params.length < 3){
|
||||||
// if(Globals.RUN_SERVER){
|
throw new Error("Invalid number of parameters!");
|
||||||
// initServerGameTerrainManager();
|
}
|
||||||
// }
|
|
||||||
|
String saveName = (String)params[0];
|
||||||
//TODO: Globals.serverTerrainManager = new ServerTerrainManager(2000,50,100,randomDampener,0);
|
String username = (String)params[1];
|
||||||
// Globals.serverTerrainManager = new ServerTerrainManager(2000,50,0.0f,0, new OverworldChunkGenerator());
|
String password = (String)params[2];
|
||||||
// SaveUtils.loadSave(Globals.currentSaveName);
|
|
||||||
// LoadingUtils.initTerrainDataCellManager();
|
//setup ui for loading
|
||||||
//TODO: set spawnpoint
|
Globals.signalSystem.post(SignalType.UI_MODIFICATION, ()->{
|
||||||
//TODO: Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager);
|
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||||
//TODO: Globals.dataCellManager = new DataCellManager(Globals.serverWorldData);
|
//show loading
|
||||||
// Globals.serverWorldData = ServerWorldData.createGameWorld(Globals.serverTerrainManager);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||||
// Globals.dataCellManager = new DataCellManager(Globals.serverWorldData);
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||||
|
loadingWindow.setVisible(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
//load the server
|
||||||
|
if(!SaveUtils.getSaves().contains(saveName)){
|
||||||
|
//
|
||||||
|
//the juicy server GENERATION part
|
||||||
|
//
|
||||||
|
//init save structure
|
||||||
|
SaveUtils.createOrOverwriteSave(saveName, SceneGenerator.createProceduralSceneFile(saveName));
|
||||||
|
}
|
||||||
|
//load just-created save
|
||||||
|
SaveUtils.loadSave(saveName, false);
|
||||||
|
//initialize the "virtual" objects simulation
|
||||||
|
LoadingUtils.initMacroSimulation();
|
||||||
|
|
||||||
|
|
||||||
LoggerInterface.loggerEngine.INFO("run server: " + Globals.RUN_SERVER + " run client: " + Globals.RUN_CLIENT);
|
LoggerInterface.loggerEngine.INFO("run server: " + Globals.RUN_SERVER + " run client: " + Globals.RUN_CLIENT);
|
||||||
//init authentication
|
//init authentication
|
||||||
LoadingUtils.initAuthenticationManager(false);
|
LoadingUtils.initAuthenticationManager(false);
|
||||||
//initialize the server thread (server only)
|
//initialize the local connection
|
||||||
LoadingUtils.initServerThread();
|
Globals.clientUsername = username;
|
||||||
//initialize the "virtual" objects simulation
|
Globals.clientPassword = password;
|
||||||
LoadingUtils.initMacroSimulation();
|
|
||||||
//initialize the "real" objects simulation
|
//initialize the "real" objects simulation
|
||||||
LoadingUtils.initMicroSimulation();
|
LoadingUtils.initMicroSimulation();
|
||||||
//init game specific stuff (ie different skybox colors)
|
//init game specific stuff (ie different skybox colors)
|
||||||
LoadingUtils.initGameGraphicalEntities();
|
LoadingUtils.initGameGraphicalEntities();
|
||||||
//set simulations to ready if they exist
|
|
||||||
LoadingUtils.setSimulationsToReady();
|
|
||||||
//log
|
//log
|
||||||
LoggerInterface.loggerEngine.INFO("[Server]Finished loading main world");
|
LoggerInterface.loggerEngine.INFO("[Server]Finished loading main world");
|
||||||
|
|
||||||
|
//load client side
|
||||||
|
Object[] subParams = new Object[]{
|
||||||
|
true
|
||||||
|
};
|
||||||
|
ClientLoading.loadCharacterServer(subParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user