VOGONS


First post, by Socket3

User metadata
Rank Oldbie
Rank
Oldbie

Hi guys.

I've been wondering - is there any way of compiling a version of Open DUNE, Dune Legacy or Dune Dynasty to run on native DOS? My programming knowledge is 0, but I'd really love to be able to play a modern dune 2 port with it's mission select function, multiple unit selection, unit grouping, skirmish and advanced AI in native DOS, but after literal months of searching I wasn't able to find a DOS port that had even part of these features... so I'm asking for help here.

i don't know if this is the right forum section, if not I apologize in advance.

I got this idea after finding a couple of working DOS Doom ports, one of witch is actually a relatively new version of zDoom witch not only supports mouselook and resolutions up to 1280x1024. Great fun - I'll link a copy of the port here in this topic if anyone is interested, it was a bit of a pain to find. It runs best on a 200-233Mhz pentium MMx or faster, but I've been able to run it on a 83Mhz pentium overdrive with good results. Not the smoothest experience on a machine this slow but it is playable.

Open Dune source can be found here: https://github.com/OpenDUNE/OpenDUNE
Dune dynasty source is here: http://dunedynasty.sourceforge.net/

and I found a fork of Dune Legacy here: https://github.com/PhilipLudington/Dune-Legacy

I think the closest one to the original DOS dune 2 is Dune Legacy with Open Dune a close second, but Dune Dynasty has a myriad of great features that the other two ports lack, like (optional) improved AI, usable skirmish and the ability to play digital music samples, as well as extra sides playable in skirmish and multiplayer - Sardaukar, Mercenaries and Freemen

Now the question is, where would I start? I have no idea what to do with source code, what programs to use for compiling, how to do it to get a working binary, let alone how I'd do it for DOS... Any help would be greatly appreciated.

Last edited by Socket3 on 2022-04-23, 18:00. Edited 2 times in total.

Reply 1 of 20, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Your best bet without having to modify code is to try the above with hxrt, as long as the above uses SDL1 you have a good shot.

Without that the you'd need to either port sdl to dos, modify the port to use allegro for dos, or code the port to work without sdl or allegro.

All of the above assumes your hardware is also compatible with dos programs, if not then you'll need to replace the hardware or add support.

9x would be a lot easier but possibly not as fun.

How To Ask Questions The Smart Way
Make your games work offline

Reply 2 of 20, by Socket3

User metadata
Rank Oldbie
Rank
Oldbie
DosFreak wrote on 2022-04-23, 13:01:
Your best bet without having to modify code is to try the above with hxrt, as long as the above uses SDL1 you have a good shot. […]
Show full quote

Your best bet without having to modify code is to try the above with hxrt, as long as the above uses SDL1 you have a good shot.

Without that the you'd need to either port sdl to dos, modify the port to use allegro for dos, or code the port to work without sdl or allegro.

All of the above assumes your hardware is also compatible with dos programs, if not then you'll need to replace the hardware or add support.

9x support would be a lot easier but possibly not as fun.

Great tips, thank you! I think there are early versions of OpenDune that use SDL1 - not sure, I'll have to check. Don't know about allegro - frankly I don't even know what allegro does - I assume it's a library like SDL, and I have no idea how I'd go about removing it from the port. I don't think it would be easy... I presume the port uses these libraries to perform certain critical tasks, witch would mean removing them means re-writing most of the code...

One problem is - if I remember correctly, the early ports of OpenDune are pretty unfinished and a bit unstable... so I guess porting SLD to dos might be the best way to go?

Damn this is complicated. It frustrates me that I have no programing ability whatsoever.

Hardware-wise the port can be tested on real hardware, I have DOS machines I can try it on.

Wouldn't DOSBOX be a quick and easy way of testing on modern hardware? It would be a lot quicker then transferring the port to a machine that can run native dos...

Reply 4 of 20, by gerwin

User metadata
Rank l33t
Rank
l33t

The OpenDune Github mentions a Watcom C DOS version in several places. Like "wccbuild.bat" and "Proof of concept Watcom C port (for DOS with DOS4GW extender)" Thought the actual download of a precompiled version is not there. Or I fail to find it.

