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"
It can also be accessed through the Start menu.
Step 1.2: After opening DM, select: File -> New Environment...
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"
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)
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
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"
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)
Step 2.4: Use the tools along the left side, and the color palette on the right to make a basic smiley face.
Step 2.5: Then click the "<- Back" button near the bottom right.
Step 2.6: Now right click your smiley face and select "Edit State..." all the way at the bottom.
Step 2.7: Name this icon_state "Player" and hit OK.
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.
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.
Step 3.3: Double click on "Main.dm" in the file tree on the left side of DM to open that file.
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.)
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
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.
//new code below
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.
//To create additional turfs:
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.
//new code below
world<<"[src] has Logged In"
world<<"[src] has Logged Out"
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.
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.
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)
Step 4.4: Click on the Grass turf to make it your Active Object.
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.
Step 4.6: Now click the Fill button
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.
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.
Continue to Tutorial #2: Player Interactions