View Full Version : Ways to Network.
BinarySpike
2005.01.01, 08:10 PM
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)
BinarySpike
2005.01.01, 08:12 PM
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)
Fenris
2005.01.02, 09:53 AM
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/index.php/t-733.html
When you have decided that you want BSD sockets, you read this:
Beej's Guide To Network Programming (http://www.ecst.csuchico.edu/~beej/guide/net/html/)
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,
BinarySpike
2005.01.02, 10:30 AM
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???)
BinarySpike
2005.01.02, 10:40 AM
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)
:)
Fenris
2005.01.02, 10:59 AM
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. :)
Fenris
2005.01.02, 11:00 AM
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.
BinarySpike
2005.01.02, 02:39 PM
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.
BinarySpike
2005.01.02, 02:40 PM
Oh yes,
Is it a security risk if I have all the IPs of my members???
Fenris
2005.01.02, 04:11 PM
Yeah, but you still need to get those IP:s back to the game somehow. :) 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. :)
BinarySpike
2005.01.02, 05:33 PM
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
BinarySpike
2005.01.02, 05:41 PM
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
Fenris
2005.01.02, 06:13 PM
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.
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.
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)
How much will it cost to get a webhost that can do this...
Umm... a boatload? :) 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.
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.
what are those include files names?
Check out Bennj's tutorial, you can copy-paste the code from there.
BinarySpike
2005.01.02, 06:58 PM
Ok, good his code should work strait from the tut. :D
The users will be able to input IP addresses by themselves...
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
Fenris
2005.01.02, 07:17 PM
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. :)
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. :D
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. :) (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)
BinarySpike
2005.01.02, 09:30 PM
OK, if so, they'll be able to play without membership, unless you jump through some hoops.
Well, in a manner of speaking...
They will only be able to play with poeple they know (IP address know)
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. (The server that takes all your IP numbers and controls them)
Ok, is this a compiled application or CGI/PHP/ASP?
I have no idea where to start (for the server stuff)?
Hey thanks for the quick reply
Fenris
2005.01.03, 04:40 AM
Work through with the tutorials and I think stuff will clear up. :)
BinarySpike
2005.01.03, 04:44 PM
Ok,
I found that that if CGI or PHP can get IP's then I can implement a login on a free server...
But if the computer freezez in the middle of a game the logout won't be recorded...
Meaning I'll have to log them out by hand...
Unless I add a logout page for that type of problem...
Then if poeple get there password they can log them out whenever...
Wreaking havoc on the player...
(and makes the game less entertaining if they have to do all kinds of technical stuff)
THANK!!!
BinarySpike
2005.01.03, 05:44 PM
YIKES,
I tryed telnet (in terminal)
telnet->telnet (my host name) 3490 (enter)
and it sits there saying:
trying 0.000.354.0 (IP address) (not exactly the same)
I'm trying the app 5.1 (server-stream-socket)
now the app wont quit (doesn't show up in force quit)
exactly how long am I suppost to wait...
I'll work with it a little bit longer..............
BinarySpike
2005.01.03, 05:46 PM
I didn't put:
telnet (my host name)
I put my host name in the place of "(my host name)"
Fenris
2005.01.03, 05:59 PM
Yeah, I got that. :)
OK, so for some reason the server-stream-socket isn't working on your machine… tough luck, I don't really have the time to help you there (deadline coming up) but I'll give you a couple of tips:
• In the Terminal, you're in UNIX. Hence, you kill any app by hitting Ctrl-C (or closing the terminal window)
• I'm curious, what did you put to connect to yourself? Your IP number or "localhost"? Try localhost. (It should give you 127.0.01 for an IP back)
• To make sure nothing is really fishy with your machine, enter System Preferences, File Sharing and make sure FTP is turned on. Then telnet localhost 21 (21 is the port number for FTP) You should now be ftp:ing to yourself. Type "bye" and hit enter.
Hope this helps, if not, post back.
BinarySpike
2005.01.03, 06:20 PM
Ok,
it says:
telnet connect to address ::1: Connection refused
then says:
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost FTP server(lukemftpd 1.1) ready
I then type bye and enter...
I get the error:
500 '"bye"': command not understood
(I expected this) (but it could still be "fishy")
I'll work with it a little more and see if I can get it to work...
I was trying the computer name (found in sharing prefs) not localhost...
(it was probebly that)
Thanks for the quick reply,
BinarySpike
BinarySpike
2005.01.03, 06:23 PM
YESSSSSS!!!!!!!!!!!
I got it!!!!!!!!
I had to change just the correct port number (3490) instead of 21
YESSSSS!!!!!!!!!!!!!
THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!
BinarySpike
2005.01.04, 09:05 PM
Ok, all I need now is the static IP of my server and the information on how to connect
(so that the php document (or perl) will activate)
and I'll be all set :D :D :D
THANKS EVERYBODY.
BinarySpike
2005.01.26, 11:37 PM
Oh, just for anybody looking here...
PHP can create a server app that logs-in and logs-out the IP addresses :)
(You create a time-out for computers that freeze and a logout for computers that logout)
So all in all you have about a 30 second delay (very good)
Kaamoss
2005.05.10, 03:45 PM
This is just a silly idea but you could easily have your server side app also write data to the msql server for your website to keep track of who's online and who's not. Keep the server updating the database and the users on the client end simply query the database. Only downside is that if you have limited bandwith on your server it could cause quite a drain. That's how I'd approach it though. This way, also, your website could show who is online and who is not.
PowerMacX
2005.05.10, 09:14 PM
And now, for my next voodoo trick: thread... RESURRECT!!!
Ooops... somebody beat me :p
kelvin
2005.05.10, 10:37 PM
We need a thread de-bumper. So we can kill zombified threads. Or, if we have one, we need to inform Kelvin of said feature's existence.
step 3) ...
step 4) Profit!!!
kodex
2005.05.10, 10:44 PM
We need a thread de-bumper. So we can kill zombified threads. Or, if we have one, we need to inform Kelvin of said feature's existence.
step 3) ...
step 4) Profit!!!
Yea ok but whats step 3? :D
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.