merge development into test #26

Merged
j23f0712 merged 95 commits from development into dev/test 2024-12-01 21:02:48 +01:00
14 changed files with 164 additions and 60 deletions
Showing only changes of commit 07f0f55192 - Show all commits

View File

@@ -0,0 +1,32 @@
#
# 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

@@ -96,10 +96,6 @@ else if(boardSelect != null) {
} }
if(name.equals("Test") &&isPressed){ if(name.equals("Test") &&isPressed){
if(app.getView() instanceof GameView gameView){ if(app.getView() instanceof GameView gameView){
gameView.getGuiHandler().test2();
// gameView.getGuiHandler().showDice();
// gameView.getBoardHandler().showDice(Color.AIRFORCE);
} }
} }
} }

View File

@@ -82,13 +82,14 @@ private void handleGame(Notification notification) {
} else if (notification instanceof DiceNowNotification) { } else if (notification instanceof DiceNowNotification) {
guiHandler.showDice(); guiHandler.showDice();
} else if (notification instanceof DicingNotification n) { } else if (notification instanceof DicingNotification n) {
//TODO
} else if (notification instanceof DrawCardNotification n) {
//TODO ??? //TODO ???
} else if (notification instanceof DrawCardNotification n) {
guiHandler.drawCard(n.getColor());
} else if (notification instanceof HomeMoveNotification home) { } else if (notification instanceof HomeMoveNotification home) {
boardHandler.moveHomePiece(home.getPieceId(), home.getHomeIndex()); boardHandler.moveHomePiece(home.getPieceId(), home.getHomeIndex());
guiHandler.hideText();
} else if (notification instanceof InterruptNotification) { } else if (notification instanceof InterruptNotification) {
//TODO //TODO ???
} else if (notification instanceof MovePieceNotification n) { } else if (notification instanceof MovePieceNotification n) {
if(n.isMoveStart()) { if(n.isMoveStart()) {
//StartMove //StartMove
@@ -111,11 +112,16 @@ private void handleGame(Notification notification) {
} }
} else if (notification instanceof PlayerInGameNotification n) { } else if (notification instanceof PlayerInGameNotification n) {
boardHandler.addPlayer(n.getColor(),n.getPiecesList()); boardHandler.addPlayer(n.getColor(),n.getPiecesList());
guiHandler.addPlayer(n.getColor(),n.getName(), gameView.getOwnColor() == n.getColor()); guiHandler.addPlayer(n.getColor(),n.getName());
} else if (notification instanceof ResumeNotification) { } else if (notification instanceof ResumeNotification) {
} else if (notification instanceof RollDiceNotification n) { } else if (notification instanceof RollDiceNotification n) {
guiHandler.rollDice(n.getEyes()); if(n.getColor() == gameView.getOwnColor()){
//TODO multiplicator guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
}
else {
if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
else guiHandler.showRolledDice(n.getEyes(), n.getColor());
}
} else if (notification instanceof SelectableCardsNotification n) { } else if (notification instanceof SelectableCardsNotification n) {
guiHandler.setSelectableCards(n.getCards()); guiHandler.setSelectableCards(n.getCards());
} else if (notification instanceof ShieldActiveNotification n) { } else if (notification instanceof ShieldActiveNotification n) {
@@ -126,12 +132,17 @@ private void handleGame(Notification notification) {
app.enter(MdgaState.MAIN); app.enter(MdgaState.MAIN);
} else if (notification instanceof SwapPieceNotification n) { } else if (notification instanceof SwapPieceNotification n) {
boardHandler.swapPieces(n.getFirstPiece(), n.getSecondPiece()); boardHandler.swapPieces(n.getFirstPiece(), n.getSecondPiece());
guiHandler.swap();
} else if (notification instanceof WaitMoveNotification) { } else if (notification instanceof WaitMoveNotification) {
//TODO disable all hover, highlight, etc //TODO ???
} else if (notification instanceof SelectableMoveNotification n) { } else if (notification instanceof SelectableMoveNotification n) {
boardHandler.outlineMove(n.getPieces(), n.getMoveIndexe(), n.getHomeMoves()); boardHandler.outlineMove(n.getPieces(), n.getMoveIndexe(), n.getHomeMoves());
} else if (notification instanceof SelectableSwapNotification n) { } else if (notification instanceof SelectableSwapNotification n) {
boardHandler.outlineSwap(n.getOwnPieces(), n.getEnemyPieces()); boardHandler.outlineSwap(n.getOwnPieces(), n.getEnemyPieces());
} else if (notification instanceof SelectableShieldNotification n) {
boardHandler.outlineShield(n.getOwnPieces());
} else if (notification instanceof TurboActiveNotification){
guiHandler.turbo();
} else { } else {
throw new RuntimeException("notification not expected: " + notification.toString()); throw new RuntimeException("notification not expected: " + notification.toString());
} }

View File

@@ -431,6 +431,21 @@ public void outlineSwap(List<UUID> ownPieces, List<UUID> enemyPieces){
} }
} }
public void outlineShield(List<UUID> pieces){
selectableOwnPieces.clear();
selectableEnemyPieces.clear();
selectedOwnPiece = null;
selectedEnemyPiece = null;
for (UUID uuid : pieces){
PieceControl p = this.pieces.get(uuid);
p.highlight(false);
p.setHoverable(true);
p.setSelectable(true);
selectableOwnPieces.add(p);
}
}
//called from inputSynchronizer when a piece is selectable //called from inputSynchronizer when a piece is selectable
public void pieceSelect(PieceControl pieceSelected) { public void pieceSelect(PieceControl pieceSelected) {
boolean isSelected = pieceSelected.isSelected(); boolean isSelected = pieceSelected.isSelected();

View File

@@ -120,6 +120,9 @@ private ColorRGBA playerColorToColorRGBA(Color color){
}; };
} }
public void hide(){
root.detachAllChildren();
}
} }

