Skip to content
Newer
Older
100644 146 lines (104 sloc) 3.96 KB
8673e91 Updated readme to match csharp library
Brian Nesbitt authored Oct 31, 2010
1 h1. Mogade For Java
2
846e65a Small text edit
Brian Nesbitt authored Nov 7, 2010
3 Mogade is a free web-based service which allows game developers to quickly enchance their games with auxiliary functionality (such as leaderboards).
8673e91 Updated readme to match csharp library
Brian Nesbitt authored Nov 1, 2010
4
5 This is the official Java library - which is meant not only to be used within games, but also to serve as the basis for platform specific implementations. Developers interested in building a library for their own language will hopefully find this library to be decent documentation of the mogade API.
6
7 h3. Other Libraries
8
4e0e0bd links to new api page
Karl Seguin authored Nov 6, 2010
9 For a list of other libraries, please visit "http://mogade.com/manage/libraries":http://mogade.com/manage/libraries
8673e91 Updated readme to match csharp library
Brian Nesbitt authored Nov 1, 2010
10
11 h3. Support
12
13 The "http://groups.google.com/group/mogadedev":http://groups.google.com/group/mogadedev google group is the best place for developers, either of games or libraries, to visit.
703be65 Implemented base library
Brian Nesbitt authored Oct 30, 2010
14
992b7b1 initial commit, sample readme
bnesbitt authored Oct 30, 2010
15
a338856 fix readme syntax
Brian Nesbitt authored Oct 30, 2010
16 h2. Usage
992b7b1 initial commit, sample readme
bnesbitt authored Oct 30, 2010
17
7b6e218 Augmented tests, updated readme
Brian Nesbitt authored Nov 5, 2010
18 I have also tried to put these in order of typical session usage as well.
19
e5dea35 Fixed readme
Brian Nesbitt authored Nov 5, 2010
20 h3. Mogade Creation
21
a338856 fix readme syntax
Brian Nesbitt authored Oct 31, 2010
22 <pre>
b3033f7 Updated readme to make it more realistic
Brian Nesbitt authored Oct 31, 2010
23 String leaderboardId = "1cc425bf5346ed081f0000ef"; //leaderboards are created and assigned an id by mogade.com
24 String gameKey = "1cc3cb835346ed081f0000ee"; //the game key and secret are provided by mogade.com
25 String secret = "aT4][A;28q]V?!!";
703be65 Implemented base library
Brian Nesbitt authored Oct 31, 2010
26
b3033f7 Updated readme to make it more realistic
Brian Nesbitt authored Nov 1, 2010
27 Mogade mogade = MogadeImpl.create(gameKey, secret);
90b5f0e Added Validator to better handle error checking
Brian authored Nov 2, 2010
28 </pre>
29
7b6e218 Augmented tests, updated readme
Brian Nesbitt authored Nov 6, 2010
30 h3. GetConfigVersion / GetConfig
31
32 <pre>
33 int savedConfigVersion = PersistentLocalDatastore.getConfigVersion();
34
35 GetConfigVersionResponse response = mogade.getConfigVersion();
36
37 if (!response.isOk())
38 {
39 //do something with response.getStatus();
40 return;
41 }
42
43 if (savedConfigVersion != response.getVersion())
44 {
45 GetConfigResponse response = mogade.getConfig();
46 PersistentLocalDatastore.saveConfig(response);
47 }
48 </pre>
49
50 h3. GetUserGameData
51
e5dea35 Fixed readme
Brian Nesbitt authored Nov 6, 2010
52 <pre>
7b6e218 Augmented tests, updated readme
Brian Nesbitt authored Nov 6, 2010
53 String username = PersistentLocalDatastore.getUsername();
54 String unique = DeviceAPI.getDeviceSerialNumberOrSomethingUniqueAboutThisDeviceOrComputer();
55
56 GetUserGameDataResponse response = mogade.getUserGameData(username, unique);
57
58 if (!response.isOk())
59 {
60 //do something with response.getStatus();
61 return;
62 }
63
e5dea35 Fixed readme
Brian Nesbitt authored Nov 6, 2010
64 for(String earnedAchievementId : response.getAchievements())
7b6e218 Augmented tests, updated readme
Brian Nesbitt authored Nov 6, 2010
65 {
e5dea35 Fixed readme
Brian Nesbitt authored Nov 6, 2010
66 //get achievement from config data by earnedAchievementId
7b6e218 Augmented tests, updated readme
Brian Nesbitt authored Nov 6, 2010
67 //show user they have earned that achievement
68 }
e5dea35 Fixed readme
Brian Nesbitt authored Nov 6, 2010
69 </pre>
7b6e218 Augmented tests, updated readme
Brian Nesbitt authored Nov 6, 2010
70
90b5f0e Added Validator to better handle error checking
Brian authored Nov 3, 2010
71 h3. SaveScore
72
73 <pre>
703be65 Implemented base library
Brian Nesbitt authored Oct 31, 2010
74 SaveScoreResponse response = mogade.saveScore(leaderboardId, new Score("brian", 2000));
75
8673e91 Updated readme to match csharp library
Brian Nesbitt authored Nov 1, 2010
76 if (!response.isOk())
703be65 Implemented base library
Brian Nesbitt authored Oct 31, 2010
77 {
8673e91 Updated readme to match csharp library
Brian Nesbitt authored Nov 1, 2010
78 //do something with response.getStatus();
703be65 Implemented base library
Brian Nesbitt authored Oct 31, 2010
79 return;
80 }
81
90b5f0e Added Validator to better handle error checking
Brian authored Nov 3, 2010
82 //sometimes the ranks won't be defined, depending on the current server load
703be65 Implemented base library
Brian Nesbitt authored Oct 31, 2010
83 if (response.getDaily() > 0)
84 {
90b5f0e Added Validator to better handle error checking
Brian authored Nov 3, 2010
85 //do something with daily rank
703be65 Implemented base library
Brian Nesbitt authored Oct 31, 2010
86 }
87 if (response.getWeekly() > 0)
88 {
90b5f0e Added Validator to better handle error checking
Brian authored Nov 3, 2010
89 //do something with weekly rank
703be65 Implemented base library
Brian Nesbitt authored Oct 31, 2010
90 }
91 if (response.getOverall() > 0)
92 {
90b5f0e Added Validator to better handle error checking
Brian authored Nov 3, 2010
93 //do something with overall rank
94 }
95 </pre>
96
7b6e218 Augmented tests, updated readme
Brian Nesbitt authored Nov 6, 2010
97 h3. SaveAchievement
98
99 <pre>
e5dea35 Fixed readme
Brian Nesbitt authored Nov 6, 2010
100 //Maybe check the saved UserGameData and see if they have already earned this achievement and don't save again??
101 //Depends on game specifics.
7b6e218 Augmented tests, updated readme
Brian Nesbitt authored Nov 6, 2010
102
103 String achievementId = "8cc425bf5346ed081f0000e1";
104 String username = PersistentLocalDatastore.getUsername();
105 String unique = DeviceAPI.getDeviceSerialNumberOrSomethingUniqueAboutThisDeviceOrComputer();
106
107 SaveAchievementResponse response = mogade.saveAchievement(achievementId, username, unique);
108
109 if (!response.isOk())
110 {
111 //do something with response.getStatus();
112 return;
113 }
114
115 long pointsAwarded = response.getPoints(); //do something with this
116
117 </pre>
118
90b5f0e Added Validator to better handle error checking
Brian authored Nov 3, 2010
119 h3. GetLeaderboard
120
121 <pre>
122 int page = 1;
123 GetLeaderboardResponse response = mogade.getLeaderboard(Leaderboard.create(leaderboardId, page, Leaderboard.Scope.DAILY));
124
125 if (!response.isOk())
126 {
127 //do something with response.getStatus();
128 return;
129 }
130
131 for(Score score : response.getScores())
132 {
133 //do something with score
134 //score.getUsername(), score.getPoints(), score.getData()
703be65 Implemented base library
Brian Nesbitt authored Oct 31, 2010
135 }
a338856 fix readme syntax
Brian Nesbitt authored Oct 31, 2010
136 </pre>
992b7b1 initial commit, sample readme
bnesbitt authored Oct 30, 2010
137
2c2d304 small readme update
Brian authored Nov 2, 2010
138 h3. More Usage Samples
139
140 View the tests!
141
8673e91 Updated readme to match csharp library
Brian Nesbitt authored Nov 1, 2010
142 h2. API Overview
143
144 Mogade is based around a _RESTish_ API, accepting and returning JSON messages.
992b7b1 initial commit, sample readme
bnesbitt authored Oct 30, 2010
145
4e0e0bd links to new api page
Karl Seguin authored Nov 6, 2010
146 A full API overview can be read here "http://mogade.com/manage/api":http://mogade.com/manage/api
Something went wrong with that request. Please try again.