|
mplay_session_create(sesname,playnumb,playname) |
|
sesname = Name of the session, must be an string playnumb = The number of player the session can hold, leave this number to 0 for an arbitrary number. playname = Name of the player creating the session, must be an string.
This function creates in the server holding the game a session, a session is like an open room where other people can come and join. Well, when you create a session you say its name, how many people can enter and finally your name.
Example:
The above example creates a session named The Rolling, it can hold up to 3 players, counting you, and finally the name of the host is gml_josea.
Depending on the game you’re making you ask or not the player for a session and player name, because for online chess or pong games you don’t need names, unless you want to show in the screen the sessions available to join, or anything that needs the name, like a chat program.
For a common 2 player online game the code can be like this:
Example:
If you fully understood what I said you should be able to know what this code tries to do, it creates a session, if it fails tell the user that it failed. That’s all. Mplay functions only work together read all the functions before trying anything ;)
gml_josea – Revision #1 |