Sign In Register

How can we help you today?

Start a new topic
Answered

Multiplayer Game in Android

Hi


I am new to gamesparks and trying to make a multiplayer turned based game similar to poker.


Right now I am just making some samples and trying to understand how gamesparks work. For now i have downloaded the the gamesparks SDK for android and added it as a module in android studio.

But I am not able to figure out how the server side interact with my application using the gamesparks android sdk. Is there any sample application or tutorials which shows how to make a complete application.


I just want to make 3-4 players , a text view and a button. When I click the button on one device then the turn of next player should come and the in textview count should increase by one on all the players device.

I think i have to use events, challenges and Rest API. But i am bit confused .

Thanks in advance.


Shubham


Best Answer

Hi there, I answered a question very similar to this but aimed more towards Unity Development, most of it should apply here however. You can find that topic here


We have a page that shows how to set up the Android SDK in Eclipse, it should transfer to Android Studio fairly easily. 


Instead of the Unity calls, yours will look something like this:

  

Create Challenge: 

Map<string, object> data = new HashMap<string, object>();
data.put("@class" : ".CreateChallengeRequest");
data.put("challengeShortCode" : "FASTEST_LAP");
data.put("endTime" : "2013-12-31T12:00Z");
data.put("usersToChallenge" : "524c13c7e4b0f3abf2b1ddc0");
Map<string, object> result = gamesparksApi.send(data);

   List Challenge: 

Map<string, object> data = new HashMap<string, object>();
data.put("@class" : ".ListChallengeRequest");
data.put("shortCode" : "FASTEST_LAP");
data.put("state" : "ISSUED");
data.put("entryCount" : 100);
Map<string, object> result = gamesparksApi.send(data);

 GetChallenge:

  

Map<string, object> data = new HashMap<string, object>();
data.put("@class" : ".GetChallengeRequest");
data.put("challengeInstanceId" : "524d4721e4b0f3abf2b2446a");
data.put("message" : "A challenge message");
Map<string, object> result = gamesparksApi.send(data);

 


1 Comment

Answer

Hi there, I answered a question very similar to this but aimed more towards Unity Development, most of it should apply here however. You can find that topic here


We have a page that shows how to set up the Android SDK in Eclipse, it should transfer to Android Studio fairly easily. 


Instead of the Unity calls, yours will look something like this:

  

Create Challenge: 

Map<string, object> data = new HashMap<string, object>();
data.put("@class" : ".CreateChallengeRequest");
data.put("challengeShortCode" : "FASTEST_LAP");
data.put("endTime" : "2013-12-31T12:00Z");
data.put("usersToChallenge" : "524c13c7e4b0f3abf2b1ddc0");
Map<string, object> result = gamesparksApi.send(data);

   List Challenge: 

Map<string, object> data = new HashMap<string, object>();
data.put("@class" : ".ListChallengeRequest");
data.put("shortCode" : "FASTEST_LAP");
data.put("state" : "ISSUED");
data.put("entryCount" : 100);
Map<string, object> result = gamesparksApi.send(data);

 GetChallenge:

  

Map<string, object> data = new HashMap<string, object>();
data.put("@class" : ".GetChallengeRequest");
data.put("challengeInstanceId" : "524d4721e4b0f3abf2b2446a");
data.put("message" : "A challenge message");
Map<string, object> result = gamesparksApi.send(data);

 


Login to post a comment