Even with that, It would be hard for me to enjoy without the Dune Dynasty Skirmish mode and a directional attack fix.

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 5 of 20, by Socket3

User metadata
Rank Oldbie
Rank
Oldbie
gerwin wrote on 2022-04-23, 16:41:

The OpenDune Github mentions a Watcom C DOS version in several places. Like "wccbuild.bat" and "Proof of concept Watcom C port (for DOS with DOS4GW extender)" Thought the actual download of a precompiled version is not there. Or I fail to find it.

Even with that, It would be hard for me to enjoy without the Dune Dynasty Skirmish mode and a directional attack fix.

Same here. Witch is why I'm hoping it is possible to compile the latest version for dos.

Looks like Allegro 4.2 can be compiled for DOS: https://www.mrdictionary.net/allegro/ and there are projects that rely on SDL for DOS: https://discourse.libsdl.org/t/porting-sdl-to-dos/27361 There are some mentions for getting around SDL and even compiling SDL2 for DOS here on vogons: Re: Any interest in a SDL-less "abstract" port?

I read trough but since I'm not a programmer, it's like reading a foreign language at times...

Dune Dynasty seems to be coded using the Allegro library, although they don't specify witch version. https://www.allegro.cc/depot/DuneDynasty It also seems to default to the openGL renderer, but since it's based on Open Dune it also supports direct 3D as well as software rendering.

[EDIT]

Ok I opened up dunedynasty.cfg and changed the value of driver= to software. It's not mentioned in the comments above, but the game launched and ran with no issues. Might have defaulted to openGL tough...

[graphics]
# driver is one of: opengl, direct3d
driver=software #opengl
# window_mode is one of: windowed, fullscreen, fullscreenwindow
window_mode=fullscreen
screen_width=1920
screen_height=1080
menubar_scale=2.00
sidebar_scale=2.00
viewport_scale=3.00
hardware_cursor=1

For DOS a resolution of 320x240 would be perfectly acceptable, but it would be nice to be able to go higher, like say 800x600 since Dune Dynasty supports zooming in and out. Using the mouse wheel (witch would not work in dos as far as I know). I guess zooming could be remapped to a key if it can be done in a dos renderer at all...

Reply 6 of 20, by Socket3

User metadata
Rank Oldbie
Rank
Oldbie
gerwin wrote on 2022-04-23, 16:41:

The OpenDune Github mentions a Watcom C DOS version in several places. Like "wccbuild.bat" and "Proof of concept Watcom C port (for DOS with DOS4GW extender)" Thought the actual download of a precompiled version is not there. Or I fail to find it.

Even with that, It would be hard for me to enjoy without the Dune Dynasty Skirmish mode and a directional attack fix.

I've been meaning to ask - does your doom port support mouse look?

Reply 7 of 20, by gerwin

User metadata
Rank l33t
Rank
l33t
Socket3 wrote on 2022-04-23, 17:54:

Dune Dynasty seems to be coded using the Allegro library, although they don't specify witch version. https://www.allegro.cc/depot/DuneDynasty It also seems to default to the openGL renderer, but since it's based on Open Dune it also supports direct 3D as well as software rendering.

Dune Dynasty uses Allegro version 5. Allegro v5 is way different compared to v4/v3. Different API. Also much less legacy support and baggage. Programs compiled with Allegro v5 do not run on Windows 98, last time I checked.
Allegro v5 has a major advantage to v4: The mouse routines are thread-safe. So allegro 5 programs don't have the tendency to crash on multi core systems like Allegro 4 programs do. The downside of v5 is that it lacks the GUI components of v4.

A while back I put in some effort to make a final SVN build of Dune Dynasty. See topic Dune II HD port at last! with download link.
The build on my site is the only OpenDune spinoff with an optional directional attack fix. I have that Dune Dynasty SVN source and its build environment on this system.

Mr. Wang the author of Dune Dynasty is unreachable by any of his message boxes or emails that I know of.
OpenDune development, despite its great intial progress seems to have stalled.

