It is currently Thu Oct 18, 2018 1:36 pm

All times are UTC + 9:30 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [CW2] Network
PostPosted: Sat Feb 07, 2009 11:05 pm 
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
in CW1 the logic resided on the client, this doesn't work very well the solution is to put the logic on a server. But how would that work exactly:

In the glossary I define client game as
Client game or just client: A Game that is behind a unique port, 1 computer can have multiple clients

The idea is that a client can be controlled by a server and a user, a HumanController and a NetworkController
The server can run locally or on the internet. The server has a live Model for each server game.
A live model(we'll just use server model from now) means game objects are loaded in the jvm, the client has 1 live model.
Once the model is live either loaded from an previous saved game, or a new creates game
the server model can be changed by clients sending messages(moving units, capturing properties, start the game)

Flow of messages:
Each time the user changes the client model, the server is informed.
The client request changes to the server model, if the changes are valid they are sent to all other clients in a server game, if the change was not valid then the client could well be hacking, we'll be nice and just send the reverse message back to the client that requested the change? or ...

Example Connecting and making a move:
When a client is started it connects to a server
The client joins or creates a server game
Any information send by the client is now redirected to the server game model
the client moves a unit from tile A on location 0,0 to tile B on location 4,4
send msg /move 0 0 4 4
server receives the information and validates it
if valid -> broadcast to all clients in the server game
/move 0 0 4 4
else -> send reverted msg back to client /move 4 4 0 0

This is live play, the game is loaded on the server and the game is only removed if the game is won or when all players leave.
clients are always connected.

server games should be saved on request or when the game 'time outs' say after 5 hours without activity.

When a client wants to start his turn after the game has been timed out then
the saved game is send to the client, the server loads the game from the file.

how can the server know what server game should be loaded for what client?

Last edited by stef569 on Tue Feb 17, 2009 7:15 am, edited 3 times in total.

 Post subject: Re: [CW2] Network
PostPosted: Sun Feb 08, 2009 2:12 am 
User avatar

Joined: Fri May 04, 2007 3:18 am
Posts: 520
Well, that is what usernames/passwords are for.

Every time a client connects to the server, he must be verified through username. That way, we are always making sure the person accessing the information is the right man. Don't worry too much about the server system. I have Urusan on hand whenever a server is to be made if we aren't capable of completing it ourselves during that time.

The current server system is a little buggy due to the amount of times the client loads data from the server. However, attempts to change data loading has proved fatal to the system, it is such a logical brain teaser.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 9:30 hours

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Blue Moon by Trent © 2007
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group