Make a dual game, where do i store variables for each player and interact between them ?
Hi everybody ! First i'm a beginner with UE4 and i watched and read lots of tutorials. (I'm not English so sorry if i make some mistakes) Now i want to make my game.
It's a "dual" card game, one player play against another player. Both of them have the same interface but each player has their owh card. (Like Clash Royal for example).
So i make a prototype of the interface with sprite color (nothing work, it's just color don't worry) then i add a widget. You have 3 screens, when you press one of the 2 button of the widget you move to the right or left other screen.
(In this picture you can see the 3 white screen)
(here you can see the two UMG buttons)
SO, all work well, the camera move bewteen the 3 screen. Then i want to duplicate the "interface" for the other player (is it the right way ??) and now nothing work... The camera don't move for each player...
So my questions are : what is the right way to do someting like this ? Do i have to use something like pawn instead of camera ? (I don't know how to use pawn) Where i store variables for player ? Because if you are the player 1, the ennemy life is the life of the player 2. And if you are the player 2, the ennemy life is the life of the player 1.
This is my Level Blueprint (if this can help you)
And here my gamemode Blueprint (empry, only variables)
I hope you will understand me, if you want to ask me some questions if you don't understand you can. I'm beginner and i really want to learn how to do a game like this on UE4. Tank you :)
asked May 23 '16 at 09:07 PM in Blueprint Scripting
you dont need to duplicate the board, you do have to understand client-server replication, add different player starts and make a pawn static, just camera view. i suggest following the multiplayer shootout tutorial, or even BlenderTek's multiplayer tutorial in youtube (he does the same but explains a little more). basically you filter the executions depending if you are client or server (if its 2 player only, if its more, you have to work with playerid stored in player state of each player) it's not hard once you understand. but you have to change your approach. its pretty much like duplicating how it works in real life, 2 players (pawns) , 1 board, and the networking is the communication channel between them.
just remember this. gamemode is only accessible from server, game instance stores values throu all game, client and server. playerstate is unique and for each player, also, it replicates by default across the game to everyone (use this to share information), game state is useful to store current game data and could be used like a game instance (i might ve wrong here but i pretty much use it this way)
answered May 23 '16 at 09:28 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here