CLICK HERE to visit the new NS2 Wiki! Please do not rely on any information here as it may be inaccurate and/or out of date! For help with NS2, hop onto the official Discord server!

NS2 sample

From NS2 community wiki
(Redirected from Ns2 sample)
Jump to: navigation, search
Current compatible Spark engine version: Betabuild 248

Current map version: build188

This is a tutorial sample map created by Kouji San for you to use and check out. The map is using dev textures mostly, but it is fully playable, The "5 tech_point/8 resource_point" layout it is using is similar to ns2_yttrium, although somewhat simplified. Actually this file was created before work started on that map. The file was used to create this example map, it still needed a roof and walls though.

ns2_yttrium most recent layout

The map can be used as an example for most things in game currently. It will be kept up to date, also introducing things which need to be added with the introduction of new NS2 builds. The first release was ns2_sample-build158, the build version of the map will usually be identical to the latest compatible build of NS2. This only holds true, when a new map version has to be released to address compatibility issues.

Everything has been put into layers, making it is easier to load and easier navigate. If you want to check something out but are unable to find it, make sure you have the related layer set to visible.

Minimum required setup for a test map

Absolute minimum (no commander mode)

To try out something in a test level, these are the absolute minimum required entities that have to be in game for the game to run properly. Otherwise it will start spamming lua errors in the console.

  • 1x light_point, light_spot or light_ambient (you cannot see without one)
  • 2x location entity (each one encasing a "base" -> tech_point, resource_point, power_point)
  • 1x ns2_gamerules
  • 1x pathing_settings (optional)
  • 2x power_point
  • 1x readyroom_start (optional, you will spawn at origin without one X:0 Y:0 Z:0)
  • 2x resource_point
  • 2x tech_point

To test commander mode

To be able to test the commander mode all of the entities listed above need to be present along with the following entities:

  • 1x minimap_extents
  • a working minimap
  • 1x commander_camera (optional)

Map content


You can set light spots to show atmopherics, by using the Atmospheric Density field in it's properties. Anything above 0 in this field will show you a misty atmosphere in it's light field. The color is controlled by changing the light color. With this option active, the light spot still functions normally. It will simply show the misty atmosphere, if players have this set to on.

  • There is a light_spot down below in the ventilation shaft in the West Techpoint room
  • There is a light_spot down in the ventilation shaft in the West Techpoint room
  • There is a light_spot in the vent

Ceiling height of hallways

Since the Onos is a big guy and there is a model of him inside the central tech_point room. So you can see how he relates to the hallway he is standing in front off.

CollisionGeometry Group

The CollisionGeometry group can be used to create invisible faces across detailed areas, to make it easier for the engine to do the hit detection on these props or geometry. It can be found at the center tech_point and also underneath each tech_point. Group names are case sensitive

    • If you do not add collision geometry faces underneath the tech_points, there's a chance you won't be able to place Hives or Command Facilities.

CommanderBuild and CommanderNoBuild Groups

These two groups are used for the commander interaction with the map. As the names imply, CommanderBuild can be used to add invisible geometry to the map which can be used to smooth out the commander build areas. While the CommanderNoBuild group is for areas the commander can go, but should not be able to place structures. Group names are case sensitive

Commander Camera

The commander_camera is located in the Marine Start.

CommanderInvisible Group

The CommanderInvisible group serves two purposes. The first one is to turn geometry invisible for the commander and the second is to exclude it from the minimap generation, which is useful for inaccessible detail which should not be part of the minimap.

ie: The Readyroom is included for these reasons

Death Trigger

A death_trigger has been added at the end of the ventilation system from the central tech_point towards the west tech_point. It is indicated by a "pit of doom" with warning textures around it. To test it, simply jump in. The death_trigger is a little gray block at the bottom of this pit, which can be re-sized. Any player touching this entity will die instantly.


One of the exits of the Marine Start is using a door, it is simply a door entity which uses the double door model. Make sure the sides of the door aren’t visible and also hidden behind a wall of some sort, because when the doors open they are visible from the sides. You have to hide at least half the width of the entire mode behind walls.

Egg starts (obsolete, NS2 build 188)

At least 7 egg_starts had to be present near each potential Hive location tech_point (for each neutral and alien start tech_point in the map). As of Ns2 build188 this is no longer necessary, the game will now generate the eggs dynamically within range of the tech_points

