Page 1 of 2

So you want to program DOS games? Steps inside...

Posted: Wed Aug 22, 2007 8:31 pm
by redshock
I read several threads here and usually there's good advice but there's no step by step process for a complete beginner. For some background, I do lot of Windows game development and am going after a computer science degree. I started missing the old DOS games and I figured I want to try out DOS programming once and for all. It kills a quick career in game programming, but I find DOS more enjoyable to program in. Besides, DOS needs more new games :) These are the steps to get you into programming your own DOS games.

0) Downloads: Assuming you have XP or beyond, you need DosBox 0.71+ (http://dosbox.sourceforge.net/news.php?show_news=1). Also, you need Turbo C (http://dn.codegear.com/article/20841). You will be writing your code within Turbo C, which is running inside of DosBox. If you installed Turbo C to the C: drive, in DosBox, type "mount c c:\turboc\disk1", hit enter, then "tc.exe". Of course, there's nothing like a real DOS machine to program with :) Usually you can get a value machine with VGA support for around $20-$50 depending where you go.

1) Study the Standard C programming language while using Turbo C. A good book would be C: The Complete Reference by Herb Schildt. If money is an issue there are several websites available that give tutorials. Stay away from C++ since it's a lot of overhead in DOS. If you're using a DOS emulator, you might get by with it.

2) Learn a bit on data structures. I know, it's an unfun topic but it will help in the long run. Most importantly, look into stacks, queues and linked lists.
This will better help you program with efficiency and apply better performance. Liberally speaking, you can ignore this step but I recommend it. (Update) I forgot, the book above teaches exactly this in the second half.

3) Buy the book Tricks of the Game Programming Gurus by Andre' LaMothe. Link: http://www.amazon.com/Tricks-Game-Progr ... 0672305070 This is the book that set the standard for DOS game programming, so you can't go wrong with it. I just bought it for $12, so it's affordable to those inspired to make DOS games. It mostly goes over 2D and also walks you through your own raycasting(wolf3d)-type game along with networking, input, and sound. (Update) Be sure to check if the CD is included with your purchase!

And you are off to making your own DOS games.

Further thoughts:

Distributing your games:
1) You can have games from DOS and Windows to play your game. XP and below can run them without DosBox, but there's always something that might not work right without DosBox. If you tested each system and found a problem, you can tell your gamers to use DosBox. Vista removed the 16-bit subsystem that XP had, so you can no longer run native DOS games under Vista alone. However, DosBox works fine since it's a 32-bit application.

Exploring Windows:
If you feel like taking the next step and make your games Windows applications (32-bit), you can get Andre' Lamothe's other book titles known as Tricks of the Windows Game Programming Gurus (and) Tricks of the 3D Game Programming Gurus. Microsoft has a free Express edition of Visual C++ 2005/2008 that can be downloaded from their site. He really tries to keep the feel like DOS and keeps it all linear-memory for 2D/3D, which is what you were use to with the first book. It goes over various APIs plus game topics including Win32 API, COM, and DirectX.

If I think of any extra tidbits I'll include them with an update mark.

Good luck!
redshock

Re: So you want to program DOS games? Steps inside...

Posted: Thu Aug 23, 2007 5:20 am
by dosraider
redshock wrote:..... If you installed Turbo C to the C: drive, in DosBox, type "mount c c:\turboc\disk1", hit enter, then "tc.exe". ...
"mount c c:\turboc\disk1", hit enter, then "tc.exe".
Nope.
You need to install TC first and you need the files that are on the 3 disks.
Mounting your way gets the install to stuck completely.
And use dosbox to install TC, you don't need to write floppies that way.
More: many modern PCs don't have a flopdrive (yay for modern times :/ ) and the install only works from the A: , so dosbox is really the best option.


This is a better way to do things to install TC:
In windows first:
Create a c:\games\temp folder
Down the file , extract all files/subs from all the disks (3 of them) to c:\games\temp\

Run dosbox, input:
mount c c\games
mount a c:\games\temp
a:
install