And so you know, In general I am interested in trying to get some classic things running in Windows XP if the effort versus benefit is reasonable, but for a while now I am not much into DOS tinkering again.
I am familiar with Allegro 3 and 4. And a little bit with 5. But still a DOS port may be very time consuming. First you have to have a compiler set up with the required libraries that can target the OS of choice. Then you compile and sometimes you are lucky if it just works, and it produces a nice executable. But more often there are errors with compiler configuration, dependencies like library versions, and/or with C or C++ language version and syntax.

Socket3 wrote on 2022-04-23, 18:45:

I've been meaning to ask - does your doom port support mouse look?

I don't even know. I never tried to to play it that way. These games did the vertical aiming for you. So I think they play very comfortably with keyboard, with one hand even. 😀
(PS, MBF 2.04 is not really my port, I just added to it)

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 8 of 20, by Socket3

User metadata
Rank Oldbie
Rank
Oldbie
gerwin wrote on 2022-04-23, 19:43:

And so you know, In general I am interested in trying to get some classic things running in Windows XP if the effort versus benefit is reasonable, but for a while now I am not much into DOS tinkering again.

I have Dune Dynasty running on my XP rig and it works great. I guess Allegro 5 is XP friendly

gerwin wrote on 2022-04-23, 19:43:

I am familiar with Allegro 3 and 4. And a little bit with 5. But still a DOS port may be very time consuming. First you have to have a compiler set up with the required libraries that can target the OS of choice. Then you compile and sometimes you are lucky if it just works, and it produces a nice executable. But more often there are errors with compiler configuration, dependencies like library versions, and/or with C or C++ language version and syntax.

I kind of figured as much.... that means any allegro 5 dependency needs to be renamed or changed to match allegro 4.2.... And then there's the renderer.... for DOS the port would need to use a VESA 2.0 software renderer as opposed to opengl... and the audio... Dune Dynasty uses timidity and fluidsynth - I suppose those would have to be pulled. The engine does have simple MIDI support so that would be fine, but it would also be great if the port would be able play pre made mp3 files like the current release can on modern windows. MT32 audio without an MT32!

gerwin wrote on 2022-04-23, 19:43:

I don't even know. I never tried to to play it that way. These games did the vertical aiming for you. So I think they play very comfortably with keyboard, with one hand even. 😀
(PS, MBF 2.04 is not really my port, I just added to it)

After years of playing shooters with mouse aiming and keyboard strafing I find playing with the keyboard alone quite clumsy... I don't mind the aiming as much as I mind the turn speed and strafing. Makes me feel like a one legged man at a butt kicking contest.

Reply 9 of 20, by gerwin

User metadata
Rank l33t
Rank
l33t
Socket3 wrote on 2022-04-23, 20:06:

I have Dune Dynasty running on my XP rig and it works great. I guess Allegro 5 is XP friendly

I just checked their latest v5.2.7 release announcement at https://www.allegro.cc/forums/thread/618381
And it says they restored Windows XP compatibility, after losing it earlier.

For Dune Dynasty SVN I used this:
- MinGW-4.5.2 compiler
- Allegro-5.0.10 (from 2013)
- FluidSynth-1.1.11-MSYS2-MinGW-x86
- LibMad-0.15.1b-4_MinGW
- enet_v1.3.14

OpenDune is totally different: "OpenDUNE is written in ANSI C (C89), and only requires SDL/SDL2 to run. In result, OpenDUNE should run on all platforms supported by SDL or SDL2."

Socket3 wrote on 2022-04-23, 20:06:

I kind of figured as much.... that means any allegro 5 dependency needs to be renamed or changed to match allegro 4.2.... And then there's the renderer.... for DOS the port would need to use a VESA 2.0 software renderer as opposed to opengl... and the audio... Dune Dynasty uses timidity and fluidsynth - I suppose those would have to be pulled. The engine does have simple MIDI support so that would be fine, but it would also be great if the port would be able play pre made mp3 files like the current release can on modern windows. MT32 audio without an MT32!

Allegro 5 has a different API compared to v3/v4, which means that the calls to get things done are different. Like the call to draw a rectangle in v5 is not written the same as the call to draw a rectangle in v4. See https://www.allegro.cc/manual/
Your sound related remarks sound logical.
Renderer is not really a word for this 2D work. It is about blitting things on a memory bitmap, then copying the memory bitmap to video memory. In Doom MBF I did not use an external library for that, like Allegro 3, but rewrote it as a small local library with direct hardware access.

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 10 of 20, by gerwin