Fans and Vents

A ventilation system can be seen near the center tech_point, showing how to use the props and connect them to other props or walls using faces. There is also a fan using the prop_dynamic with the animation set to "med" (other options: fast, med, slow)

Fog controls

This entity is located in the Marine Start, it is the gray little blob floating near the resource node. You can select colors for your fog, currently it is only possible to place one of these entities and it will affect the entire map fog. There are plans to have the fog_controls entity affect individual areas.


There is a ladder at the central tech_point, when you place a ladder entity, it is a small box. This box can be scaled up to the size you want for you ladder. You have to see this cube as some sort of pipe trough which you can climb.

Ladders are not usable by the alien team

Navigation Points (obsolete, NS2 build 188)

The map is setup with both the AirWaypoints and the GroundWaypoints, which you can see by enabling their respective layers. As of NS2 build 188 they are no longer needed as the game will generate a navigation mesh instead. which can be seen by typing nav_debug in the console, props can be set to be included in the pathing generation

Occlusion Culling

The geometry place in the layer OcclusionGeometry is responsible for the Occlusion Culling. It is basically a shell around the map which is invisible ingame, but is used by the engine to estimate what is visible to the player from any given place. To see how it has been placed, have a look at it by enabling the Occlusion Culling layer.

To tweak your OcclusionGeometry, you can start up your map ingame, enable cheats (console: cheats 1) and activate wireframe (console: r_wireframe -> turn it off: r_wireframe 0). In this render mode you can see what is rendering behind walls, to see if you need to fix areas in your OcclusionGeomtry


There is a generated overview so you will be able to use the Marine Commander or Alien Commander (Hive Mind) mode, I also included an example batch file, which you can simply drag&drop your level file onto. It will generate your overview in the related folders. Your steam folder and map folders will be retrieved from the windows register, so you don't have to change anything in the file. Thanks fsfod for showing me his example batchfile for starting up NS2 mods. I modified it to be used as an overview generation batchfile, using simple drag and drop of your map file.

For those interested in what's inside the batchfile

@echo OFF

SETLOCAL EnableExtensions

FOR /F "tokens=2,*" %%i IN ('reg query "HKLM\SOFTWARE\Valve\Steam" /v "InstallPath" ^| Find /i "InstallPath"')
DO set  SteamDirectory=%%j

@echo Steam directory is: %SteamDirectory%

set InstallPath=%SteamDirectory%\steamapps\common\natural selection 2\
set Level=%~1

@echo Install path is: %InstallPath%
@echo Level: %Level%

start "overviewbatch" /d"%InstallPath%" /b .\Overview.exe "%Level%" ns2


Note: This batchfile is currently only usable on NT5 systems (Windows 2000 and Xp). If anyone would be willing to create a batchfile which is usable on multiple OS versions, it would be highly appreciated

Pathing Settings

It is now required to have one pathing_settings entity in the map, this is used to generate the navigation mesh use by the AI units. You can tweak the settings accordingly to fix certain issues in your map, ie: maximum height an AI unit can traverse, the width and height a potential hallway has to be etc... It can be found in the South Techpoint room

Power Grid

The map has an example Power Grid, showing you how to use the location entities in combination with the power_points. Each power_point is linked to the location it is in and all light within this location entity will power off (go red), if their “Ignore power grid” is set to false.

  • As of NS2 - Build 188, all rooms require a power_point

Random and Fixed starting locations