Accept all, TC will be installed in c:\games\TC\ , (That's C:\TC\ in dosbox ! )
The install will find all the needed files/subs, no problems. And as you run the install from HardDisk it's fast.
You're still in dosbox here, prompt a:

To run TC:
c:
cd TC
TC

Next time you wanna run TC:

mount c c:\games
c:
cd tc
tc


Advantage is that you can store your games on your virtual dosbox C:\ (C:\games\ in windows).
You also can use the same one for your other games.
And you have the C:\games\ mounted as C, so you don't need to completely clutter up the TC folder to store your writings/testings/whatevers.

That C:\games\ is an example, can be a D:\games or other if you have more partitions.
But use a subfolder. Much better.

BTW: nice post you wrote.
And welcome to dosgames board.

Posted: Thu Aug 23, 2007 6:24 am
by redshock
Thanks for clearing that up! glad to be aboard...

Posted: Thu Aug 23, 2007 9:50 am
by Dogbreath
Nice post.

And congrats on being the 2000th member!

Posted: Thu Aug 23, 2007 11:50 am
by The_Sinister_Mastermind
Indeed a nice post there redshock and it was nice chatting to you in the IRC channel earlier yesterday. Iā€™m curious to see some of your own work, from our conversation I gathered you have aspirations of making some games yourself, be sure to keep us posted if you get anywhere, or indeed if you need some help/advice/etc from our members.

Posted: Thu Jun 11, 2009 8:08 pm
by carbontwelve
After reading this thread I thought I would write a how to with screenshots as one isn't really available on the net. Then I decided to go one further and create a osx app package which would run turbo C (within dosbox) under osx, something I do with all my dos games (means 100 or so copies of dosbox, but the games all have pretty icons in osx)

You can see my tutorial here with download link at the bottom for the osx app: http://photogabble.co.uk/projects/dos-days/turbo-c-dos/

Or the osx app can be downloaded directly from http://photogabble.co.uk/wp-content/plu ... .php?id=10

I hope this helps other people...

So you want to program DOS games? Steps inside...

Posted: Sat Jul 11, 2009 1:14 am
by aliannahfth
Thank You.Its Reslly nice to provide.Ill Try this.

Posted: Sun Apr 11, 2010 5:02 pm
by Vangar
And if you want to mess around, there's always qbasic for beginners.

Posted: Sat Jun 09, 2012 11:13 am
by nitrofurano
Vangar wrote:And if you want to mess around, there's always qbasic for beginners.
qbasic? i started to do something on FreeBasic instead, like this:
http://www.freebasic.net/forum/viewtopi ... =2&t=19967

btw, FreeBasic seems to be an awesome tool for newbies (like me) trying to code some stuff on DOS - the problem is FreeBasic is limited to not less than 386 - so, if people want to code on 286 or 8088 from FreeBasic, they must be able to edit the .asm file it generates temporarily when compiled

btw, for the "screen1" (320x200 4 colours), i coded this FreeBasic snippet, providing some pattern text, sprite simulation, and 52 palette combinations: http://pastebin.com/4bdwf2qJ

Posted: Sat May 31, 2014 1:00 pm
by ETTiNGRiNDER
Is there a special advantage Turbo C has over, say, OpenWatcom?

Posted: Fri Jul 18, 2014 5:13 pm
by Quadko
Usually the advantages are either library support or platform (dos, windows, etc.) support.

If you are writing for Dos specifically, maybe there are advantages to using dos era compilers. Other than things like Borland (Turbo C)'s BGI graphics library, or Watcom's early windows tools, or Microsoft's MFC for windows, it's not likely you'll care for fooling around with basic dos games.

And if you are developing for modern windows, you almost certainly want modern tools, especially as a beginner. Lots of cool stuff in new tools that didn't exist back then... but you can't compile code to dos in them anymore (mostly...). :)

Not sure if that answers the question. I know it was a while ago you asked. :)

Posted: Sat Sep 06, 2014 5:50 am
by tienkhoanguyen
Borland Turbo C 2.01 is a very good and easy language for gaming. I created my own Tic-Tac-Toe on it. However, I do have years of programming and IT experiences. At least 2 years of community college programming and many years of independent hacking if you will. These years of messing around might seem like a waste of time however I find it useful especially in making all the pieces come together. I would just say take it easy and take your time. Some of these renderings are amazing that I do not even know how to do. For instance, I love the Quake One for DOS. The rendering is amazing. It is in the same game gendre as Duke Nukem except I have the official version for Quake One. Anyways, sometimes I lose it and just toss the disc in the trash. haha Anyways, what I was telling you is that Borland Turbo C 2.01 is also free and the graphics library is modest. It might not be the latest true color in your face realism; However for games and fun it is enough.

Posted: Sat Sep 13, 2014 1:11 pm
by ETTiNGRiNDER
I guess the question was a bit vague.

OpenWatcom can still compile to DOS formats if you give it the right setting. It's a continuation of the old Watcom that was used for some DOS programs (in general looking at the docs with some source releases, it seems like id Software preferred Borland while 3D Realms used Watcom).

