99 lines
3.2 KiB
HTML
99 lines
3.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Creating and joining sessions</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body background="images/back.gif">
|
|
<!--START-->
|
|
|
|
<h3>Creating and joining sessions</h3>
|
|
|
|
When you connect to a network, there can be multiple games happening on the same
|
|
network. We call these sessions. These different sessions can correspond to
|
|
different games or to the same game. A game must uniquely identify itself
|
|
on the network. Fortunately, <i>Game Maker</i> does this for you. The only
|
|
thing you have to know is that when you change the game id in the options
|
|
form this identification changes. In this way you can avoid that people with
|
|
old versions of your game will play against people with new versions.
|
|
|
|
<p>
|
|
If you want to start a new multiplayer game you need to create a new session.
|
|
For this you can use the following routine:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>mplay_session_create(sesname,playnumb,playername)</b></tt>
|
|
creates a new session on the current connection. sesname is a string
|
|
indicating the name of the session. playnumb is a number that indicates
|
|
the maximal number of players allowed in this game (use 0 for an arbitrary
|
|
number). playname is your name as player. Returns whether successful.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
One instance of the game must create the session. The other instance(s)
|
|
of the game should join this session. This is slightly more complicated.
|
|
You first need to look at what sessions are available and then choose the
|
|
one to join. There are three important routines for this:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>mplay_session_find()</b></tt>
|
|
searches for all sessions that still accept players and returns
|
|
the number of sessions found.<br>
|
|
<tt><b>mplay_session_name(numb)</b></tt>
|
|
returns the name of session number numb (0 is the first session).
|
|
This routine can only be called after calling the previous routine.<br>
|
|
<tt><b>mplay_session_join(numb,playername)</b></tt>
|
|
makes you join session number numb (0 is the first session).
|
|
playername is your name as a player. Returns whether successful.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
There is one more routine that can change the session mode.
|
|
It should be called before creating a session:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>mplay_session_mode(move)</b></tt>
|
|
sets whether or not to move the session host to another computer when
|
|
the host ends. move should either be true or false (the default).<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
To check the status of the current session you can use the following function
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>mplay_session_status()</b></tt>
|
|
returns the status of the current session. 0 = no session,
|
|
1 = created session, 2 = joined session.<br>
|
|
</blockquote>
|
|
|
|
<p>
|
|
A player can stop a session using the following routine:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>mplay_session_end()</b></tt>
|
|
ends the session for this player.<br>
|
|
</blockquote>
|
|
|
|
|
|
<!--END-->
|
|
</body>
|
|
</html>
|
|
|
|
<!-- KEYWORDS
|
|
sessions
|
|
|
|
mplay_session_mode()
|
|
mplay_session_create()
|
|
mplay_session_find()
|
|
mplay_session_name()
|
|
mplay_session_join()
|
|
mplay_session_status()
|
|
mplay_session_end()
|
|
|
|
--> |