SFSGameSettings with private game and invites not dispatch..

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

NM
Posts: 20
Joined: 28 Nov 2011, 01:26

SFSGameSettings with private game and invites not dispatch..

Postby NM » 24 Feb 2012, 06:13

Hi,

I've been working on my first invite system for a game. I played around with the invitations and they seemed to be working fine. I then moved the invitations to the SFSGameSettings for a private game with password protection on the game room.

This works great as the invited players join the game automatically when they accept (no messing around with passwords), but it seems that the INVITATION_REPLY event isn't dispatched when using this method. Either the invited person joins the room or doesn't. So I can't now tell if the invited user rejected the invite or not.

I'm doing the invites from AS3 Client in the SFSGameSettings when creating a private game with a password. I'm using the latest SFS2X server.

I'm listening for the reply on:
sfs.addEventListener(SFSEvent.INVITATION_REPLY, onInvitationReply);
and checking for errors.
sfs.addEventListener(SFSEvent.INVITATION_REPLY_ERROR, onInvitationReplyError);

but neither are getting triggered, but the user joins the game room when accepting the invitation.

Cheers
Cheers, NM
User avatar
Bax
Site Admin
Posts: 4522
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: SFSGameSettings with private game and invites not dispat

Postby Bax » 24 Feb 2012, 10:15

Do you mean that you are accepting the invitation like this:

Code: Select all

sfs.send(new InvitationReplyRequest(evt.params.invitation, InvitationReply.ACCEPT));

but the other client doesn't receive the InvitationReply event?
This sounds strange, because the Game Lobby example we provide in the documentation shows the system functioning and it works just fine.
Paolo Bax
The SmartFoxServer Team
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: SFSGameSettings with private game and invites not dispat

Postby NM » 24 Feb 2012, 16:33

Yes, I'm accepting and or refusing the invitation like that. I'm not sure which Games Lobby Example you mean, can you send me a link so I can look at it?

I'm seeing this in my server log:

Code: Select all

