Best way to learn something is to do it, right? I decided to create a simple card game, with no AI since it’s supposed to be an online multiplayer game – an exercise/experience that could come in handy later on. The game’s just something I play with my friends when we get together, the mechanics and rules are not important here; I have no problem with implementing game logic, but the networking part is giving me some trouble. Now, I don’t need any code, I just need someone to help me understand some concepts, on a general, abstract level.
What I want is for the player to be able to create a game server (give it a name, set some game-related options, etc.) and wait for the others to connect; or to be able to connect to an existing server, that he can pick from a list. You know – like in the good ol’ Counter Strike.
I’ve started by reading some articles on simple chat applications, synchronous vs asynchronous communication, and the like. What I don’t understand is – how do I make the my program find the game servers that already exist, and what do I need to do to make a server visible to any client game looking for one? I guess I need some sort of “publicly available” or “standard” remote endpoint.
And, I must admit, although I know the basic network programming concepts, and how things are done (create server, establish a connection, send data back and forth…), I don’t have a clear understanding of some basic things about networking, since I don’t have much experience with it. For example, whether the server must have an IP of the computer it’s started on, or you can assign any IP to it, or what? I’ve read some articles on IP classes, special addresses, default network, loopback, broadcast... Do I just pick what’s suitable, or there are some mystery rules that govern this world If someone could give me a brief 101 on that… Because I think this is the main source of my problem…
Are there any tutorials or books on this topic(s) you know of?
Thanks in any case.