fixed bad performancegit status!; edited GameNotification; fixed error because of changed 'Color' enum

This commit is contained in:
Cedric Beck
2024-12-01 17:03:09 +01:00
parent 772c7a51e0
commit eb703cbd2c
12 changed files with 40 additions and 49 deletions

View File

@@ -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

View File

@@ -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;
}
/**

View File

@@ -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());
}

View File

@@ -30,7 +30,7 @@ public class BoardHandler {
private Map<Color, List<PieceControl>> waitingPiecesMap;
private Map<UUID, Color> 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();
}

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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");
};
}

View File

@@ -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");
};
}

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}
}