realbasic-games
[Top] [All Lists]

Re: Net Play

To: "REALbasic Games" <REALbasic-Games at lists dot realsoftware dot com>
Subject: Re: Net Play
From: Nick Lockwood <nick dot lockwood at ntlworld dot com>
Date: Tue, 30 Sep 2003 16:03:29 +0100
You don't have to use html/xml-style tags for your protocol, in fact
there are ways of doing it that
are probably easier to decode anyway, but it's just one approach you
could use.
I think I'll use HTML or XML. It's easier for me.

Well it's easy to write, but it's a pig to read.

To write the xml/html/whatever you'd say something like

socket.write "<lives>" + str(myLives) + "</lives>"

but to read it... well you would have to use regular expressions or something in order to split the string up into separate tags, and remove the formatting. I'm guessing you've not used the regex classes before, and they aren't trivial
to use, believe me.

You might be best off using TCP socket to begin with and just sending the data unformatted (i.e. just send the variable values). TCP socket performance is not
great, but it's a lot less to worry about for a first attempt.

You still need a protocol, in fact it's even more important because your program will be expecting to receive particular data in a particular order, and it's a lot easier if you work that out beforehand rather than try to change it after
you've already started.

Nick


- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>