Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » Client -> Server communication for game logic
Client -> Server communication for game logic Mon, 27 February 2006 12:17 Go to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
Hi,

I was browsing through the source code trying to view it from a client perspective and I have a couple of questions. How does the client get game logic information from the server. By game logic I mean things like how much fuel is used by a fleet going warp n, or how many minerals a remote miner will suck from a planet surface.

The client could compute all of these I suppose, but that means you have duplicate code and it means the client goes out of date anytime a server config file changes.

A couple alternatives would be to compile the game logic classes as a dll and have the client consume that. It's not too much to ask to require the client have an up to date server.dll. You would still have to have some way to transfer the specific server configuration xml down to each client in case custom changes were made by the host (the same goes for technology data).

Another alternative is to have each client constantly asking the server for important game logic information when they want to display fuel usage and such to the user. Considering bandwidth these days that would certainly be feasable, but the existing FreeStars! architecture seems to be targeted towards offline clients that get one set of turn data and return one set of submit data.

Any ideas, comments?

Report message to a moderator

Re: Client -> Server communication for game logic Mon, 27 February 2006 12:26 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
For C++ clients, the server code is built into a static library that can be linked into the client. At some point this should become a DLL, so some changes to the server will not require changes to the client, the problem is that building a DLL is a bit more platform specific then I want to do yet.

Madman is working on a executable that the client can communicate to with XML over sockets to ask questions and get responses. He seems to think it'll be fast enough. That would be language independant.

A C calling convention library would also be a good idea, but isn't done yet.



- LEit

Report message to a moderator

Re: Client -> Server communication for game logic Mon, 27 February 2006 13:33 Go to previous messageGo to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
So if I understand it, any clients are going to be fairly thin in implementation and have to keep a connection open to the server to query for in game computations? That's good.

Another question (and please tell me 'look in code' if you've already solved this). If the user wants to take a fleet and split it into subfleets, or merge subfleets into a single fleet, they have to do some client processing of what is essentially a server task.

I'm not sure if the client should create/destroy the fleets on their end and include that information in the submit data to the server, or if they should ask the server to split/merge the fleets and return to them the new fleets. The latter is probably cleaner if you want to prevent cheating clients, but it means the server has to store some turn data before the turn is actually submitted by the client.

The pure client side option is probably how the original Stars! did it, and requires some more complexity on the client side, as well as opens up the game for cheating. A client could trick a dumb server into adding fleets just by splitting them into copies of themselves and submitting the new fleet information back to the server.

Report message to a moderator

Re: Client -> Server communication for game logic Mon, 27 February 2006 15:38 Go to previous message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
It will be up to the client to keep track of manually merged/split fleets, there is server code to to that as well of course, and the client will probably just use that.

There will be no communication between the server and client execpt the .m and .x files. The client will have either a library with the server code, or a seperate exe that will have the server code, but the actual server will not be accessable to the client. So the client could claim to split two fleets into idenical fleets and try to merge them. However, the server checks everything, so in this case, when you try to split a fleet of 4 ships into two fleets of 4 ships, it will fail. Actually, the message telling the server to split tells how many ships are leaving the original fleet, so you'd end up with 1 fleet with 0 ships and 1 with 4. The server will not allow splitting 5 ships off a fleet with 4, it will limit it to 4 (and send a message about attempting to cheat, to the host too, if they have a way to look at that).

In general, the server needs to not trust the client, and check everything that it's asked to do.



- LEit

Report message to a moderator

Previous Topic: Compiling under Windows
Next Topic: FreeStars API Documentation
Goto Forum:
  


Current Time: Fri May 03 18:41:24 EDT 2024