Thread: user database in conjuntion with winsock.

  1. #1
    Registered User
    Join Date
    Nov 2004

    user database in conjuntion with winsock.

    Well im making game..if you didnt know from my other posts... first text based then.. im going to make a client that uses a win32 window instead of console... but use both.. I like text based games better lol...

    Well I was just wondering.. its going to have a chat system... meaning im going to have a user list... So I was just wondering what kind of database should I use/make to store this on the server?

    Should I make like a mysql database of some sort to hold who's online and who left? Or would I use a different kind of data base. Also any tutorials to anything suggested would help or book recommendations(I love buying books because reading them seem to be easier for me and they are great to have as references).

    Also should I use a database to hold characters stats,weapons,armor,ect. or should I make it make a file when someone makes a character and everytime they leave it writes its new stats to the files... Im assuming a database would be fast but I dont know anything about databases in conjunction with programming except web development.

    -- Paul

  2. #2
    Registered User
    Join Date
    Feb 2002
    I think a database is a bit of an overkill for a user list.
    Create a binary file and a record for each user, and then read/write this to a file. If you have a lot of users and think this is slow, you can jus index the file.

    	#define NAME_SZ 50
    	typedef struct UserData{
    		char achName[NAME_SZ];
    		short sType;
    	int addUser(char *achFile, USER_DATA *ud){
    		int iData, iIx;
    		if((iData=_open(achFile, _O_BINARY|_O_CREAT|_O_APPEND|_O_RDWR)) && 
    			(iIx=_open(achFile, _O_BINARY|_O_CREAT|_O_APPEND|_O_RDWR))){
    			_write(iData, ud, sizeof(USER_DATA));
    			_write(iIx, ud->achName, NAME_SZ);

  3. #3
    Registered User
    Join Date
    Nov 2004


    I have to hold not just users.. but i have to have somthing that holds stats,quest info,weapons,armor,ect... anything that has to be saved until next visit..

    I could use seperate files for these but I think that the database would be overall more efficient..

    Also im using this project as a learning tool .. So if a database could be of use here id like to use it if it wouldnt make it run slower... thus learning to use databases in conjuntion with C++ programs .

    -- Paul

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Winsock issues
    By tjpanda in forum Windows Programming
    Replies: 3
    Last Post: 12-04-2008, 08:32 AM
  2. Where do I initialize Winsock and catch messages for it?
    By Lithorien in forum Windows Programming
    Replies: 10
    Last Post: 12-30-2004, 12:11 PM
  3. comparing user input
    By lambs4 in forum C Programming
    Replies: 5
    Last Post: 12-15-2002, 10:28 AM
  4. File Database & Data Structure :: C++
    By kuphryn in forum C++ Programming
    Replies: 0
    Last Post: 02-24-2002, 11:47 AM
  5. Winsock Client User Input
    By (TNT) in forum Windows Programming
    Replies: 3
    Last Post: 11-19-2001, 09:11 PM