Sign in to follow this  
kseh

Connections and UI.

Recommended Posts

I'm writing my game using DirectPlay. The game itself is working fine and now I'm trying to improve the interface for making the connection. I don't want to have to setup a lobby for players to connect to each other. I was thinking that players (typicaly friends or family) would be ok with giving info to each other along the lines of "kseh.ab.telus.net" (this is a hostname, right?) to connect to each other. I was hoping to cerate a list of people the player typicaly connects to and store the host name for that person. When the player wants to connect with someone they select the person from the list, the appropriate hostname is sent to gethostbyname(), and the resulting numeric IP address is used to create the connection. All this was to resolve the problem of IP addresses being assigned by the server every time the player connects to the internet (for dialup). The problem I'm having is that I'm not sure how to get the hostname properly. I tried one function called gethostname() which gets me "kseh.ab.telus.net" on my machine but when I try it on other machines I just get the name of the computer and nothing to identify the server. If I pass in that computer name to gethostbyname() I can only find the computer if they're on the same server as me. Is what I'm trying to do impossible? If not what am I missing? If it is impossible, what else could I do to make the interface for connecting as user friendly as possible without having to create a lobby server?

Share this post


Link to post
Share on other sites
Well, what happens if your IP address is not static? Should a person really need to find their IP and email it to their friend every time they connect to the internet with a dial up connection? If you already have some sort of chat connection to relay this information I know that I could live with it as a player. But it doesn't seem right to require a third party program to get mine going.

Part of the reason for doing this is that I'm trying to keep this game for people who are not particularly computer savy. I'm assuming that if they're on the internet then they can deal with something that resembles an email address that doesn't repeatedly change.

If nothing else it's doing it for the sake of doing it.

Share this post


Link to post
Share on other sites
You need to keep some kind of lobby available at a fixed name.

This is what services like Battle.net, or GameSpy, or X-Box Live! do: they give you a name that will "always" answer, and where you can put your lobby (but not the actual game). There's really no way around it if you want a good UI.

And, yes, this means you have to pay hosting fees. The days of free everything are happily gone :-)

Share this post


Link to post
Share on other sites
You will want to give out a host name instead of an IP address. If you have a static IP, you can register a name with one of the many name registration services and point the name to your static ip.

If you have a dynamic IP, like running from you home cable modem, there are several services that create second level domain names. The one I use for my home connection (a cable modem) is dyndns.org. You can setup your own name like mygame.dyndns.org. They supply software that updates the IP for the name when the IP changes.

Share this post


Link to post
Share on other sites
Is it not possible to use the domain name of your internet provider in combination with your login ID to aid in the location of your computer? Even if it's not with DirextPlay? Shouldn't I be able to get the address of my IP server and be able to let other people use that to search for anyone hosting a game?

Share this post


Link to post
Share on other sites
When you get a dynamic IP address from an ISP, the hsostname associated with that IP usually has nothing to do with the user it's assigned to. A lot of ISP's will use a combination of sitecode and ip address as part of the hostname. If you get everyone to use dyndns you could setup a system like what you're doing, but otherwise it won't work because the persons hostname and IP will both change when they reconnect.

An alternative would be to tie the game in with one of the messaging systems like Yahoo or AIM, and use that to contact the person and launch the game, or just to swap IP addresses. Maybe an AIM plugin, but I haven't actually written one so dunno if it'd be a fit for what you're trying to do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this