Porting DOS game to Windows; where to start?

Discuss popular GCS tools like ZZT, Megazeux and Adventure Game Studio, as well as programming and other topics related to game design.
Post Reply
User avatar
taufan99
Newbie
Newbie
Posts: 4
Joined: Tue Apr 30, 2024 10:16 pm
Location: Indonesia
Contact:

Porting DOS game to Windows; where to start?

Post by taufan99 »

As no one has so far considered touching Kaos (that one Italian-made Doom clone that never got finished), I felt like I might be up to the challenge.
Here's the problem; despite being an IT vocational high school who graduated with a software engineering class subject years ago, there's only so much I know/remember about programming. This is especially considering that we're also talking about DOS source code.
All I'm aware of is that some dependencies need to be converted from DOS to Windows, although even then, I don't know how exactly.
I've tried looking for the good ole Google about DOS-to-Windows video game conversions, but most only gave me articles on how to compile a "pure" source port on Visual Studio, one's experience in doing such a conversion, and none exactly about the technical stuff.
Any help will be appreciated.
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Porting DOS game to Windows; where to start?

Post by MrFlibble »

taufan99 wrote: As no one has so far considered touching Kaos (that one Italian-made Doom clone that never got finished), I felt like I might be up to the challenge.
That would be a great thing to do! Good luck!

Unfortunately I have zero experience in these matters, but I suppose it could be a good idea to look at known ports of DOS games like Doom. If you can disentangle the original DOS code from the code of Chocolate Doom for example, I suppose it could give some clues as to what direction you should take, if not the exact solution to stuff like video and sound output, controls, etc.
User avatar
kronoman
Newbie
Newbie
Posts: 8
Joined: Mon Oct 10, 2022 7:45 pm

Porting DOS game to Windows; where to start?

Post by kronoman »

Hi, quick reply here while feeling sleepy:

I used to work a long time ago on porting games for a well-known game company (20 years back).

I've downloaded and checked the source code and files you mentioned.

This isn't a modified or cloned Doom engine; it's entirely built from scratch, not compatible with or based on Doom clones.

In the pack I downloaded from https://www.dosgamesarchive.com/file/kaos/kaos:

info.doc has detailed info, all in Italian, spanning 10 pages; I haven't translated it all yet.

Documentazione/ contains 3 folders:

Grafica/

LBM files are Deluxe Paint files, an old MS DOS tool. I managed to view them using IrfanView with the right plugin; perhaps GIMP can handle them too. You likely won't need to edit them since the data is already generated and packed. Editing might be needed only if you plan to create new content or follow the path I describe later. You can get more info about LBM files here: https://moddingwiki.shikadi.net/wiki/LBM_Format

Suoni/

WAV files can be edited with Audacity; these are the game's sounds.

Testi/

Appears to be documentation about development, all in Italian. Try using DeepL to translate it. There are many .nic files that seem to be plain text; .nic might stand for Nicosoyt (Valentini Domenico), but they're text files.


Source code is in C++; it seems they used Borland Turbo C++ (check the .PRJ files).

I did a quick check; it seems to use fast fixed math in fixed.c with assembler (not ideal for porting to modern systems; you'd need to recreate the math, but it's not hard as ASM is ancient art now). They also use their own memory allocation routines, also in assembler in fastmem.cpp, which should be replaced with modern routines for your port to work on Windows.

As a quick example (might not be entirely accurate; I'm quite sleepy):

In fastmem.cpp,

Code: Select all

void fmove(void far *dest, void far *sorg, word bytes) {
asm {
LDS SI, sorg
LES DI, dest
MOV CX, bytes
CLD
REP MOVSB
// !!! SS==DS !!!
MOV BX, SS
MOV DS, BX
}
}
could be replaced with modern C++ (the standard has changed many times over the years):

Code: Select all

#include <cstring> // memcpy

void fmove(void* dest, void* sorg, unsigned int bytes) {
std::memcpy(dest, sorg, bytes);
}
Unfortunately, the code has a lot of assembler in many places; it'll be challenging to port to modern systems easily, but not impossible.

kaos.cpp is the main entry point, also quite large and could be split into smaller files.

You have several options:

1. You could attempt to use the Allegro game library and a GCC compiler to port it; your new engine would then run on Linux and Windows, replacing all hardware and assembler calls with Allegro calls. For instance, in lgraph.cpp and vgatool3.cpp, you'd call Allegro routines instead of assembler routines to set up the screen, etc. It's a significant task, basically rewriting this particular engine, but like eating an elephant, piece by piece.

2. Extract the sounds, assets like sprites, etc. (LBM and WAV files), check the maps in the included editor, and recreate maps, enemies, weapons in a modern Doom engine already ported to Windows. This wouldn't replicate the original game exactly but would be easier--a recreation rather than a direct port (this approach is common in the industry). You'd reuse an engine and focus on recreating enemies, weapons, maps, sounds, as a homage.

3. Simply bundle the game with DOSBOX and call it a day--some old games on Steam are sold this way. The original companies repackage them with DOSBOX to make a quick buck.

4. Just enjoy it on DOSBOX and be done with it.

Some .doc files mention DirectX and Direct3D; it seems they had a Windows version or were considering it--all in Italian, which I can't read. Check the doc and rtf files in Documentazione/Testi, like Kaos72.rtf.

Have fun! English isn't my native language, by the way.
Last edited by kronoman on Sat Jul 27, 2024 4:45 pm, edited 1 time in total.
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Porting DOS game to Windows; where to start?

Post by MrFlibble »

kronoman, thank you for the in-depth reply!
User avatar
kronoman
Newbie
Newbie
Posts: 8
Joined: Mon Oct 10, 2022 7:45 pm

Porting DOS game to Windows; where to start?

Post by kronoman »

MrFlibble wrote: kronoman, thank you for the in-depth reply!
Glad to help

Some more info:

The easiest path would be to grab the assets of the Kaos game and do a Total Conversion using a Doom engine, see more https://doomwiki.org/wiki/Total_conversion

Now starts the ramblings:

Seems to be inspired in Wolf 3D source code, since I found some references to that code in the .DSK files.

Also the engine is more similar to Rise of the Triad than Doom, since it has perfect square walls; but it has floor and ceiling textures (Wolf3D does not)

So, you maybe can use Rise of the Triad source code with this Kaos game assets , found here: https://github.com/videogamepreservation/rott

On December 20, 2002, 3D Realms released the source code for Rise of the Triad!

On December 22, 2002, the world was introduced to Rise of the Triad for Linux! (and Win32, and OSX, and even DreamCast!)

The porting job of that engine is already done here: https://github.com/LTCHIPS/rottexpr

Other good modern engine aimed specifically to porting old FPS games is Kex Engine, but it does not seem available to public ($$$)
On the assets,
for the maps, they gave you a editor to see them
Sounds is WAV file
images is LBM

Also, again , you can use Irfanview with proper plugin to see the ancient LBM files, like I did here:

Image
User avatar
Frenkel
Way too much free time
Way too much free time
Posts: 546
Joined: Wed May 05, 2004 7:47 am
Location: Netherlands

Porting DOS game to Windows; where to start?

Post by Frenkel »

Groeten van Frenkel
Visit us at the Official S&F Prod. Homepage
Post Reply