- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Creating a batch file for compilation and other purposes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

In this tutorial we will cover the following:

- How batch files work
- Getting compilers to work with batch files
- Advanced batch files

First of all if your familiar with the basics of dos then this should be pretty easy. Once you learn dos it sticks with you... like forever! :)

Batch files are a wonderful way to get what you want done without clicking or typing a lot. But what are they? Well im sure you've heard of autoexec.bat in your C:\ that's a batch file (.bat = batch) and it is a series or strings of commands that the computer does.

What do you gain by using batch files? Batch files are for lazy people (such as myself), who want things done quick, and easily without lots of clicking and typing. It basically like sitting back and watching the show.

Now lets get onto the good stuff. Using a batch file for quake! But it's really like working with a config file for quake. First make a new text document using notepad. In the document go to File>Saveas or Alt+F+A and see where it says "Save as type: Text Documents", change that to "Save as type: All Files (*.*)" Then give your batch file a name like compiley.bat :)

I had an old quake mapper pass this info to me so im passing it onto all of you! Don't you feel lucky?

What I do is I use C:\Quake2\baseq2\maps\compiles as a place of compiles, where all the junky .pst files are stored that I hardly use and stuff. It's basically the compilers playground. I suggest you make something like that. I strongly suggest that you use that the maps/compiles folder so you can get your ball rolling right along with the tutorial, things will be much smoother if you do, well sorta. :)

So lets say you just made the Quake2\baseq2\maps\compiles. Put your friendly compiley.bat in there. Also take whatever .map you working on and go ahead and stick that in there too, you'll need the compiley.bat and the (mapname).map in the same folder.

Now move your compile tools (qbsp3, qvis3, and arghrad). If you dont have arghrad it's a superior alternative to qrad3 that can be downloaded here, and the Arghrad Manual here.

Put those 3 compile tools in your compiles folder.

Now go into that folder (if you aren't already) and right click on compiley and click edit. If there isnt an edit open notepad and open compiley manually. It's empty right? Well that's not good! We need something to fill in all this blank space, how about some nice dos commands? Let's start with the first line. (The number before the words are for line representation only, do not type them in notepad.)


ECHO OFF basically means: Dont show me a bunch of dos crap when im running this batch file. It keeps things nice and clean.

Now next we start putting in the compile commands. Compiles always go in this order, bsp, vis, rad. So lets stick them in like this


This should be making sense, after qbsp is finished it goes onto qvis then arghrad, simple no? But we need to tell the compilers what map to compile, that goes like this, watch carefully as i go from .map to .bsp

2 QBSP3.EXE mymap.map
3 QVIS3.EXE mymap.bsp
4 ARGHRAD.EXE mymap.bsp

Use whatever you want, mymap is just an example. Right now this is a good working basic compile. You can pickup your things and leave right now, but there's some really cool things coming ahead which makes using a batch file all worth it. :)

Now the lesson on REM, which is means "remove". This is a simple command that goes before a line that tells the batch file to ignore this line. So if you want a fullbright version of your map and you dont want to run arghrad or qrad3, then insert REM like below. Simply take out REM to have the batch file use that line again for a compile with light.

4 REM ARGHRAD.EXE mymap.bsp

Now that compiley is working nicely, were going to take the mymap.bsp and and move it into the quake2\baseq2\maps folder then were gonna start quake and have it load our map! But im getting ahead of myself. Lets go onto like 5. Now that our bsp is all nice and done, we need to move it out of our compiles folder and into our maps folder so quake can read it. So try this

5 COPY mymap.bsp C:\Quake2\Baseq2\Maps

If thats not your maps folder, then type in your maps folder. So now we have the batch file compiling, then moving your .bsp from the compiles folder to the maps folder.

Now we want compiley to start quake and load our map, no problem! Just add the new stuff below in!

2 QBSP3.EXE mymap.map
3 QVIS3.EXE mymap.bsp
4 ARGHRAD.EXE mymap.bsp
5 COPY mymap.bsp C:\Quake2\Baseq2\Maps
6 CD..
7 CD..
8 CD..
9 QUAKE2.EXE +disconnect +map mymap

on line 6-8 we have CD.., which backs us down a folder. So right now were in C:\Quake2\Baseq2\Maps\Compiles and since CD.. is up there 3 times we end up right in C:\Quake2. So on line 9 it's starting quake, it stops single player from loading then it'll load your map.

So it all works out like this: Compiley.bat compiles your map, then it moves the .bsp to your Maps folder, then it starts Quake2 and loads your map. Now you know why this is all worth it! All with the double-click of your mouse on Compiley.

Here is a unedited Cut'n'paste from my own compiley.bat

QBSP3.EXE joebuild16.map
QVIS3.EXE joebuild16.bsp
ARGHRAD.EXE joebuild16.bsp
COPY joebuild16.bsp C:\Quake2\Baseq2\maps
QUAKE2.EXE +disconnect +set game ctf +map joebuild16

Remember the #'s just represent lines in this tutorial, dont actually put them in! Like how my batch file shows that their not in there.

I hope you found this guide useful, if you have any questions or cool idea's for my little friend compiley, feel free to email erukian@planetquake.com. Have fun and good mapping! :)

Back to top




Created by Space Design.  Copyright 2001 C.O.D.