# Ken Silverman's Build Engine Source Code Page

While the Apogee teams were hard at work on their own Build engine games, I was maintaining my own little game for testing purposes. This demo, which I sometimes call "Ken-Build", has been evolving ever since the day I started writing the sector-based Build engine back in 1994.

### Screenshots from "Ken-Build"

## FULL SOURCE AVAILABLE FOR DOWNLOAD!

- 06/20/2000: Tick-tock... I graduated college and I said I'd release the source by the summer. Guess what? I wasn't lying!
- 06/21/2000: Fixed a typo in BUILDLIC.TXT.
- 06/27/2000: SLABSPRI source code released.
- 04/01/2003: Duke Nukem 3D source code released by 3D Realms.
- 08/20/2003: BUILDC.ZIP: Unobfuscated A.C. (that's a .C source file, not an air conditioner : )
- 12/23/2003: "POLYMOST" (The name of my new OpenGL Build renderer) released through Jonathon Fowler's port&website.
- 10/08/2004: XTRAMAPS.ZIP: 8 bonus maps for Ken-Build; POLYMOST.BAS: My initial test program for "POLYMOST".
- 11/19/2005: MDVIEW.ZIP: My original test code for displaying MD2 and MD3 models in "Polymost" mode.
- 12/24/2005: POLYTEX.ZIP: The beginnings of a successor to Build that never saw the light of day.
- 05/15/2009: MAP2STL.ZIP: A new utility for converting Build .MAP file geometry to .STL format (simple triangle soup).
- 03/07/2018: KENVEX.ZIP: The beginnings of another successor to Build written in 1998 that never got far.

KENBUILD.ZIP (1,057,428 bytes): "Ken-Build" test game, including complete Build engine source code. NOTE: This is a snapshot of my Build source code from 2000. If you're starting a new project with this code, I recommend you start with a more recent version (with bug fixes to the original code... yes, there were bugs!) at one of these links.(DOS, Watcom C/C++ 11.0 required to compile)

SLABSRC.ZIP (39,365 bytes): SLABSPRI voxel editor source code. I have a newer voxel editor called SLAB6.(DOS, Watcom C/C++ 11.0 required to compile)

BUILDC.ZIP (48,785 bytes): A.ASM ported to A.C (originally done by yours truly in June of 1996 to help the Mac & console port teams). I've seen some pretty nasty hack jobs done by people who have tried to port my A.ASM to C. They're so obfuscated it's funny! So I thought I'd help them by providing a more readable version to start with.(DOS, Watcom C/C++ 11.0 required to compile)

XTRAMAPS.ZIP (18,472 bytes): 8 bonus maps that I made a long time ago for Ken-Build.(Requires STUFF.DAT&GAME.EXE from KENBUILD.ZIP. You can also play the maps using JFBuild, a native Windows/Linux port by Jonathon Fowler.)

POLYMOST.BAS (17,773 bytes): My initial test program for "POLYMOST". Running the program may reveal some insight into how the "Polymost" hidden surface removal algorithm works, but I don't think the QB code is much more readable than the C version.(DOS, QuickBasic 4.5. QBasic users: add this for mouse support)

POLYMOST.KC (17,169 bytes, 12/25/2017): POLYMOST.BAS ported to EVALDRAW.(EVALDRAW / Win32)

MDVIEW.ZIP (68,649 bytes, 12/10/2006): My original test code for displaying MD2 and MD3 models. The polygonal model renderer in "Polymost" is based on this code, so if your model works here, it should also work in JonoF's ports.(Win32)

POLYTEX.ZIP (225,760 bytes, 12/24/2005): POLYTEX engine demo and source code. At one time, this was an exciting project that was going to be the next generation of Build. I started writing a polygon engine in late 1994 in order to keep up with Id Software's next game (Quake 1). Read the included text file to find out what happened.(Dos32)

KENVEX.ZIP (275,293 bytes, 03/07/2018): KENVEX was a 2nd attempt at a successor to the Build Engine. Build has the special ability to sort walls in a perfect front-to-back order without ever needing to split a wall. I thought this same property could be made to work in full 3D. It sure would have been nice if this were true, but it wasn't. So much for that.(Dos32)

MAP2STL.ZIP (9,494 bytes, 05/15/2009): A utility for converting Build .MAP files to .STL format (simple triangle soup). This may be useful for small test programs, although not much else since all texture and color information is lost during the conversion.(Win32)

# Ken Silverman's Build Engine Source Code FAQ:

I want to compile your code. How do I get Watcom C?

Watcom C was discontinued in 1999 and is now freeware. You can download it here: http://www.openwatcom.org/ I believe it includes everything you need to compile.

Probably a better option is to start with the code from one of the Windows ports. I highly recommend Jonathon Fowler's port.

Will Build compile under an older version of Watcom C?

You shouldn't be using an old version of Watcom C since it is now freeware! Visit: http://www.openwatcom.org/

Are you going to port the code to [my favorite operation system]?

I tried porting Build to Windows back in 1996. I actually had the BUILD editor working, but I was overwhelmed with crashing bugs. I was new to Windows programming. When I discovered that Windows offered no way of doing triple-buffered page-flipping (an important feature for fast frame rate), I lost interest in the project. A few years later, DirectX caught on, but by that time, it was already too late.

Things are much different now! In June of 2000, I released the Build source code. Since then, many fans have done source ports of Build - including Windows, Linux, Mac, and probably more that I don't know about. My favorite one is Jonathon Fowler's Windows port. My opinion is biased because he has an unfair advantage ... that would be me! ;)

