<Been out for a long time <again>, had many things to do and my project got stucked again, but it didn't get forgotten! I have been reading all the code again and had time to think about it, the things I have done right and which things should I change / improve, and made an small list:>
- The server actually works!
- Client program able to create players, connect, and "move around"
- Worked quite fast in a desktop computer using small amounts of RAM
- Ugly code, I feel really ashamed about that, but it is the result of writing code in a "fast 15 min way"
- Server is unstable, yeah, after fixing many, many bugs it did worked, but still had things to fix.
- I was not using a real scenario , data was not being loaded from server, so player creation, maps, etc was everything client-side, obviously that is not good, for many reasons (security, for example)
- World didn't had persistent data, players, objects, etc were not stored after closing client program
So I took a hard decision, dropped the code and to make a second server with all the good things the first server had + all the things it SHOULD HAVE like persistent data, and a true server-client model.
Having persistent data meant to use some kind of static storage, so I thought in using just plain files plus standard c++ io functions to write data, but I dropped the idea fast because there are already libraries to solve the "writing another text parser" like TinyXml , but after playing with that again I found that if I used that library I will be making two times the work because:
- First I will have to write all the data in .xml files
- To later rewrite the code again to switch to a real database..
<NOTE: I have completely dropped support for windows in the server part, that means I wont be posting how to install and make it run under Windows OS family, basically I made that because that's the OS I will be using to make and run the server and I cant loose more time in something I wont be using, although anybody could check how to download and install the required libraries for the OS you choose..>
So I installed the mysql server:
It just asked me for the "root" database password, it is very important because it will be used to connect to MySql and use the database, NOTE: it is not the linux root account so you can / should have different passwords .
I installed too MySql tuner:
Used to get advice to tune the databases
And the client libraries:
Used to connect from the client app
To check that the MySql server is running:
You can restart the service with:
<You can see installing MySql server is quite simple, in the next post I will write about comand-line database management, and finally start using it with code::blocks>