OpenWatcom is free and open source, and you can download as you will while Borland is apparently only free of monetary charge but with some obnoxious strings attached (they want mailing address and telephone # just for me to download? I don't think so, bro.)

So my question is more, what (if anything) can Borland give me that Watcom can't? As far as I can tell the answer might be that Borland has some extra DOS graphics libraries of some sort, but I haven't been able to find a good feature comparison on that front, nor how hard it would be to make Borland code compile in Watcom (or vice versa). I'm not sure how much old C compilers were like the old BASIC dialects where every system had a different and incompatible one.

DJGPP is also a thing, but I haven't looked into it as much. Seems it can only compile protected mode programs, which may or may not be a bother depending on what you're making I guess.

Posted: Sat Sep 13, 2014 11:42 pm
by tienkhoanguyen
As a nobody who has experiences of maybe 8 or more programming languages in my lifetime, I would have to say it depends on you! Many people seem to prefer C++, or even Objective-C over Borland Turbo C 2.01. Others prefer Tiny C Compiler (TCC). Then there is GCC which is built by TCC. So there are so many options. I have tried Watcom and it was a pain in the buttocks. It boils down to what each individual seems to like. Maybe I like Vietnamese Spring Rolls while another person might enjoy a nice Hamburger with Fries. So don't be shy hehe Just dig in and have fun with what you like. As for Borland asking for person information, I do know they do advertise frequently their 64-bit Borland packages. However it is a small price to pay for a package that was originally $450 back in 1987, 1988. Also, as a registered user, you can put your own copyright sign, however, I like the annoying priviledge of boasting about the standard Borland preference haha.

Well, developing a demo is fine and it is good practice. However, getting everything copyrighted and getting all the legal works done is a pain in the butts. So I know having to get approval is often times harder than it seems. This is especially true of known companies.

Posted: Thu Aug 24, 2017 5:50 pm
by SeanRamey
I have put together a pack with many good books for DOS development, plus my own Code::Blocks dev environment setup for DOS programming.

The upside of mine is that you can use Code::Blocks IDE which runs on modern Windows and Linux, and I've integrated Dosbox a bit so that you can be more productive.

The downside of mine is that I haven't figured out a way to integrate a debugger yet, and I also don't have a profiler integrated. These shouldn't be too hard to add if you can find a debugger that works with Digital Mars C (that's the compiler I use in this setup) and you might be able to integrate Turbo Profiler pretty easily, but I haven't tried. But, here are the files if anybody wants them.

Instructions are in the Readme.txt.

DOS Programming Pack.7z

So you want to program DOS games? Steps inside...

Posted: Sun May 29, 2022 6:27 am
by Dutch
Hello, guys. I understand this topic is ancient, but if any of you are still around -- please, help.

I've read this thread couple month ago and decided to start learning C, and did some progress since then. I've went through tutorial (256-Color VGA Programming in C) and made couple of graphical "experiments" on a real hardware. But now its time for some serious stuff, and I can't find any literature about game developement for DOS. This book in OP (Tricks of the Game Programming Gurus) isn't available anymore and I can't find it anywhere in the internet. If anyone can share this book, I would be so grateful!
And maybe someone can advise where to start with VESA-modes programming. VGA is good, but I would prefer 640x480.

Also, link in a last post is dead by now, sooooo.. maybe someone can reupload too.

So you want to program DOS games? Steps inside...

Posted: Mon Oct 10, 2022 8:02 pm
by kronoman
Dutch wrote: ā†‘ if any of you are still around -- please, help.
Hi, Im Krono, I have developed many games for MS DOS, Windows, Linux, etc as professional as well as hobbyist.

Im right now doing a small new MS DOS game (2022) for a retro competition at my country.

The book you are looking for is available at Library Genesis, look for it, you need the 1994 version, the 1999 version already talks about Windows

For developing I use the following toolchain now, since I dont own real old hardware anymore:

- DosBox
- DJGPP
- Allegro 4.2
thats for compiling for MS DOS. I may try to use 86box later, to achieve faster compiling times. Virtualbox really did not gave good results with Allegro.

There is plenty of games done with Allegro 4.2 to check source code and learn. Do NOT use Allegro 5 for MS DOS, since it is not supported. 4.2 is the last Allegro version to support MS DOS.

I edit my code in Notepad++ and draw my sprites and ard using Aseprite, GIMP, Inkscape, Irfanview. The audio I do with Audacity and OpenMPT.

Note that if you use my toolchain, you games will only run in 386+ up hardware.

I have also found that the grabber tool for Allegro 4.2 does not work properly in Dosbox, yet to be investigated, so I use the Windows version to generate the datafiles.

For the makefile, I use almake, a simple makefile I created (its at sourceforge)

To save a little space on exe files, you can strip debug info, then compress with UPX

From the DJGPP FAQ:
3.5 Can I run it on a 286?

Q: Why can't I run DJGPP on my 286? It has protected mode also....

A: True, but the protected mode isn't an issue here. Gcc doesn't care much about memory protection, but it does care to run on a 32-bit processor, which the 286 isn't. A 386 or better CPU really is required
Happy coding! :thumbsup:

ps Check my two games, KBall and Kraptor, available for free and with source code.

Soon there will be more! I cant put the links since Im a new user, but you can find me at the authors page as Kronoman. :thumbsup:

So you want to program DOS games? Steps inside...

Posted: Sat Oct 22, 2022 10:26 am
by MrFlibble
Oh, so you are the Kronoman! Welcome to the forums! We appreciate the games that you have created.

So you want to program DOS games? Steps inside...

Posted: Mon Oct 24, 2022 5:11 pm
by kronoman
MrFlibble wrote: ā†‘ Oh, so you are the Kronoman! Welcome to the forums! We appreciate the games that you have created.
Thanks for the welcome! Yes, I've been working on some new MS DOS games, and also salvaging some old floppies with experiments and little games I never released.

I'll be throwing everything I can before I disappear from this world.

I feel that MS DOS game programming is an art that is being forgotten.

I will try to do a tutorial or course to preserve knowledge...

Best regards!

So you want to program DOS games? Steps inside...

Posted: Wed Nov 02, 2022 6:30 am
by Janeere
Learning C not so long ago I also ran into the problem of the lack of tutorials. I would appreciate helpful sources. Thanks.