User metadata
Rank l33t
Rank
l33t

Out of curiosity I tried the source "OpenDUNE-0.9.zip" with compiler "open-watcom-2_0-c-dos.exe"
This goes reasonably well. but there are problems with long file names in the source. 25 files of the source are more then 8 characters.
So manually I rearranged that and got it to compile and link an OpenDune.exe.
Together with DOS4GW it starts, shows the intro and all. But I cannot play a game because it does not respond to mouse or keyboard at all. Also there is no sound.

Edit
In cutscene.c, at GameLoop_GameIntroAnimation(void) comment out and add:
//Gameloop_Logos();
g_canSkipIntro=1;
Now I can enter games and keyboard and mouse do fine. But it is like time does not start, everything is frozen. only the GUI responds properly. No sound of course.
Probably timer.c is missing its DOS components. Define DOS is mentioned several times there, but seems like a stub.

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 11 of 20, by Socket3

User metadata
Rank Oldbie
Rank
Oldbie
gerwin wrote on 2022-04-23, 23:58:
Out of curiosity I tried the source "OpenDUNE-0.9.zip" with compiler "open-watcom-2_0-c-dos.exe" This goes reasonably well. but […]
Show full quote

Out of curiosity I tried the source "OpenDUNE-0.9.zip" with compiler "open-watcom-2_0-c-dos.exe"
This goes reasonably well. but there are problems with long file names in the source. 25 files of the source are more then 8 characters.
So manually I rearranged that and got it to compile and link an OpenDune.exe.
Together with DOS4GW it starts, shows the intro and all. But I cannot play a game because it does not respond to mouse or keyboard at all. Also there is no sound.

Edit
In cutscene.c, at GameLoop_GameIntroAnimation(void) comment out and add:
//Gameloop_Logos();
g_canSkipIntro=1;
Now I can enter games and keyboard and mouse do fine. But it is like time does not start, everything is frozen. only the GUI responds properly. No sound of course.
Probably timer.c is missing its DOS components. Define DOS is mentioned several times there, but seems like a stub.

That is amazing!

Maybe sound doesn't work because it's looking for an external driver or even a windows component / subsystem instead of trying to output to real hardware? I dunno, talking out of my ass here. I'm amazed you got it do display graphics, I think that's an achievement all in it's own! Not to mention getting keyboard and mouse to work!

Is timer.c a script? Maybe it relies on a library that's either missing or does not compile properly under dos? If it's a stub does that mean it needs to be re-written?

What software can I use to open up the source files? I'd like to have a look, even if I won't be able to understand much of anything...

Reply 12 of 20, by gerwin

User metadata
Rank l33t
Rank
l33t
Socket3 wrote on 2022-04-24, 16:20:

Maybe sound doesn't work because it's looking for an external driver or even a windows component / subsystem instead of trying to output to real hardware? I dunno, talking out of my ass here. I'm amazed you got it do display graphics, I think that's an achievement all in it's own! Not to mention getting keyboard and mouse to work!

Sound was not expected to work because it needs card specific drivers for that. Like for Sound Blaster or something else. That is a DOS thing, because sound interfacing was never a proper standard in DOS.
Video, keyboard and mouse just works. I did not do anything to make it work. It is fortunate it just works already.

Socket3 wrote on 2022-04-24, 16:20:

That is amazing!
Is timer.c a script? Maybe it relies on a library that's either missing or does not compile properly under dos? If it's a stub does that mean it needs to be re-written?
What software can I use to open up the source files? I'd like to have a look, even if I won't be able to understand much of anything...

The dot-c files hold most of the code. There are also dot-h header files, which announce what is in the matching dot-c files.
You can open both with a normal text editor. There are also text editors with c specific functionality to make life easier, called IDE's. But one can do everything with a normal text editor anyways.

