Guide to mapping: Difference between revisions

Jump to navigation Jump to search
6,314 bytes added ,  03:54, 27 April 2020
Applied constant-templates to discord- and github-links
(Updated)
(Applied constant-templates to discord- and github-links)
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
Other related guides: [[Understanding SS13 code]], [[SS13 for experienced programmers]] and [[Map Merger]].<br>
{{Contribution guides}}
''This guide was originally written by Meta for TG-Station. It has been adapted for YogStation by Ktlwjec.'' It is written for those with little to no idea of how to use the map-maker. If there are any errors, questions or requests then feel free to ask in #development-public [https://github.com/yogstation13/Yogstation here].
If there are any errors, questions or requests then feel free to ask in #mapping [{{Constant/Giturl}} here].
 
'''This guide uses Dream Maker. There is an alternative, better tool that you can use [https://fastdmm2.ss13.io/ here].'''<br>''Contact monster860#0001 on [{{Constant/Discordurl}} discord] if there are any issues or you require help with it. For other mapping issues contact ktlwjec#9403.''


==Downloading and Opening Maps==
==Downloading and Opening Maps==
[[File:Dreammakermap.png|thumb|400px|Boxstation opened in Dream Maker.]]First, you need to get yourself a copy of all the files for editing. To do this, go [https://github.com/yogstation13/Yogstation here], click "Clone or download" and click "Download ZIP". You won't be able to submit your changes to GitHub, but that's complicated and something you can get round to later. Once the .zip downloads, extract it wherever.
[[File:Dreammakermap.png|thumb|400px|Boxstation opened in Dream Maker.]]First, you need to get yourself a copy of all the files for editing. To do this, go [{{Constant/Giturl}} here], click "Clone or download" and click "Download ZIP". You won't be able to submit your changes to GitHub, but that's complicated and something you can get round to later. Once the .zip downloads, extract it wherever.


So now you have your folder with the latest code in, and a zip backup to go back to if you break everything. In the master folder (Yogstation-TG), you'll see a file named "yogstation.dme". Double-click this and it should open with Dream Maker, a program that'll be in your BYOND folder. If it doesn't open with Dream Maker, then set it as the default program for opening .dme files. When you open it, you'll see two tabs on the left: file, and object. In the '''file''' tab, open '''_maps''', then '''map_files'''. This will give you a list of map folder. For this guide we are going to use Boxstation, so open the "YogStation" folder and then open '''YogStation.dmm'''. It will take a little while to load, but once it's done you'll then get something looking a bit like the image on the right.
So now you have your folder with the latest code in, and a zip backup to go back to if you break everything. In the master folder (Yogstation-TG), you'll see a file named "yogstation.dme". Double-click this and it should open with Dream Maker, a program that'll be in your BYOND folder. If it doesn't open with Dream Maker, then set it as the default program for opening .dme files. When you open it, you'll see two tabs on the left: file, and object. In the '''file''' tab, open '''_maps''', then '''map_files'''. This will give you a list of map folder. For this guide we are going to use Boxstation, so open the "YogStation" folder and then open '''YogStation.dmm'''. It will take a little while to load, but once it's done you'll then get something looking a bit like the image on the right.
Line 33: Line 35:


==Creating a Map: Basics==
==Creating a Map: Basics==
''This guide was originally written by Meta for TG-Station. It has been adapted for YogStation by Ktlwjec. It is written for those with little to no idea of how to use the map-maker.''
Begin by creating a new dmm file. To do this, go to "File" then "New". Make sure the '''Type''' is "Map File (.dmm)". You can name your file whatever you want to. Press "OK". You'll then be greeted with a map size window. Usually we would make the map hundreds on tiles big, but for now we just want a small map to practice on. Set the '''x''' and '''y''' values to '''30''' each, leave the z value on its default.
Begin by creating a new dmm file. To do this, go to "File" then "New". Make sure the '''Type''' is "Map File (.dmm)". You can name your file whatever you want to. Press "OK". You'll then be greeted with a map size window. Usually we would make the map hundreds on tiles big, but for now we just want a small map to practice on. Set the '''x''' and '''y''' values to '''30''' each, leave the z value on its default.


Line 40: Line 44:


====Directional objects====
====Directional objects====
Once you've made your room you'll want to put lights in (/obj/machinery/light). When you click on an object you will have noticed that it appears underneath your mini-map as well. Some objects, such as lights, have to be placed differently depending on where they are placed. Right-click on the light under the mini-map, then click "Generate Instances from Directions". This will bring up all the different directions of the object. If you can't find one for a certain direction (at the time of writing, things like vendors and arcades only face one direction) then it hasn't been sprited yet. Go to #spriter on [https://discord.gg/0keg6hQH05Ha8OfO discord] and request it!
Once you've made your room you'll want to put lights in (/obj/machinery/light). When you click on an object you will have noticed that it appears underneath your mini-map as well. Some objects, such as lights, have to be placed differently depending on where they are placed. Right-click on the light under the mini-map, then click "Generate Instances from Directions". This will bring up all the different directions of the object. If you can't find one for a certain direction (at the time of writing, things like vendors and arcades only face one direction) then it hasn't been sprited yet. Go to #spriter on [{{Constant/Discordurl}} discord] and request it!


Since you now know about directional objects, practice placing a light on each wall facing the correct way. To get these to work, however, they need power.
Since you now know about directional objects, practice placing a light on each wall facing the correct way. To get these to work, however, they need power.
Line 69: Line 73:
Once in, go to the admin tab and click 'start game'. By joining after the start, you'll spawn at the late spawn you made. To stop your server, go onto Dream Daemon and press the red "STOP" button.
Once in, go to the admin tab and click 'start game'. By joining after the start, you'll spawn at the late spawn you made. To stop your server, go onto Dream Daemon and press the red "STOP" button.


==Mapping Guidelines==
==Creating a Map: Advanced==
Listed here are some advanced techniques and tips to help you map.
 
===Layered Pipes===
There may come a time where you need to connect pressure tanks to pipes that are layered. An example of this can be found in "miningbase.dmm", in the maintenance room. This is very simple to do, just change the '''piping_layer''' var on the pressure tank to the same layer number as the connected pipe.
 
Gas meters also need to have their vars changed in order to work with layered pipes. After placing the gas meter on top of the pipe, change the '''target_layer''' var on the meter to the same layer number as the connected pipe.
 
Areas such as [[Atmospherics]] require connecting pipes of one layer to pipes of a different layer. Use a layer adaptor with the pipes either side of it. The layer adaptor is like having a pipe of layers 1, 2 and 3 in one.
 
===Mapping Helpers===
These mapping helpers are all placed on top of airlocks for their effect to work.
 
'''Abandoned''' "/obj/effect/mapping_helpers/airlock/abandoned" - Provides the attached airlock with a chance to be; replaced by a wall, bolted, welded or have an open maintenance panel.<br>
'''Airlock Cyclelink Helper''' "/obj/effect/mapping_helpers/airlock/cyclelink_helper" - When one door is opened, the other will close. Use on two doors that are facing each other, with the arrow pointing towards the opposite door.<br>
'''Airlock Cyclelink Helper Target''' "/obj/effect/mapping_helpers/airlock/cyclelink_helper_target" - When one door is opened, the other will close. Use on two doors that are not facing each other. You will need to edit the "dirx" and "diry" vars. For example if airlock 1 was a single tile above airlock 2, airlock 2 would have a "diry" value of "1" and airlock 1 would have a "diry" value of "-1".<br>
'''Airlock Lock Helper''' "/obj/effect/mapping_helpers/airlock/locked" - Used to bolt a door at the start of the round.<br>
'''Airlock Unrestricted Side Helper''' "/obj/effect/mapping_helpers/airlock/unres" - Used to remove access restrictions when using the door from one side. The side the arrow faces '''away from''' is the side with no restrictions. See the cloning airlock on boxstation as an example.
 
===Randomized Templates===
This short guide will teach you to make a template for YogStation.dmm. It will be assuming you are making two cryo rooms for Medbay.
 
Find the cryo area and figure out how many tiles tall and wide it is (6 down and 7 across). Create two new dmm files in "_maps/yogstation/RandomRuins/StationRuins/BoxStation/" (/Cryo1 and /Cryo2) with the x (7) and y (6) dimensions equaling the size you just measured. Cut (this will copy it too) and Paste the original cryo area onto one of the files. Create your new version on the second file.
 
Open "yogstation/code/game/objects/effects/landmarks.dm" and add the following:
  /obj/effect/landmark/stationroom/box/cryo
  template_names = list("Cryo Original", "Cryo New")
Follow the previous template in the file if you get stuck.
 
Open "yogstation/code/datums/ruins/station.dm" and add the following:
  /datum/map_template/ruin/station/box/cryo
  id = "cryo1"
  suffix = "Cryo1.dmm"
  name = "Cryo Original"
 
  /datum/map_template/ruin/station/box/cryo/newversion
  id = "medbay_cryo_2"
  suffix = "Cryo2.dmm"
  name = "Cryo New"
 
Compile using ctrl+k. Once it is done go to YogStation.dmm, place /obj/effect/landmark/stationroom/box/cryo into the bottom-left tile of the area you are adding a template to. Cover the entire template area with /area/template_noop and /turf/template_noop. Delete /turf/open/space/basic under the new template_noop areas. Compile again using ctrl+k.
 
===Linking Buttons===
Buttons can be linked to a lot of objects, including shutters and doors. It doesn't matter where the button or object is on the map, as long as they are connected correctly they will work.
 
Shutters: Change the "id" var on the button and the "id" var on the shutters to be the same. Use a keyword that is appropriate, for example the RnD shutters have "id = rnd2".
 
Doors: Change the "id" var on the button and the "id_tag" var on the doors to be the same. Use a keyword that is appropriate, for example the exterior brig doors have "id = outerbrig".
 
===Shuttles===
There are 3 types of shuttle dock:
*Stationary - places where the shuttle can dock
*Transit - shuttle as it moves
*Mobile - the place with the actual shuttle
You will have a transit dock in the transit area, 2 stationary docks (one in centcom, one in the station) and 1 mobile dock in centcom for most shuttles.
 
The shuttle docks are grouped by id: eg. id = "cargo_away", id = "cargo_transit"
 
You need to add the dock types to the map and edit the bounding boxes via varediting the dock. You need to varedit height, width, dheight and dwidth at minimum. These are offset by the dir so do keep that in mind, eg if dir = 2 then width goes from EAST to WEST, if dir = 4 then width goes from NORTH to SOUTH and dwidth/dheight are offsets from the lower-left corner of the plane switched to the dock's dir.
 
You should also ensure the directions face the shuttle or face away from the thing the shuttle docks with.
 
If a shuttle's mobile docking port direction is different then the stationary docking port's direction, the shuttle and all items on it will be rotated accordingly.
 
''The bounding box for the mobile dock must fit inside of the stationary dock (after any rotation) or the shuttle will refuse to move.''
 
If the shuttle's mobile docking port is in an area that is a subtype of /area/shuttle, only turfs in the bounding box in that same area are moved. Otherwise it moves all turfs in the bounding box. This can be used for odd-shaped shuttles.
 
The emergency shuttle and cargo shuttle need special subtypes of the dock type, eg /obj/docking_port/mobile/emergency.
 
The other variables of note is traveldir, which defines if the shuttle rotates on transit and its angle in degrees (imagine the shuttle is inside a circle, if you want the shuttle going right to left set it to 270 degrees).
 
====Dwidth and Dheight====
dwidth/dheight is the offset of the docking_port obj from the (0,0) bounding box corner. If dir = 1 (north), 0,0 is the bottom left corner. This changes for each direction, for example when dir = 2 it's the upper right corner. So dwidth and dheight identify where the bounding box starts relative to the docking port obj, whereas width and height determine the actual width and height of the bounding box.
 
''We count step 0 as a tile, so a height and width of 9 is actually 10 tiles (tile 0 to tile 9).''
 
Here is an example for the north facing shuttle dock direction - you can rotate this image to determine where the offset is for each other cardinal direction.
[[File:ShuttleBox.png]]
 
===Do Not Edit These on the Map===
A small list of things to avoid editing on the map, you should instead find the relevant .dm file to do these in.
 
Paper names and descriptions. Mob names and descriptions. Area names and descriptions. Adding items to all lockers (a small selection of a locker subtype is fine, but not when you need to add an item to every one). Vendor contents.
 
===Pipes and manifolds===
===Pipes and manifolds===
Atmospherics releases it's cocktail of gases into the air supply loop (blue pipes). The station is also equipped with a scrubber loop, which filters unwanted gases and sends them back to atmospherics via the scrubber loop (red pipes).
Atmospherics releases it's cocktail of gases into the air supply loop (blue pipes). The station is also equipped with a scrubber loop, which filters unwanted gases and sends them back to atmospherics via the scrubber loop (red pipes).
Line 103: Line 191:
Junction pipes serve a purpose like manifolds do to pipes, except they only allow anything coming into the pipe to go out one way. The arrow on the pipe shows the direction anything inside it will go.
Junction pipes serve a purpose like manifolds do to pipes, except they only allow anything coming into the pipe to go out one way. The arrow on the pipe shows the direction anything inside it will go.


Sorting pipes check for destination tags (from [[Cargo]]) on objects passing through. If a destination tag is found with the same value as the sortType var on the pipe, then it is moved out of the main disposals line. In the image, objects passing through that are tagged to CMO will be moved out into the straight pipe on the right. SortType values for pipes can be found [https://github.com/yogstation13/Yogstation/blob/b01b48e41bcf98f330d6e2fb82afe2cac2ab1b07/code/_globalvars/lists/flavor_misc.dm here].
Sorting pipes check for destination tags (from [[Cargo]]) on objects passing through. If a destination tag is found with the same value as the sortType var on the pipe, then it is moved out of the main disposals line. In the image, objects passing through that are tagged to CMO will be moved out into the straight pipe on the right. SortType values for pipes can be found [{{Constant/Giturl}}/blob/b01b48e41bcf98f330d6e2fb82afe2cac2ab1b07/code/_globalvars/lists/flavor_misc.dm here].


===Access===
===Access===
Line 112: Line 200:
Multiple accesses to doors are handled by adding a semicolon (with no spaces) between access values, using the "req_one_access_txt" var (eg. "28;31" is for Kitchen and Cargo access). This is useful for small maps, such as Omegastation, where jobs need to share access due to cramped spaces.
Multiple accesses to doors are handled by adding a semicolon (with no spaces) between access values, using the "req_one_access_txt" var (eg. "28;31" is for Kitchen and Cargo access). This is useful for small maps, such as Omegastation, where jobs need to share access due to cramped spaces.


There's an important difference between the two that you need to pay attention to - req_access_txt requires '''All listed accesses''' to open the door, while req_one_access_txt lets anyone with '''one of the listed accesses''' open the door. For example - say you want your Brig to be accessible by the Detective and Security Officers, we would put "63;4" in '''req_one_access_txt''', because we want the Detective and Security to have access. If we used req_access_txt, you would need both accesses to open the door, meaning neither the Detective or Security could open it.
There's an important difference between the two that you need to pay attention to - req_access_txt requires '''all listed accesses''' to open the door, while req_one_access_txt lets anyone with '''one of the listed accesses''' open the door. For example - say you want your Brig to be accessible by the Detective and Security Officers, we would put "63;4" in '''req_one_access_txt''', because we want the Detective and Security to have access. If we used req_access_txt, you would need both accesses to open the door, meaning neither the Detective or Security could open it.


You can view all of the access values in the access.dm file, or view them [https://github.com/yogstation13/Yogstation/blob/bb3c47b03178f6290b34b10e1dac0882121cf1af/code/__DEFINES/access.dm here]. If you get confused, you can take a look at Boxstation's map file and check the value on the door you're looking for.
You can view all of the access values in the access.dm file [{{Constant/Giturl}}/blob/master/code/__DEFINES/access.dm here]. If you get confused, you can take a look at Boxstation's map file and check the value on the door you're looking for.


===Airless Floors===
===Airless Floors===
Line 139: Line 227:
☑ Areas are balanced correctly (eg. the Vault should be made of reinforced structures and electrified windows, the Kitchen should not).<br>
☑ Areas are balanced correctly (eg. the Vault should be made of reinforced structures and electrified windows, the Kitchen should not).<br>
☑ Areas are not too empty.<br>
☑ Areas are not too empty.<br>
☑ Disposals is connected and works.
☑ Disposals is connected and works.<br>
☑ All station rooms have gravity.
 
'''Checking tools:'''<br>
These are in-game tools that will provide you with a list of mapping errors:<br>
* Admin tab, Get Current Logs, map_errors.log. This will provide you with a list of errors, such as APCs placed wrong or duplicated pipes.
* Debug tab, Debug verbs - enable, Mapping tab, Camera Report/Check Plumbing/Check Power/Test Areas. These will provide you with different checks.


'''If all your checks pass, then [[Map Merger|map merge]] and [[Setting up git|PR]] your change.'''
'''If all your checks pass, then [[Map Merger|map merge]] and [[Setting up git|PR]] your change.'''


==Map Merger==
==Before Making Your PR==
It is important that you use the [[Map Merger]] tools before committing any changes to a map. See [[Map_Merger|here]] for how.
===Final Requirements===
''This requirement assumes you have made a completely new map. If not, then ignore it and move on to map merger.''


==Step X and Y==
Make sure your map is in its own folder inside "_maps/map_files". Follow the naming structure of the other maps and folders.
If you compiled the map and suddenly whenever you move you no longer get the animation of moving but just 'appear' on the next tile, this problem has occurred. Step_x and step_y were introduced to allow pixel based movement. SS13 does not utilize this. Step_x and step_y are variables that each atom has. The way they work is that as soon as you set any object on the map to use one of these variables, the game interprets that you overrode all default movement code and wrote your own - but you didn't. Luckily it's a really easy fix.


To fix this problem you need to close dream maker (save the project first, obviously). Open your map (.dmm) file in a text editor, such as notepad or notepad++. Search (ctrl+f) through the file for step_x and step_y and remove any reference to it. Once no more instances of step_x or step_y are found in the file, save it and open it in dream maker once again. Compile the code and movement should work fine once more. Ask on our discord if you need any extra help.
In "_maps/_basemap.dm" you will need to insert a new line, "#include "yogstation\map_files\YogsPubby\YogsPubby.dmm". Replace YogsPubby with your folder name and file name.


==Shuttles==
In "_maps", make a new .json file. I copied an existing one and used an [https://jsonformatter.org/json-viewer online editor] to view the file. This file should contain the following:
There are 3 types of shuttle dock:
  {
*Stationary - places where the shuttle can dock
    "map_name": "YogsPubby",
*Transit - shuttle as it moves
    "map_path": "map_files/Yogspubby",
*Mobile - the place with the actual shuttle
    "map_file": "Yogspubby.dmm",
You will have a transit dock in the transit area, 2 stationary docks (one in centcom, one in the station) and 1 mobile dock in centcom for most shuttles.
    "shuttles": {
      "emergency": "emergency_pubby",
      "whiteship": "whiteship_pubby",
      "ferry": "ferry_fancy",
      "cargo": "cargo_box"
      }
  }


The shuttle docks are grouped by id: eg. id = "cargo_away", id = "cargo_transit"
Replace yogspubby with the appropriate names for your map, and change the shuttles if needed.


You need to add the dock types to the map and edit the bounding boxes via varediting the dock. You need to varedit height, width, dheight and dwidth at minimum. These are offset by the dir so do keep that in mind, eg if dir = 2 then width goes from EAST to WEST, if dir = 4 then width goes from NORTH to SOUTH and dwidth/dheight are offsets from the lower-left corner of the plane switched to the dock's dir.
In "_maps", make a new .dm file containing the line, "#define FORCE_MAP "_maps/yogspubby.json". Replace yogspubby with your .json file name.


You should also ensure the directions face the shuttle or face away from the thing the shuttle docks with.
In "config/maps.txt", make a new line containing:
  map yogspubby
  endmap


If a shuttle's mobile docking port direction is different then the stationary docking port's direction, the shuttle and all items on it will be rotated accordingly.
===Map Merger===
It is important that you use the [[Map Merger]] tools before committing any changes to a map. See [[Map_Merger|here]] for how.


''The bounding box for the mobile dock must fit inside of the stationary dock (after any rotation) or the shuttle will refuse to move.''
==Step X and Y==
If you compiled the map and suddenly whenever you move you no longer get the animation of moving but just 'appear' on the next tile, this problem has occurred. Step_x and step_y were introduced to allow pixel based movement. SS13 does not utilize this. Step_x and step_y are variables that each atom has. The way they work is that as soon as you set any object on the map to use one of these variables, the game interprets that you overrode all default movement code and wrote your own - but you didn't. Luckily it's a really easy fix.


If the shuttle's mobile docking port is in an area that is a subtype of /area/shuttle, only turfs in the bounding box in that same area are moved. Otherwise it moves all turfs in the bounding box. This can be used for odd-shaped shuttles.
To fix this problem you need to close dream maker (save the project first, obviously). Open your map (.dmm) file in a text editor, such as notepad or notepad++. Search (ctrl+f) through the file for step_x and step_y and remove any reference to it. Once no more instances of step_x or step_y are found in the file, save it and open it in dream maker once again. Compile the code and movement should work fine once more. Ask on our [{{Constant/Discordurl}} discord] if you need any extra help.
 
The emergency shuttle and cargo shuttle need special subtypes of the dock type, eg /obj/docking_port/mobile/emergency.
 
The other variables of note is traveldir, which defines if the shuttle rotates on transit and its angle in degrees (imagine the shuttle is inside a circle, if you want the shuttle going right to left set it to 270 degrees).
 
===Dwidth and Dheight===
dwidth/dheight is the offset of the docking_port obj from the (0,0) bounding box corner. If dir = 1 (north), 0,0 is the bottom left corner. This changes for each direction, for example when dir = 2 it's the upper right corner. So dwidth and dheight identify where the bounding box starts relative to the docking port obj, whereas width and height determine the actual width and height of the bounding box.
 
''We count step 0 as a tile, so a height and width of 9 is actually 10 tiles (tile 0 to tile 9).''
 
Here is an example for the north facing shuttle dock direction - you can rotate this image to determine where the offset is for each other cardinal direction.
[[File:ShuttleBox.png]]
[[Category:Guides]] [[Category:Game Resources]]
[[Category:Guides]] [[Category:Game Resources]]
{{Contribution guides}}
1,133

edits

Navigation menu