Page 1 of 1

Starting out with CKSRCMOD: some issues

Posted: Wed Feb 05, 2020 20:43
by keenmaster486
Hello everyone who knows something about cksrcmod:

I am going to try to dive into this code and figure out how it all works. I figure I may as well just get my hands dirty.

It was easy enough to get it compiling. I'm using Borland Turbo C++ 3, and TASM 5. It compiles just fine.

But after compiling it has weird issues with the graphics. Things like: every sprite has an irregular black line across the top of it, the Terminator intro is a little glitchy, and half of the menu turns to garbage when you press ESC and it gives you the "do you want to quit" box.

What could be causing this? The executable that comes with the package works fine. My executable is slightly larger.

Also, does anyone have any tips right off the bat as to how best to familiarize myself with this code?

Re: Starting out with CKSRCMOD: some issues

Posted: Wed Feb 05, 2020 22:43
by K1n9_Duk3
I'm not sure if Turbo C++ will work. I've been using an installer package called "Borland C++ For Wolf3D" (or something like that) ever since I started messing around with the Wolf3D source code in the early 2000's. I remember that it was packaged with a Windows-based installer, probably created by members of the Wolf modding community and not by Borland. This package contains Borland C++ 3.1 and Turbo Assembler 3.1.

Turbo C++ is the cheaper version, Borland C++ was targeted at businesses. I have never tried compiling the source with Turbo C++, so I can't tell for sure if it will work or not.

This is how I would set up Borland C++ and the source code:
  1. Create a base folder for the compiler and the source code somewhere on your hard drive (let's say "C:\WORK")
  2. Get Borland C++ 3.1 and install it (or extract the files) to a subdirectory, like "C:\WORK\BORLANDC"
  3. Extract the CKSRCMOD archive into a subdirectory, like "C:\WORK\SRCMOD"
  4. Start DOSBox and mount the base folder ("C:\WORK") as your C drive
  5. Make sure the path to the BIN subdirectory of the compiler is added to your PATH variable. For example, run "SET PATH=%PATH%;C:\BORLANDC\BIN" or add this to a batch file.
  6. Navigate to the SOURCE subdirectory of your SRCMOD directory ("cd \srcmod\source") and start the Borland IDE by running "BC"
  7. The IDE should auto-load the project file. You should see the Project window at the bottom (select "Window -> Project" if it's not there). Check if all the source files are listed in that window. If not, something went wrong.
  8. Select "Options -> Directories..." and enter the correct path to the INCLUDE and LIB subdirectories of your Borland C++ directory under "Include Directories" and "Library Directories" respectively.
  9. Select "Compile -> Build all" and see what it does.
I just downloaded the source modding package from the KeenWiki and compiled it myself in Borland C++ 3.1 (with the "Build all" option). It compiled with 0 errors and 0 warnings and the resulting executable works perfectly fine.

Once you start modifying and re-compiling the code, you will most likely want to use "Compile -> Make", which only re-compiles the files that have been modified since the last run of the compiler. But I recommend doing your first build with the "Build all" option, since this will show you all the warning messages (if there are any). Do yourself a favor and do not ignore compiler warnings.

By the way, compiling everything may take quite a while in DOSBox, even when DOSBox is running at maximum speed. I'm actually running the Borland C++ compiler natively under Windows XP (32 bit) on a system with a 2.4 GHz CPU so I don't have to wait too long for the compiler to do its job. If running the compiler natively on a relatively modern CPU is an option that's available to you, then by all means, do it. You'll be glad you did.

On my development system, I have a BORLAND.BAT file that looks like this:

Code: Select all

I just copy this batch file into the SOURCE subdirectory of the source mod package (or whatever I'm working on) and double-click it to start the IDE, then I hit F9 to compile the code and ALT+X to quit once it's done. I don't use the IDE to edit the source files, I've got better, more modern tools to do that.

If you have to use DOSBox, I would recommend creating a batch file with the following contents and saving it in your base directory ("C:\WORK"):

Code: Select all

cd srcmod
cd source
Dragging and dropping this batch file onto DOSBox.exe (or a shortcut to DOSBox) will automatically mount "C:\WORK" as the C drive in DOSBox and start the IDE. I think the IDE automatically causes DOSBox to run at max cycles, unless your main DOSBox configuration forces it to behave differently.

If you can tell me which aspects of the code you're interested in, I can probably guide you to the right places. But the source modding package probably won't help you all that much, since there's almost nothing in it in terms of enemy behavior. All it has is Keen and code for moving platforms. If you want to learn how the enemies are designed, grab the Keen Dreams source or the Atroxian Realm source instead.

Re: Starting out with CKSRCMOD: some issues

Posted: Thu Feb 06, 2020 17:34
by keenmaster486
Woah, Borland C++ 3 works perfectly!

So now I can get to coding.

I grabbed a copy of the latest (1.3) Atroxian Realm source code. It also compiles fine and works properly.

Right now I'm not looking to do anything huge with the code. I just want to poke around in it, familiarize myself with the structure of it, and tinker with things just so I can gain my confidence in modifying the code.

Some time in the near future I hope to make a new DOS game with this codebase. I think it's probably the best bet for such a project as it's well established and performant.