From eb703cbd2c9aee3fc98c6c6ea46f365ef3e542b7 Mon Sep 17 00:00:00 2001 From: Cedric Beck Date: Sun, 1 Dec 2024 17:03:09 +0100 Subject: [PATCH] fixed bad performancegit status!; edited GameNotification; fixed error because of changed 'Color' enum --- Projekte/mdga/client/hs_err_pid112363.log | 32 ------------------- .../src/main/java/pp/mdga/client/MdgaApp.java | 10 +++--- .../mdga/client/NotificationSynchronizer.java | 3 +- .../pp/mdga/client/board/BoardHandler.java | 11 ++++--- .../pp/mdga/client/board/CameraHandler.java | 3 +- .../pp/mdga/client/button/CeremonyButton.java | 1 + .../pp/mdga/client/gui/ActionTextHandler.java | 1 + .../pp/mdga/client/gui/PlayerNameHandler.java | 1 + .../java/pp/mdga/client/view/GameView.java | 7 ++++ .../java/pp/mdga/client/view/LobbyView.java | 2 ++ .../java/pp/mdga/client/view/MdgaView.java | 6 ++-- .../mdga/notification/GameNotification.java | 12 ++++++- 12 files changed, 40 insertions(+), 49 deletions(-) delete mode 100644 Projekte/mdga/client/hs_err_pid112363.log diff --git a/Projekte/mdga/client/hs_err_pid112363.log b/Projekte/mdga/client/hs_err_pid112363.log deleted file mode 100644 index 7e7c369f..00000000 --- a/Projekte/mdga/client/hs_err_pid112363.log +++ /dev/null @@ -1,32 +0,0 @@ -# -# A fatal error has been detected by the Java Runtime Environment: -# -# SIGSEGV (0xb) at pc=0x000076fb04e70b48, pid=112363, tid=112397 -# -# JRE version: OpenJDK Runtime Environment Temurin-20.0.2+9 (20.0.2+9) (build 20.0.2+9) -# Java VM: OpenJDK 64-Bit Server VM Temurin-20.0.2+9 (20.0.2+9, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64) -# Problematic frame: -# C [libLLVM.so.18.1+0x1070b48] llvm::EVT::isExtendedVector() const+0x8 -# -# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/cedric/ProgProjekt/Gruppe-01/Projekte/mdga/client/core.112363) -# -# If you would like to submit a bug report, please visit: -# https://github.com/adoptium/adoptium-support/issues -# The crash happened outside the Java Virtual Machine in native code. -# See problematic frame for where to report the bug. -# - ---------------- S U M M A R Y ------------ - -Command Line: -Ddebugger.agent.enable.coroutines=true -Djava.util.logging.config.file=logging.properties -Dkotlinx.coroutines.debug.enable.creation.stack.trace=false -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:37129 -javaagent:/usr/share/idea/plugins/java/lib/rt/debugger-agent.jar -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -ea pp.mdga.client.MdgaApp - -Host: AMD Ryzen 5 8640HS w/ Radeon 760M Graphics, 12 cores, 14G, Manjaro Linux -Time: Fri Nov 29 22:02:46 2024 CET elapsed time: 26.893420 seconds (0d 0h 0m 26s) - ---------------- T H R E A D --------------- - -Current thread (0x000076fbec5e6dd0): JavaThread "jME3 Main" [_thread_in_native, id=112397, stack(0x000076fbd00fe000,0x000076fbd01fe000)] - -Stack: [0x000076fbd00fe000,0x000076fbd01fe000], sp=0x000076fbd01f4ef8, free space=987k -Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) -C [libLLVM.so.18.1+0x1070b48] llvm::EVT::isExtendedVector() const+0x8 \ No newline at end of file diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java index f0d55121..8341a9b2 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java @@ -35,7 +35,7 @@ public class MdgaApp extends SimpleApplication { private MdgaState state = null; /** Scale for rendering images. */ - private static final float imageScale = 1.5f; + private static final float IMAGE_SCALE = 1.5f; /** The main menu view. */ private MdgaView mainView; @@ -59,8 +59,8 @@ public static void main(String[] args) { AppSettings settings = new AppSettings(true); settings.setSamples(128); settings.setCenterWindow(true); - settings.setWidth(1920); - settings.setHeight(1080); + settings.setWidth(1800); + settings.setHeight(900); settings.setVSync(false); MdgaApp app = new MdgaApp(); @@ -91,7 +91,7 @@ public void simpleInitApp() { gameView = new GameView(this); ceremonyView = new CeremonyView(this); - enter(MdgaState.MAIN); + enter(MdgaState.LOBBY); } /** @@ -174,7 +174,7 @@ public MdgaState getState() { * @return the image scale as a float */ public float getImageScale() { - return imageScale; + return IMAGE_SCALE; } /** diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java index 3ab0999d..be112418 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java @@ -64,8 +64,9 @@ private void handleLobby(Notification notification) { lobbyView.setTaken(n.getColor(), false, false, null); //} else if(notification instanceof LobbyReadyNotification lobbyReadyNotification) { //lobbyView.setReady(lobbyReadyNotification.getColor(), lobbyReadyNotification.isReady()): - } else if (notification instanceof GameNotification) { + } else if (notification instanceof GameNotification n) { app.enter(MdgaState.GAME); + ((GameView) app.getView()).setOwnColor(n.getOwnColor()); } else { throw new RuntimeException("notification not expected: " + notification.toString()); } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/board/BoardHandler.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/board/BoardHandler.java index 475092c5..524a36df 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/board/BoardHandler.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/board/BoardHandler.java @@ -30,7 +30,7 @@ public class BoardHandler { private Map> waitingPiecesMap; private Map pieceColor; - private Node node = new Node(); + private Node rootNodeBoard; private final Node rootNode; private final FilterPostProcessor fpp; @@ -49,6 +49,7 @@ public BoardHandler(MdgaApp app, Node rootNode, FilterPostProcessor fpp) { this.app = app; this.fpp = fpp; + rootNodeBoard = new Node("Board Root Node"); this.rootNode = rootNode; isInitialised = false; } @@ -61,14 +62,14 @@ public void init() { selectedOwnPiece = null; selectedEnemyPiece = null; initMap(); - rootNode.attachChild(node); + rootNode.attachChild(rootNodeBoard); } public void shutdown(){ clearSelectable(); isInitialised = false; initMap(); - rootNode.detachChild(node); + rootNode.detachChild(rootNodeBoard); } private void addFigureToPlayerMap(Color col, AssetOnMap assetOnMap) { @@ -132,7 +133,7 @@ private Spatial createModel(Asset asset, Vector3f pos, float rot) { Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md"); mat.setTexture("DiffuseMap", app.getAssetManager().loadTexture(texName)); model.setMaterial(mat); - node.attachChild(model); + rootNodeBoard.attachChild(model); return model; } @@ -468,7 +469,7 @@ public void enableHover(UUID uuid){ } public void showDice(Color color){ - node.attachChild(diceControl.getSpatial()); + rootNodeBoard.attachChild(diceControl.getSpatial()); diceControl.setPos(getWaitingPos(color).add(new Vector3f(0,0,4))); diceControl.spin(); } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/board/CameraHandler.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/board/CameraHandler.java index a1c6b8d6..1404905d 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/board/CameraHandler.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/board/CameraHandler.java @@ -45,12 +45,11 @@ public CameraHandler(MdgaApp app, FilterPostProcessor fpp) { ambient = new AmbientLight(); ambient.setColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 1)); - dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 4); + dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 1); dlsf.setLight(sun); dlsf.setEnabled(true); dlsf.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON); dlsf.setShadowIntensity(0.7f); - fpp.addFilter(dlsf); sky = SkyFactory.createSky(app.getAssetManager(), "Images/sky/sky.dds", EnvMapType.EquirectMap).rotate(FastMath.HALF_PI*1,0,FastMath.HALF_PI*0.2f); diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/button/CeremonyButton.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/button/CeremonyButton.java index 00244262..2402ba01 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/button/CeremonyButton.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/button/CeremonyButton.java @@ -110,6 +110,7 @@ public CeremonyButton(MdgaApp app, Node node, Node node3d, Color tsk, Pos pos, S instance.setText("Marine"); yield Asset.marine; } + default -> throw new RuntimeException("None is not valid"); }; switch (pos) { diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/gui/ActionTextHandler.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/gui/ActionTextHandler.java index e27686c1..aa41bdf5 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/gui/ActionTextHandler.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/gui/ActionTextHandler.java @@ -117,6 +117,7 @@ private ColorRGBA playerColorToColorRGBA(Color color){ case NAVY -> ColorRGBA.Blue; case CYBER -> ColorRGBA.Orange; case AIRFORCE -> ColorRGBA.Black; + default -> throw new RuntimeException("None is not valid"); }; } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/gui/PlayerNameHandler.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/gui/PlayerNameHandler.java index 5a4456b9..1b197d16 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/gui/PlayerNameHandler.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/gui/PlayerNameHandler.java @@ -78,6 +78,7 @@ private String imagePath(Color color){ case NAVY -> root+"MARINE_IMAGE.png"; case CYBER -> root+"CIR_IMAGE.png"; case AIRFORCE -> root+"LW_IMAGE.png"; + default -> throw new RuntimeException("None is not valid"); }; } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/GameView.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/GameView.java index 8c4be754..e4236576 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/GameView.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/GameView.java @@ -10,6 +10,12 @@ import pp.mdga.client.button.ButtonRight; import pp.mdga.client.gui.GuiHandler; import pp.mdga.game.Color; +import pp.mdga.notification.GameNotification; +import pp.mdga.notification.PlayerInGameNotification; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; public class GameView extends MdgaView { private BoardHandler boardHandler; @@ -49,6 +55,7 @@ public void onEnter() { app.getViewPort().addProcessor(fpp); app.getAcousticHandler().playSound(MdgaSound.START); + } @Override diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/LobbyView.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/LobbyView.java index 6262e93f..0ee82c56 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/LobbyView.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/LobbyView.java @@ -18,6 +18,7 @@ import pp.mdga.client.button.LobbyButton; import pp.mdga.client.button.SettingsButton; import pp.mdga.game.Color; +import pp.mdga.notification.GameNotification; public class LobbyView extends MdgaView { private Geometry background; @@ -186,6 +187,7 @@ public void setReady(Color color, boolean isReady) { case AIRFORCE -> airforceButton; case ARMY -> armyButton; case NAVY -> navyButton; + default -> throw new RuntimeException("None is not valid"); }; button.setReady(isReady); diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/MdgaView.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/MdgaView.java index f146324f..bea0cbff 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/MdgaView.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/MdgaView.java @@ -20,9 +20,9 @@ public enum Overlay { } protected MdgaApp app; - protected Node rootNode = new Node(); - protected Node guiNode = new Node(); - protected Node overlayNode = new Node(); + protected Node rootNode = new Node("View Root"); + protected Node guiNode = new Node("View Root GUI"); + protected Node overlayNode = new Node("View Root Overlay"); private SettingsButton settingsButton; diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/notification/GameNotification.java b/Projekte/mdga/model/src/main/java/pp/mdga/notification/GameNotification.java index d1864bbd..1c6e79fa 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/notification/GameNotification.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/notification/GameNotification.java @@ -1,12 +1,22 @@ package pp.mdga.notification; +import pp.mdga.game.Color; + /** * GameNotification class */ public class GameNotification extends Notification{ + + private final Color ownColor; + /** * Constructor */ - public GameNotification() { + public GameNotification(Color ownColor) { + this.ownColor = ownColor; + } + + public Color getOwnColor() { + return ownColor; } }