Sign In Register

How can we help you today?

Start a new topic

How To Exchange Data Between Player After Challenge Begin Unity


I have createchallengerequest, acceptchallengerequest both of player now got message challengestartedmessage. Seem that challenge has started.
After challenge started, I have test chatonchallengeresquest too, It work normally with chat send to each player and vice versa. Now the game is able for chating in challenge.

And the question is But What Now or Next ?. I have item at challenger that need to share with challenged. I need like some challengemessage could call realtime get my data from variable list item send my list item to challenged and challenged get response of what the list item. I need that realtime When challenger click on item the challenged response on what challenger clicked.

And so the challenger and challenged could exchange data.
So when challenge started whoes turn is now ? Do i need a turn base since i have system like above ? (sharing data with challenged, challenger click on what and response is on challenged too )

To exchange Data what should i need ? What event should i use ? etc

What is missing and what i should know about this ?



1 person has this question
1 Comment

Hi I will repost my question above with more detail using reply.

Let's Start

In here i need to create a simple multiplayer game. So far i have implement in unity a create challenge, accept challenge, decline challenge, send chat message in P2P Player to Player with maximum only 2 Player.

Using Build In Multiplayer API :

CreateChallengeRequest => AcceptChallangeRequest => Got Message ( ChallengeStartedMessage) these are mean Challenge has Begin. And then i can send chat to player using : ChatOnChallengeRequest => Got Message (ChallengeChatMessage) These are work successfully so far. All i have it implemented in Unity C#.

When Challenge Begin It will Load two Player in A scene challenge. In here i need they are in same scene so all is syncron.

But after challenge Begin, i need to exchange data between player to player. In here so far if i am not mistake from gamesparks support is use an API : LogChallengeEventRequest() to trigger an Event cloud code from : LogChallengeEvent Event cloud code.

> Example for exchange Data :

Player 1 : Have List 5 Item Showed In Interface

> Make a Link For

Player 2 : Show List 5 Item From Player 1 Too. Showed In Interface

So in both of them scene they have showed the same list item.

In other word, i need to syncron the data between Player 1 to Player 2. And So I need if player 1 Clicked the one of the List Item, Player 2 recognize it that the item is clicked.

In here i don't really understand what i should use and do, how it work. Do i a need a networking build in from unity ? Or Gamesparks Multiplayer could have done this ?

If i am using a LogChallengeEventRequest() example :

Player 1 Call LogChallengeEventRequest() and get the List Item From Client Player 1 and store temporary to server then it come Player 2 Turn then Player 2 Call LogChallengeEventRequest() to get data from server item. I think it will work. But when choose and item with clicking continuosly what will happen ? Because LogChallengeEventRequest() will consume a turn and each call LogChallengeEventRequest() it will change to the other player turn. If clicking continuously is fastest than transfer data between client to server and server to client than is not that is a problem ?

Note That Every Click It will Run a LogChallengeEventRequest()

Please Note : Player 1 and Player 2 are not in a local network. But two of them are online with using server Gamesparks Backend Service.

All help is very appriciated.




Login to post a comment