screenshot

screenshot

Development

Editing without compiling

No maps were extracted, recompiled or vmex'ed to make CSS SCI FI. All maps included as part of the game are the original maps, unedited and completely intact.

All bsp files for the Source engine contain an entity table which tells the game where to place entities and how they should behave. SMOD (as well as several other mods) contains code which edits this entity table on the fly when the map is loaded. The entity table edits are kept in a "mapadd" file which is completely separate from the map bsp. When the mapadd file is used in conjunction with a Lua engine, complex and controlled behaviours can be produced, resulting in the gameplay experience that is CSS SCI FI.

Placing entities

Almost all entities available in HL2 can be placed in this way. In addition to a range of NPCs and props, players of CSS SCI FI will see path tracks and corners, point spotlights, logic compares, instant triggers, assaults and even the little-used physics_cannister to name but a few. All keyvalues for each entity can be set as normal. Their values can be governed either by set inputs or through the use of random integers, such as the choice of additional equipment used by NPCs or the type of headcrabs which emerge from an env_headcrabcannister.

All placements were made using a series of simple console commands documented in the Valve Developer Wiki. The most important of these are:

"noclip" - move and test walkable areas.
" r_drawclipbrushes 1" - show clip brushes (which are absolutely everywhere in CS:S maps!).
"impulse 90 " - show the current coordinates. These can then be used as the "origin" and "angle" for an entity at that location.
"drawcross" - visualize the planned location of entities.
"ai_show_connect" - ensures entities can make it around the map. Red lines are failed connections (see below for more about navigation).
"ent_fire" - allows inputs on entities to be tested in order to see what works in game.
"ent_text" - gives complete on-screen information about entities under the crosshair

It is also recommended that the following startup options are used:

"-condebug" - prints everything from the console into a log file from which coordinates from the "getpos" command can be copy and pasted, rather than from the console itself.
"-dev" - outputs more verbose descriptions of errors and engine events (and because of this it is not recommended to always play using it, only when editing). Includes specific line numbers of lua engine errors, which is very important for bugfixing.

Many of these commands are already bound to keys in the css_sci_fi_dev.cfg, which can be added to the autoexec if desired.

It is strongly recommend that a programming application such as notepad++ or SciTE is used for editing. Such programs greatly enhance the reading and processing of long chains of commands, and are especially helpful for ensuring that all brackets and commands are properly encapsulated and ended.

Node graphs from nav files

Making node graphs for ai navigation is an essential step in script construction, but is easily done using a few simple commands. First, load the map without a mapadd or lua. You do not need to move or delete any of the original nav or bsp files. Leave the map and its nav file in your ..\counter-strike source\cstrike\maps folder.

It is recommended that you do all editing in windowed mode at a lower resolution than you would normally play, as you will be switching back and forth between the game and explorer throughout the process.

To generate an smod node list:
1. Load the map
2. Enter the command "nav_converttoainode".
3. Enter the command "ai_snl_save". The resulting file will have the same name as the map but with the extension .snl and will appear in your smod\mapadd folder.
4. Move the .snl file from the mapadd folder to the "..\smod\mapadd\nodes" folder.
5. Reload the map. Use the command "ai_show_connect" to view the node graph. This shows you all the possible routes ai will use to move around the map.
6. Use the command "npc_create npc_citizen" to create a citizen npc. Making sure notarget is off, walk around the map with the npc citizen. If any of the connections in your node graph turn red, then this indicates a connection which cannot be travelled by an npc.

To enhance a node graph (the following instructions are illustrated on this page, which you may wish to open in a new window to follow along):

1. With your npc citizen at your side, and the node graph visible ("ai_show_connect" and "ai_nodes"), enter the command "give weapon_nodemaker". You should drop all your other weapons to ensure you always have the nodemaker selected. (picture 1)

2. The nodemaker has a number of different functions. First, it can join unlinked nodes already which already exist. To make a path between two nodes, highlight one by placing the red crosshair over it until it turns blue (the nodemaker uses a vector based crosshair which will not match the standard HL2 crosshair). Then press mouse2 (the nodemaker functions cannot be remapped). The node will then turn red. Then highlight another node by placing the crosshairs over it. Press mouse1. Both nodes will flash white for a moment and then a green line will form between them (or a red line if the ai thinks the connection is invalid). You can join as many nodes as you wish, but keep in mind that it only makes sense to join the closest unlinked nodes in any given area. (pictures 2 to 6)

3. When you have finished linking nodes, use the command "ai_snl_save" again. This will save the node list in your mapadd folder, which, if you are happy with the results, you must move to your mapadd\nodes folder.

4. If you do not wish to keep your changes, then reload the map. Any unsaved edits will be lost. As far as I know there is no way to delete nodes, so if you make a mistake you can either leave the node or connection in place and let the ai ignore it, or you can reload and start over.

5. The second function of the nodemaker is to create nodes. Point the nodemaker at the ground in an open area. Press mouse1. This creates a node. You must then link it to other nodes as above. You can normally do this as many times as is necessary for your map, keeping in mind that node placement should be as efficient as possible while still providing enough options for the ai. (pictures 7 and 8)

6. When you have finished, save and move the node list as above.

