|
-
Jan 24th, 2012, 10:20 PM
#1
Thread Starter
Member
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.
-
Jan 27th, 2012, 09:09 AM
#2
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|