Post tutorial RSS An introduction for manually editing your vmfs

Learn how to edit with only a simple text editor your map to fix bugs, find an entity... !

Posted by on - Basic Mapping/Technical


I. Theory

When you start making a map, Hammer creates by default 2 files, a VMF and a VMX. The VMF is ready to be used by Hammer and the VMX is used for recovery, like if your VMF has been completely broken or lost (just replace the x of .VMX by a f and you will be able to open it again with Hammer). Few other files are also created during the compilation of your map (the BSP, who is used by the game, the LOG of compilation and it can also generate a LIN if you got leaks).

What is interesting us here is of course the VMF file. Note that it does often contains a very lot of lines in it's code. For instance, my TF2 map named cp_fortassault, who is not so big in-game (a small fort surrounded by desert) has 48528 lines ! So you better don't plan about exploring each one of them or you will certainly try to kill yourself.
The first question you may have now is how the hell are we going to open a VMF ? Well it's easy ! Double click on a VMF and open it with notepad or any other text editor ! Note that I highly recommend you to install Notepad++ which is - for me - the best text editor !

Exploring the VMF of an empty map

Even empty, so without any blocks or entities, a map does already contains some code ! This code is the base one and the will not works without. So give it a look, it is better that you see how does look like the code of an empty map so you can understand more easely the rest.
Log 01

The organisation of an entity

When you create an entity, it does not fall in any groups which I show you right before ! Here are few explanations about :
Log 02

II. Practice

It may have seems a bit short, but if you have correctly read the beginning, you should be able to solve the most common problems you may encounter.

Finding an entity in a big map

Okay so let's imagine that you have just opened with hammer sdk_cp_dustbowl and you want to see how Valve has configured the light_environment (because you are making a TF2 map who has the same sky as cp_dustbowl, of course !). So here is a screenshot of the situation you will be confronted :
Log 03
So now you have two choices, you can either try to find the light_environment by exploring the map with Hammer OR looking for it in the VMF ! Of course you will choose the second choice because you are now a l33t modder hax0r dud3 and you are now running to the VMF of sdk_cp_dustbowl. After opening the VMF with your favourite text editor, you have a big problem...
Log 04
Well in fact, when I was talking about a big problem, I was joking because the computer will do the crap work for you, and thanks god the computer is still our slave. Just press Ctrl and F and your text editor will show you a window where you can enter the word you are searching for ! We are looking here for an entity who defines the light_environment, so let's type light_environment in the field and let's see what is going to happen.Log 05
Here it is ! You can now edit the VMF of your map and copy/past this piece of code from sdk_cp_dustbowl to have the same lighting ! You can also do the same research for the env_sun.

Resolving the unexpected end of file

One day you opened a map you were working on for 1 month when suddenly, you received this message :
Log 06
Damned ! You can't work any more on your map because of this crap ! But no problems because for the first time, reading the error message will help us ! It is saying that there is something wrong at line 15740, so why shouldn't we check it ?
Log 07
This kind of problem is often due when Hammer crashs while attempting to create a new entity. You can delete the bloody entity or you can either try to finish it (see how the other entities of the same class are made to take example of)

III. Conclusion

As you can see, editing the VMF with a text editor is not so hard ! You can always learn by yourself the rest and if you have a problem, try to google it. Have nice mapping !

- Bioko

Jokerme - - 1,170 comments

Editing vmfs manually comes in handy from time to time, especially for error tracking.

But finding an entity is easy using hammer from "Entity List". It can quickly show you where the entity you want is.

Reply Good karma Bad karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.