Online Lobby Example (with movement)
Author: | Solgryn
|
Submitted: | 28th February, 2010
|
Favourites: | 0 |
Genre: | Engine
| Downloads: | 496
|
Rated: |
|
|
This is how it works
1st creates game:
when "create game button" clicked:
>send message 'gamename' to subchannel whatever
when peers recieve that message, they will add the name to a list object or whatever
now, peers can join that game by selecting the name and pressing join
this will send another message, also we indicate which game the peer wants to join by putting the game name in a string (we'll use that later):
when "join button" clicked:
>send message "I just joined"+'game name' to subchannel whatever
>set global string a to 'game name'
When theres enough players, the 1st will start the name. Notice theres only 1 peer joined, the second peer haven't joined the game yet.
the 1st player (The one who created the game) presses the start game button. And by that, he sends a message:
when "start game button" clicked:
>send message 'gamename' to subchannel whatever
>next frame
when a peer recieves that message, and their alterable string is == message, they will join the channel and go to next frame:
when message recieved == global string a:
(you could also send a message like 'I left the lobby to play 'game name' or something)
>next frame
when a peer that haven't joined the game recieved that message, we'll delete it from the list.
when message recieved <> global string a:
>list: delete line (Find string exact) 'message recieved'
also, have a disconnect at the end of frame
end of frame:
>disconnect
when the players go to the next frame, they will connect as usual but join the channel 'global string a' (the game name, remember?), this does that only those people
can see each other etc.
Review This Download
http://www.solgryn.org/Stuff/Random/LobbyExampleSolgryn.zip (21.21 kb )
|
|
Is this worth a look? Let others know! Favourite
|