24 Feb 2012 | 15:32:28,572 | INFO  | com.smartfoxserver.v2.controllers.SystemController-1 | v2.api.SFSApi |     | Room created: [ SFSGame: [PG] Jeff #1, Id: 7, Group: games, public: false, minPlayers: 0 ]
24 Feb 2012 | 15:32:28,579 | INFO  | com.smartfoxserver.v2.controllers.SystemController-1 | v2.api.SFSGameApi |     | Game started: [ SFSGame: [PG] Jeff #1, Id: 7, Group: games, public: false, minPlayers: 2 ] -- Invited people: [( User Name: Jeff, Id: 2, Priv: 0, Sess: 127.0.0.1:51018 ) , ( User Name: John, Id: 3, Priv: 0, Sess: 127.0.0.1:51028 ) ]
24 Feb 2012 | 15:32:37,707 | INFO  | com.smartfoxserver.v2.controllers.SystemController-1 | v2.game.SFSGameInvitationCallback |     | Invitation refused by ( User Name: John, Id: 3, Priv: 0, Sess: 127.0.0.1:51028 )  for game [ SFSGame: [PG] Jeff #1, Id: 7, Group: games, public: false, minPlayers: 2 ]


So I'm seeing the refused reply on the server but it isn't triggering an INVITATION_REPLY event client side.

My SFSGameSettings are like this - this triggers the invitation and I mySelf automatically joins the game room:

Code: Select all

         var settings:SFSGameSettings = new SFSGameSettings(game_name);
         settings.groupId = GAME_GROUP_ID;
         settings.password = password;
         settings.isPublic = false;

         settings.invitedPlayers = [sfs.mySelf, invitedUser];
         
         var params:ISFSObject = new SFSObject();
         params.putUtfString('it', INVITE_TYPE);
         settings.invitationParams = params;
         
         settings.isGame = true;
         settings.maxUsers = 2;
         settings.maxSpectators = 0;
         settings.extension = new RoomExtensionMyGame();
         
         settings.variables = new Array();
         settings.variables.push(new SFSRoomVariable(...SOME VAR...));
         settings.variables.push(new SFSRoomVariable(...SOME VAR...));
         settings.variables.push(new SFSRoomVariable(...SOME VAR...));

         sfs.send(new CreateSFSGameRequest(settings));



Like I said, the invitation is sent OK and onAccept, the invited user joins the room. But I'm not getting the INVITATION_REPLY event.

Cheers
Cheers, NM
User avatar
Bax
Site Admin
Posts: 4522
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: SFSGameSettings with private game and invites not dispat

Postby Bax » 24 Feb 2012, 16:46

The example is available inside the Flash examples package you can find here: http://www.smartfoxserver.com/download/sfs2x#p=examples

Another question is.. why are you inviting yourself??
Paolo Bax
The SmartFoxServer Team
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: SFSGameSettings with private game and invites not dispat

Postby NM » 24 Feb 2012, 16:52

Oh yeah, and if I send a normal InviteUsersRequest then I get the INVITATION_REPLY event. So I'm not sure if this is an actual bug or not - is it the expected behaviour to not get INVITATION_REPLY events when creating an invite via the SFSGameSettings?

I could send a "normal invite" and wait for a reply before then doing the "SFSGameSettings invite" and auto accept this invite as the "normal invite" was accepted and both players will enter the game.

That would work, but I'd like to know if the "SFSGameSettings invite" not sending INVITATION_REPLY events is a bug or not.

Cheers
Cheers, NM
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: SFSGameSettings with private game and invites not dispat

Postby NM » 24 Feb 2012, 16:57

I invite myself because when I invited one user, I got an server error/warning saying not enough users, min users is 2 only 1 user invited (or something).

So I added myself to the invite to stop this log message. And this also auto joined me to the join while I waited for the reply.
Cheers, NM
User avatar
Lapo
Site Admin
Posts: 21639
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFSGameSettings with private game and invites not dispat

Postby Lapo » 24 Feb 2012, 17:03

Are you using the latest release? Version 2.0.1?
If not please update, because we fixed a bug related to a similar issue.
Lapo
--
gotoAndPlay()
...addicted to flash games
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: SFSGameSettings with private game and invites not dispat

Postby NM » 24 Feb 2012, 17:04

Here is the error I was getting when inviting only one person (and not myself)

Code: Select all

24 Feb 2012 | 16:59:33,711 | WARN  | com.smartfoxserver.v2.controllers.SystemController-1 | v2.controllers.SystemController |     |
com.smartfoxserver.v2.exceptions.SFSCreateGameException: Invited players (size = 1) are not enough to start the game (min = 2). Additionally no searchable rooms were provided
   com.smartfoxserver.v2.api.SFSGameApi.validateSFSGameSettings(SFSGameApi.java:336)
   com.smartfoxserver.v2.api.SFSGameApi.createGame(SFSGameApi.java:93)
   com.smartfoxserver.v2.api.SFSGameApi.createGame(SFSGameApi.java:81)
   com.smartfoxserver.v2.controllers.system.game.CreateSFSGame.execute(CreateSFSGame.java:142)
   com.smartfoxserver.v2.controllers.SystemController.processRequest(SystemController.java:128)
   com.smartfoxserver.bitswarm.controllers.AbstractController.run(AbstractController.java:96)
   java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   java.lang.Thread.run(Unknown Source)


So I assumed I should be adding myself to the invite array.

I tried to find more about inviting players in the SFSGameSettings but couldn't find much about. I'll see how it is done in the example you suggested...

EDIT:
This warning also stops the invitation from arriving at the invited user's client.
Last edited by NM on 24 Feb 2012, 17:09, edited 1 time in total.
Cheers, NM
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: SFSGameSettings with private game and invites not dispat

Postby NM » 24 Feb 2012, 17:07

In the Admin Tool, it says I'm using Server Version: 2.0.1

EDIT
The swc says it is version: 1.0.2

Is that right? Should the swc be 2.0.1 too?
Cheers, NM
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: SFSGameSettings with private game and invites not dispat

Postby NM » 24 Feb 2012, 17:33

Hi again, I looked at the game lobby example. Mine is slightly different because I'm not using "settings.searchableRooms = ["default"]" as I only want a game between two players, the invitee and invited. So I don't want random others to be invited.
Cheers, NM
User avatar
Lapo
Site Admin
Posts: 21639
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFSGameSettings with private game and invites not dispat

Postby Lapo » 24 Feb 2012, 20:00

NM wrote:I
The swc says it is version: 1.0.2
Is that right? Should the swc be 2.0.1 too?

Yes that is correct. We'll investigate and let you know.
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: SFSGameSettings with private game and invites not dispat

Postby NM » 24 Feb 2012, 20:04

OK thanks. I'll get on with something else for now.
Cheers, NM

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 17 guests