Ko/Level Design Introduction (Portal 2)/Your First Level

__TOC__
는 Hammer editer에서 Block을 사용해 만든 물체를 이릅니다. brush는 대부분의 레벨에서 천장과 바닥과 같은 주요한 표면을 만드는 데 사용됩니다. 이 문서에서는 brush를 이용해 작은 방을 만드는 방법을 설명합니다.
== 바닥 브러시 만들기 ==
# 왼쪽의 Tool 바에서 Block Tool을 선택하십시오. .
# Top 스크린에서 좌클릭하고 512*512만큼 끌어당기십시오. Right와 Downward 스크린에서도 각각의 시점으로 보여집니다.
# 키를 눌러 상자를 만드십시오.
이제 Tool 바의 Selection tool 아이콘을 누르거나 키를 눌러 Selection mode로 전환하십시오.
selection mode에서는 선택된 브러시의 크기나 모양을 변형시킬 수 있습니다. 박스를 좌클릭하고 윤곽선의 점들을 끌어당겨 크기를 변형할 수 있습니다.
브러시가 너무 두꺼우니 두께를 64에서 16으로 바꾸십시오. 그러나 그 전에, 우리는 그리드의 크기를 수정해야 두께를 수정할 수 있습니다.
=== grid ===
2D views 스크린에서 보여집니다. 기본적으로는 모든 물체는 grid에 맞춰 고정됩니다. grid는 끌 수 있지만 grid를 킴으로써 기타 에러를 방지할 수 있어 그리드를 켜 놓는 것을 추천합니다.
기본적으로 그리드는 한 칸에 64 units입니다. 그리드의 크기는 Hammer editer 창의 오른쪽 아래에 표시됩니다.
* Smaller Grid 아이콘을 클릭하거나, 를 눌러 grid의 크기를 크게 만들 수 있습니다.
* Larger Grid 아이콘을 클릭하거나, 를 눌러 grid의 크기를 작게 만들 수 있습니다.
=== 바닥 두께 수정 ===
상자를 좌클릭해 선택한 다음 끌어당겨 16 units로 만드십시오.
그리드 크기를 전환시켜야 규격에 맞게 두께를 수정할 수 있습니다.
=== 브러시 이동시키기 ===
Selection Tool을 이용해 브러시를 옮길 수 있습니다. 브러시의 윤곽선이나 브러시의 중앙에 있는 x를 클릭하여 포인터가 모양으로 바뀌면 브러시를 드래그해 이동시킬 수 있습니다. 
방향키(화살표 키)로도 브러시를 이동시킬 수 있습니다. 그러나 그러기 위해서는 Hammer editor 환경을 수정할 필요가 있습니다:
# 화면 상단의 Tools 메뉴에서 Options을 선택하고 Configure Hammer를 클릭하십시오.
# 2D Views 탭으로 이동하십시오.
# 많은 설정들이 있지만 지금은 Arrow keys nudge selected object/vertex를 OK로 전환하십시오.
이제 브러시를 아래 방향키를 눌러 이동시켜 보십시오. 
== 2D viewport 조작 ==
* 스크롤 바를 통해서도 시점을 이동할 수 있습니다.
* 더 빠른 방법으로, 를 누르고 화면을 드래그하면 시점 이동이 가능합니다. 3D view에서는 방향이 전환됩니다.
* 마우스 휠을 이용해 확대하거나 축소할 수 있습니다.
== Texture 수정하기 == 
3D camera viewport에서 Texture를 보려면 3D camera viewport에서 camera 텍스트를 마우스 오른쪽 버튼으로 클릭하고 3D Textured를 선택하십시오.
=== 3D camera viewport 조작 ===
3D viewport 조작과 2D viewport 조작은 비슷하지만 조금 다릅니다:
* 키를 누르고 화면을 좌클릭 드래그하면 시점을 회전합니다.
* 키를 누르고 화면을 우클릭 드래그하면 자유 이동합니다. 2차원 방향으로만 이동하며 기준은 적용시점입니다.
* 키를 누르고 양쪽 마우스 키좌클릭 우클릭를 누르고 드래그하면 자유 이동합니다. 기준은 우클릭 드래그의 수직 방향입니다.
* , , , 를 이용해서도 이동할 수 있습니다.
* 마우스를 3D viewport 중앙에 고정합니다. 마우스를 이용해 시점을 회전하고 , , , 로 이동할 수 있습니다.
3D camera viewport에서 위로 이동하여 아래로 만든 바닥을 보십시오.
바닥에 기본 Texture가 적용되어있음을 알 수 있습니다. 아마도 그것을 바꾸고 싶을 것입니다. 현재 Texture를 변경하려면 Texture 상자의 Browse를 클릭하십시오.
Browse를 클릭하면 Texture Browser 창을 여십시오.
Filter에 바꾸고 싶은 Texture명을 입력하십시오. 일단은 "dev_measure"로 진행합니다. 검색하면 "developer" texture들이 나타날 것입니다. developer 텍스처들은 색감이 단순하고 제도하기 쉽게 단위계가 그려져 있어 개발에 자주 쓰입니다.
이제 dev/dev_measuregeneric01b를 찾고 더블클릭하십시오.
This should bring back the 4 viewports of the editor and place the generic developer texture as the current one in the Texture bar.
Select the floor brush, if it isn't already selected, by clicking on it in the Camera viewport. It should turn red.
After the brush is selected, click on the Apply current texture icon on the Tool bar to apply the current texture to the selection. The gray developer texture should appear on the floor as shown.
== Creating the walls and ceiling ==
Now let's go over how to create the walls and ceiling of the room. The easiest way to do this is to duplicate the floor brush. 
=== Duplicating ===
You can also select an existing brush and duplicate it to create them.
To duplicate:
# Select the floor brush that you've created.
# Move your cursor over the Side viewport.
# Hold the key down and press the key to create a duplicate and move it up 1 grid unit.
This will create a brush exactly like the floor on top of the existing floor.
You can now change the size and dimensions of this new brush to create a wall grabbing the corner handles on the brush and dragging it to the size you wish. Let's make the wall 128 units tall and 16 units thick.
Now duplicate the wall 3 more times to outline the floor.
Duplicate the floor brush 1 more time and raise it to become the ceiling.
== Deleting brushes ==
To delete a brush, select it with the Selection Tool and press the key.
== Multiple selection ==
You'll notice that in the Camera viewport, if you navigate inside the room, it's hard to tell what's going on because all of the walls, floor and ceiling are the same texture. Next we'll change the walls to a different texture.
You can select all of the walls by holding down the key and clicking on them one at a time in the Camera viewport. You will have to use the camera controls to rotate the camera around so you can select each wall.
After you have all of the walls selected, click on the Browse button in the Texture bar. This time, select the orange texture next to the current one, labeled dev/dev_measuregeneric01. Double-click it to select it and close the browser window.
Use the tool on the Tool Bar to apply the orange texture to the walls.
== Saving the file ==
To save a level, you can use + or Save from the File menu.
You will need to give the map a file a name and choose the directory to place it in.
For this tutorial, name the map "tutorial01" and save it into the mapsrc directory, located by default at:
 C:\Program Files\Steam\steamapps\common\portal 2\sdk_content\maps\
