Hi.
I successfully created a multiplayer demo game based on the example:
In my test app, I just connect two users to a room and one of them only sends one short message. Then both users leave the room. I only did it once.
Then in the AppHQ console, I see 105 messages for my test app. How is this possible?
I use App42MultiPlayerGamingSDK.jar (version 2.3).
Code:
public void quickGame() {
...
WarpClient.initialize(apiKey, secretKey);
warpClient = WarpClient.getInstance();
connectionListener = new ConnectionListener(this);
roomListener = new RoomListener(this);
zoneListener = new ZoneListener(this);
notificationListener = new NotificationListener(this);
warpClient.addConnectionRequestListener(connectionListener);
warpClient.addRoomRequestListener(roomListener);
warpClient.addZoneRequestListener(zoneListener);
warpClient.addNotificationListener(notificationListener);
warpClient.connectWithUserName(myId);
}
private void onConnectDone(boolean status) {
...
warpClient.joinRoomWithProperties(properties);
}
private void onJoinRoomDone(RoomEvent event) {
if (event.getResult() == WarpResponseResultCode.SUCCESS) {
...
warpClient.subscribeRoom(roomId);
} else if (event.getResult() == WarpResponseResultCode.RESOURCE_NOT_FOUND) {
...
warpClient.createRoom("game", "owner", 2, properties);
}
}
private void onRoomCreated(String roomId){
...
warpClient.joinRoom(roomId);
}
private void onRoomSubscribed(String roomId) {
...
warpClient.getLiveRoomInfo(roomId);
}
public void sendMessage(byte[] msgBuf) {
warpClient.sendPrivateUpdate(opponentId, msgBuf);
}
public void leaveGame() {
...
warpClient.unsubscribeRoom(roomId);
warpClient.leaveRoom(roomId);
warpClient.deleteRoom(roomId);
warpClient.removeConnectionRequestListener(connectionListener);
warpClient.removeRoomRequestListener(roomListener);
warpClient.removeZoneRequestListener(zoneListener);
warpClient.removeNotificationListener(notificationListener);
warpClient.disconnect();
}
What am I doing wrong? How do I reduce the number of messages? Does App Configuration (Auto Recover Time, Default Zone) affect the number of messages?
This may be a problem when choosing AppWarp to implement multiplayer in the release version of the game. Since it is not profitable. It is still more profitable to pay for CCU than for the number of messages that are not clearly counted.
Thanks.