Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


rtwilli

Member Since 31 Jan 2013
Offline Last Active Apr 26 2013 12:07 PM

Posts I've Made

In Topic: Multiplayer Setup - Lobby

02 February 2013 - 04:17 PM

Hi,
 

Just my 2 cents here.
 

Q1:

The algorithm you have seems pretty solid to me.  I’m not sure if you’re using winsocks or something else.  Also not sure if you’re using UDP or TCP.  If you’re using UDP you might want to add a check every few seconds to see if the clients are still responding, and/or perform a test to see how many packets are lost (make sure it’s in range for your game).  A quick ping to make sure there wasn’t a disconnect, that way invalidated players could be taken out of the saved players list.  Although TCP is more reliable for data packets, disconnects can still happen so you could do the same with a TCP connection. In the master server I would store all the players..but would also check every 60 seconds or so to see if the ip:port still responds to pings.  I would add this because after a while your list of players could fill up with dropped connection player data, also if your match making ends up having some sort of user login/validation logic the server will think they’re already connected if they try to log back in after a disconnection event.


 

Q2:  I’m not sure if you meant that you would code 500 host applications that are different than the master sever executable.  I wouldn’t execute 500 applications at the start.  This would use resources that aren’t needed until a game is actually matched.  Also in this case I think you would end up having to setup a separate port for each application so that you could have 500 different listeners.  This would also make you have to code the client to test every possible port to find an empty server game application. (However, if you had a single “master sever” clients could first connect to this and would be assigned port/host application to play on (possibly only executing new instances of the application as needed).  Again, I not sure what your design plan was.)  This is definitely doable.


 

I would code a single master server application as a multithreaded application, and code each host game as a thread in this application.  I’d create a linked list of host game threads (or whatever structure you prefer) Every time two players were matched for a new game I would create a new node and spawn a new thread passing in the players
data.  Since you’re limited by hardware I would probably code a max number of threads (available games).   In this way games could be kept track of by a master server application and games could be added and removed from the linked list as needed.  This would also give you the ability to check in on games. Test that the games haven’t disconnected.  If so you could reclaim the game node and log the players out.  After a while your list could fill up with dead games so you may want to code a process that
would walk the linked list every once and a while to make sure things are going ok.  Maybe even later you could add some tests to make sure players aren’t cheating.

 

What I said above only works if you plan to have a single computer act as your server, if your plan was to have servers on several computers than you would need to do something different and have at least a server/host executable on each machine.

 

 

rtwilli


In Topic: start a topic about rts game development

01 February 2013 - 02:31 AM

Hi,

 

I’m new here, and this is my first post.

 

I’m also in to rts game programming and have been working on my own rts game.

 

I don’t know anything about any commercial or freeware level editors, but I’m working on designs for other game aspects.  Unit AI, game control GUIs, message and event
systems, exc.  There’s so much to do but it’s interesting work.

 

Looking forward to discussing rts programming.

rtwilli



 


PARTNERS