Hi all !
I'm actually developping a game with this logic :
- login
- Then i do a PHP request to retrieive users that can play and then i create a room game for them. The room is created by the server and have its own extension to manage connection and disconnection.
- When all the users are connected to this new room i send a response to my client and i create a new AS3 class that use another extension that is the game logic.
But i think i'm wrong by doing this, because my last extension for the game logic is not associated to the room and is initialised at the start of the server. I do this because there will be different games to play randomly in order to clarify my code and not to put all my code in one extension for 6 games...
So i'm wondering if it's possible to instantiate new extension in my "general" extension
I've seen this post : http://www.smartfoxserver.com/forums/viewtopic.php?t=11724&highlight=add+extension+another+extension
Or is it possible to attach multiple extension to one room ? Is it a good way ?
I really appreciate if you can help me
Thanks
Multiple Extension
Hi Bax !
Thanks for you reply
I think i poorly explained my situation.
I create a room with one extension for 3 to 5 people. Then they play 3 minutes one game at the end of the first three minutes they play another game and so on for another one...
Then i can't move all my players to another room for each games every 3 minutes ?
Thanks for you reply
I think i poorly explained my situation.
I create a room with one extension for 3 to 5 people. Then they play 3 minutes one game at the end of the first three minutes they play another game and so on for another one...
Then i can't move all my players to another room for each games every 3 minutes ?
- A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
An easy way to do this would be to set a RoomVariable from the server side as each game starts and finishes indicating to the server which game they are playing.
Then, when an extension call is received, you can perform a switch statement on the RoomVariable and fork the handler to the correct place for that game.
Then, when an extension call is received, you can perform a switch statement on the RoomVariable and fork the handler to the correct place for that game.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
http://a51integrated.com / +1 416-703-2300
Thanks guys for your reply ! i was in holidays so, that's why i was not answering.
@bax : Ok so it was what i was thinking. But I don't know how to make it in as1, is there some examples ?
@A51 : I'm not sure to understand very well what you mean, i'm sorry. Do you mean that i have to move all people to a specific room with the game extension ?
@bax : Ok so it was what i was thinking. But I don't know how to make it in as1, is there some examples ?
@A51 : I'm not sure to understand very well what you mean, i'm sorry. Do you mean that i have to move all people to a specific room with the game extension ?
- A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
- A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
Try something like this.....been a while since I wrote AS1, so I hope it works!!
Code: Select all
function init()
{
trace("Extension init")
}
function destroy()
{
trace("Extension destroy")
}
function handleRequest(cmd, params, user, fromRoom)
{
var handler;
if (cmd == "game_cmd")
{
switch (params.values.myGameVal)
{
case 1:
handler = new HandlerOne(params,user,fromRoom);
break;
case 2:
handler = new HandlerTwo(params,user,fromRoom);
break;
//........
}
}
}
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 54 guests