I was trying to run your GAME.EXE and it gave me the following error message. What's wrong?

Stub exec failed:
dos4gw.exe
No such file or directory

First of all, you should upgrade to Jonathon Fowler's Windows port

If you insist on using DOS, then... You need DOS4GW.EXE in the path or in the same directory. You might already have it if you look through the directories of some old DOS games. If you can't find it, then download it from the bottom of my Utilities page Also, if you get a DOS4GW syntax error when trying to run the game, then try typing "DOS4GW GAME" at the DOS prompt.

I was playing [a commercial Build game] and I noticed some sector effects were missing in your Ken-Build demo. Are you going to release that stuff?

No, because that stuff was never a part of my Ken-Build test game. If you want that stuff, then you should download the Duke Nukem 3D source code from 3D Realms.

KenBuild uses different tags from what I'm used to. Is there any documentation on how to use them?

Look at the top of GAME.C (located inside SRC.ZIP). Find where it says "KEN'S TAG DEFINITIONS" and read the text that follows it.

I noticed some reflective water in NSNOAL.MAP. Is this similar to the reflective water in Lameduke?

The Lameduke water effect was Allen Blum's code - he was the first one to try this effect, although it was buggy and slow. A while later, I tried my own reflective water. It worked ok, but no one used it.

You mention some sample maps in the BUILD.TXT/BUILD2.TXT files (for example MONWALK.MAP), but I can't find them! What's up with that?