Your directory may be slightly different, depending upon where you have installed Steam.
When naming your file, dont give it too long a name. Maps with names of excessive length will not load in-game.
== Included sample maps ==
When you went to save your map, you may have noticed other directories underneath the mapsrc path. The Portal 2 Authoring Tools come with some example maps to help you. (The Portal 2 maps can be decompiled using a tool named .)
Directory 	Contents 	Useful for Studying
maps\mp_coop_doors 	Simple coop map. 	How to begin and end coop maps; how to use glass in coop.
maps\mp_coop_paint_red_racer	Underground-themed coop map with Propulsion Gel. 	How to begin and end coop maps in Underground-themed maps; how to use turrets, lasers and gel in Underground-themed coop maps.
maps\sp_a2_column_blocker 	Single Player map with a Hard Light Bridge and some other stuff. 	Using and placing hard light bridges, lasers, laser catchers, laser relays, panels, turrets, glass, grating, deadly goo, and aerial faith plates in a Portal 2 map.
maps\sp_a2_trust_fling 	Single Player map with Aerial Faith Plates. 	Great for learning about how to make panels for reconstructing-themed maps.
maps\sp_a3_speed_ramp 	Underground-themed Single Player map with Propulsion and Repulsion Gel. 	How to make a simple Underground-themed map for Portal 2.
maps\sp_a4_laser_catapult 	Single Player map with Excursion Funnels, a Laser and a couple of Piston Platforms.	How to place excursion funnels; making piston platforms; working with the Wheatley theme.
maps\zoo_mechanics 	Contains a sampling of some of the gameplay mechanics used in Portal 2. 	More information on creating excursion funnels, gel droppers, deadly goo, etc.
== Placing entities ==
Next we'll place an entity in our level:
# Select the Entity Tool on the Tool Bar.
# Once the Entity Tool is enabled, the Entity selection list on the Object bar becomes active.
# Keep the Categories entry as Entities.
# Click the arrow on the Objects drop down list and select info_player_start.
# Now, navigate in the Camera viewport to the middle of the inside of the room.
# left-click on the floor to place the entity.
# Do the same with weapon_portalgun and try to place it in a position so the info_player_start is touching it.
This will place an info_player_start entity in the middle of the room. You will also receive a Portal Gun when you spawn.
=== Placing a light ===
Now we'll place a source of illumination in the map:
# Select the Entity Tool again
# Select light from the Objects drop down list on the Object bar.
# This time, place the light on the ceiling (above the player's head).
# Go back into selection mode by clicking on the Selection tool in the Tool Bar or by pressing the key.
Next we'll change some settings on the light. Bring up the light's properties by double-clicking it in the Camera viewport or by selecting it (left-clicking on it) and then pressing the + keys. This will bring up the Object Properties dialog box.
From the Object Properties, you can change various properties of the entity. For example, you can change the Brightness of this light. Click on the Brightness row under Keyvalues and you will see a set of numbers on the drop down menu on the right side. The default setting for the brightness of a light is 255 255 255 200. The first three numbers represent the RGB values (color) and the last number represents the intensity of the light. 
You can click on the Pick Color button to select a color rather than input values for it.
Simply click on the color you want the light to be and click OK.
This will bring you back to the Object Properties dialog box for the light. You should see any changes you made to the brightness on the Brightness row and the drop down field on the right side if the Brightness row is selected.
Click the Apply button to set your changes to the entity and close the dialog box by clicking on the "X" at the upper right side of the window.
=== Placing a prop_static ===
Entities also consist of props like furniture, decoration, and complex parts of architecture. There are a variety of different kinds of props. Prop_static entities are props that are static – they don't move, animate, turn on or turn off. There are also prop_dynamic entities that can move, animate, be enabled and disabled. There are also prop_physics entities which the player can interact with and behave physically as they would in the real world.
To place a prop:
# Select on the Entity Tool again.
# Go to the Object bar and change the Objects field to prop_static.
# Point to the floor in front of the info_player_start and left-click to place a prop_static. You will see a red cube that represents the prop_static before a model is attached to it.
# Go back into selection mode by clicking on the Selection tool in the Tool Bar or by pressing the key.
# Double-click on the red cube to open the properties.
# Double-click on the World Model field to open the Model Browser.
=== Selecting the model ===
# In the Filter field at the bottom of the dialog box, type in "paint". This will show all the models that have the word "paint" in their name.
# Scroll down to the one named:
#: "props_underground\underground_paintdropper.mdl".
#: It should look like the image shown.
# Click OK to select it and close the browser and return to the Object Properties dialog box. You should see the name of the model now in the World Model row.
# Click the Apply button to set your changes to the entity.
# Close the Properties box.
You will see the paintdropper that you just placed in the room in the viewports in the editor.
== Moving entities ==
You can move entities like our paintdropper the same way you can move brushes. Click and drag inside the bounding box of the selected entity to move it around with your mouse or put your mouse over any of the viewports and use the arrow keys on your keyboard to move them around. 
== Rotating entities ==
To rotate an object , you simply select the object you wish to rotate using the Selection Tool , then click once on the object. You should see the object surrounded at the corners with circles. Mouse over a circle in any 2D view, then click and drag to rotate the object.
Use your mouse wheel to zoom into the Front viewport and click once inside the bounding box of the paintdropper model to make its four corners highlight with circles around each one.
Left-click and drag in a counter-clockwise motion to rotate the paintdropper so that it can drop paint from the ceiliing. 
== Running your level in the game ==
You have saved your map, but you will also need to compile it before it can be played in the game engine.
When a map is compiled, it is converted from the raw .VMF file that you just saved, into the .BSP format used by the game engine. The geometry is processed and the proper lighting and shadows are pre-calculated with several compile programs.
* Open the File menu, and choose Run Map... or press the key.
* The Run Map dialog will open.
* This dialog is used to set some basic compile parameters.
*# Make sure that Normal is set under the Run BSP, Run VIS, and Run RAD settings.
*# Under Additional game parameters:, make sure these settings are present, and type them in if not:
*#: -toconsole -dev -console +sv_lan 1
*# You may wish to check "Wait for keypress" so that you can see any error messages that occur.
*# Now click the OK button to start the map compile process.
The Compile Process Window will show the progress of the compile. When the compilation is done, the game you are mapping for will automatically launch, and load your map in the engine.
Your level in the game should load up after compiling. It may take a minute or two.
Next time you compile, you may wish to check the "Don't run the game after compiling" checkbox. Otherwise, it will complain that only one instance of the game can run at once. Instead of exiting and relaunching the game (slow!), you can simply recompile the map (F9) and then type map myMapFileName in the developer console to reload the map.
== The Developer console ==
Making levels for Portal 2 sometimes involves using commands typed into the window. The console can also be used to do things like spawn cubes and turrets to test your level.
If you haven't already, make sure the console is enabled in the game:
# Press the key in the game.
# Click on Options, then Keyboard/Mouse.
# Click on the Allow Developer Console and select "Enabled".
# Click on the Done Button.
# Click on Return to Game.
Using the developer console:
# Bring down your developer console (tilde).
# Type any console command and press the key.
# Hide the console again with .
== Noclip mode ==
One console command you'll find constantly useful is noclip mode. This is a mode that let's you fly around the level without being stopped ("clipped") by anything in the level. It's useful to get around large levels quickly.
To enter noclip mode:
* Press to enter the console.
* Type noclip in the console and press .
* Fly around the level.
* Type noclip again to leave noclip and walk around the level normally.
* You can toggle noclip with the press of a button with the bind console command. For example, bind mouse3 noclip for the middle mouse button.
== Some useful console commands ==
There are lots of available. Here is a very small sampling:
; sv_cheats 1
: Turns on cheats. Necessary for many console commands.
; map <name of map>
: Loads a map or reloads the level you're in.
; changelevel <name of map>
: Loads a map while continuing the session.
; god 1
: Turns on god mode for all players. The players are invulnerable.
; noclip
: Allows you to fly through the world.
Category:Portal 2 Level Design