I am a bit intimidated with the timer.c file. When I say it looks like it is a stub in regards to DOS, I mean they just mention DOS there in order to skip over most of it, because the actual DOS code is not there. And I don't know what they expect there to be. I suppose it needs to program a DOS hardware timer to a proper Hz-speed and also make an interrupt routine around that timer. Not easy.

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 13 of 20, by Socket3

User metadata
Rank Oldbie
Rank
Oldbie

I had some dune 2 dos source code somewhere - written in Basic. I think it's a fan recreation. I don't remember where I got it from - probably from some c&c forums - but maybe it can be of some help? I'm attaching it here:

Filename
dune2basic.rar
File size
190.11 KiB
Downloads
36 downloads
File license
GPL-2.0-or-later

I downloaded it some time ago in hopes I'd pick up coding as a hobby once I can wrestle up some free time, but haven't really gotten there yet.

[EDIT]

While looking around the internet for anything related to dune 2 source code and timer.c I came across this:

https://sudonull.com/post/134568-Dune-2-The-B … ng-of-a-Dynasty

It describes porting OpenDune to Java, and mentions some bits about timers....

Reply 14 of 20, by gerwin

User metadata
Rank l33t
Rank
l33t

Okay, Good news.
I setup the OpenDune build again, this time with the current SVN version instead of v0.9.
- Can now skip the intro at start without any tricks.
- Messed with the ini file again and probably the "debug_scenario" option was the cause for the game not running. It runs now.

Found a good timer example for DOS4G/Watcom here. But since the build now obviously runs fine already, I did not change anything to the source code, and limited the adjustments to the Watcom build files.

You can download the build + adjusted build files here: http://www.gb-homepage.nl/index.htm (Downloads section)

Tested it in Windows XP and in DosBox: Works.
On a pentium II, either in Windows 98 or real DOS 7: Works

And to temper the expectations: There is no Sound/Music. OpenDune has no multi-unit selection.

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 15 of 20, by gerwin

User metadata
Rank l33t
Rank
l33t
gerwin wrote on 2022-04-24, 20:40:

And to temper the expectations: There is no Sound/Music. OpenDune has no multi-unit selection.

I uploaded a new version with a rudimentary MPU-401 midi music driver.
The detection takes the P address from the BLASTER environment variable. In case that does not work it probes 0x330 too.
Example: SET BLASTER=A220 I7 D1 H5 P330

Rudimentary: I filled the OpenDune driver interface with the DOS counterparts of the functions. But that won't do for the note-timing and for MPU ready to receive delays...

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 16 of 20, by Socket3

User metadata
Rank Oldbie
Rank
Oldbie

This is shaping up surprisingly well. I'll download the latest build now and try it on real hardware.

UPDATE

I rant alpha 2 on my k6-2+ and the game ran fine, albeit a bit slow (didn't try changing game speed from menu). At first I thought sound doesn't work, but then I turned my SC-55 on and the game outputs both music and sound effects to it, so sound is outputted on port 330h, probably because of my SET BLASTER enviroment.

I'll do a bit more testing as I have time, pretty excited tough.

Reply 18 of 20, by gerwin

User metadata
Rank l33t
Rank
l33t
cyberluke wrote on 2022-11-11, 19:32:

Any updates?

Not really.
I concluded that the way OpenDune interfaces to the different sound and music drivers, is not suitable for slower DOS machines. The way the project is set-up now, it is not possible to ADD proper DOS drivers. It can still be implemented of course, like forked and changed more thoroughly. But I don't feel like doing that.
Back then, I contact the guy from OpenDune github "miniupnp", he wrote on 25-5-2022:

well about the timing, I guess the midi playback of Dune II was interrupt driven. For many reasons OpenDUNE changed that so indeed it is possible that the notes are played with a wrong timing, especially on a slow machine.

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 19 of 20, by cyberluke

User metadata
Rank Member
Rank
Member

Yes, I understand, but lets forget MIDI and what about Sound Blaster + Adlib OPL3? I have 10 DOS machines here ranging from 40Mhz to 1GHz. I would prefer 550 Mhz AMD K6-62+ because of ISA slot. I compared Roland SC-MKII (including its MT-32 mode) with Sound Blaster AWE 32 as well as AZTech Yamaha OPL3 soundcard. I prefer the OPL3 (choose Adlib in setup.exe).