Multiplayer game server

I would love to know how to write a server for my game so many players can play it over a LAN. Where do I start from, understanding winsock is not everything i believe, is it?
dede:-)

Comments

  • For game server you need 3 things:
    1. Network code
    Deals with synchronization of clients.

    2. Game logic
    Keeps the current actual data and watches over clients, who might try to cheat.

    3. Multithreading
    This is probably, what you wanted to know. You do want to have multiple clients I believe? So, you need to use multithreading. The idea is as follows:
    Start listening for incoming connections.
    For each connection create a new thread and keep listening in the main thread. A thread is something that runs at the same time as other threads. Google for more information.

    : I would love to know how to write a server for my game so many players can play it over a LAN. Where do I start from, understanding winsock is not everything i believe, is it?
    : dede:-)
    :

  • I believe all of these steps can be done using the Win32 API, right?
    Thanks for concerning..
    dede:-)

  • Technically, yes. WinAPI32 has functions for multithreading and networking (winsock functions, take a look at here for a good tutorial: http://tangentsoft.net/wskfaq/).

    But keep in mind, that game servers (talking about the actual physical server operating system) tend to run under Linux. And for portability, you'd want to use some portable 3rd party library for networking and maybe STL (Standard Template Library) for multithreading. Not a difficult thing to use and should be portable. Also be vary of different file system functions when dealing with portable applications.
  • You mean Servers like Apache? can I use it for my game?? I had thought about that but still, some technics must get clearer for me first.
    Like Synchonization and Multithreading, Winsock programming. :) it's a noble war to write a game.


    dede:-)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion