Files
QtGameMaker/help/files/413_04_shared.html
T

52 lines
1.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Shared data</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body background="images/back.gif">
<!--START-->
<h3>Shared data</h3>
Shared data communication is probably the easiest way to synchronize
the game. All communication is shielded from you. There is a set of
1000000 values that are common to all entities of the game (preferably
only use the first few to save memory). Each entity can set values and
read values. <i>Game Maker</i> makes sure that each entity sees
the same values. A value can either be a real or a string. There
are just two routines:
<p>
<blockquote>
<tt><b>mplay_data_write(ind,val)</b></tt>
write value val (string or real) into location ind (ind between 0 and 1000000).<br>
<tt><b>mplay_data_read(ind)</b></tt>
returns the value in location ind (ind between 0 and 1000000). Initially all values are 0.<br>
</blockquote>
<p>
To synchronize the data on the different machines you can either use a
guaranteed mode that makes sure that the change arrives on the other machine
(but which is slow) or non-guaranteed. To change this use the following routine:
<p>
<blockquote>
<tt><b>mplay_data_mode(guar)</b></tt>
sets whether or not to use guaranteed transmission for
shared data. guar should either be true (the default) or false.<br>
</blockquote>
<!--END-->
</body>
</html>
<!-- KEYWORDS
shared data
mplay_data_write()
mplay_data_read()
mplay_data_mode()
-->