The tech_points have been set up in such a way, so you as a mapper have full control if you want random or fixed starting locations or a combination of both. The Team Number on the tech_points can be used for this. Ns2_sample has been set up to use random starts, while the center tech_point is excluded from being a starting location, by setting it to use "Don't use as random start" and setting the others to "Either team random start"

  • Some examples using ns2_sample's layout
    • Fixed starting locations
      • 1x Marine start (Marine-only random start)
      • 1x Alien start (Alien-only random start)
      • 3x Neutral tech_points (Don't use as random start)
    • Random starting locations, central tech_point excluded (current ns2_sample setup)
      • 4x Neutral tech_points (Either team random start)
      • 1x Neutral tech_point (Don't use as random start)

Ready Room

There is a fully featured Ready Room in the map, located above and behind the Marine Start. It has 32 ready_room_starts

  • Both team_location and player_start haven been made obsolete as of NS2 build 188, the game will now generate spawnpoints dynamically


A skybox can been seen trough a window (glass prop), with the use of skybox props as well. The skybox entity is in the Marine Start and the skybox is visible from the central tech_point.


You can find an ambient_sound near the fan in the ventilation system, used for the fan sound.

There are also two Reverbs present in the West Techpoint room. The second one can be found down the ventilation shaft. This entity can be used to affect the way sound reverbs in certain rooms, the options are (Generic, Hallway, Vent, Medium Room, Large Room, Big Hallway)

Release List

  • 2010, December 07 - ns2_sample-build158 OBSOLETE!
  • 2010, December 21 - ns2_sample-build160 OBSOLETE!
  • 2010, December 23 - ns2_sample-build160_01 OBSOLETE!
    • Added a fan with shadow-casting lights at the bottom of the "pit of doom" as Wheeee suggested when testing the map. It also has an ambient_sound, The same one as the one in the ventilation
    • Added the new overview.bat, which can be used for any map by dragging and dropping the level file onto the batchfile. You can thank fsfod for providing me with an example batchfile, I could modify to be used as a drag and drop overview batchfile.
    • Changed the cast shadows setting of the beams at the glass window to true, now the spotlight outside the map can cast shadows into the room of those beams.
    • Changed the commander alpha of the glass window at the central tech_point to 0, commanders could build on it.
    • Changed the volume of the ambient_sounds from 0.5 to 1.0, they were barely audible
    • Increased the range of the spot_light casting light into the central tech_point, the shadows are more visible now
    • Moved the ReadMe text file into the map folder and now using this format "[mapname] [version]-ReadMe.txt"
    • Removed the overview-ns2_sample-build160.bat
  • 2011, May 04 - ns2_sample-build176 OBSOLETE!
    • Added a CollisionGeometry at the center tech_point
    • Added an Airwaypoint and a Groundwaypoint in Marine Start to their respective groups/layers, they were not in a group/layer
    • Added more faces around the door, when open the doors were visible trough the walls
    • Added CollisionGeometry (one face) underneath each tech_point, apparently the commander was unable to place buildings on them when it is a hole into nothingness
    • Added the faces above the door and the faces in the "pit of doom" to CommanderInvisible group and layer
    • Added the ventilation faces to the commander invisible group and changed the ventilation props commander alpha to 0
    • Build version has been changed to match the latest NS2 build
    • Changed the Alien team_location to Alien only (it was set to neutral, not that it caused an issue)
    • Changed the ceiling texture angle of one of the vents from 90 to 0
    • Fixed a "leak" inside the vent near the fan on the inside corner of the ventilation shaft
    • Textured floors make sure you actually hear footsteps
  • 2011, November 24 - ns2_sample-build188
    • Removed a face at the door, which was basically a backface to the one faces inwards (visible from inside the map)
    • Added two faces at the door so the wall looks uninterrupted from the commander perspective
    • Recompiled the minimap, it was broken as of NS2 build 178. Apparently the minimap_extends needs to be a perfect square across the y-axis. Otherwise the object and location offset is wrong.
    • Removed both team_location (no longer needed)
    • Removed all egg_start (no longer needed)
    • Removed all player_start (no longer needed)
    • Left the airwaypoints, groundwaypoint and their respective layer and group. They are no longer needed though!
    • Added the pathing setting entity, used for pathing mesh generation. It can be found in the South Techpoint room
    • Removed two location entities and renamed all the others to not have the "alien" or "marine" name in them anymore
    • Moved the two resource nodes from the central tech_point into the west and east expansion rooms
    • Added a power_point in the former alien start room
    • Added atmospherics to the light_spot down in the ventilation shaft in the West Techpoint room
    • Added atmospherics to the light_spot in the vent
    • Added a new light_spot and light prop, with atmospherics in Center Techpoint room
    • Added two reverb entities to show how they are used in the West Techpoint room
    • Added textures to the ceilings and walls (northern part has a yellow theme, the southern part has a blue theme), also to set them apart from the OcclusionGeometry mesh (which will use gray wall textures)
    • Added the OcclusionGeomtry mesh
    • Changed the depth of the fan pit, so you can see the atmospherics at work

External Links