CW Network
http://forums.customwars.com/

Server Jargon?
http://forums.customwars.com/viewtopic.php?f=109&t=8873
Page 1 of 1

Author:  JakeSamiRulz [ Sun Feb 08, 2009 6:36 am ]
Post subject:  Server Jargon?

Okay, there has been a lot of buzz about the server and what we should do with it, but first:

A little info about how the old cw1 server works... (Hopefully with confirmation from Urusan)...

First of all, the server is split into two parts. Java and Perl, each section deals with verification of data... but it is mostly connecting to the server that takes up most of the coding space. The key files for dealing with the server are these two.

Java: NetworkSession.java
Perl: main.pl

Some documentation in main.pl
Code:
# test     - Test connection, return "success"
# qname    - Tests if a certain game exists, returns "yes" or "no"
# newgame  - Creates a new game by reserving the game name
# mpass    - Tests a master password
# join     - Registers a player with a particular game
# validup  - Checks if a player's user/pass is correct in general
# canplay  - Checks if a player's user/pass is the current player's
# getturn  - Returns the day and turn
# nextturn - informs the server that the next turn has started
# sendchat - puts a chat message in the game's .chat file
# getsys   - returns the contents of the system log
# getchat  - returns the contents of the chat log
# dplay    - eliminates a specified player


Some documentation in NetworkSession.java
Code:
/**
 * Handles chatting to the server using plain text
 * Invalid input, commands and server error messages are wrapped in NetworkException
 * <p/>
 * The results of a command from the server is stored in this object and
 * can be retrieved by using getters.
 *
 * @author stefan
 * @since 2.0
 */


In order for the program to send the map file, it first verifies if all the data sent is correct. The data is read from the server at any time, which could be the source of all the mixups of text data. There is no way to see if all the data has been sent to the server before data is read. If anywhere is causing the problem, the root would be here... I think?

------------------

Anyway, there is only a few ways we can handle the new server. I'll name them here.

1) Put game information on the client. (cw1 server kinda)

-Most of the information of units, movement and so on will be downloaded on the client's computer. Server will hold raw data, like save files, and username password verification (basic text stuff).

Pros:
-The game remains easily customizable.
-Server will be able to hold tons of information.
-No heavy reliance on other oop's and ipl's... (other languages in general)... to get a server running.

Cons:
-Promotes cheating (especially this being an open source project)
-Possibility of lag
-Extremely unfriendly for FOW because of the ability to reload entire games

2) Put game information on the server

Pros:
-Really fast smooth move-by-move gameplay
-Really difficult to cheat the system
-FOW friendly games

Cons:
-Custom ability limited by server space/number of servers available.
-Can't do turns offline/ Must always be connected to server to do a turn.

-----------------------------
Even though I am leaning 2. It'll also means that starting the game in a new language would be the wisest path for the game. Since Java is a little tricky when dealing with server information. Other languages are a little more straightforward and require less verification.

Erm, it'll probably be a wise idea to stick to a Java based system, since we are all mostly comfortable with Java.

Yeah, it isn't necessary to get a response here. But if you have any thoughts, you can post up.

-JSR...

Page 1 of 1 All times are UTC + 9:30 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/