A few years ago, my good friend, Andy Cotter (the one from Ken's Labyrinth), combined a lot of these small maps into one huge one, called NSNOAL.MAP. I decided to include the big one instead of a lot of small ones to make the directory look cleaner. For now, you'll just have to look around that huge map and find the places that match my descriptions. It's all part of the fun!

I thought Build and Editart were owned by 3D Realms. Are these now in the public domain?

Any version you find on a commercial CD is owned by the respective game company since it may have foreign code in it (such as modifications made by the game developer). The version in my "Ken-Build" game is 100% my code, and is therefore free for distribution as long as you include my license file with it.

I'm having no luck myself. Could you personally ask 3D Realms / Monolith to release their source?

I'd be delighted to see them release their part of the code, but I am not going to beg them to do it, so the answer is no.

Are there any differences between the source code you just released and the stuff you gave out to the individual game teams?

Yes! Believe it or not, the only "source" code I ever gave out (prior to 06/20/2000) was: GAME.C, BSTUB.C, BUILD.H, and NAMES.H. I provided the rest of the files in the form of object files (ENGINE.OBJ, BUILD.OBJ, MMULTI.OBJ, CACHE1D.OBJ, A.OBJ) along with some documentation (BUILD.TXT and BUILD2.TXT) so they knew how to link their code. As far as versions go, this is the latest version I have on my hard drive. I even left in the source to those secret messages you see if you modify my name in the EXE. Trust me when I say that this is the real thing!

Why is there a message in your code that says: "Don't screw with my name"? When does it get displayed?

It gets displayed if you modify my name (Ken Silverman) in the EXE file. If you really want to see if it works, try it in a hex editor (make a backup before doing it, of course). Obviously this is not an essential part of the Build Engine.

I have a non-Intel processor (such as AMD) and when I run the game in hi-res mode, the frame rate is a lot slower than other Build games.

One of the last things I added to my engine (see end of BUILD2.TXT) were some wall/ceiling/floor drawing routines that I specially optimized for Intel generation #6 processors (Pentium Pro, Pentium II, etc.) I don't have any experience with non-Intel processors, so I'm not sure which CPU's are affected. Probably what's happening is: my code thinks the foreign processor is a generation #6 processor, but the old generation #5 code would run much faster. There are 2 ways to fix this:

1. If you have my original GAME.EXE, try this patch (save the old EXE just in case it doesn't help):
   KENBLDP5.EXE (6,799 bytes)
   KENBLDP5.C (2,144 bytes) (the source code if you want it)
   This patch will force GAME.EXE to use the old Pentium optimized code (CPU generation #5).
2. If you can compile the code, disable the call to the "dommxoverlay" function located in A.ASM (this is the routine that replaces the CPU generation #5 code with the CPU generation #6 code.)

In future projects, I'll pick the best code by timing the routines directly. After all, nothing beats good old trial & error!

In the Ken-Build game, why is there a guy with "Al" on his shirt?

Al is short for Alan, my older brother. I mention him at the end of my "life story". No, he doesn't look like a cartoon character, but he does have red hair :)

Did you steal some sounds ("die", "ow", "bye-bye") from "Worms", a game made by Team17?

No, those are actually my own voice. They are obviously based off of their game. While I'm at it, I should mention that the "doh" sound is my voice too. (I doubt I fooled anyone with that one.)

Are there any cheat codes in Ken-Build?

No, although they wouldn't be hard to implement. You shouldn't need god mode unless you really stink at my game! (If you do try to implement it, be careful not to make multiplayer games go out of sync. To accomplish this feat, you really need to understand my multiplayer code first.)

Why did you write a custom license instead of using GPL (GNU's General Public License)?

Short answer: to satisfy my ego :) Long answer: I know GPL is an industry standard, but I felt that it was way too long and boring for anyone to read seriously. I chose to write a nice short license that everybody could understand. This way, people unfamiliar with GPL would understand their rights.

I want to release a stand-alone EXE using your code. Is it ok to do this according to the terms in your Build source code license?

According to my license, I want to see the following 3 lines "somewhere" in the archive:

// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.

If you have a credits screen, then you could stick these lines at the bottom of the screen (in small type if you want). Another good place might be on the text screen after you quit.

Also, if you don't want to include BUILDLIC.TXT with your distribution, you should reword the 3rd line to say:

// Original distribution & license info can be found from the above address

# Related links:

http://www.jonof.id.au/jfbuild The best Windows & Linux port of KenBuild, the Build Editor, Duke Nukem 3D, and Shadow Warrior by Jonathon Fowler. His port uses DirectX natively, and supports full OpenGL rendering using my "Polymost" technology.

http://www.icculus.org/BUILD/ The first source port of Build to Linux & Windows ... now dead, thanks to the success of JonoF's port.

http://r-t-c-m.com/ For those interested in hard-to-find Build Engine game related information, RTCM is the place to go.

Back to Ken Silverman's Official Build Page
Back to Ken Silverman's Official Home Page