ID:292504
 
This Tutorial will explain how to create a new project in DM (Dream Maker) and go over several things that are needed to get your game into its first "playable" state.
This Tutorial will probably be much longer than the others; since it will be explaining a multitude of systems that are needed to get you started.
(Note: if you hold Ctrl when clicking on any of the links in this tutorial; they should open in a new tab. This will prevent you from losing your place)

If you don't already have BYOND, you can download it here

Creating a new project:
Step 1.1: First, open Dream Maker.
The Dream Maker application can be found in the "bin" folder where BYOND is installed.
This may vary by computer, but is most likely located in "C:\Program Files\BYOND\bin"
http://www.angelfire.com/hero/straygames/Tutorial/ DmFolderLoc.png
It can also be accessed through the Start menu.
http://www.angelfire.com/hero/straygames/Tutorial/ DmStartLoc.png

Step 1.2: After opening DM, select: File -> New Environment...
http://www.angelfire.com/hero/straygames/Tutorial/ DmNewEnviro.png

Step 1.3: You will then be asked for the location you wish to save at, and the name of the new environment.
(In keeping with this tutorial it is recommended to use the same file names and location, but it is not required)
I will be saving my project in location: "C:\Program Files\BYOND\bin"
And the project environment will be named: "Tutorial"
http://www.angelfire.com/hero/straygames/Tutorial/ DmNewEnviroName.png

Step 1.4: You will then be asked for the type and name of your first file.
Let's make our first file a Code file named "Main.dm"
The system will automatically add the extension based on what file type you have selected. (ie: .dm for a Code File)
http://www.angelfire.com/hero/straygames/Tutorial/ DmNewFileName.png
We won't be using this yet, but I like to create a main code file to get started.
EDIT: This tutorial was written before BYOND pixel movement was released. When you create your first code file in the new version of BYOND, it will fill it with some default project code. For the purpose of this tutorial, you would want to remove said code.


Creating a new Icon:
Step 2.1: Select: File -> New
http://www.angelfire.com/hero/straygames/Tutorial/ DmNewFile.png

Step 2.2: You will again be prompted with the file type and name selection window from before.
This time lets make it an "Icon File (.dmi)" named "Player.dmi"
http://www.angelfire.com/hero/straygames/Tutorial/ NewIconFile.png

Step 2.3: Click on the paint board in the top left of the icon section to create a new single frame icon_state
(The camera next to it can be used to create an animated icon_state, but we wont do that now)
http://www.angelfire.com/hero/straygames/Tutorial/ PaintBoard.png

Step 2.4: Use the tools along the left side, and the color palette on the right to make a basic smiley face.
http://www.angelfire.com/hero/straygames/Tutorial/ IconTools.png

Step 2.5: Then click the "<- Back" button near the bottom right.
http://www.angelfire.com/hero/straygames/Tutorial/ SmileyBack.png

Step 2.6: Now right click your smiley face and select "Edit State..." all the way at the bottom.
http://www.angelfire.com/hero/straygames/Tutorial/ EditState.png

Step 2.7: Name this icon_state "Player" and hit OK.
http://www.angelfire.com/hero/straygames/Tutorial/ IconStateName.png

Step 2.8: Repeat the above steps to create another new icon file. Name this one "Turfs.dmi".
Create an icon_state in it, fill the icon_state with solid green, and name the icon_state Grass.
Click the paint board again, inside Turfs.dmi, to add a 2nd icon_state. Fill this one tan and name it Dirt.


Programming:
Step 3.1: Now that we have a couple of icons created, lets write the code so we can place them in the game.

Step 3.2: You may have been sent to the Object tab in your travels, if you were; simply click on the File tab.
http://www.angelfire.com/hero/straygames/Tutorial/ FilesTab.png

Step 3.3: Double click on "Main.dm" in the file tree on the left side of DM to open that file.
http://www.angelfire.com/hero/straygames/Tutorial/MainDM.png

