hachi from the block (hachibambatar) wrote in multitic,
hachi from the block

  • Mood:
  • Music:


alright, so my plan is to write a c++ backend for a multitic system on the server... here's the deal though, i've /never/ written network or gui code before... if i have to, i will, but please don't make me, that or point me to a nice sockets library...

the storage for a game is as follows, much as the coordinates would be written as a list of numbers between zero and two, the game is stored as a list of moves.

here's the class, things will be simpler that way, hopefully...

class Game {

public :

// Constructors, destructors and the like...
Game(); // default constructor
Game( string name, int ndimensions, int nplayers, int gametype ); // this should make some sense, gametype is a flag variable...
~Game(); // the destructor is going to do some database stuff if the gametype happens to be rated...

// Setup
void addplayer(int playerid); // i don't quite know what the implementation of playerids will be, except that they will be 32 bit ints...
void removeplayer(int playerid); // not everything needs a comment...

// Gameplay related
void move(char *pos); // this function is nothing more than a malloc and a memcpy with some error checking so that people don't make illegal moves...
void undo(); // guess what this does...
int iswon(); // is the game won?
int iscatsgame(); // is it a cats game?

// File related
int save(string filename) const; // save the game to a file on the server
int load(string filename); // load up a game from a file on the server

private :

int gametype;
int ndimensions;
int nplayers;
int *playerids;
int nmoves;
int counter = 0;
char *history;


post questions about this, anytime, or if you have a better model for the program or anything to say, do go ahead and say so... cvs, bah...
  • Post a new comment


    default userpic