HOW TO: Make a 2D mmorpg (Get started)

Write your "How To" regarding anything you are comfortable with and you feel it will help the forum members.

NOTE :: All threads started here will appear only after the approval from Administrator
Post Reply
salmjak
Posts: 32
Joined: Wed Jun 04, 2008 2:40 pm

HOW TO: Make a 2D mmorpg (Get started)

Post by salmjak »

Feel like you want to create your own mmorpg? Well, I will try to learn you how.
I will be using the program BYOND (Build Your Own Net Dream) which you can find here (Join and download BYOND by following the links on the side bar).

BYOND is using a quite simple coding language (The Dream Maker Language), if you ever coded any other language before (except html...) this shouldn't be a problem. What I believe is good about BYOND is that the internet connection system is already done for you, all you need is an IP and a port opened to host a game.

The first thing you have to do after installing is to start the "Dream Maker", you will get a new window namned untitled. Go to "file"-->"New enviroment" and save it in a folder by the name you would like your game to be namned (not necessary but will be good if you want to keep track of your stuffs). The file is saved as a .dme-file ("BYOND Enviroment"), this is the file you should start when you want to open the work enviroment for your game.

First thing you should do in the .dme-file is to create a new code file, you do this by pressing "File"-->"New", then choose "Code (.dm)" in the list and type a name for the code file, continue by pressing "ok".

We will start by giving the game some basic things, type this into your code:
world
*tab*name = "my game" /*the *tab* should be replaced by pressing tab once once :P*/
*tab*view = 8 /*This decides how much of the map the players will be able to see*/

mob /*Mob is a path for all moving, so called, atoms. There are three main paths you will need, mob for players, npcs, monsters, etc. Turfs for tiles, background, etc and obj for non-moving atoms (althought there are ways to make it move)*/
*tab*Login() /*This is the, so called, proc (procedure maybe?) called when a player login (this is automatically called by the game when a player connects), there are many usefull procs already made in BYOND (You can look through every one if you go "Help"-->"Help on" or simply press F1). We will just add some extra things this proc should do.)*/
*double tab*src << "welcome to [world.name]" /*the src is the source/mob calling the proc (in this case the player connecting), << is outputting the text inside the quote signs into the game window. If you wonder what the [] they are there to output a string from a variable (In this case the variable is name and is belongs to world) so whenever you want to ouput a variable as string you do it inside []*/

When you run the game now it should output "Welcome to my game" :)
You run it by pressing, first "Build"--->"Compile" and then (after it's compiled and no errors occured) "Build"-->"Run".

Part 2-Going through some basics

We will start with the thing you will use the most; Variables.
Variables are basicly values, a variable has a name and a value assigned to it (if it has no default value from the beginnig the value is "null").
These are some variables you may use:
mob/var
*tab*hp = 100
*tab*strenght = 4
*tab*mana = 50

Note that the path is "mob/var" this means that the variables in that path are only for mobs, they can not be used for turfs or objects. the "/var" is the same as "*tab*var" on the line below, but saves space and tells the code that the "strings" below are variables. Also these are global variables
Now you might wonder "if there are global variables, what more variables are there?", the second type of variables are local variables, these variables are defined directly in a running code (The variables above are defined at start up), you might find local variables in procs and verbs (more about verbs later), an example:
obj/proc/Localvar() /*the () at the end is important, there you can put a statement for which atoms this proc should apply*/
*tab*var/localvar = 5 //this is a local variable, defined inside the proc.
*tab*src << "The local variable has the value [localvar] and HP has the value [src.hp]!"

Since HP is a global variable and it is probably going to be changed differently character from character I tell the code that I'm talking about the source's HP. But I can't do "src.localvar" since this variable is local and only belongs to the proc. I hope you got the differences now :)

I've talked about procs earlier, but what are these really and how do you use them?
A proc is a codesnippet already coded into the game. The most common proc is probably the if() proc.
the if() proc works like this:
if(statement), if the statement is true, run the code below.

mob/proc/testtheif()
*tab*var/localvar = 1
*tab*if(localvar == 1) /*NOTE: You have to use == and not =, = changes the variable, it tells it YOU ARE EQUAL TO THAT NUMBER! while == checks if it is.*/
*double tab*src << "The localvar vas equal to 1! :D"

Going to take a break now, so I post it. I will add more later.


SHAdmin
Posts: 2089
Joined: Sat Dec 18, 2004 11:28 am
Contact:

Post by SHAdmin »

40 points have been credited into your account for taking efforts to share your knowledge with SmokyHosts.com members
0jasoniriarte2010
Posts: 2
Joined: Mon Dec 21, 2009 12:33 pm

cheap gold

Post by 0jasoniriarte2010 »

I purchase an order for 15k gold. I received an email within 2 mins and a phone confirmation from a customer service rep within 5 mins. I was told that my order was being processed and would be delivered within the 10hr limit. I received the gold i ordered and will be a repeat customer again in the future. Thank you SusanExpress.com you made a believer at of me!!!!!!!!!!!!!!
Post Reply