I am writing a simple game. I would like to let two (or perhaps more)
computers hook up into a network to play the game human against human
instead of merely human against computer. I did this once with a game I
wrote a while back, but that was OS 9 and I used Open Transport, which I'm
not sure is the current approach to networking on OS X. My program is
presently Carbon, not Cocoa. I am slightly familiar with Unix sockets and
I have some code I used once for socket programming, but I'm not sure how
to use Unix style commands in a Carbon app, and I'm not sure if Unix
sockets are the reccomended approach for Carbon networking anyway.
I am perusing the Networking section of developer.apple.com, but most of
the network sample code seems to assume you want to do web programming. I
don't want simple one-go client retrieval. I want to set up a persistent
two-way pipe for a game.
Any ideas?
Thank you for any suggestions.
Cheers!
________________________________________________________________________
Keith Wiley kwiley@cs.unm.edu http://www.unm.edu/~keithw
"Yet mark his perfect self-contentment, and hence learn his lesson,
that to be self-contented is to be vile and ignorant, and that to
aspire is better than to be blindly and impotently happy."
-- Edwin A. Abbott, Flatland
________________________________________________________________________
Michael Ash - 23 Nov 2005 09:54 GMT
> I am writing a simple game. I would like to let two (or perhaps more)
> computers hook up into a network to play the game human against human
[quoted text clipped - 12 lines]
>
> Any ideas?
Assuming you're looking to use TCP, check out CFSocket and CFStream.
They're relatively easy to use, and integrate directly into your Carbon
runloop so you can get callbacks and whatnot with ease.
If you want to use UDP, then you can probably still use CFSocket to do the
initial setup bits, and then you'll have to drop down to more basic stuff
like read/write/etc. Using CFSocket will allow you to get notifications
like "data available" on your runloop.

Signature
Michael Ash
Rogue Amoeba Software
Gregory Weston - 23 Nov 2005 12:23 GMT
> I am writing a simple game. I would like to let two (or perhaps more)
> computers hook up into a network to play the game human against human
[quoted text clipped - 12 lines]
>
> Any ideas?
One worth looking into:
<http://sourceforge.net/projects/openplay>

Signature
Goal 2005: Convincing James Hetfield to cover the Strawberry Shortcake
"Are You Berry Berry Happy?" song.