<If you have a team>
- Get a team: coders + artists + world designers +well like 10 persons.
- Get ready to expend 2 years (at least) on it
- Pay big amount of money to the ISP
- Have a design document
- Forget about it :(
I tried to divide the BIG puzzle into small pieces, c++, SDL, SDL_image, SDL_ttf, SDL_NET, SDL_thread, Gimp, MYSQL....
With those pieces I made some bigger ones: A tileset, a simple game engine, game states, player creation process, a simple chat server....
And now it comes the good thing, I got a Simple (RPG DEMO) server with a client, I didn't made it on time (1 year was my objective), but now , after millions of doubts I know I will finish the game...
My objectives now are:
- Start a series of posts explaining how I did it.
- Clean Server / client code and upload them (Yes, I'm going to release it soon)
- Set up MYSQL server
Q:What do I need to learn to send / receive date across the network?
Q: How does network sockets work?
A: Network sockets handles data send/received to an IP network, they are both used by TCP (Connection oriented ) and UDP (Connectionless oriented), in the server you "open" a socket to listen for incoming data, open a socket means bind the program to a particular IP port of the computer, so we could open a socket at port 80 to create a web server, for example, when we create a server socket it waits until a Client machine (program) connects to it, then we create a client sockets that is going to actually communicate with the client. The clients just open a client socket and establish a connection with the server socket.
Q:Why do I need threads?
A: Threads are used to do many things at the same time, for example, a Client for the MMORPG, could have a thread to draw the images on the screen while another one sends/receives network data , the server could have one thread (maybe more?) to handle network data, another one for the AI, another one for Environment events... In the modern multi-core computers, it's a way to use 100% of the processor power
Q:Why are you using SDL_NET? isn't it an ancient library?
A:It is old, but network sockets are older and are still used today (and probably are going to be used for many, many years), just thing the new IP protocol (IPv6) uses them too... SDL_NET has other advantages too, it can be used in a multi-platform environment (I use it in my client and I can compile it under windows / Linux without touching a single line from the code to make it work :) ), finally it is a low-level library so you feel you have the control over what you are working, there are libraries made upon SDL_NET that add things (NET2 uses multi-threading for example), but you have less control about what is happening, another problem is find documentation , SDL_NET is so small that when you read the manual , you realize how easy is to use it.
<More Q/A soon...>
In the next post: Server code and explanations..