Stencyl 3.4.0 is now out. Get it now!

Multiplayer Extensions Resource List

mdotedot

  • *
  • Posts: 1282
In my profile is a game called Turn in a Row which uses the turnbased engine for 4 players. Unlike tic-tac-toe it starts without waiting for other players and other players can join in.

The Lobby extension has an example where both turn and lobby powers are combined and you can create new room (by pressing a button) and other people can see that room. You can even ask the user to enter their own room name.
Selecting the room in the listbox and pressing OK is the JOIN action and inside that room you can switch between players.

I don't have a system where you can invite players to join your game. The rooms you create are visible by anybody not just your friends. Maybe that is what you are looking for?!?

Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

RulezTeam

  • *
  • Posts: 223
 I think that if every player can create a room there will be a big confusion, so my intention is to have three/four rooms that I -and only I- decide the name.  Is this possible ? (Otherwise I prefer to have a system like the turn extension but it would be a good thing to have the name of the players.)

All the players can choose which room enter to play and if there is already a player in it, the user can play the game, otherwise the user  waiting for a player.

If a room is full (because two/three players are switching to game scene, so in this instant before that the players goes to the game the room appears full), the new player that try to enter in that specific room, what can he do? Create a new room ? Or waiting that that room back to being free ?


mdotedot

  • *
  • Posts: 1282
Oh OK. You can create rooms with the lobby extension and name them whatever you want.
"Create room name 'EnterYourOwnName' for number of players [4?] with heartbeat of [10] seconds, force turn after [2] heartbeats Extra []"

The system automatically removes rooms when they do not contain players (!!)
I've not tested it but you could try uncommenting the deletion of the room in the following two php files:

Turn.php
function turn_Housekeeping
Code: [Select]
Below Line: sql1=“DELETE FROM stencyl_rooms WHERE …
Uncomment:
//$msql=mysql_query($sql1)

Same applies to Lobby.php in Lobby_Housekeeping

Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

RulezTeam

  • *
  • Posts: 223
Hi mdotedot,

thank you. I'm having a little problem with lobby and focus.
Now the lobby/turn are working better, but I cannot control when a player escape from the game/room when he lost the focus. I've seen that if a player close the game without using my button (close room and logout), the player that is already playing the game continue to play (or wait) for an action from the opponent. This isn't right because there are more other problems from this issue (the room stay active, the player that has lost his focus continue to be logged to the server, etc).
So, is there a mode (or I have make some errors) to know if a player isn't anymore in game ?
In room I can control it with seat, but in game the seat seems always busy from the player that there isn't in game anymore.

Thank you


mdotedot

  • *
  • Posts: 1282
The heartbeat value will connect to the database.  The force turn after x heartbeats means that if a connection hasn't made contact within the x times (heartbeat-value) the system will force the connection.
As this is TURN based and not realtime the clients will only connect (heartbeat-seconds) to the server. You only get information about the other connection when they have connected to the server.
My estimation is that you have a large heartbeat value or a large force x heartbeat setting.

Example: heartbeat = 10 seconds, force after 2 heartbeat      results in a 20 second wait to get the server to change to another player.

If you control the leaving room situation with a block then the server gets the information from the disconnect faster. But the client still needs (heartbeat seconds) to connect to the server to discover this. The SEAT will become 0 so checking this value will give you information about the availability of the client.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

RulezTeam

  • *
  • Posts: 223
Hi mdotedot,

I've tried to wait the heartbeat (20 sec) and with a behavior I check the seat every 1 sec, but the player in game continue to wait for a response (for a play) so I cannot understand if the client is still online, because this control has produced no result. This control is in game. But the same behavior apply to the waiting room, it works.

mdotedot

  • *
  • Posts: 1282
Again I want to point to the example games. Please check out the InARow game in which you can clearly see that the player who left is reflected in the playerlist.
(http://www.stencyl.com/game/play/31424)

Compare the blocks used in that game with your setup and try to find the difference.

Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

RulezTeam

  • *
  • Posts: 223
It could be that there are problems with HTTPS.  I only recently aquired a HTTPS certificate for my webcam things.
I had to make a change to the PHP code to accomodate things but I forgot if that was for WebSockets or if that was for the turnbased mechanism.

Anyhow try adding this to the PHP file(s) . It can be the second line (after the <?php)
Code: [Select]
header("Access-Control-Allow-Origin: *");

If that doesn't work please explain what exactly isn't working so that I can test it myself.


Hi mdotedot,
I've tried to add that line to all files, but the connection isn't established. It remain 'append'.
What's can I do ?

Thank you

mdotedot

  • *
  • Posts: 1282
Without sending your stuff to me it would still be interesting to see what happens when you take all my stuff and put it on your server. The provided materials have all the php files and things that I use to use and write the demos. You would need to adjust connect.php for your environment but that should probably be it.
The other way around is that you send me all your stuff so that I can try to reproduce.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

RulezTeam

  • *
  • Posts: 223
hi mdotedot,

where can I send you the project ?

Thank you

mdotedot

  • *
  • Posts: 1282
In your private forum - mail (Inbox)  you should have a post with my private email address.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

RulezTeam

  • *
  • Posts: 223
Hi mdotedot,

is there a block (or an expression) to get only a portion of a scoreboard ?
For example I would like to know the 50 players before my score and get their score and name.

Thank you

mdotedot

  • *
  • Posts: 1282
There is not really a block for this. I would just get all scores and check the list for the position you are in.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

RulezTeam

  • *
  • Posts: 223
So, if there are 1000 score, I must download all the scores ?
My problems is that I have different levels and download 1000 scores for every level take so much time. I have tested that I cannot be able to download all the score in the while the player click to level scene, and this problem block my code to extract the position.

mdotedot

  • *
  • Posts: 1282
wow do you have a game with 1000 scores?!?
Well I might have to think about a block to get the previous 50 scores then. Do you need 50 scores after your score as well?
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.