7. A third function of the nodemaker is that it can make nodes a specified height above the surface of any brush. By scrolling the mouse wheel up and down, you can increase or decrease the distance from the surface that the nodemaker will make a node. This can be useful in some situations where you need to maintain a certain distance from objects. Note that ground nodes more than 10 units off the ground cannot be used by ai, so you will want the distance measure to be scrolled to zero most of the time. This function can be useful when making air nodes a given distance off the ground. It's also very handy as a measuring tool when placing entities in the scripts. (picture 9)

8. A fourth function of the nodemaker is to create nodes based on your current position. With the nodemaker selected, press the f key. This will change the function of the nodemaker to "direct target". This means that rather than produce nodes where the nodemaker is pointing (which is called trace target and can be returned to by pressing f again) it now will produce a node based on your current position. Otherwise, the functionality is the same: mouse1 to make a new node, mouse2 to select an existing node, and mouse2 then mouse1 to link two nodes. Note that as in all of HL2 editing, your position is not your feet, it is the centre of your view, so you will have to use noclip to get inside nodes and move around. This feature is ideal for making and linking air nodes, which cannot easily be found using the tracetarget mode.

9. A fifth function of the nodemaker is to make different kinds of nodes. With the nodemaker selected, press the r key. This will change the type of node created to the following:
0 - ground node
1 - air node
2 - climb hint
3 - crouch hint
4 - jump hint
Pressing r again returns to ground node.

To view these nodes, enter the commands "ai_nodes", "ai_show_connect" and "ai_show_hints". If you are working with air nodes, use the command "ai_show_connect_fly". This will show valid connections for flying entities. To see valid connections for jumping entities, use "ai_show_connect_jump".

You can transform hints into other types by manually editing your .snl file. For example, it is possible to transform air nodes into info_node_hint type 904 (strider node) by changing the first 3 digits in that node's line in the snl file. Be cautious when editing the snl list, as deleting any lines will cause the game to crash.

Nodemaker quick reference:
mouse1 - create new node in space or select link target when another node is selected.
mouse2 - select a node. Then press mouse1 to link that node to the previous node.
f - change from trace target mode to direct target mode. Other commands are unaffected.
r - change node type.
mouse wheel up/down - raise and lower the distance from a brush the nodemaker creates a node in trace mode.

10. When you are finished, you must save the node graph as above.

Occasionally you will want to place a prop to allow ai to navigate over gaps, as this is more reliable than jump hints. You can see how I have done this in Port and Piranesi.

Node graph issues

The maximum number of nodes possible in SMOD is 3000. Some maps will have more nodes than this, especially if the nav was auto-generated in CS:S (such nav files do not make good node lists). If a node is added to such a map, the last node in the node list is deleted. This will always be the last node created, so this effectively means that nodes cannot be added to these maps.

Some nav files cannot be converted at all. The nav files for CS_Italy, CS_Havana and CS_Compound could only be converted to an SMOD node list by setting nav_converttoainode_nolink to 1, which means that the nav points will be converted to nodes, but these nodes will not be linked to one another. This means that ai will spawn, but cannot move because it is impossible to build routes without links. When attempting to convert these nav files with the links turned on, the engine checked the nav ids as normal, but then returned an endless series of "Reference Count for Material" lines for every material in the map, which then crashed the game. To see a console log of this, along with the unlinked .snl files, please download this file. If you try to create a new node list from a nav file when an existing node list is already present, you will get the same error. It is unknown at this time whether these issues are related.

It would be possible to re-link by hand every node in these maps, but linking 1221 nodes (the count for CS Compound) is beyond even my patience. If someone could describe commands for mass linking SMOD nodes I would be very grateful. It would be very nice if the SMOD author could find a way to automatically link nodes, in the same way the HL2 engine builds ai node graphs. In HL2, all nodes within 720 units of one another are automatically linked, resulting in beautifully complex possibilities for navigation, as shown in this picture.

Once you are happy with your ai's ability to navigate, you are ready to place entities and start scripting.

Entity issues

1. Templates. It is not possible to use templates in scripts, which means some situations which rely on them, such as dropships and buried antlions will not work. Even if the template flag is checked, the entity spawns. This is why my use of dropships is sparse, and is a copy of the fake drop scripted by the SMOD author in d2_coast_04.

2. Brush based entities. Most brush based entities, such as info_apc_missile_hint and trigger_multiple do not function when spawned in a mapadd.

3. Crashes. The npc_turret_floor and npc_cscanner cannot be used in lua scripts. The npc_turret_floor will crash the game every time if it falls over while active, if it is spawned through the lua. If it is spawned using the mapadd (either randomly or in a specific location), the entity causes no problems.

4. Vehicle spawns. The helicopter and apc only work if you spawn them in the map on start (in the "entities" section of the mapadd). Gunships and dropships, on the other hand, can be spawned at any time. If you try to spawn a helicopter or apc from the mapadd at a time other than the start, the game will crash. The solution is to spawn the entity in the map, but silent and hidden, then activate it, or even teleport it, from its hidden location to another location.

5. Development outtakes. Click here for a page of development outtakes.

css sci fi amphibian mods moddb Valve SMOD This work is licensed under the Creative Commons.