Pages

Tuesday, November 15, 2011

So I want make an MMORPG, Where do I start from? PART 1

That is indeed a good question, asked so many times and answered many times too, in many sites the answer is like:

<If you have a team>
  1. Get a team: coders + artists + world designers +well like 10 persons.
  2. Get ready to expend 2 years (at least) on it
  3. Pay big amount of money to the ISP
  4. Have a design document
<Lone developer>
  1. Forget about it :(
 What can I add to that? I basically decided to made it no matter how hard it was; I'm not somebody that has never programmed and think that their "RPG maker experience is enough", I'm not asking how to make it because If you are asking that, you probably are so far from the objective you desire that you wont get it never.

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:
  1. Start a series of posts explaining how I did it.
  2. Clean Server / client code and upload them (Yes, I'm going to release it soon)
  3. Set up MYSQL server
So first thing first:

Q:What do I need to learn to send / receive date across the network?
A:Network sockets

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..

JB

No comments: