Fangame How-to:SonicGDK/Building a map
From Sonic Retro
Revision as of 16:15, 1 June 2014 by Xaklse (WIP... expanding tutorial.)
(Original guide by Xaklse)
Now that you have installed SonicGDK, you can create actual game levels, also known as maps in Unreal.
Run the UDK Editor and close all the windows that appear. Create a new blank map (File>New...>Blank Map); the editor may be a bit daunting at first, but you don't have to learn all the functions associated to every button, so check the following pictures to get started. The screen space that contains the black void with the blue grid and the red cube is called a viewport.
Let's create a new map by using one of the existing map templates, do so by selecting the File>New...>Midday Lighting option (Figure 1). After the map is loaded, click on any part of the map and move around with the WASD keyboard controls. QEZC keys also let you move up/down and zoom in/out. Hold down the right mouse button and move the mouse to rotate the camera.
Open the Search For Actors window (Figure 2); there you can see the objects that are placed in the map:
- Brush_0 is the Red Builder Brush which is like a cookie cutter or a template; you can reshape it and then use it to create an additive or subtractive brush that will alter the map's space. You can construct the level only with brushes, but UDK heavily rely on static meshes. Unfortunately, if you need new static meshes, 3D modeling software is required to create them.
- StaticMeshActor_3 is the static mesh used for the floor; StaticMeshActor_5 is the cube that is on the floor.
- InterpActor_3 is the sky dome, which happens to be a dynamic/movable static mesh.
- WorldInfo_0 represents the world itself, it contains all the objects and holds important information about the map and the game.
- PlayerStart_0 is the player start location, which is organized into a network of navigation points.
- The other objects are related to lighting and fog.
Double-click on the PlayerStart_0 word to select and focus on the corresponding object, and close the Search For Actors window. Now right-click on the PlayerStart object and replace it with a SGDKPlayerStart object (Replace With>All Templates>Add SGDK PlayerStart>OK, Figure 3). You do this because SonicGDK uses a special type of PlayerStart.
Each object has configurable properties, if you double-click on any of them, or select one of them and press F4 key, the Object Properties window appears with a list of properties and their values. When you mouse over the name of a property, the editor usually displays tooltips, which are very important to check if you want to know the effects of changing a value.
(Optional) When a map is played, UDK opens it with a predetermined gametype, which is the one that belongs to SonicGDK. You should select the default gametype to use for this map anyways, just in case you want to change it in the future. Select the View>World Properties option and expand the Game Type section; change the Default Game Type and Game Type For PIE properties by choosing SGDKGameInfo instead of None.
Now find the button that has a green playback icon (Figure 4), that's the "Play in Editor" (PIE) button that allows you to play a map without closing the UDK editor. Click on the button and play. To close the game window that appears, just press the Esc key. You can also right-click somewhere on the floor of the map and play from there (Play from Here).
Notice that a "PATHS NEED TO BE REBUILT" message is displayed while playing the map; to get rid of it you have to rebuild paths (Build>AI Paths). The invisible network of paths will be updated, and if you pay attention to the SGDKPlayerStart object, it will move automatically to a better position to fit character's size.
While creating a level, objects/actors are placed into the map, moved around to create an environment, and their properties modified so that they look or behave appropriately. To quickly add detail to a map, you should place static meshes (StaticMeshActors). Open the Content Browser window and drag from it a StaticMesh and drop it onto the viewport in the location of the map you would like the actor to be placed (Figure 5); a StaticMeshActor with the shape you selected in the Content Browser appears. Close the window and move/rotate/scale the StaticMeshActor; to do that press Space bar to cycle between modes, grab any part of the red/green/blue widget and drag.
If you place a looping, you play the map and try to run on the looping, you'll notice that you can't. SonicGDK adds to UDK the "Sonic Physics mode", a new physics mode that lets the playable character to walk on steep slopes and walls/ceilings. It only must be used on smooth curvy geometry (no little extrusions or holes) and its calculations are complex and very expensive, so activate it where it's really needed. If you want a walkable static mesh to be compatible with "Sonic Physics mode", you have to place a SGDKStaticMeshActor with the corresponding StaticMesh, or encompass a StaticMeshActor with a SonicPhysicsVolume.
Open the Content Browser window and select from it a StaticMesh that you want to use with "Sonic Physics mode". Now close the window, right-click on the floor and place a SGDKStaticMeshActor object (Add SGDK StaticMesh: ..., Figure 6). Now the special physics mode kicks in whenever the character walks on that object.
To enable "Sonic Physics mode" on parts of StaticMeshes, on solid geometry generated by brushes, or on a terrain/landscape, you have to use a SonicPhysicsVolume to encompass the walkable surfaces. You create brushes and volumes with the Red Builder Brush; change its shape, move/rotate it and place a SonicPhysicsVolume with it (Figure 7, note the three highlighted buttons).
(Optional) By default, new maps use Lightmass, a static "global illumination" solver for lighting scenes; rebuilding lighting for a large or complex level takes a lot of time. Lightmass can be disabled: select the View>World Properties option and expand the Lightmass section; change the Use Global Illumination property by leaving it unchecked. Now global illumination is disabled, but you'll have to place additional light sources into the map. Lights placement and configuration are beyond the scope of this guide.
Notice that a "LIGHTING NEEDS TO BE REBUILT" message is displayed while playing the map; to get rid of it you have to rebuild lighting. Open the Lighting Build Options window (Build>Lighting), select the Build Quality and press the OK button.
The KillZ is an invisible plane that kills characters/objects when it's touched; that way any object that falls out of the environment doesn't fall forever. Let's change the KillZ value; select the View>World Properties option, expand the Zone Info section and change the value stored in Kill Z. Set it just below the lowest point in your playable level and make sure no killable object is below this height. The KillZ line as such shows up in the 2D Front/Side viewports as a red line (Figure 8, make sure your KillZ is lower than this example!!).
(Avatar placement & configuration)
Let's place a pawn template from which the playable character object will take many configurable parameters. Open the Content Browser window, click on the Actor Classes tab and go to the SGDK>Invisible>PawnTemplates section (make sure the Show Categories option is enabled and works!!). There you can see the different classes of PawnSonic:
- PawnSonic is the default playable character of SonicGDK, it has a balanced set of skills and physics values.
- PawnSonicModern is an amalgam of Sonics from Adventure and Modern game series, it has all skills fully enabled and higher speed values.
- PawnSonicClassic is the Sonic of old/classic games; it has few skills and it's slower than the other classes.
Choose the Sonic class you want to be the default playable character for your map; drag from the Actor Classes window the word item and drop it onto the viewport in the location of the map you would like the actor to be placed (Figure 9). A model of Sonic in its reference pose appears; notice that when selecting the model, a green wireframe cylinder is displayed which is the collision cylinder that interacts with the world and can't be modified. However, you can change the mesh and many other properties through the Object Properties window. Double-click on Sonic, expand the Template section, expand its Misc sub-section and tick Default Pawn Class checkbox; this way this type of Sonic is used as the default playable character for your map.
Let's swap the player model with Epic's Cathode the Robot (Figure 10). Go to each sub-section and change these properties (copy-paste text to each field):
- Template>Mesh>Visible Mesh>Skeletal Mesh Component>Skeletal Mesh = SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_CH_LIAM_Cathode'
- Template>Mesh>Visible Mesh>Skeletal Mesh Component>Anim Tree Template = AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
- Template>Mesh>Visible Mesh>Skeletal Mesh Component>Physics Asset = PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
- Template>Mesh>Visible Mesh>Skeletal Mesh Component>Anim Sets> = AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
- Template>Mesh>Visible Mesh>Primitive Component>Scale = 0.7
After changing the values, play the map and see the results; you should be moving the robot instead of the default Sonic model.
You should also experiment with other configurable properties, like those included in the Skills and Physics sub-sections, and remember that when you mouse over the name of a property, the editor usually displays tooltips.
The different types of placeable rings are: RingActor, RedRingActor and GiantRingActor. RingActor_Dynamic is a variant of the RingActor that can be created on the fly by splines (curved paths), so don't use it unless you're creating an archetype.
Another useful type is the RingProjectile, which represents a dropped/magnetized ring. You can use Kismet and this class to create a fountain of rings.
Let's place classic ring items; open the Content Browser window (Figure 5), click on the Actor Classes tab and go to the SGDK>Visible section (make sure the Show Categories option is enabled and works!!). Drag from the window the word RingActor and drop it onto the viewport in the location of the map you would like the item to be placed. A ring appears; double-click on it to change its configurable properties through the Object Properties window, mouse over the name of a property to display a tooltip.