Download

[Help] Multiplayer Cursor Chess game

Hello,

I’m making a multiplayer Chess game in UE. The Pawn Class is a FPS with a really long an scalable neck, and the player controller has the mouse cursor showed with the click event enabled.
I have a “ChessBoard” Blueprint witch handle the “ChessPawns”. The “ChessPawn” blueprint has an “onClick” event to select it. If a ChessPawn is selected and the player clicks on the ChessBoard or an enemy pawn, it test if it can go on that square, if it can it goes (and destroy the enemy pawn, if there is one).
But I’m facing some problems :

  • How do I set the spawn location for each players ?
  • How can I get the Player name/number/tag to know witch player clicked for example.
  • Can I restrict an “onClick” event (on a Pawn) to a specific player ? (white pawns handle player 0 click, black pawns handle player 1 click).
  • Also I have some flickering glitches on the unfocused window when I set multiple clients, I know that’s a common issue, but I didn’t found any solution.

I’m only using Blueprints, I’d like to continue with that.

Tell me if you want screenshots.

Thanks in advance. :slight_smile:

I jnot sure but you can put the players in the scenary and use the possess node to assig the controllers.

Well, it works for Player 0, but Player 1 spawns at 0,0,0.

up please :slight_smile:

You will find answers to your questions right there Unreal Architecture | Unreal Engine Documentation
Shortly:

  • GameMode - single instance which runs only on server. You can setup spawn position, rules for players and etc.
  • GameState - exists on server and can be replicated by players(General info that each player should have access to). Contains data like scores, position on map/board and etc
  • PlayerController handles different players, not pawns. Pawns are puppets, which you can control with PlayerControl “Possess” ability. Each player gets own PlayerController instance, which responsible for input and etc.
  • After you setup PlayerControllers you can get player number by simply GetPlayerController node, GetPlayerPawn and etc

Ok thanks.

What about :

I assume you can define player index in Get Player Controller node to restrict click events.