View File

@@ -54,9 +54,9 @@ public void shutdown() {
cardLayer = null; cardLayer = null;
} }
public void rollDice(int rollNum) { public void rollDice(int rollNum, Runnable actionAfter) {
if (!(1 <= rollNum && rollNum <= 6)) throw new RuntimeException("rollNum is not in the range [1,6]"); if (!(1 <= rollNum && rollNum <= 6)) throw new RuntimeException("rollNum is not in the range [1,6]");
diceControl.rollDice(rollNum); diceControl.rollDice(rollNum, actionAfter);
} }
public void showDice() { public void showDice() {

View File

@@ -23,7 +23,7 @@ public class DiceControl extends AbstractControl {
private final Vector3f angularVelocity = new Vector3f(); private final Vector3f angularVelocity = new Vector3f();
private float deceleration = 0.5f; private float deceleration = 0.5f;
private float timeElapsed = 0.0f; private float timeElapsed = 0.0f;
private float rollDuration = 0.0001f; private float rollDuration = 1f;
private static final int ANGULAR_MIN = 5; private static final int ANGULAR_MIN = 5;
private static final int ANGULAR_MAX = 15; private static final int ANGULAR_MAX = 15;
private static final int ANGULAR_SPIN = 10; private static final int ANGULAR_SPIN = 10;
@@ -31,6 +31,7 @@ public class DiceControl extends AbstractControl {
private boolean slerp = false; private boolean slerp = false;
private boolean spin = false; private boolean spin = false;
private final AssetManager assetManager; private final AssetManager assetManager;
private Runnable actionAfter;
public DiceControl(AssetManager assetManager){ public DiceControl(AssetManager assetManager){
this.assetManager = assetManager; this.assetManager = assetManager;
@@ -60,13 +61,14 @@ protected void controlUpdate(float tpf) {
if (timeElapsed > 1.0f) timeElapsed = 1.0f; if (timeElapsed > 1.0f) timeElapsed = 1.0f;
Quaternion interpolated = spatial.getLocalRotation().clone(); Quaternion interpolated = spatial.getLocalRotation().clone();
interpolated.nlerp(targetRotation, lerp(timeElapsed)); interpolated.slerp(targetRotation, timeElapsed);
spatial.setLocalRotation(interpolated); spatial.setLocalRotation(interpolated);
// Stop rolling once duration is complete // Stop rolling once duration is complete
if (timeElapsed >= 1.0f) { if (timeElapsed >= 1.0f) {
isRolling = false; isRolling = false;
slerp = false; slerp = false;
actionAfter.run();
} }
} }
}else if(spin){ }else if(spin){
@@ -90,11 +92,11 @@ protected void controlRender(RenderManager rm, ViewPort vp) {
} }
public void rollDice(int diceNum) { public void rollDice(int diceNum, Runnable actionAfter) {
if (isRolling) return; if (isRolling) return;
spin = false; spin = false;
slerp = false; slerp = false;
this.actionAfter = actionAfter;
angularVelocity.set( angularVelocity.set(
FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX), FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX),
FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX), FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX),

View File

@@ -31,8 +31,23 @@ public void shutdown() {
cardLayerHandler.shutdown(); cardLayerHandler.shutdown();
} }
public void rollDice(int rollNum) { public void rollDice(int rollNum, int mult) {
cardLayerHandler.rollDice(rollNum); cardLayerHandler.rollDice(rollNum, ()->{
if(mult == -1) actionTextHandler.ownDice(rollNum);
else actionTextHandler.ownDiceMult(rollNum, mult);
hideDice();
//TODO send Model finished
});
}
public void showRolledDiceMult(int rollNum, int mult, Color color) {
String name = playerNameHandler.getName(color);
if(mult == -1) actionTextHandler.diceNum(rollNum, name, color);
else actionTextHandler.diceNumMult(rollNum, mult, name, color);
}
public void showRolledDice(int rollNum, Color color) {
actionTextHandler.diceNum(rollNum, playerNameHandler.getName(color), color);
} }
public void showDice() { public void showDice() {
@@ -67,8 +82,8 @@ public Node getCardLayerRootNode(){
return cardLayerHandler.getCardLayer().getRootNode(); return cardLayerHandler.getCardLayer().getRootNode();
} }
public void addPlayer(Color color, String name, boolean own) { public void addPlayer(Color color, String name) {
playerNameHandler.addPlayer(color, name, own); playerNameHandler.addPlayer(color, name, color == ownColor);
} }
public void setActivePlayer(Color color) { public void setActivePlayer(Color color) {
@@ -78,14 +93,6 @@ public void setActivePlayer(Color color) {
else actionTextHandler.activePlayer(playerNameHandler.getName(color), color); else actionTextHandler.activePlayer(playerNameHandler.getName(color), color);
} }
public void test() {
cardLayerHandler.test();
}
public void test2() {
actionTextHandler.drawCardOwn(Color.NAVY);
}
public void shield(){ public void shield(){
cardLayerHandler.shield(); cardLayerHandler.shield();
} }
@@ -97,4 +104,15 @@ public void swap(){
public void turbo(){ public void turbo(){
cardLayerHandler.turbo(); cardLayerHandler.turbo();
} }
public void hideText(){
actionTextHandler.hide();
}
public void drawCard(Color color) {
if (ownColor == color) actionTextHandler.drawCardOwn(color);
else actionTextHandler.drawCard(playerNameHandler.getName(color), color);
}
} }

View File

@@ -32,9 +32,6 @@ public GameView(MdgaApp app) {
this.boardHandler = new BoardHandler(app, fpp); this.boardHandler = new BoardHandler(app, fpp);
app.getViewPort().addProcessor(fpp); app.getViewPort().addProcessor(fpp);
FrameBuffer backFrameBuffer = new FrameBuffer(app.getCamera().getWidth(), app.getCamera().getHeight(), 1); FrameBuffer backFrameBuffer = new FrameBuffer(app.getCamera().getWidth(), app.getCamera().getHeight(), 1);
Texture2D backTexture = new Texture2D(app.getCamera().getWidth(), app.getCamera().getHeight(), Image.Format.RGBA8); Texture2D backTexture = new Texture2D(app.getCamera().getWidth(), app.getCamera().getHeight(), Image.Format.RGBA8);
backFrameBuffer.setDepthTarget(FrameBuffer.FrameBufferTarget.newTarget(Image.Format.Depth)); backFrameBuffer.setDepthTarget(FrameBuffer.FrameBufferTarget.newTarget(Image.Format.Depth));
@@ -54,22 +51,6 @@ public void onEnter() {
boardHandler.init(); boardHandler.init();
guiHandler.init(); guiHandler.init();
continueButton.show(); continueButton.show();
// boardHandler.addPlayer(Color.AIRFORCE, test);
// boardHandler.movePieceStart(player0, 0);
// boardHandler.enableHover(player0);
// boardHandler.enableHover(player1);
// boardHandler.highlight(player0, true);
// boardHandler.outline(player0, true);
// boardHandler.outline(10);
guiHandler.test();
} }
@Override @Override

View File

@@ -15,7 +15,7 @@ public class DrawCardNotification extends Notification {
* @param color the color of the player who drew the card * @param color the color of the player who drew the card
* @param card the card that was drawn * @param card the card that was drawn
*/ */
DrawCardNotification(Color color, BonusCard card) { DrawCardNotification(Color color) {
this.color = color; this.color = color;
this.card = card; this.card = card;
} }

View File

@@ -3,24 +3,32 @@
import pp.mdga.game.Color; import pp.mdga.game.Color;
/** /**
* Notification that a die has been rolled. * Notification that a dice has been rolled.
*/ */
public class RollDiceNotification extends Notification{ public class RollDiceNotification extends Notification{
private Color color; private Color color;
private int eyes; private int eyes;
private int moveNumber; private boolean turbo;
private int multiplier;
/** /**
* Constructor. * Constructor.
* @param color the color of the player that rolled the die. * @param color the color of the player that rolled the die.
* @param eyes the number of eyes that were rolled. * @param eyes the number of eyes that were rolled.
* @param moveNumber the number of the move that was made.
*/ */
RollDiceNotification(Color color, int eyes, int moveNumber) { RollDiceNotification(Color color, int eyes) {
this.color = color; this.color = color;
this.eyes = eyes; this.eyes = eyes;
this.moveNumber = moveNumber; this.multiplier = -1;
this.turbo = false;
}
RollDiceNotification(Color color, int eyes, boolean turbo, int multiplier) {
this.color = color;
this.eyes = eyes;
this.multiplier = multiplier;
this.turbo = turbo;
} }
/** /**
@@ -39,11 +47,11 @@ public int getEyes() {
return eyes; return eyes;
} }
/** public int getMultiplier() {
* Get the number of the move that was made. return multiplier;
* @return the number of the move that was made. }
*/
public int getMoveNumber() { public boolean isTurbo() {
return moveNumber; return turbo;
} }
} }

View File

@@ -0,0 +1,34 @@
package pp.mdga.notification;
import java.util.List;
import java.util.UUID;
/**
* Notification for selecting pieces for swapcard.
*/
public class SelectableShieldNotification extends Notification{
/**
* List of UUIDs representing the player's own pieces available for selection.
*/
private final List<UUID> ownPieces;
/**
* Constructs a notification for selecting pieces for swapcard.
*
* @param ownPieces the list of the player's own pieces
*/
public SelectableShieldNotification(List<UUID> ownPieces) {
this.ownPieces = ownPieces;
}
/**
* Gets the list of the player's own pieces available for selection.
*
* @return a list of UUIDs representing the player's own pieces
*/
public List<UUID> getOwnPieces() {
return ownPieces;
}
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.notification;
public class TurboActiveNotification extends Notification{
}