Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/sites/a/ on line 20
Wavelength | Your Game Editing Resource | Tutorial 1:
Welcome, Guest! Login | Register

Tutorial 1: [Print this Article]
Posted by: Hellbringer
Date posted: Feb 23 2003
User Rating: 5 out of 5.0
Number of views: 12370
Number of comments: 0
Description: What the heck makes up a "level" anyway
This tutorial is designed for those of you who are new to Level editing and CSG (Constructive Solid Geometry) / Brush-based maps. If you are comfortable with all of the terms in here, you will have a much easier time following the other tutorials; AND a better grasp of just WHAT yer doing when you edit. There will be a glossary at the beginning, and that will lead into a short discussion of how they all relate. Without further ado, here they are: Brush - This is basically any polygon that makes up a part of the architecture or level. Some can have special attributes (emit light, appear transparent, etc), but all brushes MUST be convex (no concave polygons). This means that you could have a solid cube-shaped brush; but not a "C" - shaped brush, because the "C" shape doubles back inward on it self. The neat thing about levels is that brushes don't always have to line up neatly - you can stack them inside each other; and only the parts that are "sticking out" (visible) will be drawn when you play the game (so you can use multiple brushes to make a concave shape). Also, remember that all brushes are really a solid color; that's why you apply textures.

Face - A face is ONE SIDE of a polygon / brush. These can be selected individually, and have ONE texture applied per face. Also, sometimes certain attributes can be set for faces; instead of just the whole brush. These are referred to as "surface properties". There are also "content properties" - but these MUST be applied to the whole brush to prevent errors when you try to compile/run your map.

Textures - A texture is a pre-made piece of artwork (usually stored in another compressed file like a .WAD or .PAK) that you "paint" or "apply to" a face or a whole brush. Only one texture is allowed per face; but you can have different textures for each face of the same brush. Attributes that can be modified for a texture (once it is on a face) include: Horizontal position, Vertical position, Horizontal / Vertical stretch (scale), and Rotation.

Entity - An entity is basically anything that is not just a brush. I know that sounds vague; but its pretty much the truth. Anything that the player can interact with; or that changes / moves is an entity. They are pretty much pre-defined by the game engine; and should be listed in the level editor. The key to remember is that there are 2 types of entity: Pre-sized; and ones that attach to a brush. The pre-sized entities include: Player Start Points, Monsters, Weapons, Ammo, etc... Entities that attach to a brush basically use the brush (or brushes; you can sometimes use more than one) for the shape, size, and texture of the entity. Examples include: Doors, Trains (moving platforms), Buttons, etc... And in case you were wondering - yes, the brushes you use DO become the entity. Also, if you use multiple brushes; they will group together as one (but since the game thinks of them as seperate BRUSHES, don't worry about them being concave once they're grouped).

That pretty much covers the basics; every other object is a sub-set of those described above. Now, here's some more on generally how a level gets put together....

Once you've created your level in a Map-editor (such as WorldCraft), the saved information needs to be compiled by a series of utilities that convert the raw file into game data that the game-engine can use. For most Quake-engine-based games, this means 3 steps must be followed:

  • 1) A BSP program must be run to convert the text-file-format containing the level-geometry into a "Binary Space Partition". The details of this are much too complex for the scope of this short article; but suffice it to say that this breaks down the architecture and player-accessible space into manageable chunks. Half-Life breaks this into TWO steps, with the QCSG and QBSP programs.

    2) A VIS program needs to be run. The VIS program calculates what's known as the "potentially visible set", or PVS. It goes like this: If the computer tried to draw the whole level every time it refreshed the screen (every rendered "frame"), Unreal would look fast by comparison! So VIS goes through and calculates what parts of the level can be seen from any OTHER part of the level; and groups them accordingly. That way, the game engine knows only what it HAS to draw for each frame (This isn't ENTIRELY accurate; but once again is too complex to go into now. I'll be posting more details on the compile-tools at a later date). VIS is often the most time-consuming part of compiling a level; as it is EXTREMELY processor and memory-intensive!!

    3) After VIS has calculated all of the PVS's and such, you need to apply a LIGHTMAPPING program. Basically, once you have placed lights in your level, the LIGHTMAPPING program goes through and determines what lights brighten or darken certain areas or brushes in the map. Radiosity lighting also includes calculating light bouncing off of the brushes in your map, so it can again take some time (though usually not nearly as much as a VIS operation. Once all 3 (actually 4, since you now have QCSG to deal with as well) of these steps have been completed without error messages, your map is complete and ready to play from within the game. As a side note: you CAN play the map after only completing steps 1 or 2; but it will not look right (everything will be light super-brightly), and may play VERY slowly! You must at least run the QCSG and QBSP programs.

The KEY thing to remember is that the "empty" space on the "outside" of a level is turned into a void when it compiles; so you must make SURE that the "inside" of your level is completely cut off from the outside (i.e. There are brushes around the whole space you want the player to be able to access). If there aren't, you will get what are known as "leaks". This is when any entity or entities (including a player start point) are not completely surrounded by brushes. I CAN NOT STRESS THIS PART ENOUGH!! 90% of your map-compiling errors will be as a result of one leak or another... in future tutorials I will discuss how to track down and fix leaks using some of Quake2's built-in features; but your best bet is to look around and SEE where any openings exist in your level. EVEN OUTDOOR AREAS NEED TO BE SEALED AND HAVE A ROOF! You must just apply a "sky" texture to that roof to make it look as if you are outdoors. Examples of that will be in future tutorials.

Some other random tips:

First off, you always want to have a level with a player start point; and at least one room. It doesn't matter what shape the room is; as long as there are walls on all sides (and a floor and roof). This will ensure that you have a space without leaks, and you will "enter" the level when you try to play it.

Also, don't forget to add lights!! These can be "light"-type entities; or set the surface attributes of a face / brush so that they emit light. Its tough to play in a pitch-black level.

Lastly, don't forget to target buttons and switches / triggers! If you want something to cause an event, you have to modify the "target" and "targetname" attributes of the desired entities (more on this in the next tutorial).

Last Tip - Speaking from experience, it is VERY HELPFUL if you sketch out your level on paper first. You don't have to be an artist, or plan EVERY detail; but if you set out your main ideas, and get a feel for what goes where, things go very smoothly when you start putting it all into the computer. This helps because you won't be constantly worrying about how to connect things; or what is going to be in the next room or area. Just remember to keep one thing in mind: it is a 3-d environment; TOO much paper-work tends to condition you to having a single-floored level. Don't be afraid to play with floor heights and multiple-levels as long as it appears well and "makes sense".

Well, that about wraps it up for this time. As always, be sure to email me if you have any questions or comments about this tutorial. In the next session, we will begin building our first 2 rooms; and then connect them with a door. Hope you enjoyed this brief intro to levels!

Rate This Article
This article is currently rated: 5 out of 5.0 (1 Votes)

You have to register to rate this article.
User Comments

No User Comments

You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005

Latest Comments
knock knock
General | News
By: MIFUNE | Dec 31 2017
knock knock
General | News
By: omega | Dec 22 2016
knock knock
General | News
By: MIFUNE | Oct 10 2015
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
knock knock
General | News
By: Whistler | Nov 05 2011
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (10 guests)
About - Credits - Contact Us

Wavelength version:
Valid XHTML 1.0! Valid CSS!