Jump to content
  • Advertisement
Sign in to follow this  
astrospider

FPS Game Server Tips

This topic is 4370 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I shall create a game server for a own maded FPS game. (DirectX 9) I have only some experience in winsock and don't know if I shall use winsock or DirectPlay. At most the server will have about 128 connections at one time. I have done some reasearch about winsock/DirectPlay and winsock with IOCP and need some help about what to choose ;) I have figured out that IOCP is very good if u want to handle alot of connections and don't create 1 thread for each connection, but is it good to use IOCP in a FPS game server or is it only a waste of time? what shall I use, DirectPlay or winsock? what would u do use? TCP or UDP or maby mix them both? I have read alot of information about TCP/UDP with different games, but I don't really understand what's best to use in a FPS game... Does anyone have any good books or links that explain winsock or IOCP? I haven't found alot of books about this, so I would appreciate some tips about books ;) thanks alot in advance :)

Share this post


Link to post
Share on other sites
Advertisement
There is no issue with using UDP or TCP its just knowing when to use either.
You should use TCP (or your UDP equivalent) for things like log in, chat, log out, new map etc. And UDP for things that need to be fast, but you can afford to lose a few packets of like position updates.

Share this post


Link to post
Share on other sites
For UDP, you only have a single socket, so IOCP wouldn't be necessary.

DirectPlay is deprecated and won't be developed more by Microsoft; they recommend using Winsock. You can also use one of the libraries found in the Forum FAQ to help you out.

You don't necessarily have to use TCP for chat or login; you could also build everything on top of UDP without too much trouble. Many libraries (like Enet) give you reliable channels on top of UDP. This may simplify your code, too -- only a single socket needed for the entire server!

Share this post


Link to post
Share on other sites
depending on your data load, and the rate of your entities update (10~15fps), I think TCP would do the job perfect...I've read somewhere that CodUO is TCP only...


Tcp is simpler to manage

In the game we just did, we used to mix TCP with UDP ... the problem we had is that sometimes TCP lags and not UDP(very rare), resulting in a loss of synchronisation (invisible guys shooting)

We've put it back to TCP only, and now a home connection (Cable/DSL) can host an 8 player game... and theres a lot of projectiles in the game.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
DirectPlay is deprecated and won't be developed more by Microsoft; they recommend using Winsock. You can also use one of the libraries found in the Forum FAQ to help you out.

You don't necessarily have to use TCP for chat or login; you could also build everything on top of UDP without too much trouble. Many libraries (like Enet) give you reliable channels on top of UDP. This may simplify your code, too -- only a single socket needed for the entire server!


ahaa okey :)

so you would recommend me to use winsock with UDP instead of winsock with TCP for the whole game?
shall I care about threads or it's not necessary if I use UDP?
is it only necessary to use threads with TCP or with both?

thanks alot for yur previouse answare it have helped me :)

Share this post


Link to post
Share on other sites
Quote:
Original post by md_lasalle
We've put it back to TCP only, and now a home connection (Cable/DSL) can host an 8 player game... and theres a lot of projectiles in the game.


hm.. isn't there a mimit to 64 connections /socket? Or I have mixed it up? :P
because I shall have at most 128 connections that's why i'm asking ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by astrospider
Quote:
Original post by md_lasalle
We've put it back to TCP only, and now a home connection (Cable/DSL) can host an 8 player game... and theres a lot of projectiles in the game.


hm.. isn't there a mimit to 64 connections /socket? Or I have mixed it up? :P
because I shall have at most 128 connections that's why i'm asking ;)


For the select function the default is 64 but you can define FD_SETSIZE before including winsock to the required size.

Share this post


Link to post
Share on other sites
Quote:
so you would recommend me to use winsock with UDP


That's what I would do.

Quote:
threads


If I were doing a TCP server on Windows, I would use IOCP, with one thread per physical CPU. If I didn't do IOCP, I wouldn't bother with threads.

For UDP, you need a single socket only, so no threads needed. Also, with UDP, there is no connection limit, because YOU create the connection concept; typically using a hash table of the source UDP port (as seen in ::recvfrom()).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!