Results 1 to 2 of 2

Thread: How to make game server?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2012
    Location
    Georgia, USA
    Posts
    44

    How to make game server?

    Ok im 100% new at this trying to build a server stuff. I have made applications befor that didnt need servers that was just forms and buttens and stuff but making a game kinda needs a server. I know i need to have 2 winsocks on the server form but thats about it... I know its a lot to ask for but could anyone show me how to design a server that could handle at least 200ppl at a time running threw a MUD style game at any one time without lagging? I would like most of the game info to be read on server side so my client isnt able to be hacked easaly.... I hope i said most of this correctly and if i didnt im sorry. Ill explain more in depth if need be.

  2. #2
    New Member
    Join Date
    Jan 2012
    Posts
    1

    Re: How to make game server?

    I use sockets not Winsock to network games in VB, but the principle is the same.
    Server:
    Create a listening socket on a port
    Loop{
    Accept a client
    Create a new inputThread to deal with this client's input
    Create a new outputThread to deal with this client's input
    }
    Server-inputThread
    Loop{
    Get client input using the accepted client socket
    process the input
    }
    Server-outputThread
    Loop{
    sendDisplay/data required to client
    }
    Client
    Create a new socket using the server's ip+port
    Create a new inputThread to handle incoming data from the server
    Loop{
    Get keypress
    send keypress to server using socket
    }
    Client - inputThread
    loop{
    recieve data from the server
    update display
    }

    At least this is my way of doing it, generally uses 2n +1 threads on the server (n is number of clients) and 2 threads on each client.
    I've got an example of both a chat room (which is pretty easy to understand) and an old nethack (top down, console (ASCII characters representing things)) game/RPG which is a bit more complex if you want them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width