×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Breathing New Life Into Old DirectDraw Games

Soulskill posted more than 3 years ago | from the new-love-to-old-games dept.

Classic Games (Games) 274

An anonymous reader writes "I bought a bunch of old Wing Commander games for Windows, but they use DirectDraw, which Microsoft has deprecated. They don't work too well under Windows 7, so I ended up reimplementing ddraw.dll using OpenGL to output the games' graphics. I wrote an article describing the process and all the fun workarounds I had to come up with, and released all related source code for others to hack on."

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered

274 comments

There were some damn fine games in that era... (4, Insightful)

Dexter Herbivore (1322345) | more than 3 years ago | (#33495436)

and we didn't need gimmicks like motion controllers, photo-realistic graphics and high framerates to enjoy them.

Re:There were some damn fine games in that era... (4, Funny)

reverendbeer (1496637) | more than 3 years ago | (#33495670)

and we didn't need gimmicks like motion controllers, photo-realistic graphics and high framerates to enjoy them.

...consarn it!

Funny that (eggy post follows) (2, Interesting)

Anonymous Coward | more than 3 years ago | (#33495950)

Minecraft is the most fun I've had in a computer game for years, and practically everyone I have shown it to has downloaded it and become obsessed - yet the graphics are kind of shit - but even then, it requires a reasonably modern computer to run quickly (drawing millions of cubes is quite time consuming, I guess - does anyone know how he draws everything so efficiently? Does MC only render blocks that are unoccluded? If so, how does it figure that out? I'm really intrigued by the tech behind MC). I wonder if the game would be more fun if it had better graphics? I kinda think it would.

Re:Funny that (eggy post follows) (0)

Anonymous Coward | more than 3 years ago | (#33496192)

With raytracing, you could have millions of perfect spheres instead of cubes!

Re:There were some damn fine games in that era... (4, Funny)

LazLong (757) | more than 3 years ago | (#33496202)

and we didn't need gimmicks like motion controllers, photo-realistic graphics and high framerates to enjoy them.

In my day we didn't have fancy-schmancy graphics. We didn't have graphics all. All we had were alphanumeric characters to manipulate for our games. And that's how it was, and you liked it! Sound? You were lucky if you could get a single-toned beep from your computer. And don't get me started on those fancy motion controllers! All we had was the keyboard. We stabbed ADWS until our fingers bled. And games? We had great games like Lemonade Stand, Tic-Tac-Toe, SpaceWar!, Star Trek, Super Star Trek. And that's how it was, and you liked it! You loved it!

Re:There were some damn fine games in that era... (0)

Anonymous Coward | more than 3 years ago | (#33496290)

Neither have stone age sapiens needed any fancy stuff to enjoy from the sex.

Great! (2)

Warma (1220342) | more than 3 years ago | (#33495438)

I've been waiting for this, though not expecting to see it. In my understanding, this'll allow future generations to play at least MechWarrior 2 and Battlezone, which have sadly been destroyed by DirectX patching.

WoW!! (1, Informative)

Anonymous Coward | more than 3 years ago | (#33495440)

Fastest slashdotting *ever*

Re:WoW!! (2, Informative)

Kjella (173770) | more than 3 years ago | (#33495520)

Fastest slashdotting *ever*

Ever since they started giving subscribers early peeks, the weakest sites have been slashdotted before the story hit the front page. Oh well...

Ya well (2, Informative)

Sycraft-fu (314770) | more than 3 years ago | (#33495604)

Looks like this is some little personal site, perhaps run on a server in a broom closet (I run such a closet server at my house). I have no idea why the author thought it would be a good idea to submit that to Slashdot.

Were there ever anything I wanted to submit, I wouldn't stick on my closet server, I'd stick it on my Pair server and link to it there. Slashdot people are very, very clickly. Anyone who submits to here ought to know that.

Re:Ya well (2, Informative)

Anonymous Coward | more than 3 years ago | (#33495892)

FYI: The hostname sol.gfxile.net resolves to 79.98.31.24, which belongs to a Lithuanian hosting company. Technically that doesn't rule out that the server is in a broom closet and talks to the internet via a home DSL line, but it's kinda unlikely.

99% of all Slashdottings are due to overly complex or badly configured content management systems. I.e., the bottleneck is not the uplink but the server. A static web site (which is delivered statically, not through a CMS) with moderately sized files (1-2MB per page) is almost impossible to overload by accident, even in a shared hosting scenario.

Re:Ya well (1, Informative)

Anonymous Coward | more than 3 years ago | (#33495896)

or you could submit the link to a caching service instead directly the one of your closet server

Wine? (4, Interesting)

Ynot_82 (1023749) | more than 3 years ago | (#33495454)

I haven't read TFA yet
but wouldn't this have been a prime use-case for Wine on Windows?

Re:Wine? (2, Interesting)

Zixaphir (845917) | more than 3 years ago | (#33495622)

I was going to place a statement in a similar vein. I hope he didn't have to replicate any work that Wine has already been successful in implementing [winehq.org] .

Re:Wine? (0)

Anonymous Coward | more than 3 years ago | (#33496232)

Because installing a whole nother application with its own problems and issues is a much better idea then replacing a single file and doing the work yourself and knowing its done right.

Re:Wine? (4, Interesting)

Anonymous Coward | more than 3 years ago | (#33495652)

"Funny you should mention that..." I blew this morning trying to get some old PS2 hacking apps running on Wine. In the end I just installed w98 on a spare box. Wine is classic YMMV. It's a good, worthy project, but man, you just can't _count_ that's it's going to deal with even small old VB6 apps ahead of time. Use restraint for recommending it unless you've done exactly what's being discussed.

Re:Wine? (4, Insightful)

advocate_one (662832) | more than 3 years ago | (#33495736)

"Funny you should mention that..." I blew this morning trying to get some old PS2 hacking apps running on Wine. In the end I just installed w98 on a spare box. Wine is classic YMMV. It's a good, worthy project, but man, you just can't _count_ that's it's going to deal with even small old VB6 apps ahead of time. Use restraint for recommending it unless you've done exactly what's being discussed.

what seriously pisses me off with WINE is that something works with one version of it, but breaks in the next... the database is almost useless with regards to being kept up to date and I'm too old for all this hassle now... and there's TOO much emphasis on having the very latest game running on it to the detriment of making sure other games don't become broken by changes made to support the latest and greatest...

Re:Wine? (2, Insightful)

Anonymous Coward | more than 3 years ago | (#33496120)

there's TOO much emphasis on having the very latest game running on it to the detriment of making sure other games don't become broken by changes made to support the latest and greatest...

You aren't really proposing an alternative though... Automated testing is practically impossible and manual testing is a huge, huge job if it means play testing thousands of games before every release. just saying "don't make mistakes" is not useful.

Re:Wine? (5, Insightful)

mr_mischief (456295) | more than 3 years ago | (#33496188)

Automated testing of all the applications is pretty much a nonstarter. However, automated regression testing to make sure function calls with the same arguments in the same context don't give different results just because you debugged a different set of arguments or in a different environment are easy to do with a proper test harness. The hard part is mapping the applications to test cases, but that's not impossible, just time consuming and somewhat difficult.

Re:Wine? (0)

Anonymous Coward | more than 3 years ago | (#33496218)

Well, they could start by just applying patches that fix things and can't really break anything instead of referring to some hypothetically better solution for over a year.
See e.g. http://bugs.winehq.org/show_bug.cgi?id=8854 [winehq.org]
They still wait on some X extensions that maybe, if we are lucky, will be in some distros in a year... or two... or never.

Re:Wine? (2, Insightful)

gmthor (1150907) | more than 3 years ago | (#33496360)

The Problem with Wine is, that from the user point of view, it is extremely unstable. It tried it out a couple time with games that had Gold or Silver status. None of them worked with the version I tried.
I think I would be really worth it, to stop developing more features for a while and add as many regression tests as possible to the project. So that the project gains stability. Since in the end, the real success is always determined by the end user.

Re:Wine? (0)

Anonymous Coward | more than 3 years ago | (#33495842)

On a spare box? Why? What's wrong with running a VM? Get with the program man, this is 2010! The concept of "spare box" to run temporary installs of whatever OS is long gone.

Re:Wine? (0, Troll)

FuckingNickName (1362625) | more than 3 years ago | (#33495926)

This isn't 2005. The concept of a VM software decently supporting old operating systems is long gone. They're now just a way of selling something to go with the "cloud" hype, a solution to a problem that shouldn't even exist were it not for awful security and installation policies on commodity operating systems: the need to run more than one instance of an operating system on a single piece of hardware.

Specifically, go on and try various VM solutions and see how many get you a working and stable Windows 98 install. And by "stable" I mean at least as stable as you'd get from good 10 year old hardware. Now what happens if the choice you've already made for all your other VMs doesn't support Windows 98? You going to install two vendor's solutions on the same box and run them simultaneously? Good luck with that.

Re:Wine? (4, Insightful)

bmcage (785177) | more than 3 years ago | (#33495988)

Wingcommander ran great in wine last time I played it in 2008. I suppose windows developers don't follow linux development?

Re:Wine? (1)

TheRaven64 (641858) | more than 3 years ago | (#33496180)

That was my first thought, but then I remembered what early DirectDraw actually did. It's basically little more than a bitblt operation, with some very primitive line drawing and image scaling support. Implementing it from scratch would probably take less time than factoring out WINE's DirectDraw DLL. I'm also not sure if WINE actually uses any acceleration for this kind of drawing. It's probably not worth it - it was done entirely on the CPU, back when the CPU was a 486, so doing it in software, even via a couple of bonus layers of indirection, on a modern machine is likely to be more than fast enough.

These games would probably work fine under WINE, but there's not much point in using the WINE DLLs on Windows except where the Windows ones don't work properly, so he may as well use the real versions for everything else.

The real question is why didn't he use DOSBox? He ran Wing Commander 1-4. The first three predate Windows 95, and so use DOS. The fourth had both DOS and Windows versions. Back then, they probably used a very simple set of wrappers around the VGA bitblt operation for DOS and the DirectDraw equivalent on Windows so that the game could use either.

All four of the games he tried are already supported by DOSBox, so it seems like a solution in search of a problem. He probably learned a bit and had fun making it work, but missed the important lesson of making sure that a project actually needs doing before you start.

Re:Wine? (1)

Tapewolf (1639955) | more than 3 years ago | (#33496344)

The real question is why didn't he use DOSBox? He ran Wing Commander 1-4. The first three predate Windows 95, and so use DOS.

Apparently he had some weird collector's edition which was made up of later Windows ports - it may not have included the original DOS versions.

Or you could (3, Insightful)

Rosco P. Coltrane (209368) | more than 3 years ago | (#33495462)

use an older version of Windows in a virtual machine.

Re:Or you could (3, Insightful)

M. D. Kristopeit (1890086) | more than 3 years ago | (#33495690)

NOT INSIGHTFUL. virtual machines are NEVER the optimal solution. ddraw.dll has been reimplemented at the lowest level... given that, why would anyone choose to rather use a virtual machine?

the only appeal of using a virtual machine was to a lazy developer WHO DIDN'T WANT TO DO IT RIGHT.

thanks story submitter... glad someone out there still understands, and has some pride left.

Re:Or you could (4, Insightful)

dintech (998802) | more than 3 years ago | (#33495716)

But to run Wing Commander on modern hardware, it doesn't need to be optimal. 80/20 rule dude.

Re:Or you could (-1, Flamebait)

M. D. Kristopeit (1890086) | more than 3 years ago | (#33495824)

what part of THE WORK IS ALREADY DONE don't you understand? 100% rule, idiot.

Re:Or you could (5, Insightful)

Your.Master (1088569) | more than 3 years ago | (#33496166)

It's only already done if the only ddraw game you want to play is Wing Commander 1-4 (Windows versions). And only with conventional monitor setups and only if you never want to capture the window content, due to the kludges involved. And if you can stand the known bugs he mentioned, eg. the blinking screen effect described in Wing Commander 4.

So basically, it's only already done if you want a suboptimal experience. But you were just talking about how you wanted an optimal solution, and how a solution that basically works better than this is "never" the optimal solution. To be fair, it sounds like 1-3 work pretty well, but for 4 you have to put up with some crap. And any other ddraw game is unlikely to work all that well.

This is a fun an interesting reverse engineering project. Stop being such a prick about it.

Re:Or you could (1)

Zaphod The 42nd (1205578) | more than 3 years ago | (#33495858)

You misunderstand the word optimal. It doesn't just mean processing performance capability. Yeah, sure, even if not running most efficiently, a modern processor can easily run Wing Commander. However, running a Virtual Machine in order to accomplish this will entail many more things, WAY more hard drive space being use for one.

Re:Or you could (1)

Hieronymus Howard (215725) | more than 3 years ago | (#33496336)

A virtual machine for old games would only require a tiny fraction of a modern hard drive.

If you just want to run old games, then a VM is the way to go. If you want a pet programming project then do something like this.

Ya no kidding (3, Informative)

Sycraft-fu (314770) | more than 3 years ago | (#33496136)

Virtualization has gotten really good these days, for those that don't keep up with it. You can virtualize modern OSes at near native speed. Running servers in VMs is getting real common. At work we have a few servers that we keep as physical boxes, like our SQL server, but the majority of our servers are virtual. Not only can that save on hardware costs (we have like 30 virtual servers on 4 physical servers) but it provides some amazing flexibility.

Now when talking older OSes, it isn't as speedy. Not all of the modern tricks work as well, and there's often not client drivers to accelerate things... However there doesn't need to be. Consider that when Windows 95 was about a Pentium was as good as things got. Well when you are dealing with something that slow, you can incur a hell of a lot of overhead in your virtualization and still maintain good speed.

As another posted mentioned, DOSBox is a good example. So are various console emulators.

I AM a fan of old games, and have played around with this. For DOS games, DOSBox works great. For probably 99.9% of Windows games, they run natively on Windows 7 64-bit. The rest seem to run fine on Windows XP 32-bit which works real well in VMWare, Virtual Box, and even MS's own VM is you have professional or ultimate. I've not yet come across a game for which I'd need to get 95 or 98 and virtualize those. I have done it at work though, and 98 does function just fine.

As you said, doesn't have to be optimal.

Re:Ya no kidding (1)

Hamsterdan (815291) | more than 3 years ago | (#33496174)

ST: Armada is one that won't run properly in XP.

1- you have to disable Sound acceleration (otherwise it's all skippy)
2- Mouse acceleration is somewhat broken (really really slow mouse)
3- It *WILL* crash to the desktop.

Re:Or you could (3, Interesting)

peppepz (1311345) | more than 3 years ago | (#33495840)

I think it's not a good idea to run software which was not designed to run on the version of the OS you're using. Besides using ddraw.dll, those games might also display funny behaviour which was not uncommon in those pre-NT, pre-UAC days, such as installing VxD device drivers, scribbling the registry and tossing DLLs all over the filesystem. A VM could spare you those worries.

See for example DOSBox: it lets you run old games with near-perfect results, and running them in DOSBox is much, much, much easier than getting them to work on a real DOS machine was, back in the days.

Re:Or you could (1)

Athrac (931987) | more than 3 years ago | (#33495750)

None of the DirectDraw games I've tried have worked correctly in VMWare (6.5). I know it's supposed to support DirectX, but in practice there are all sorts of graphical glitches and everything runs slow as hell.

Re:Or you could (1)

Hamsterdan (815291) | more than 3 years ago | (#33495986)

Tried running ST: Armada in 98SE (under Virtualbox), and it won't work properly either. So, I'm keeping an old machine for 98SE and DOS

Re:Or you could (1)

zblack_eagle (971870) | more than 3 years ago | (#33495768)

I tried that some time ago. Unfortunately it seems that some old games don't test the capabilities of the virtualized graphics "hardware" so much as compare it to some internal list of supported hardware, and thus refuse to run

Re:Or you could (5, Insightful)

kinema (630983) | more than 3 years ago | (#33495784)

What is learned by simply booting up a VM and loading a game? In the story submission he specifically mentioned "all the fun workarounds" that he had to come up with get everything to work on a modern system. Don't you think doing a cleanroom reimplementing a subsystem like DirectDraw presents a great learning experience?

No, I wouldn't have done this if you had payed me; I have my own interests and passions. I'm not at all interested in graphics programming or for that matter video games, though, apparently someone is and I think it's great that he saw a problem and decided to attempt to find a solution for it.

This is what being a geek is all about. Bravo.

BREAKING NEWS: GOD IS AN ATHIEST !! (-1, Offtopic)

Anonymous Coward | more than 3 years ago | (#33495494)

God is an athiest. Think about it.

Re:BREAKING NEWS: GOD IS AN ATHIEST !! (-1, Offtopic)

Anonymous Coward | more than 3 years ago | (#33495510)

Not if he's Triune. Think about it.

Re:BREAKING NEWS: GOD IS AN ATHIEST !! (0)

Anonymous Coward | more than 3 years ago | (#33495578)

THINK about your BREATHING!

Re:BREAKING NEWS: GOD IS AN ATHIEST !! (0)

Anonymous Coward | more than 3 years ago | (#33495734)

No, I am agnostic.

Yours,
God

Re:BREAKING NEWS: GOD IS AN ATHIEST !! (0)

Anonymous Coward | more than 3 years ago | (#33495954)

Yes, God don't believe in a higher being!

Re:BREAKING NEWS: GOD IS AN ATHIEST !! (0)

Anonymous Coward | more than 3 years ago | (#33496130)

Why was I not consulted ? DEATH TO INFIDELS ! Except babies. No, babies too.

M.

Who says DirectDraw is going away? (4, Informative)

Man On Pink Corner (1089867) | more than 3 years ago | (#33495498)

My own DirectDraw apps from 1996 work great in Windows 7. The API is deprecated in the sense that Microsoft no longer recommends using it, and who knows if they're still even shipping ddraw.h, for that matter. But as a COM component, runtime support for IDirectDraw isn't any more endangered than CreateWindow().

Re:Who says DirectDraw is going away? (5, Insightful)

Suiggy (1544213) | more than 3 years ago | (#33495766)

Yes, DirectDraw still exists on Windows 7, ddraw.dll is still there, and the headers are still a part of the Windows SDK and DirectX SDK. The problem is that graphics card vendors no longer care to test that their drivers work properly with DirectDraw, so it's really hit or miss if you get support.

Re:Who says DirectDraw is going away? (5, Informative)

peppepz (1311345) | more than 3 years ago | (#33495796)

But removing IDirectDraw would only break some games from the 90s, while removing CreateWindow (Ex) would kill every single Windows application ever coded.

Re:Who says DirectDraw is going away? (0, Funny)

Anonymous Coward | more than 3 years ago | (#33495846)

But removing IDirectDraw would only break some games from the 90s, while removing CreateWindow (Ex) would kill every single Windows application ever coded.

And nothing of value was lost.

Re:Who says DirectDraw is going away? (4, Interesting)

Xest (935314) | more than 3 years ago | (#33496156)

Indeed, in fact, this was precisely one of the problems DirectX was always designed to solve from the start, it was designed to provide a multimedia API that could both move with the times and retain backwards compatibility.

Issues with older games tend to come down to hardware specific optimisations, obsolete libraries such as Glide, or OS specific code.

For the most part, stuff written with Microsoft's officially provided Windows APIs even back to Windows 95 (and sometimes even further back than that) tends to still run. It's the stuff that doesn't use those APIs that often causes the problems.

For better or worse, backwards compatbility is one thing that Microsoft certainly does tend to get right most the time. It's just that companies often ignore backwards compatibility when building new apps and just build for the now. Sometimes this is excused, i.e. game companies doing low level optimisations to improve performance, other times it's some MBA falling hook line and sinker for the sales pitch of some fly by night company providing an obscure set of code libraries and mandating all his developers use it.

I still have apps I wrote in C using the raw Win32 API back in 1995/1996 that work absolutely fine to this day.

Chances are if a game doesn't run, DirectX version is the least of it's troubles.

i would read TFA.. (-1, Redundant)

Anonymous Coward | more than 3 years ago | (#33495500)

... but the server is sol

The Kilrathi Saga (2, Informative)

black3d (1648913) | more than 3 years ago | (#33495552)

As its difficult to get through the Slashdotting (I can't reach the site), this would be "The Kilrathi Saga" versions of the games - almost as valuable as a WoW Vanilla Collector's Edition to WC fans - which were "upgraded" versions of the original DOS Watcom C games for Windows 95. I say "upgraded" because I was once speaking to one of the original programmers who were working on the Kilrathi Saga edition and said that they couldn't even convert WC1. He called the original source a "Goat-fuck-hack" demo which Roberts put together to get a job at Origin, so they instead tinkered with a DirectDraw-wrapped WC2 engine.

The original DOS versions of the games, alternatively, work fine through DosBox.

link dont work (-1, Redundant)

Anonymous Coward | more than 3 years ago | (#33495554)

haha

heads up for combat soldiers' family and friends: (1, Offtopic)

ChipMonk (711367) | more than 3 years ago | (#33495568)

In 1998, I bought a second-hand Wing Commander IV: The Price of Freedom for US$10. The gameplay and graphics quality were fantastic, and I was particularly impressed with the producers' investment in the game.

But there was one thing I couldn't get past: the warzone aspect. At the time, a dear friend of mine was in the Bosnia combat zone, and every time I tried to play WC4, I couldn't help but think about her and what she was experiencing. I wanted to enjoy WC4, honestly, but after about 5 minutes I just couldn't, knowing that my friend was in mortal danger for real. It got to the point that I ejected the CD, wrote off the $10 as a bad investment, and flung it across the room.

Re:heads up for combat soldiers' family and friend (2, Funny)

Anonymous Coward | more than 3 years ago | (#33495586)

Man that is pretty bad! I say we put Origin out of business for making such a hurtful game!

Re:heads up for combat soldiers' family and friend (3, Informative)

Anonymous Coward | more than 3 years ago | (#33495598)

Except the Bosnia war ended in 1995. so your friend could not be in combat zone.
(I know. I was there. I still am.)

Re:heads up for combat soldiers' family and friend (0)

Anonymous Coward | more than 3 years ago | (#33495740)

Perhaps he meant it in a "had been" way instead of a "was" sort of way. War's impact on someone you know doesn't become less real with time; if anything, anyone who has been through the process of helping a friend through the re-tellings, the emotional fallout, and the post-traumatic stress of it all can relate to the fact that, for many, the apparent impact of the war seems to only grow with time.

Re:heads up for combat soldiers' family and friend (0)

Anonymous Coward | more than 3 years ago | (#33496048)

At the time,

Re:heads up for combat soldiers' family and friend (1, Insightful)

Anonymous Coward | more than 3 years ago | (#33496200)

He said "At the time", and since he bought it in 1998 - at the time means that his friend was in war in 1998 ... so your explanation is very improbable ...
It doesn't matter. Reason of my posting is to correct the prejudice about my country. In 1998 there were no combat zones in Bosnia and his friend could not be in danger in any way that could be presented in a game about war.

Re:heads up for combat soldiers' family and friend (1, Informative)

Anonymous Coward | more than 3 years ago | (#33496228)

Having been clipped in the calf muscle by an RPG while serving with IFOR in Sarajevo in 2002, I can personally tell you that even though the war ended, it was most certainly still a combat zone for many years.

Re:heads up for combat soldiers' family and friend (1, Insightful)

Anonymous Coward | more than 3 years ago | (#33495638)

You must be a real hoot at parties.

Re:heads up for combat soldiers' family and friend (5, Funny)

linguizic (806996) | more than 3 years ago | (#33495848)

I try to enjoy parties, but every time I can't help but feel bad for all those poor Indians who died in 1812 during the Boston Tea Party.

Re:heads up for combat soldiers' family and friend (2, Interesting)

couchslug (175151) | more than 3 years ago | (#33496100)

Heads up for combat soldiers family and friends, get a grip. Stress is one thing, wigging out is another and helps no one.

Plenty of combat soldiers/Marines/airmen game in-theater! Deployments have loooooong, boring stretches and gaming is a popular distraction.

Re:heads up for combat soldiers' family and friend (2, Insightful)

tehcyder (746570) | more than 3 years ago | (#33496364)

Did you not know that it was a space combat game?

I wonder about this (3, Informative)

Sycraft-fu (314770) | more than 3 years ago | (#33495582)

The server has 'asploded so I can't read the article (note to people: don't submit your shit to /. if your server isn't ready for it) but I'm questioning the summary. Windows 7 does have DirectDraw. ddraw.dll is present in the Windows directory.

As far as I know, compatibility is maintained for ALL versions of DirectX back to the beginning. Things stop being supported, but that just means they aren't included with the new APIs. So you can't use DirectDraw from DirectX 11 APIs, but if you have an old DirectX 6 game, it'll still work fine.

As a practical matter the original Fallout runs, and it wants DirectX 3 to do its thing.

I'm not claiming that the author didn't have to do something to make these games work, but I think he may be confused about the situation.

I also wonder on his methods. Why would you use OpenGL to reimplement DirectDraw on Windows 7? DDraw's replacement is Direct2D, which is a native Windows API. OpenGL works fine on Windows, but only in the event that the company who makes the graphics card chooses to write an ICD for it. Direct2D is automatic for anything with WDDM 1.1 drivers.

Re:I wonder about this (3, Informative)

Anonymous Coward | more than 3 years ago | (#33495674)

Windows 7 does NOT support full backwards compatibility for older versions of directX. You can, however, install directX 9 (which then sits alongside directx11) and that fixes up many games. (Finding the correct install package that doesn't just say "Oh, you've got 11, I'll stop" is a chore, though.

This situation isn't going to improve. Running through a virtual machine does work fairly well though.

Re:I wonder about this (1)

KiwiSurfer (309836) | more than 3 years ago | (#33495764)

Mod parent up. Installing DX9 is required to make Civilization 4 (and several other games) work on Windows 7. This is apparently due to missing DLLs which are not included with DX11 but are included with DX9. The whole concept of backward compatibility is a joke with DX.

Re:I wonder about this (1, Interesting)

Anonymous Coward | more than 3 years ago | (#33495996)

Two years ago I went through this process on Windows Vista, and I realized later you didn't need to install DX9. The root problem was that the default DX10 installation on Windows Vista was missing older DX components, including DirectDraw. DirectDraw could be installed by manually reinstalling the DX10 runtime. Is it the same on Windows 7?

Re:I wonder about this (1)

Suiggy (1544213) | more than 3 years ago | (#33495778)

Wrong, the DLLs for the older versions of DirectX are still there on Windows 7, and the headers and libraries are still available in in the Windows SDK. The problem is that graphics card vendors don't test that their drivers work with the older versions of DirectDraw and Direct3D anymore because they just don't care. So you never know if you'll get support or not.

Re:I wonder about this (5, Informative)

TheThiefMaster (992038) | more than 3 years ago | (#33495998)

Not 100% accurate. Windows 7 includes direct-x 9 itself (there's not much to it), but not all the different d3dX9_??.dll extension files. Those are what you have to install.

The DX web setup [microsoft.com] will bring you up to date with all direct-x 9 onwards extension files, regardless of whether you're running XP or 7, x86 or x64, Home or Ultimate (just look at the comprehensive supported OSs list!).

Any older versions of DX are supported, you shouldn't need to install anything for them.

Re:I wonder about this (0)

Anonymous Coward | more than 3 years ago | (#33495802)

note to people: don't submit your shit to /. if your server isn't ready for it

The majority of the time some dude found someone else's blog posting and submitted it to Slashdot, and the site owner has no control over that.

Re:I wonder about this (1)

kramulous (977841) | more than 3 years ago | (#33495810)

I can't answer your questions, nor can I read the article yet, but I can say that on Linux I'm doing a very similar thing.

I'm programming (when I find the time) for a 9600x4800 pixel display and found that 3D graphics on that sort of size is absolute shite using current methods. I am using OpenGL to get the drawing contexts and find that using a glDrawPixel to get around a 100fps. But that is all it is good for. I am reimplementing the 3D point, line drawing myself on the cpu (my interactive datasets are > 10TB).

I paint the canvas and copy across. Just like the grey beards used to do. My bottlenecks are network supply (10Gbps to five clients with dual network ports and jumbo frames not sufficient).

Re:I wonder about this (2, Insightful)

Achromatic1978 (916097) | more than 3 years ago | (#33496032)

My bottlenecks are network supply (10Gbps to five clients with dual network ports and jumbo frames not sufficient).

Well, yes, I'm not entirely surprised your system has trouble pushing tens of gigabits of data whilst reading from a ten TB dataset and live-rendering 3D on a bank of 3 x 3 3200x1600 screens. All this on a side project "when you find the time", too, impressive. To the best of my calculations you'd have what, 7 PCI-E slots?

Re:I wonder about this (2, Interesting)

kramulous (977841) | more than 3 years ago | (#33496118)

5 slaves, each rendering 1920x4800. Each machine is a single E5530; 2xFX1800; 4GB memory. Luckily, I have a totally excellent colleague who helps me with the networking/file server config (when he can find the time).

We find it much better to compress the data prior to network transmission and perform a parallel decompress on arrival to the clients. Not exactly rocket science.

Thanks man.

Re:I wonder about this (4, Interesting)

Rogerborg (306625) | more than 3 years ago | (#33495884)

Funny you should mention DX3. Microsoft actually removed some surface caps flags in the transition from DX3 to DX5, and silently flipped the orientation that .BMP files were loaded (i.e. loaded them 'right way up' rather than 'upside down' as they're stored in the file). I know that was like three ice ages ago in Dev Years, but it still hurts when I think about it.

I realise that TheFineSummary talks about Windows 7, but there's still a fair number of XP boxen out there, for which Direct2D isn't an option. That said, I'd guess (as the article is down) that it's more of an ideological position, or - given that it's clearly a hobby project - just what the author is familiar with, or enjoys using. Given that we're talking about playing games here, I'd go with the latter explanation.

I do intend to RTFA when it recovers, since I find replacing/subverting dlls quite fun. I kludged up some code a while back to create a shim dll [hulver.com] that can be used as the basis for selectively replacing functions in dlls, while calling through to the 'real' one for the other functions, so you can easily hack some functionality without having to re-implement the whole thing.

Re:I wonder about this (0)

Anonymous Coward | more than 3 years ago | (#33496142)

XP boxes have the option of installing old video drivers if the current vendor drivers have issues with DirectDraw support, which they shouldn't (but did anyway). So using Direct2D is a non-issue as everyone using this tool will be on Vista or 7, not XP. You'd be insane to use this hack when you can reliably roll back to proven drivers -- just thinking about the performance issues & graphical bugs it can cause makes me want to stay away.

Direct2D is useless for this (1, Insightful)

Anonymous Coward | more than 3 years ago | (#33496302)

Maybe you should take a look at what Direct2D and DirectDraw does before making some silly assumption that Direct2D is more suitable for simulating DirectDraw behavior.

Direct2D effectively acts as a hardware acclerated scanline renderer, so it is more comparable to GDI than DirectDraw. DirectDraw surfaces are actually much closer in design to Direct3D and OpenGL textures. So your real question should be why he didn't chose Direct3D instead. My guess is that he liked OpenGL's API better and this is about fun after all - nobody was paying him.

Fuckin A man (1)

gagol (583737) | more than 3 years ago | (#33495662)

Seriously, thanks for the good work!

Re:Fuckin A man (-1, Troll)

Anonymous Coward | more than 3 years ago | (#33495984)

what does your presumed homosexuality have to do with the article?

Re:Fuckin A man (-1, Troll)

Anonymous Coward | more than 3 years ago | (#33496096)

You're fucking a man? That's disgusting.

C&C and Red Alert (0)

Anonymous Coward | more than 3 years ago | (#33495692)

I've been trying to get Command & Conquer and Red Alert 1 working on Windows XP and upwards for quite a while now.

Here's hoping this will work for these two DX6 games!

Re:C&C and Red Alert (1)

ledow (319597) | more than 3 years ago | (#33495910)

Run them in Windows 95 mode as the documentation suggests? I've not had a problem getting them to run at all on XP. If in doubt, download the free ISO's of Red Alert from http://www.commandandconquer.com/classic/ [commandandconquer.com] and follow their instructions (you might have to patch with a file that's on the ISO, I can't remember).

Custom Star Ornament (-1, Offtopic)

Anonymous Coward | more than 3 years ago | (#33495710)

haha Custom Star Ornament (One Side) Our star shaped procelain ornaments are unique and adorable keepsakes and gifts, perfect for holiday seasons. The images are imprinted into tile surface using a heat sublimation technique that creates a permanent imprint that won't rub or wear off. The star shaped ornament measures 3' x 3', including a red ribbon hanger.

Ideal image size in pixels (W * H) :
Front(Center) : 600 x 600 or Higher
$4.49

www.waazula.com

Blood (1)

spamdog (646409) | more than 3 years ago | (#33495730)

I sure do hope it runs Monolith's Blood! I tried it in VMWare recently and it ran like a hog - and not in VESA modes.

Re:Blood (1)

aiht (1017790) | more than 3 years ago | (#33496020)

Are you talking about Blood 1? 'Cause that was a DOS game.
I've had some success running that in DosBox, but I needed the [cpu] core=dynamic and [dosbox] machine=svga_s3 settings to get anything approaching a decent framerate.
Apparently both are the default now, but they weren't when my dosbox.conf was first written.

Text, I think (5, Informative)

Anonymous Coward | more than 3 years ago | (#33495754)

In the Beginning

It all started about a month ago, when one friend of mine had decided to follow his dreams and was moving to the states, and he had to get rid of a lot of stuff. Among his discard pile was a bunch of Wing Commander games, which I bought off him, figuring they might be interesting research material, as I'm planning on a game with similar game play structure (as in story combined with game play, not a 3d space shooter).

So, I found myself in the possession of Wing Commanders 1, 2, 3 and 4, all Windows versions - the Kilrathi Saga and WC4CD to be specific. I installed the first and tried it out. My Win7 switched to 256 colors at a 640x480 resolution, but the game ran.. with completely wrong palette.

Bugged by this I played with the compatibility options, and got the game to almost work well, with the palette going wrong at some points.. so the game was sort of playable, but I hated the fact that Windows changed to 256 colors and I couldn't see my mailbox properly in the other screen, etc.

I also tried WC2 and WC3, and they had similar - or worse - problems. I even learned the steps to get WC3 to work properly:

      1. Find the WC3W.EXE executable, turn on (basically) all the compatibility options.
      2. Start task manager.
      3. Find and kill all instances of explorer.exe. Your desktop will disappear, along with the task bar.
      4. Using task manager, launch WC3W.EXE

Naturally the screen resolution and color mode will be 640x480 and 256 colors, but if you've bent backwards that much, you probably don't care all that much.

Seeing that the games use DirectDraw, I decided to roll my own.

Doing the Homework

The first step is always to look for prior art. Maybe someone had written a new ddraw.dll already, and I could just use it. As it happens, lots of people have, but nothing that's useful for me. Most of the ddraw.dll hacks are actually wrappers - that get between the game and the real ddraw.dll, change something subtle, but let the real ddraw.dll do the heavy lifting.

The point of these hacks is to fix small problems, like games that ignore surface pitch, require cleared surfaces or some such. In one case I found a forum thread claiming that deleting ddraw.dll from the game's directory fixes something, so in this case it's a hack gone wrong.

After further searching I found a project which actually released sources, with a liberal license even. It was a wrapper project (meaning, again, that they just call the real ddraw.dll), only supported DirectDraw7 and only very small parts of it, but it showed me how to get going.

I also dug up old DirectX SDK:s from my personal CD stack, as Microsoft has helpfully nuked all old DirectDraw documentation off the online MSDN. Thanks, dudes.

Wing Commander 1

Wing Commander 1 for Windows uses DirectDraw2. There's no real reason it couldn't just use DirectDraw1, considering that all it does is locking the front buffer and dumping a frame to it, along with some palette manipulation.

Or well, that's not the whole truth. If the game can set a 320x200 mode, it does what I described above. If this fails, it tries to set up 640x400, and after that fails, 640x480. In the two higher resolution modes, the game allocates a software 320x200 buffer, and uses blt() to scale it up 2x, meaning that in 640x480 mode, black bars are introduced to the top and the bottom, and the aspect ratio is wrong.

When playing WC1 it astonishes me just how much love has gone into the it when compared to later games. The later ones may be better in some ways, but the polish that can be experienced in WC1 is gone.

Anyway, I started by writing a wrapper that just dumps out log about what calls are made with what parameters, and then went on to implement a hack dll that only implements those calls.

The hack dll resizes the application's window to desktop resolution, sets up an OpenGL context, uploads the frame as a texture and uses OpenGL to stretch the result on screen.

Yes, I know, I'm using OpenGL to fix a DirectX problem. Some find this rather ironic. To make things even more fun, vista and Win7 solve OpenGL problems by rendering OpenGL with DirectX. That is, if you're not using ATI or Nvidia drivers..

Anyway, there were several little problems that had to be solved.

First was that if I resized the window to desktop resolution, Win7 figures something is going on and goes into self defence mode, disabling aeroglass. This could be solved by simply making a one-scanline too large window. It still looks the same to the user (assuming they don't have a very, very multimonitor setup).

Second problem was with using OpenGL from a DLL. Everything went fine in Win7, but under XP it suddenly gave me the dreaded dialog "Runtime Error! R6030 - CRT not initialized". Googling up what this means resulted in lots of threads pleading for help but a few answers. MSDN says to get this error I've done something weird which I'm sure I haven't.

This got solved by delay-loading OpenGL, but this broke rendering in Win7. Forcing the OpenGL32.dll to load fixed Win7, but broke XP again. Finally I opted to just loop until OpenGL context creation succeeds; this works for both systems.

Thirdly I wanted to override some keys for options - something I later removed as Wing Commander games require all but four keys on the keyboard - and for that, I needed to hijack the window function. This came in handy later on when I started stealing other window functions, such as focus changes.

Hijacking the window function was a surprising experience. Apparently the legal way to do so is to use SetWindowLong, a function designed to access user-defined data padded after the window class structure, with a negative offset. This is documented in MSDN.

After this, the game ran fine.. more or less. Some input lag was introduced, but there's little I could do about it. As an added bonus, the game could also be run in bilinear mode, which may or may not please some of the viewers more than the point-sample mode.

Wing Commander 2

After playing through WC1, I moved onto WC2. WC2 is very similar, uses DirectDraw2, is much more unstable, and as a game feels like a "what can we do more"-sequel. There's more of a story, more frames of animation, speech, but.. less love.

WC2 ran with the unmodified dll from WC1, except that some screens were missing. In some cases, the game would update the screen, but not wait for retrace. I opted to start updating the screen on surface unlocks as well, and the problem went away.

WC2 also did some additional checking when returning from alt-tabbing, which got solved by adding some more "everything's ok" responses from stubbed functions.

In some situations the music will stutter in the game (with or without the DLL). This is due to the fact that the game doesn't poll its message pipe during these scenes. I assume they're some sort of busy loops, and whoever did the port from dos to Windows didn't hit this problem.. on his (or her) machine. In any case, there was little I could do about that.

As an additional enhancement, I added a "half'n'half" output mode, which first upscales to 640x400 with point-sample (or nearest neighbor, same thing) sampling and then upscales this to full screen with bilinear. It's a nice trade-off in that no pixel block information is lost, but the harsh pixel borders are gone.

At this point I also realized the keys I had used for configuration were also used by the game, so I whipped up a simple configuration file instead. The configuration file also let me add more options, like a funky "old lcd" simulation which some may find amusing.

Wing Commander 3

WC3 is a different beast. It only uses DirectDraw1, so it's clearly older than the WC1/WC2 Windows ports. At first I hit a problem where the game went into some kind of fallback mode and managed to draw to screen around my code, by using GDI instead of DirectDraw. This was solved by implementing better answers to capabilities and features queries. I'm still not sure exactly what the game was looking for, as I just copied whatever the real ddraw.dll answered to those questions.

WC3 queries back buffer from the primary, and uses flipping. Support for this had to be added. Instead of actually supporting flipping, I hacked things so that the "backbuffer" actually points at the same front buffer data. After all, what the game thought to be a front buffer was actually our OpenGL back buffer, so this just saved some data copying.

WC3 also includes full-motion video cut-scenes instead of still (or crudely animated) images when you discuss with other people. These are, by default, shown in "interlaced" mode where every second line is black. This probably looked OK back when monitors were of the 14" variety, but on modern systems it's just painful. I added code that detects when a movie is being played and doubles the scanlines. Naturally, I find after this that the game already has a commandline option to do this.

Using said commandline option brought up something interesting. Instead of locking the back buffer, the game had a separate 320x240 buffer into which it rendered the movie and then scale-blitted that on screen. I added an option not to scale but just do a "small video" window in the middle of the screen with black borders all around. I was rather amused later on to find that WC4 has this feature built in.

I also experimented with some blurring filters on top of the movies, but these do not necessarily make it look any better. Some harsh blockiness may be gone, but so are some details. A "smart blur" might work better.. Anyway, the option is there if someone wants to take it for a spin.

There's an option in the game to run the in-game flight in "VGA" mode, as opposed to the "SVGA" mode which is the default. This mode also uses the smaller 320x240 buffer, scales up to 640x480, and then renders the HUD elements at full resolution on top of this.

Disregard the fact that "VGA" is usually 640x480 and "SVGA" 800x600; in this game VGA means 320x240 and SVGA 640x480.

Not that these are truly standardised terms anyway..

For some odd reason the mode only stays on for a second or so, and then the game turns back to "SVGA" mode. I'm guessing it detects a high frame rate and doesn't want to torture you with blocky graphics.. in which case it's odd to have the option at all.
Wing Commander 4

WC4 introduced a pile of additional problems. The game added true-color (well, 15 bit) movies and wants to use GDI for some parts of the game.

Adding the 16bit mode support was relatively simple, just implementation work. There's also an option to use 24bit graphics mode, which sounded promising, but ended up being 15bit with additional padding(!). So yes, the 24bit mode appears to be X1R5G5B5X8 (or 1:5:5:5:8). I have no idea how this could have ever worked. It's entirely possible some capability flag the game expected is still missing, and thus I'm getting a weird response from the game.

The GDI bit was more worrying. Unlike with WC3, this does not seem to be dependent on some information I'm giving the game, or at least the game works exactly the same with the wrapper DLL as with my hack dll. The first "load savegame" screen after the setup screen (if game is launched with -i) does run with DirectDraw, though, so it is entirely possible the whole game could be made to use DirectDraw. After a game is loaded, the game changes screen mode to 16 bit and starts using GDI, rendering the exact same screen with it.

To fix the GDI problem, I made the biggest kludge in this project yet; I resized the window so that it is 480 scanlines taller than the desktop, and let the game draw to the off-screen portion, and copied the data to the framebuffer from there whenever I detected we're in the "GDI mode". This works surprisingly well, but will look a bit strange for people with way too many monitors (i.e, if you have a monitor on top of the main one, you'll see the top of the window there).

I could have made the game's window hidden and created a new one - this would have been much cleaner solution, but much more complicated one. And hey, we're talking about a hack here, and all I wanted was to get to play the game..

One remaining issue with WC4 has to do with the "mission briefing text" screens. From the looks of it, the game does perfectly normal lock/unlock cycle of the primary (not back buffer like everywhere else in this game!), but the result is just an odd blinking screen. After all the text has been outputted, the correct screen appears. This is annoying, but does not stop anyone from actually playing.

What disturbs me most about the blinking is that it sometimes seems to blink between the green grid and the hangar area picture, and the hangar area is from a different graphics mode from the game's point of view.. so there may be some major brainfart from my part in play here.
And So...

Next up would have been WC4DVD version, but that adds MCI, DirectShow, mpeg2, DirectDraw7, and all sorts of headaches to the mix, so I figured it's time for this project to end. I'm releasing the sources, so anyone who wants to pick them up and continue hacking can feel free to do so; with Wing Commanders or other old DirectDraw games.

I'm fairly confident the Windows versions of Wing Commander 4 came first, then WC3, and then WC1 and 2, probably in that order.

Yes, getting the source code to these games would help a lot. I already know a few bugs I could fix easily, and I haven't even seen the code. =)

Lots of thanks for the Wing Commander CIC community for their help, comments and suggestions.

Comments, etc, appreciated, as always.

This is great! (1)

daid303 (843777) | more than 3 years ago | (#33495920)

While people can say that the old ddraw works fine in Win7, that's all nice and everything. But sometimes we want more then just the old school graphics and gameplay. In this case we can hack the ddraw layer to add extra features like a higher resolution, AA or HQ2x or something like that.

I tried to do this with Direct3D7 for TheTypingOfTheDead, to run it at higher resolutions, but I failed. Maybe if I use this code as base I have a better shot at it.

beautiful (0, Offtopic)

didtrade (1884658) | more than 3 years ago | (#33495956)

Magic Carpet I & II (1)

w0mprat (1317953) | more than 3 years ago | (#33495992)

Were damn fine games I'd love to play again.

Re:Magic Carpet I & II (1)

PhilHibbs (4537) | more than 3 years ago | (#33496042)

MC1 runs fine under DosBox, I think I needed to install a Glide wrapper. I found all I needed through google, was really easy.

Re:Magic Carpet I & II (0)

Anonymous Coward | more than 3 years ago | (#33496252)

MC didn't have any 3d accelleration at all IIRC. It did support 320x200 and 640x480 though, which you could change between mid game.

hey (0, Offtopic)

cookienihui (1845396) | more than 3 years ago | (#33496108)

Hi guys! Do you like older women!? Sick of those boring little girls? Come to ::SugarMommyDate.C/O/M ^_^ ^_^ SugarMommyDate.C/O/M ::!!This site must be very helpful to you.I bet you can find what you want here! There are Over millions of profiles from all over the world! No matter where you are or what you are.A brief introduction with at least 100 characteristics maybe more helpful to you~ YOU MUST CHECK IT!!
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...