Blitz3D Newbies: How to create your own WoW killer! Part 1
by Afr0

As many who read this article will already know, I'm the creator of the much debated Jupiter Engine in the showcase of this webpage.

However, not long ago, I discovered that using UDP (Rottnet is a UDP library) can cause anyone who wants to create an MMORPG to loose 90% of their usergroup. This is because UDP forces anyone behind a router to make changes to their router NAT configs if they want to play your game. Also, I discovered that Blizzard uses TCP for World Of Warcraft. That's when I decided to rewrite the Jupiter Engine specifically for TCP. "Why TCP then?" I hear you say. "UDP is faster, isn't it? Isn't the point of this article to end up with a product that will be able to beat World Of Warcraft?" Well, yes and no. Either way, loosing tons of money is not what we want, so bear with me.

Now I feel the time has come to explaim what this tutorial WILL cover and what it WON'T cover!

This tutorial WILL cover the following:

- How and where to buy cheap servers.

- Teach you why more is always better in most MMORPG situations.

- How to create a questing system that will beat World of Warcraft's system.

- How to create a good framework for your MMORPG, so that you'll truly be able to only let your imagination set the limit for your gamedesign.

- A little bit about how to create a good MMORPG design.

- How to create an engine that will beat Blizzard's engine, as far as graphics and seamless loading goes.

- A little bit about marketing, so that you'll be able to beat Blizzard's salesfigures on your releaseday!

This tutorial WON'T cover the following:

- How to use 3DS Max (or any other 3D modeling application for that matter) to create characters, environments, trees etc.

- How to create/record sound.

- How to hire a symphonical orchestra.

- How to create World of Warcraft in Blitz (what would you need that for?)!

- How to learn C++ (the final server will most likely be written in C++, but I'll get back to this in another part).

- How to smoke weed.

- How to create your own company in order to support the game properly.

Right, I guess it's time to start then, aye? If you are reading this tutorial and are thinking of following it through, I can tell you that you've just started on a journey that most likely not only will make your rich, but it will also give you joy and fun, and enable YOU to create the MMORPG that YOU'VE always wanted to create!

The first things that we will cover are some TCP basics. To create a server, the first command you will have to learn is this one:


This command only has one argument. It needs to know which port the server is going to use to listen for messages. For now, just type in or copy this:


This function, as you can see, creates a server on any given port and then performs some errorchecking to see if the server was started properly. To make this function work though, you'll have to make a global var somewhere in your program so that the entire program can access the server that the function creates. So just stick this at the top of your program:


Once you're done with that, you need to initialize function, so that the server will be created:


7000 is a good port, because it is rarely used by other programs. You can in theory just type in any name though, and the server will still work as planned. Now I will show you the mainloop of the server:


This needs some explanation. The first line of the mainloop creates a new TCP stream. The server uses this stream to listen for messages. This stream is connected to the port that you you specified as an argument for the CreateServer function, and every message from other clients will be stored in this stream. The first if check of the mainloop obviously creates a new playertype if a new client connects to the stream that we've created. It also stores a copy of the stream that we've created in the stream field of the player type so that we can send messages to each player individually and to every player at the same time. I will show you the player type later. The for loop should need no explanation. The ReadAvail command should, though. It checks if there is something to read in a stream, and it takes a valid stream as an argument. As you can see, we've supplied it with one. For simplicity's sake, all we're doing for now if there is a message in one of the playertype's streams, is to print out the message and then send a message back to the client who sent the message. Now it's time to show you the actual player type! I usually store all my types in a separate file, but you can do what you want to. Anyway, here is the code:


For now, it's not really huge, but it contains some important basic fields. As you can see from the servercode, all we are actually utilizing for now is the stream field, but the second part of this tutorial will show you how to utilize the other fields. If you choose to have this type stored along with your server, make sure that you stick it in your code BEFORE the mainloop! Now it's finally time to cover the clientcode:) To create a client, you must use this command:


It takes two parameters. The first parameter is a string that must contain the adress of the machine to connect to. For now, all we will use is "127.0.0.1", which indicates that the client should connect to your own PC. When you are going to launch this game though, you have to remember to change that parameter so that it contains the adress to your server. You can find your real IP adress at: www.whatismyip.com! The second parameter of the OpenTCPStream is a number to indicate which port to connect to. This must ALWAYS be the same port as the server listens to, or you won't get any action from your program. Allrighty then, now stick this code into your client program:


This creates a client connection and performs error checking;) DO check though, that the port number matches the one in your servercode, in case you changed it there. Here's the last bit of clientcode that I will show you in this part of the tutorial:


This code first uses the WriteString command to send a message to the server via the client that we created previously. Then it checks if there is anything to read in the clientconnection, and prints out whatever there is to read if there is anything:D

Ok, now we have created a nice framework on which to build ourselves a beatiful WoW killer:) To test this statement, you can compile two clients if you'd like, and run them. As you will see, the clients will both recieve a message each, and the server will recieve two messages, one from each client.

What we have accomplished in this part:

- Creating a system through which we can send messages from the server to a specific client, or send messages to every client.

- Creating a system through which we can send messages to the server from the client.



What we will accomplish in the next part of the tutorial:

- Modifying the server so that we can utilize the id and name fields of the playertype to reckognize a specific player by his id, and keep track of each player's nickname in the server.


For a printable copy of this article, please click HERE.


This site is Copyright© 2000-2004, BlitzCoder. All rights reserved.