CodeBase - Simple Chat to Demonstrate Using Multiplayer Commands

Return to the CodeBase listing

Category: Multiplayer

Version: 1.0

0
0

Information

Uploaded: 30th Jul 2004 05:42

Modified: 4th Aug 2004 15:02

Author:  Fluffy Paul

Summary

A very simple chat program that highlights the use of multiplayer commands to start or connect to a game and send messages.

Full Description

This program was initially supposed to demonstrate the multiplayer commands but evolved into a really simple chat program. The idea was NOT to make a chat program - that's just what it ended up being.<br /> <br /> The code is heavily commented to explain what all the code *ought* to be doing. In case there's too many comments to read, these 6 variables control the important stuff:<br /> <br /> connection=0<br /> connection$=&quot;&quot;<br /> host$=&quot;&quot;<br /> playername$=&quot;&quot;<br /> netsession=0<br /> netsession$=&quot;&quot;<br /> <br /> <br /> The important stuff being: <br /> <br /> set net connection connection, host$<br /> select action$<br /> case &quot;START&quot; : create net game netsession$, playername$, 16, 1 : endcase<br /> case &quot;FIND&quot; : join net game netsession, playername$ : endcase<br /> endselect<br /> <br /> Please note that action$ is a string just to make things more obvious to a reader of the demo program. You might want to change this to a numerical constant or something if you're doing it for real. It's simply used to make the program switch between the mode where it starts a new game and where it looks for an existing game. The difference is subtle but important. When starting a game you use netsession$ - a string containing the name of the game. When looking for a game you use netsession - an INTEGER which is the position in a list of sessions where the game you want to join is.

Comments

No comments yet.