[Newbies] Network Game - Server Client Approach
Herbert König
herbertkoenig at gmx.net
Fri Jun 5 10:05:41 UTC 2009
Hi Martin,
MB> I am still looking for a way to program my network game (four
MB> players on four different computers collaboratively control the
MB> direction of one object, each is responsible to move the object in
MB> one of four directions.)
you may try simple Socket connections via UDP. ByteArrays make nice
Buffers as ByteArray has methods to stuff in Floats, Integers and
Strings.
The class to look at is Socket.
On the class side newUDP will create a new UD socket, which you assign
a port via setPort:
Receiving and sending is done via receiveUDPDataInto: and
sendUDPData:toHost:port:
You query the receiving socket with dataAvailable before actually
receiving data.
If you search the swiki or the mailing list archives for these method
names you will find examples.
Cheers,
Herbert
More information about the Beginners
mailing list