Server: Make DisconnectedPlayer async, await hub notifications, add logging, and delay scheduled deletion (2s). Harden ScheduleGameDeletion with try/catch and only destroy/send GameDestroyed when game is not running or has no players.
Client: Add restart-game flow — expose restartGame on OnlineGame, propagate event from GameEndedMenu (adds local restarted state and disables button), and hook restart handling + player disconnect on unmount in OnlineMode. Also conditionally show bot switch in GameCreationMenu and include replayGameCode in GameEnded interface. Remove automatic reconnect on SignalR connection.
Overall: Improves robustness around player disconnects and adds a UI/logic path for restarting games.
Create replay games when a match ends (win or draw) and include ReplayGameCode in the GameEnded payload; adjust deletion timing to keep the replay longer and clean up original games sooner. Update game deletion logic to only destroy non-running games and schedule immediate deletion for quick timeouts. Add optional local bot support (botPlayer2 flag) with automated random-delayed moves and a UI switch in the game creation menu; expose botPlayer2 in GameSettings and LocalMode defaults. Introduce RandomPlaceMessage utility to generate varied turn descriptions and integrate it into LocalGame and OnlineGame. Also include a minor whitespace fix in Game.cs.
Move SignalR group join into GameManager and add support for player names and improved online join flow.
- Moved Groups.AddToGroupAsync call out of GameHubSocket into GameManager (hubContext.Groups.AddToGroupAsync) so group membership is handled when adding players to a game.
- GUI: added player name input to GameJoinMenu and updated JoinGameObject to include playerName and use string gameCode.
- OnlineMode & LocalMode: constructors updated to instantiate games without passing settings; removed WaitingForOpponent state and cleaned up event bindings.
- OnlineGame: rewrote to handle onGameCreated/onGameJoined/onGameStarted/onFieldUpdated/onGameEnded/onError, added joinGame validation (expects 6-digit code), join flow (connect + join), state updates, drop forwarding to player.drop(gameId, index) and place description updates.
- LocalGame: constructor signature simplified to no-arg.
These changes centralize group management, add player identification, validate join codes, and improve game state/event handling for online play.
Add game creation lifecycle hooks and UI feedback for online games.
- OnlineGame: add onGameCreated and onGameJoinedFailed callbacks, wire player.onGameCreated to set gameId and invoke onGameCreated, and implement createGame to connect and create a game on the player connection. Small cleanup in drop().
- GameSettings: add optional message field to carry informational text to the UI.
- OnlineMode.vue: register handlers for onGameStateChanged, onGameEnded and onGameCreated to update the reactive state and transition to the end/waiting states; update createGame to call OnlineGame.createGame; adjust component rendering logic to include WaitingForOpponent state.
- GameCreationMenu.vue: hide form controls when a settings.message exists and display the message instead; minor layout class adjustments.
These changes enable creating a game, propagating the generated game code to the UI, and showing a message to the user while waiting for opponents.
Rename JoinMenu to GameJoinMenu and add a JoinGameObject model + OTP input for entering a 6-digit game code. Introduce a new JoinGameObject interface file. Update OnlineMode.vue to import and render GameJoinMenu and GameEndedMenu, add refs for joiningModel, game, gameField, currentSelectionIndex and gameEndedInformation, wire create/ join handlers (stubbed) and the main game view (Field and InfoField). Refactor LocalGame to OnlineGame, export it as default and add a stubbed drop method; adjust import path formatting. Several functions remain as stubs to be implemented in follow-up commits.
Add a new JoinMenu.vue component to provide a UI for joining existing games (emits a "join" event and offers Cancel/Join buttons). Improve UX by adding spacing to GameCreationMenu.vue header. Update OnlineMode.vue to import GameCreationMenu. In the API, send a client-side error message when adding a player fails (GameManager.cs now notifies the player's connection with "Spiel Existiert nicht!" before returning null) so users receive immediate feedback when a join attempt is invalid.
Introduce Online mode UI and supporting logic, plus small UI/layout refinements and a backend guard fix.
- Add CreateOrJoinMenu component for choosing between creating or joining an online game.
- Add OnlineGame class (stub) to manage online-game connection callbacks.
- Update OnlineMode route to drive Create/Join flow and start creation state.
- Refactor GameCreationMenu and GameEndedMenu layout to center content and adjust spacing/emit names.
- Update LocalMode to use the refactored components for creating and end screens.
- Minor text tweak in LocalGame description.
- Fix GameManager guard to prevent processing player moves when the game is not in Running state (check current turn and game state before proceeding).
These changes wire up the initial online UI flow and tighten server-side validation to avoid processing moves outside a running game.
Update GUI/package-lock.json to upgrade rollup from 4.57.1 to 4.59.0. This updates the top-level rollup dev dependency and its many platform-specific optional packages (version, resolved URLs, and integrity hashes). Lockfile-only change from running npm install; no source code modifications.
Introduce an OnlineMode route and placeholder component, wire it into the router and Home menu (replace the removed local-vs-bot entry). Rename utils/index.ts to router/index.ts and add the new /onlineMode route; update main.ts to import the router from ./router and include the new app.css. Extract shared #game and .game-content styles into GUI/src/app.css and remove the duplicate styles from LocalMode.vue. Make small UI tweaks: adjust GameEndedMenu width, minor formatting/attribute fixes in Layout.vue and LocalMode.vue.
Prevent handling disconnects for games already ended; add a disconnect() method on the SignalR connection and a LocalGame.disconnectAll() helper. Update GameEndedMenu to emit a restart event and adjust displayed messages/labels. Wire a restart() handler in LocalMode that disconnects all players then restarts the game.
Send a GameInformationDto from the GameManager when broadcasting FieldUpdated (includes players, current field, state and current turn) and move currentTurn toggle before the broadcast. Update client code (GameConnection and LocalGame) to accept GameInformationDto for FieldUpdated, rename handler to updateState and apply the full game state payload. This ensures clients receive consistent game metadata (including current turn) with each field update.
Change game field representation to jagged arrays (int[][]) for JSON/SignalR compatibility and add conversion helpers in GameManager. Make Coordinates JSON-serializable (constructor and JsonPropertyName attributes). Update GameHubSocket: validate field size, fix JoinGame parameter order/Group join, rename Place->Drop and send proper game id. Add client-side local play support: GameConnection SignalR client, LocalGame orchestration for two local players, and UI components (GameCreationMenu, Slider) plus GameSettings interface. Update LocalMode route to use the new creation UI and start local games. These changes enable reliable serialization over SignalR and a local two-player flow with a creation UI.
Introduce CurrentTurn to Game (default 1) and expose it via GameInformationDto. Update GameManager to include CurrentTurn in the GameInformation payload, validate that a player can only Drop when it is their turn, and toggle CurrentTurn between 1 and 2 after a successful move. Also use a safe fallback (0) when game is null.
Schedule game removal after a short delay when a game ends. Adds ScheduleGameDeletion which starts a background task, waits (5s), checks the repository for the game and its Ended state, destroys it, and notifies the hub with "GameDestroyed". Calls to ScheduleGameDeletion were added after Win, Draw, and PlayerDisconnected; PlayerDisconnected no longer returns the SendAsync task but returns a completed task after scheduling deletion.
Introduce column-based drop mechanics and game info transfer; add disconnect handling and related API/interface updates. GameField API renamed Place->Drop and PlaceResult->DropResult, added ColumnFull, IsFull, and updated drop logic to insert at lowest empty row. Game model now exposes Players, adds GetPlayerByTag and makes StartGame public. New GameInformationDto conveys game state and field. Hub methods updated: GameCreated->GameJoined, RequestGameInformation, Place now forwards to Drop, and OnDisconnectedAsync notifies GameManager. GameManager implements RequestGameInformation, Drop (validates moves, broadcasts FieldUpdated and GameEnded on win/draw), improved JoinGame logic to auto-start when two players join, and handles player disconnects. Repository and interface extended with GetOneByConnectionId. Also tightened SignalR timeouts in Program.
Additions and refactors across controllers, models, repo and services to support game lifecycle and win detection. Key changes:
- Models: Player now has PlayerTag; Game assigns tags, starts when 2 players join, exposes GetPlayerByConnectionId, StartGame and EndGame helpers.
- GameField: Implemented win-detection (CountInDirection, CheckLine, CheckForWin) and minor backing-field init.
- Repository/API: GameRepository.Create no longer accepts a Player (repo only creates games); minor variable cleanups; IGameRepository signature updated accordingly.
- Services: GameManager now injects IHubContext<GameHubSocket>, moves player-adding into manager (CreateGame), makes JoinGame async and notifies the SignalR group when a game starts, and adds a placeholder async Place method. Controller (GameHubSocket) also exposes a Place method stub to match the service API.
Motivation: separate responsibilities so repository only creates games, manager handles player joins and notifications, and add core game logic (player tagging and win checks) needed for gameplay. Place methods are added as placeholders for future move handling.
Change GameManager/CreateGame to return (gameId, gameCode) and Make JoinGame return the game Id (or null) instead of a bool. Update IGameManager signature accordingly. Refactor Hub methods to construct Player objects, accept Coordinates for game creation, use the manager results to add connections to groups and send GameCreated with GameId and GameCode, and handle join failures with an error message. Simplify Player class to use a primary-constructor style with property initialization; add necessary using directives.
Replace the nullable PlayerConnectionIds array with a private List<Player> inside Game and add AddPlayer/RemovePlayer methods to manage membership. Have GameRepository.Create attach the initial player to the newly created game. Implement GameManager.CreateGame and JoinGame to call the repository (using the injected gameRepository) — CreateGame returns the created game's code and JoinGame looks up the game and tries to add the player. Also update imports accordingly. These changes centralize player handling in the Game model and connect repository/manager flows to use it.
- Introduced `IGameRepository` interface and its implementation.
- Transitioned namespaces to `file-scoped` for consistency.
- Simplified class definitions, e.g., `Game` and `SixDigitInt`.
- Restructured `GameField` logic for improved readability and functionality.
- Fixed formatting issues in `API.csproj` and added a `using` directive in `Program.cs`.
- Refactor `Field.vue` for better state management and event handling.
- Update path references for SVG assets.
- Add selection highlighting in game field with red and white arrows.
- Simplify and organize styles in game components.
- Minor updates to local mode game logic (`LocalMode.vue`).
* Style homepage with centered title and polished buttons
- Split title into two lines with uppercase styling and yellow highlight
- Use Roboto font with light/bold weight contrast for visual hierarchy
- Center buttons in a vertical flex layout with consistent spacing
- Add elevation shadow and hover scale animation to buttons
- Improve letter-spacing and font sizing for readability
https://claude.ai/code/session_01N9z7ADBGmszE5ZoAbVEp4f
* changed ' to "
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: jhim <jhim@d-velop.de>
Change the app title in GUI/index.html to "4 Gewinnt" to reflect the project name. Apply updates to GUI/src/Home.vue (UI/logic adjustments). Regenerate/normalize GUI/package-lock.json alongside these changes.