Setting up the build menu in Radiant for Q1BSP compiling
NOTE: This tutorial was written and tested on/for winXP. This is not to say that it will not work if you have a different windows. I am saying that I personally do not know if it will work. Also, where I explain an apparent impossibility, it is because I have tried every logical and illogical thing I could think of to change the apparent impossibility and none of it worked. If you know something that I don't...please share it.
Understanding the Radiant build menu
Radiant uses an xml document to store build commands, it can be found in .../pathToRadiant/q1.game/(default_)build_menu.xml*. This file can be opened with any word processor. I personally deleted all the data in the stock build menu and wrote my own.
* default_ NetRadiant only
Before I begin I would like to state that you should know what compile tools you intend to use before modifying the build menu. There are many tools available and they all come with their own features that make them special. For the remainder of this tutorial I will be using hmap2.exe as it is an all-in-one compiler. If you choose to use something else, simply substitute my "hmap2.exe" with the proper name for what you are using (ie...Wvis.exe, etc). You need to put your compile tools in C:/Path/to/radiant/ as that is the system that this tutorial utilizes.
Making sure you are set-up properly
This is where it gets a little raw. If you are using GTKRadiant you do not have the power to set your GameName. Sure you can go to the local.prefs file (found in C:/Documents and Settings/username/application data/radiantsettings/1.5.0/q1.game/local.prefs) and change [GameName], but GTKRadiant will just set it back to "id1" when you click build. This means that GTKRadiant users will have to use a different method. I will explain both the GTK and portable Net radiant methods for setting up an auto- build and test menu. If you are not using NETRadiant with portability then I think the GTK radiant way applies to you, because there is a C:/Documents and Settings/username/application data/NETradiantsettings/ folder, that has all the same stuff that the gtk one does.
Note: The GTKRadiant merhod also works on NetRadiant portable. The only difference being where the files that you need to modify are located. Really it comes down to, do you want NETRadiant to determine your game directory or do you just want to type it into the .bat (GTK way). I like Netradiant way because the .bat is not static beyond the engine (I would make that dynamic too if I could figure out how.)
Open local.prefs -
GTKRadiant
C:/Documents and Settings/username/application data/radiantsettings/1.5.0/q1.game/local.prefs
NETRadiant (portable!)
C:\path\to\radiant\settings\1.5.0\q1.game\local.pr efs
first you want to make sure that this line points to the proper build_menu.xml file.
next make sure that your engine path is correct. This does not have to be C:/Quake. It is wherever your engine is located.
NETRadiant (portable style) ONLY
Creating our .bat
This is going to be a little "helper" file that allows us to load our game after it compiles. Regardless of Radiant type you need to open up a blank text document and save it in/as:
C:\path\to\engine\go.bat. From there choose the below method that suits your radiant.
GTKRadiant
go.bat
-include the quotes
NETRadiant (portablized)
go.bat
Of course you can switch "darkplaces.exe" for any engine you like as long as you actually have it.
Defining the build menu
Let's look at the top of the document structure for (default_)build_menu.xml
This is the beginning of any xml document ever, just leave it alone. Consider this the DOCTYPE if you know what such a thing is.
This is opening the project "tree" where all build options will be categorized.
-------------
There are tokens (placeholders) that can be used in the build menu. Depending on what token you want to use and what radiant you are using, it is defined in local.pref. In the case of all Radiants [EnginePath] and [RadiantPath] are customizable tokens. In the case of only NetRadiant portable [GameName] is also a customizable token. I will approach the basic options that are universal first and then I will branch off into the 2 Radiant methods for automatically loading your map in an engine, using a mod folder.
What the above is doing is creating a var named bsp and defining it's path. In essence: var bsp = "C:/path/to/radiant/hmap2.exe"
*re: for vis and light
----
Now that you have created the vars we can use them. Since hmap2.exe is an all-in-one compiler, it has to be -switched with the compile type you want to use. If none is specified it assumes you are using it to build the bsp. "[MapFile]" is dynamic and will be whatever the name of your map is. technically the token is [MapFile]. The quotes are added so the compiler(s) (and engine) treat it like a string.
- this closes the project tree and consequentially the entire document. Anything you put after this will be considered garbage and wont be read.
-------
Understanding more
Earlier I stated that all the compilers come with their own little features that make them special. Since I have used hmap2.exe for my examples, I will continue to use it to illustrate compile options.
Hmap2.exe has a bsp option to allow huge polygons (-darkplaces). It also has vis options to remove ambient sound (-noambientsky), and a light option to increase the light in the darkest areas (-minlight 15 {can be any number 0 to 255, with 255 being fullbright}). There are many more options and whatever compiler you use, you should definitely read the read_me and learn what it is capable of. I explained one option for each level of compilation so I could show you how it should look in the build menu.
You do not have to have just one option. You can have as many as you like.
---
So far your entire radiant build menu should resemble this
The Road Forks
Here is where we create a new variable and use it as a command to start our engine, from a mod folder, on the map we just compiled. No matter what radiant you use, you need to add this line after "light" line:
Then add the line below that applies to you
GTKRadiant
you need to add this after the [light] line.
NETRadiant (with portableness)
you need to add this after the [light] line.
Multiple Builds
You can create multiple builds that utilize different features. Here would be an example of that
Whatever you name a build, is the option that will appear in the Radiant build menu. So, if I clicked build in NETRadiant (using the above build data) I would be presented with the options "simple build" and "big map build".
How do I make NETRadiant portable?
1) Create a folder named "settings" in C:/path/to/NETRadiant/
2) start NETRadiant
that's it.
How did you figure out GTKRadiant's local.pref directory?
When you are compiling in radiant (any) the output window tells you where it saves junk.txt. That is your directory, no matter which radiant you use, that (apparently) will be the directory with all the configurations that are being used.
Well, that ends the tutorial for now. It is "complete", but I can do better. This will be edited a few more times as I run more tests, revise the explanations and develop a "master" build menu that includes all (current) q1bsp compilers. Stay tuned.
NOTE: This tutorial was written and tested on/for winXP. This is not to say that it will not work if you have a different windows. I am saying that I personally do not know if it will work. Also, where I explain an apparent impossibility, it is because I have tried every logical and illogical thing I could think of to change the apparent impossibility and none of it worked. If you know something that I don't...please share it.
Understanding the Radiant build menu
Radiant uses an xml document to store build commands, it can be found in .../pathToRadiant/q1.game/(default_)build_menu.xml*. This file can be opened with any word processor. I personally deleted all the data in the stock build menu and wrote my own.
* default_ NetRadiant only
Before I begin I would like to state that you should know what compile tools you intend to use before modifying the build menu. There are many tools available and they all come with their own features that make them special. For the remainder of this tutorial I will be using hmap2.exe as it is an all-in-one compiler. If you choose to use something else, simply substitute my "hmap2.exe" with the proper name for what you are using (ie...Wvis.exe, etc). You need to put your compile tools in C:/Path/to/radiant/ as that is the system that this tutorial utilizes.
Making sure you are set-up properly
This is where it gets a little raw. If you are using GTKRadiant you do not have the power to set your GameName. Sure you can go to the local.prefs file (found in C:/Documents and Settings/username/application data/radiantsettings/1.5.0/q1.game/local.prefs) and change [GameName], but GTKRadiant will just set it back to "id1" when you click build. This means that GTKRadiant users will have to use a different method. I will explain both the GTK and portable Net radiant methods for setting up an auto- build and test menu. If you are not using NETRadiant with portability then I think the GTK radiant way applies to you, because there is a C:/Documents and Settings/username/application data/NETradiantsettings/ folder, that has all the same stuff that the gtk one does.
Note: The GTKRadiant merhod also works on NetRadiant portable. The only difference being where the files that you need to modify are located. Really it comes down to, do you want NETRadiant to determine your game directory or do you just want to type it into the .bat (GTK way). I like Netradiant way because the .bat is not static beyond the engine (I would make that dynamic too if I could figure out how.)
Open local.prefs -
GTKRadiant
C:/Documents and Settings/username/application data/radiantsettings/1.5.0/q1.game/local.prefs
NETRadiant (portable!)
C:\path\to\radiant\settings\1.5.0\q1.game\local.pr efs
first you want to make sure that this line points to the proper build_menu.xml file.
Code:
<epair name="BuildMenu">C:/path/to/radiant/q1.game/(default_)build_menu.xml</epair>
Code:
<epair name="EnginePath">C:\Quake</epair>
Code:
<epair name="GameName">QungFu</epair>
This is going to be a little "helper" file that allows us to load our game after it compiles. Regardless of Radiant type you need to open up a blank text document and save it in/as:
C:\path\to\engine\go.bat. From there choose the below method that suits your radiant.
GTKRadiant
go.bat
Code:
cd /d %~dp0 darkplaces.exe -game "nameOfYourModFolder" +map %~n1
NETRadiant (portablized)
go.bat
Code:
cd /d %~dp0 darkplaces.exe -game %1 +map %~n2
Defining the build menu
Let's look at the top of the document structure for (default_)build_menu.xml
Code:
<?xml version="1.0"?>
Code:
<project version="2.0">
-------------
There are tokens (placeholders) that can be used in the build menu. Depending on what token you want to use and what radiant you are using, it is defined in local.pref. In the case of all Radiants [EnginePath] and [RadiantPath] are customizable tokens. In the case of only NetRadiant portable [GameName] is also a customizable token. I will approach the basic options that are universal first and then I will branch off into the 2 Radiant methods for automatically loading your map in an engine, using a mod folder.
Code:
<var name="bsp">"[RadiantPath]hmap2.exe"</var> <var name="vis">"[RadiantPath]hmap2.exe"</var> <var name="light">"[RadiantPath]hmap2.exe"</var>
*re: for vis and light
----
Now that you have created the vars we can use them. Since hmap2.exe is an all-in-one compiler, it has to be -switched with the compile type you want to use. If none is specified it assumes you are using it to build the bsp. "[MapFile]" is dynamic and will be whatever the name of your map is. technically the token is [MapFile]. The quotes are added so the compiler(s) (and engine) treat it like a string.
Code:
<build name="build"> <command>[bsp] "[MapFile]"</command> <command>[vis] -vis "[MapFile]"</command> <command>[light] -light "[MapFile]"</command> </build>
Code:
</project>
-------
Understanding more
Earlier I stated that all the compilers come with their own little features that make them special. Since I have used hmap2.exe for my examples, I will continue to use it to illustrate compile options.
Hmap2.exe has a bsp option to allow huge polygons (-darkplaces). It also has vis options to remove ambient sound (-noambientsky), and a light option to increase the light in the darkest areas (-minlight 15 {can be any number 0 to 255, with 255 being fullbright}). There are many more options and whatever compiler you use, you should definitely read the read_me and learn what it is capable of. I explained one option for each level of compilation so I could show you how it should look in the build menu.
Code:
<build name="build"> <command>[bsp] -darkplaces "[MapFile]"</command> <command>[vis] -vis -noambientsky "[MapFile]"</command> <command>[light] -light -minlight 15 "[MapFile]"</command> </build>
Code:
<command>[light] -light -extra4x4 -minlight 15 "[MapFile]"</command>
So far your entire radiant build menu should resemble this
Code:
<?xml version="1.0"?> <project version="2.0"> <var name="bsp">"[RadiantPath]hmap2.exe"</var> <var name="vis">"[RadiantPath]hmap2.exe"</var> <var name="light">"[RadiantPath]hmap2.exe"</var> <build name="build"> <command>[bsp] -darkplaces "[MapFile]"</command> <command>[vis] -vis -noambientsky "[MapFile]"</command> <command>[light] -light -extra4x4 -minlight 15 "[MapFile]"</command> </build> </project>
Here is where we create a new variable and use it as a command to start our engine, from a mod folder, on the map we just compiled. No matter what radiant you use, you need to add this line after "light" line:
Code:
<var name="go">"[EnginePath]go.bat"</var>
GTKRadiant
you need to add this after the [light] line.
Code:
<command>[go] "[MapFile]"</command>
you need to add this after the [light] line.
Code:
<command>[go] "[GameName]" "[MapFile]"</command>
You can create multiple builds that utilize different features. Here would be an example of that
Code:
<?xml version="1.0"?> <project version="2.0"> <var name="bsp">"[RadiantPath]hmap2.exe"</var> <var name="vis">"[RadiantPath]hmap2.exe"</var> <var name="light">"[RadiantPath]hmap2.exe"</var> <var name="go">"[EnginePath]go.bat"</var> <build name="simple build"> <command>[bsp] "[MapFile]"</command> <command>[vis] -vis "[MapFile]"</command> <command>[light] -light "[MapFile]"</command> <command>[go] "[GameName]" "[MapFile]"</command> </build> <build name="big map build"> <command>[bsp] -darkplaces "[MapFile]"</command> <command>[vis] -vis -noambientsky "[MapFile]"</command> <command>[light] -light -extra4x4 -minlight 15 "[MapFile]"</command> <command>[go] "[GameName]" "[MapFile]"</command> </build> </project>
How do I make NETRadiant portable?
1) Create a folder named "settings" in C:/path/to/NETRadiant/
2) start NETRadiant
that's it.
How did you figure out GTKRadiant's local.pref directory?
When you are compiling in radiant (any) the output window tells you where it saves junk.txt. That is your directory, no matter which radiant you use, that (apparently) will be the directory with all the configurations that are being used.
Well, that ends the tutorial for now. It is "complete", but I can do better. This will be edited a few more times as I run more tests, revise the explanations and develop a "master" build menu that includes all (current) q1bsp compilers. Stay tuned.
Comment