Ways to Network.

Member
Posts: 277
Joined: 2004.10
Post: #1
I've been looking all over on how to network in Carbon...

But the main problem is I can't find anything except apple source code (that won't compile)

The other stuff I've found is stuff like PTK's kNetwork and other 3rd party frameworks...

I really want to create my own Network interface...

I also need to learn how to create a game server.
Kinda like xBox live, (I don't want to recreate xBox live though)

I am working on a game thats one player only, but my next game is going to have to be networked. (because you'll use either the entire screen or both halves)

Global warming is caused by hobos and mooses
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #2
Oh, that game server is like a IP address locater...

So poeple can find each other if they login. (and don't have to tell each other there IP address)

Global warming is caused by hobos and mooses
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #3
Well, if you're doing Carbon but aren't targeting Mac OS 9 (which you shouldn't), go with BSD sockets. They're quite easy to get up and running with, and there are tons of sample code on the
'net. If you're targeting 9, read this: http://www.idevgames.com/forum/archive/i...t-733.html

When you have decided that you want BSD sockets, you read this:
Beej's Guide To Network Programming

When you know that like the back of your hand, we can start talking about your game server. The server should accept connections from your game, add the client's IP to a list and then the client's user name. The server then sends the entire list of IP:s back to the client, who can now present the list of logged-in players.

Now, the question is whether you want to play over the centralized server or if you go peer-to-peer.

HTH,
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #4
Quote:Now, the question is whether you want to play over the centralized server or if you go peer-to-peer.

All I want the server to do is log the IP address so I can connect several games to each other,
I shouldn't need the server to do anything else...

I think I'll go with BSD because I don't want to have learn much new,
because I've been learning for two years just how do get a application
up-and-running...(siiiigh Carbon)

I'll look at that BSD tutorial (it's based around windows and unix thought???)

Global warming is caused by hobos and mooses
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #5
Ok, how do I compile this, what is inet_aton, is it macintosh compatible function etc. etc. etc.

I don't know how to compile all this stuff (it looks helpful though)
Smile

Global warming is caused by hobos and mooses
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
Yeah, but if you just log the IP addresses, the addresses are just going to sit on the server doing nothing. You need to get the addresses back to the client somehow. Or are you planning to just hook up gamers randomly?
If you could explain a bit closer what you're planning to do, I can try to help. Smile
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #7
By the way, yes - the tutorial is Unix/Win based, but since Mac OS X is Unix, BSD sockets are exactly the same as in their Unix.
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #8
Poeple through my game create a membership on the website (and name) and then the game get's the current IPs and names and see's who's on (so they can play together)...

Kinda like a advanced IM service, only with gameplay...

Ok, how can I compile this Unix stuff???
Do these functions compile name-for-name???
(Do I have to change the names of the functions so that they will work with a mac compiler)

Thanks.

Global warming is caused by hobos and mooses
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #9
Oh yes,

Is it a security risk if I have all the IPs of my members???

Global warming is caused by hobos and mooses
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #10
Yeah, but you still need to get those IP:s back to the game somehow. Smile How else is the game going to know who it should connect to? I think I understand where you're going - are you building a web interface to connect the gamers, or will they do that inside the game interface?

The Unix stuff compiles as it is, just make sure you have the needed includes. There should be no frameworks or anything needed.

I wouldn't think keeping their IP:s would matter much. Each and every internet service has it anyway. Smile
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #11
The server will just have IP's and the names will just be an easyer way of finding others.

When a user signs-up (downloads the game) they provide a user name for the network,
every so often the game looks for membership updates on the server
and stores them on your HD (meaning IP and name for the IP)

I don't know if I can check to see if poeple are on the web (in the game) a fast way...
The game can test all IPs to see if there running...
or the game can login at the server and ask who's online...
(when they login they say that there online to the server)

One other question...
How much will it cost to get a webhost that can do this...
(because I don't think places like angelfires server won't you do this)

all in all, the server is just providing IP addresses for the app to use... (members only)

if you know somebody's IP though you will be able to play even without membership...


as long as the application over the network is the game, only one IP address is needed.
(because the game itself will know the IP of the conntactor and create a link auto)

That just about explanes it...


Oh yes, (i'm looking for this on the web right now)
what are those include files names?

Thanks
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #12
The IP's will be on every members computer (see what I mean).

And there might be poeple that fear hackers..............

I think this is a risk because it would take too long to load every IP and
if I just made poeple login with any name it would be less kidie safe...
because there wouldn't be members just anybody (scary).

I'm going to add a hacker/cheater protecal because the game is more than
likely Open Source.
(I'm working on a game right now and wanted to learn networking in my spare time).

Thats about all,
BinarySpike
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #13
Quote:Every so often the game looks for membership updates on the server and stores them on your HD
Just a minor point - since IP numbers will change very often, the client should ask for the IP numbers whenever it needs to show the list. No reason to drop it to disk.

Quote:I don't know if I can check to see if poeple are on the web (in the game) a fast way...
That shouldn't be a problem. When the client (game) asks for the IP list, it should only get the list of players that are online. Just display that list, and you're good to go.

Quote:The game can test all IPs to see if there running... or the game can login at the server and ask who's online...
As I said, and I think this is what you mean as well: whenever the game wants to show the list of users, it asks the server for available players. When a player disconnects, the server should get a notice from the client and remove that player from the list. Also, the server should check up with all the players on a set interval - say 30 secs, just in case they dropped the connection without quitting the game. (Crash, dropped connection, dog chewing on ethernet cable)

Quote:How much will it cost to get a webhost that can do this...
Umm... a boatload? Smile What you want is a server that allows you to do CGI. You will need static IP and permission to run your server app on their machines. I'd guess that you would have to fork out, what, $100 a year, at least.

Quote:If you know somebody's IP though you will be able to play even without membership...
Not necessarily. If the game doesn't allow you to input IP addresses yourself, the game can only connect to the IP:s it gets from the server's list.

Quote:what are those include files names?
Check out Bennj's tutorial, you can copy-paste the code from there.
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #14
Ok, good his code should work strait from the tut. Grin

The users will be able to input IP addresses by themselves...

Quote:static IP and permission to run your server app on their machines.
Uh, I know several free servers that let you use CGI...
BUT, I have no clue is to what a static IP is and, what server app are you talking about?


Good I'll work with that tut and see if it's good...

One minor problem,
I don't have two Mac os X's on the internet... (so I can't test the code...)

Thanks

Global warming is caused by hobos and mooses
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #15
Quote:The users will be able to input IP addresses by themselves...
OK, if so, they'll be able to play without membership, unless you jump through some hoops.

Yes, there are free CGI servers, but you want a good, reliable one. But, of course, it's your call. Smile
Static IP is an IP number (to your server) that doesn't change, but that's kind of standard. Doesn't make much sense to pay for it otherwise. Grin

The server app I'm talking about is the server software you have two write. You need to write the game, and then a central server application which is what you wre asking about in the first place. Smile (The server that takes all your IP numbers and controls them)

As for two Internet Macs, no problem. As you write the server code, you can run it as a regular program, and then connect to your own IP address (127.0.0.1 or whatever you have for localhost)
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  java network api San_Andreas 1 3,212 May 1, 2008 08:05 AM
Last Post: AndyKorth
  Getting network connection for a specified PID Florian 6 5,008 Dec 23, 2006 03:46 AM
Last Post: Florian
  Network play David 15 7,605 Apr 10, 2003 05:56 AM
Last Post: rvangaal
  Network Programming henryj 9 5,453 Jan 6, 2003 07:42 PM
Last Post: henryj