Saturday, 18 June 2011

Magic Carpet re-release

On Thursday evening I discovered, after being alerted by a Facebook 'mention', that Magic Carpet had been re-released for Windows on gog.com. As I hadn't played it for a long time I paid up the $5.99 and downloaded it. It turned out it was 'just' the original packaged up with DOSBox but the price was right and I was very unlikely to get round to setting it up myself. That would have required all sorts of hassle like trying to work out where my boxed copy of the original is for a start.

Screenshot from the Edge review


It was weird to be playing a game I wrote the graphic engine for seventeen years ago and once I'd checked the manual to work out how to turn all of the options on, several things struck me. 

  • The reflections and animated water were pretty cool for the time. 
  • Stereo 3D with red/cyan glasses was (and still is) cool.
  • Stereogram mode was a stupid idea, specially when I got the maths so very wrong (1/z not z you idiot).
  • Sean had done a pretty good job of moving all that stuff around at a decent speed.
  • What to do at the start is so much more confusing than games these days.
  • DOSBox emulation of the 640x480 Vesa mode we used for 'high' resolution is really, really slow.
  • The draw distance is pretty pathetic.

Sadly, that last one is the thing that strikes you the most as you try to play. The fog really does seem to start just in front of your nose. I think I should warn anyone reading this that most of the rest of this post is probably going to turn into an excuse for this pathetic draw distance.

I had been working the Graphic Engine for Magic Carpet for a while. In fact, for the a year or so I was the only programmer working on it. It was aimed at 50+ Mhz 486 CPUs and pretty well optimised when you consider it textured with gourad shading and translucency. In my prototype version the tiles/triangles that made up the landscape were about 20 metres across and it drew, I think, 20 tiles before the fog faded it out completely. This meant you could see 20x20 = 400 metres before the fog faded the 'horizon'. Characters, trees, the lumps in the landscape and the speed of the carpet were all scaled accordingly.

then some smart arse decided it would be cool to make castles and things out of the landscape itself. These looked kind of cool but suddenly the tiles had to be the width of a castle wall or the walkway that the archers patrolled to defend it. Now the tiles were only about 2 metres across. The engine still only drew 20 tiles to the 'horizon' (I couldn't up this number and expect a decent frame rate on the target hardware) but 20x2 is only 40. The fog now kicked in at just 40 metres. characters were scaled up accordingly, the landscape smoothed out and the carpet's speed scaled up by a factor of 10. Suddenly it only took about a second or so to fly to the 'horizon'.

This sort of thing doesn't happen when you code games on your own...

Since trying to play it I've downloaded the mac version of DOSBox but haven't got round to trying it yet. Hopefully I'll be able to play in glorious 640x480 'HD' when I'm only using one level of emulation*. I had previously been running DOSBox (an emulator*) on Windows7 running on VMWare (an emulator*) on my iMac.

*Is it emulation when it's all related Intel CPUs? I really don't know. 

9 comments:

  1. My understanding is that a virtual machine running on a modern computer will just pass on the CPU/memory 'stuff' to the host hardware.

    DOSBox OTOH does emulate the hardware in software, hence we can run it on something like a PSP.


    In case the mac version of DOSBox is still slow, remember that you can increase the amount of instructions it tries to emulate each millisecond; use Ctrl+F12 to increase and Ctrl+F11 to decrease.

    ReplyDelete
  2. I suspect there is something wrong with the VESA emulation though. 320x200 runs silky smooth. 640x480 is 2 or 3 FPS. I could understand it being almost 5 times slower but it seems to be at least 10x

    ReplyDelete
  3. Just want to say what a legend you are Glenn. The stuff you were producing back in the late 80's early 90's was utterly fantastic. I love Ground Effect too. Very underrated.

    ReplyDelete
  4. @robaal You were completely correct about the cycles thing! Thanks.

    ReplyDelete
  5. Cheers for the reminder for gog.com. I had forgotten the site existed.

    I'm going to have to go through my back catalogue now, starting with Evolva, the first game I ever tested.

    Happy days

    ReplyDelete
  6. can't you do something about that draw distance? i mean you did code the grafx engine, there must be a way to hack it up.
    or re-release an enhanced version ;)

    btw, there is a custom dosbox build with glide and d3d acceleration. with that, even mc2 is pretty fast in 800x600.

    ReplyDelete
  7. It would be trivial to fix with access to the source code, probably almost impossible without it.

    By the way, I can now name the 'smart arse' who decided to make those Castles out of the landscape and cause the reduced draw distance.

    He was bragging about how it had been a good idea! Barry Meade of http://fireproofstudios.com/

    ReplyDelete
  8. I loved watching the castles rise out of the ground. It was one of the coolest parts of the game!

    ReplyDelete
  9. Magic Carpet 2 was (and actually, still is!) one of my most beloved games! It's a pity that no one had created remake or modern engine modification of this game. :(

    3D engine of this game was way ahead of its time when the first game was released. And some features (terramorphing) still amazes me to this day!

    I must thank you Glenn Corpes for countless hours of fun gaming!

    ReplyDelete