Step 3.4: Click in the large white section to the right to begin typing.
Input the following code.
(Note: I don't recommend copy/pasting the code, but typing it in yourself. Not only should this help you learn, but copy/pasting will convert any tabs into spaces.)
world
name="Tutorial"
mob=/mob/Player

What will this do?
It will set the name of your world (your game) to "Tutorial", and set the world's default mob type to /mob/Player.
But wait! We haven't created mob/Player yet, so this will give us an error if we compile.

Step 3.5: Select: Build -> Compile
http://www.angelfire.com/hero/straygames/Tutorial/ BuildCompile.png
This will check your code for any syntax errors.
As I have already pointed out, we currently have one "Main.dm:3:error:/mob/Player:undefined type path".
Any errors that you have will appear in the bottom section of Dream Maker.
It will tell you the code file and line number that the error has occurred on, along with a (somewhat cryptic) description of what the error is.
If you double click on an error, it will take you to the line in your code where the error exists.
Be warned however, if you modify the code (reducing or increasing line numbers) then when you click on an error you may be taken to the wrong line.

Step 3.6: Now lets correct that error by creating a Player mob.
world
name="Tutorial"
mob=/mob/Player

//new code below
mob/Player
icon='Player.dmi'
icon_state="Player"

What does this do?
In short, it creates a new mob type called Player and sets up its visual appearance.
You'll notice we use 's around file names, and "s around text strings.
If you compile now, it will clear the error from the bottom.

Step 3.7: Lets create a new Code File to put the code for our Grass in.
Follow the same method you used to create an icon file, but select "Code File (.dm)" for the file type, name the file "Turfs.dm".
This will automatically move you into the new code file so you're ready to begin typing.
turf
icon='Turfs.dmi'
Grass
icon_state="Grass"

//To create additional turfs:
Dirt
icon_state="Dirt"
Wall
density=1
opacity=1
icon_state="Wall"

You may notice that this looks somewhat similar to our mob/Player code, but the icon declaration is in a different position.
By setting the icon under just /turf, instead of under turf/Grass (like we did with mob/Player), it sets the default icon for ALL turfs to 'Turfs.dmi', instead of only setting it for your Grass.

Step 3.8: Switch back over to Main.dm by double clicking on it.
Now we'll write some code for what will happen when a player logs in and out of your game.
world
name="Tutorial"
mob=/mob/Player

mob/Player
icon='Player.dmi'
icon_state="Player"

//new code below
mob
Login()
src.loc=locate(5,5,1)
world<<"[src] has Logged In"
Logout()
world<<"[src] has Logged Out"
del src

mob/Login() will be called any time a person logs in to your game.
What does it do? It sets their location on the map to x:5 y:5 z:1 and then announces to everyone in the world that they have logged in.

mob/Logout() will be called any time a person logs out of your game.
It first announces to the world that they have logged out, and then deletes their mob.
Take note to do it in this order. Deleting the src (source) of a proc (procedure) will cause that proc to immediately stop.
In situations where you del (something) and (something) isn't the src; if you then attempt to reference (something), you will encounter a runtime error, so delete things last.

Step 3.9: Compile one last time and we'll move on to mapping.


Creating a Map:
Step 4.1: Create a new Map File like you would an Icon or Code file.
Select "Map File (.dmm)" from the list, and name it Map.dmm.
When it asks for map sizes put in 200, 200, 1.
I recommend using 200x200 as it provides a 1:1 relation in the mini-map.
http://www.angelfire.com/hero/straygames/Tutorial/ MapSize.png

Step 4.2: You should have been brought to the Object Tab automatically when creating a new map file, but if you weren't you can click it over on the left.
http://www.angelfire.com/hero/straygames/Tutorial/ ObjectTab.png
This tab contains all of your mappable creations.

Step 4.3: Click on the + next to turf to expand the turf section and see your created turfs (at this point just Grass)
http://www.angelfire.com/hero/straygames/Tutorial/ TurfPlus.png

Step 4.4: Click on the Grass turf to make it your Active Object.
http://www.angelfire.com/hero/straygames/Tutorial/ ActiveObjectGrass.png

Step 4.5: Click in the top right of your mini map to scroll the map there.
I find the map fills much faster if you go down/left as opposed to up/right.
http://www.angelfire.com/hero/straygames/Tutorial/ MiniMapScroll.png

Step 4.6: Now click the Fill button
http://www.angelfire.com/hero/straygames/Tutorial/Fill.png
Step 4.7: Once you have Fill mode selected: click in the top right of your map (the full map not the mini one) and drag into the bottom left corner.
Hold the mouse off-screen for a few moments so that the map will scroll, selecting the entire area.
Once you release the mouse button, the selected area will be filled with your active object (which should have been turf/Grass)


Playing your Project:
Step 5.1: Select Build -> Run to see your project in action.
http://www.angelfire.com/hero/straygames/Tutorial/ BuildRun.png
You will get an alert saying that some files have been modified. Select Yes to Compile and Update your game before running it.
That's all we're going to cover in this first tutorial.
You now have a "playable" game.
Though all you can do for now is walk (or more like slide) around.
http://www.angelfire.com/hero/straygames/Tutorial/ GameInAction.png


Continue to Tutorial #2: Player Interactions
Thank You so much, I was about to ask for this
In response to Andyextreme42king (#1)
it wont let me make map
how do you get turf.dmi imported to the map files?
In response to Mner2 (#3)
Mner2 wrote:
how do you get turf.dmi imported to the map files?
The Turf Code File
In response to The Final Duelist (#4)
I am new t making games and I am stuck with Importing Files to make the map, I spend a little while just trying to get the objects done.
In response to Highlord_Horus (#5)
Are you sure you have read Step 2.1 to Step 4.7 ?
Thanks, this helped me a lot and gave me a clue what BYOND coding is like.:D
on the log in log out i ceep geting 3 eerrors Login dm:17 error src.loc: undefind proc

mod
Login()
src.loc=locate(5,5,1)
world<<"[src] has Logged In"
Logout()
world<<"[src] has Logged Out"
del src


i ceep geting an error on login logout and on src.loc=locate(5,5,1)
can some one tell me y i ceep geing the error
Try changing mod to mob and see if the error goes away.
o crap thanks it worked
Hey, thanks for this. I just created my first BYOND "game". The DM guide didn't seem to be explaining the process this well, but maybe that's because it was late and I was probably half asleep.

Kudos for keeping the whole thing bare-bones simple, by the way... I one-upped your pixel art by spending a few more minutes on it than you did. lol

Yeah yeah, I know. But it's going to happen one step at a time, like anything else we learn.
i'm gonna start to make my first game as soon as i can i'll try my best
Might I suggest using HTML tags to display those images. Must be a pain to click them for your readers.
if you wanted the game to ask what you want your name to be what code would you use?
how do you link to maps?
Im going to try this from tut one to what ever number your on now and see what i can come up with
Wow, For some reason i Understood this better than the DM Guide, Thanks !! Maybe with your Tutorial i'll be able to make som Fine games ^^
I keep getting errors about the turfs
Page: 1 2