Author Topic: Soldat Network Programming  (Read 3378 times)

0 Members and 1 Guest are viewing this topic.

Offline Jammy

  • Major(1)
  • Posts: 2
Soldat Network Programming
« on: August 08, 2008, 04:12:16 pm »
I was wondering if someone could give me come pointers on how to program a game to play over the internet. I have experience with C++ and have studied sockets. I made a basic game to solidify my knowledge, but then found that it could only be played over a local network. I really like Soldat, and was wondering how the networking is done, particularly how games are found with people the other side of the world.

Thanks in advance. :)

Offline mar77a

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1295
  • mad
    • random stuffs
Re: Soldat Network Programming
« Reply #1 on: August 08, 2008, 04:28:10 pm »
Yes, Soldat's a good example of how a game's networking should be coded...

Pointers? Check gamedev.net and this: http://www.tar.hu/gamealgorithms

Offline Jammy

  • Major(1)
  • Posts: 2
Re: Soldat Network Programming
« Reply #2 on: August 12, 2008, 05:31:52 am »
Excellent link, thank you, that will help a lot! ;D

Date Posted: August 08, 2008, 05:32:11 pm
Have looked at this in more detail and it's still not quite what I'm looking for (taught me a lot though).

Basically when I got to testing it the game I made with friends, it didn't work despite working fine over a local network. After asking around I got the idea that I either needed a dedicated server, or else needed to perform a punch through operation, similiar to what P2P file sharing software does. For my current project, ideally I'd like a dedicated lobby server which assigns a game host, and sends him the addresses of all clients that want to connect to him so that he can set up a connection between himself and all clients.

I gather that I will need to learn PHP (and mySQL?) to achieve this on a server.

Essentially I would really appreciate a walkthrough of the steps I need to take, or an online tutorial that does that. All winsock tutorials I have found on the internet only seem to work over a local network.


As a P.S. I have little idea what I'm talking about at this stage, so feel free to point out any incorrect assumptions or term usages. Anything I can learn on the subject is really useful to me. :) Thank you.

Offline chrisgbk

  • Inactive Staff
  • Veteran
  • *****
  • Posts: 1739
Re: Soldat Network Programming
« Reply #3 on: August 12, 2008, 10:09:43 pm »
Excellent link, thank you, that will help a lot! ;D

Date Posted: August 08, 2008, 05:32:11 pm
Have looked at this in more detail and it's still not quite what I'm looking for (taught me a lot though).

Basically when I got to testing it the game I made with friends, it didn't work despite working fine over a local network. After asking around I got the idea that I either needed a dedicated server, or else needed to perform a punch through operation, similiar to what P2P file sharing software does. For my current project, ideally I'd like a dedicated lobby server which assigns a game host, and sends him the addresses of all clients that want to connect to him so that he can set up a connection between himself and all clients.

I gather that I will need to learn PHP (and mySQL?) to achieve this on a server.

Essentially I would really appreciate a walkthrough of the steps I need to take, or an online tutorial that does that. All winsock tutorials I have found on the internet only seem to work over a local network.


As a P.S. I have little idea what I'm talking about at this stage, so feel free to point out any incorrect assumptions or term usages. Anything I can learn on the subject is really useful to me. :) Thank you.

What you need is port forwarding for the person who hosts, same as anyone who hosts a soldat server is required to do. Punch through only works in certain cases, where the router forwards ports on a 1:1 basis.

Offline rayanaga

  • Soldier
  • **
  • Posts: 143
  • ~Fur flying~
    • Kryonex
Re: Soldat Network Programming
« Reply #4 on: August 13, 2008, 06:14:40 pm »
Network programming is a very tricky thing to do right.

Some network methods are blocked by routers, and you have to come up with methods of Dead-Reckoning and efficient Data Transportation. (Like updating the major things in a millisecond but small things in a couple seconds).

To make a Master Server, or Lobby server is a great idea and you do not need to learn PHP/mySQL to achieve it. Mainly you could just go ahead and create a seperate socket server for which the dedicated servers can register on.

Keep in mind that the lobby server has to be powerful. (I wonder how powerful soldat's lobby server is?)
[kY] Kryonex - Your local zombie fanatics.
http://www.kryonex.com/

Offline chrisgbk

  • Inactive Staff
  • Veteran
  • *****
  • Posts: 1739
Re: Soldat Network Programming
« Reply #5 on: August 17, 2008, 08:58:00 pm »
Network programming is a very tricky thing to do right.

Some network methods are blocked by routers, and you have to come up with methods of Dead-Reckoning and efficient Data Transportation. (Like updating the major things in a millisecond but small things in a couple seconds).

To make a Master Server, or Lobby server is a great idea and you do not need to learn PHP/mySQL to achieve it. Mainly you could just go ahead and create a seperate socket server for which the dedicated servers can register on.

Keep in mind that the lobby server has to be powerful. (I wonder how powerful soldat's lobby server is?)


The lobby server doesn't have to be very powerful at all; Soldat's lobby server runs in a virtual machine on a server with other virtual machines that serve various aspects of the community; FLAB may have to correct me on this, but I believe that these forums, soldat.pl, and the lobby all run off of the same physical server, under different virtual machines for ease of maintenance.

All a lobby server has to do is maintain a list of servers, and allow updates to that list, and send the list to clients who request it; that's very easy to do with SQL, and even with a few thousand servers is hardly any load at all.