reverse engineering strike commander

10
28/9/2014 Reverse Engineering Strike Commander http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 1/10 FABIEN SANGLARD'S WEBSITE JAN 22TH, 2014 REVERSE ENGINEERING STRIKE COMMANDER Back in the early 90s, one company was on the bleeding edge of PC gaming: Origin Systems . Their motto was "We Create Worlds" and boy did they deliver: With the Ultima series, Crusader series and Wing Commander series, they consistently took gamer's breath away. One of them took four years and more than a million man hours to complete: Strike Commander . The famous flight simulator had its own 3D engine called RealSpace which pioneered many of what we take for granted today: Texture Mapping, Gouraud Shading, Level of Details and Dithered colors. My old dream was to play the game with a Virtual Reality device. With the Oculus Rift that fantasy came one step closer to reality. But when it turned out the source code had been lost and would never be released, I decided to reverse engineer it. As of the publication of this article, the project is not yet completed but I want to share the techniques that have so far allowed this : to become that : HOM E ABOUT FAQ EMAIL RSS TWITTER

Upload: dagush

Post on 08-Apr-2016

16 views

Category:

Documents


2 download

DESCRIPTION

from http://fabiensanglard.net/reverse_engineering_strike_commander/

TRANSCRIPT

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 1/10

FABIEN SANGLARD'S WEBSITE

JAN 22TH, 2014

REVERSE ENGINEERING STRIKE COMMANDER

Back in the early 90s, one company was on the bleeding edge of PC gaming: Origin

Systems. Their motto was "We Create Worlds" and boy did they deliver: With the Ultima

series, Crusader series and Wing Commander series, they consistently took gamer's breath

away.

One of them took four years and more than a million man hours to complete: Strike

Commander. The famous flight simulator had its own 3D engine called RealSpace which

pioneered many of what we take for granted today: Texture Mapping, Gouraud Shading, Level

of Details and Dithered colors.

My old dream was to play the game with a Virtual Reality device. With the Oculus Rift that

fantasy came one step closer to reality. But when it turned out the source code had been lost

and would never be released, I decided to reverse engineer it.

As of the publication of this article, the project is not yet completed but I want to share the techniques that have so far allowed this :

to become that :

HOME ABOUT FAQ EMAIL RSS TWITTER

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 2/10

... and maybe inspire some people to join the adventure.

TABLE OF CONTENT :

Part 1: Introduction

Part 2: Game Architecture

Part 3: Reverse Engineer Assets

Part 4: Play the game again

Part 5: Oculus Rift

Before Strike Commander

Early 90s flight simulators were good but like Falcon 3.0 or Flight simulator 4.0 they focused mostly on accurate flying models than beautiful rendition :

There were many fight simulator on the market and few people noticed the 1990 Origin Systems announcement for a new game. But things changed after

Chicago CES 1991 where a demo could be seen in action : Nobody could believe the game could feature things only seen in military flight simulator so far:

Texture Mapping, Gouraud Shading, Haze and more. Screenshots demonstrated a technology far ahead any competitors :

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 3/10

After 1991 the game became highly anticipated. Not only the engine was gorgeous and the story captivating, RealSpace also supported exceptional

hardware out of the box: The very expensive and fragile accessories that every flight simulator enthusiast wanted were the THRUSTMASTER WEAPON

CONTROL SYSTEM and the THRUSTMASTER FLIGHT CONTROL SYSTEM:

And you could even connect the THRUSTMASTER RUDDER:

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 4/10

Still, there was more: The game also supported a Virtual Cockpit. The 4-way 'hat switch' on the ThrustMaster allowing to move the pilot's head and follow

ground objects/enemy jets without the need for a Virtual Reality HeadSet :

1993: First Contact

The game and its 3D engine were mind blowing but required an impossibly powerful machine :

IBM PC 486-DX2 66Mhz

4MB RAM

38MB mandatory installation

Game comes on 11 x 1.44MB floppy disks.

Adjusted to today technological inflation the recommended configuration would be :

8 Cores CPU with 16 GB of RAM.

Dual Nvidia Titan GPUs.

Mandatory install of 1000 GB.

Game comes on five BluRays.

And purchasing the game was not enough, you also had to survive the installation ! Upon opening the box you would be faced with 8 floppy disks ( +3 for the

Speech Pack):

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 5/10

Trivia : Notice the poster announcing a Christmas 1991 release. The game would not be completed until 1993 after a long process that Chris Robert

labeled "The Apocalypse Now of computer games".

Decompressing the game from floppies to hard-drive and swapping the 13 flopping disk took a good 30 minutes. And when you thought you were done, the

game proceeded to generate all the maps. The size of the game would blow up from 24MB to 38MB: Four times the size of any game back them.

Trivia : A map was generated from a single "seed" (an integer number) that was injected in a pseudo-random numbers generation algorithm. This was a

clever technique that avoided shipping data by generating the map after installation. If you are curious about this technique, go read The Backroom Boys and

the chapter about Frontier Elite game.

The maps generation step took ONE hour on a 386 PC. But Origin Systems had the good idea to ship with the box a superb 100 pages magazine set in the

dystopian 2012 world of the game. Sudden Death made the entire process less painful ( notice the fake advertisement on page 38 promising the release of

Strike Commander for Christmas 2013).

Strike Commander !

Finally after all those steps, players were able to enjoy the game....in April 1993 ! Despite being 2 years late, the game was everything Origin promised and it

sold very well. Many spent nights after nights dogfighting even if for most what was supposed to look like this :

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 6/10

...ended up looking like that on minimum settings :

Overall the game was enough to captivate pilots and generate fond memories.

The Lost Source Code

With the Oculus Rift release, my interest in Strike Commander peaked again: The hardware was ready. Since it was a 20 years old game, I expected the

source code to have been released but I quickly found out the sad story of Origin Systems decline.

Origin Systems was acquired by Electronic Arts in September 1992 and all projects were canceled circa 1999 following poor sales of Ultima 9. The

company was to refocus on an other field they pioneered: MMORPG Ultima Online. Most people assume the source codes and gold versions of all finished

games were stored in a Vault somewhere at EA. But after getting in touch with people at Wing Commander CIC, it appeared that all the source code was

lost when the company closed.

It is something hard to believe today but back then developers and companies were more focused on the next title instead of preserving "old things", there

was not nostalgia factor, no huge fan base and no market like Good Old Games today. Many stories could illustrate how "primitive" source control was but

the best is probably the "ZAP SC" story at 15m14s :

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 7/10

On his first day one developer managed to delete the full 900MB of Strike Commander source tree. The IT team spent 72 hours recovering everything from

developers machines. The interview also mention that Wing Commander 1 and 2 code was exchanged via floppy disks: They did not have a network until SC !

Trivia : In a surprising turn of event, some of the source code re-emerged recently via ex-Origin developers: Wing Commander CIC maintains an off-line

archive which features the source codes of Wing Commander I Wing Commander III and people working on Ultima 8 were offered (but turned down) the

source code of "Ultima 8: Pagan" by an anonymous source. As for Strike Commander, I have never heard of someone having it.

Reverse Engineering: Can it be done ?

Over the years many teams had done work on Origin Systems game and reached great results:

Underworld II Revial reimplemented Ultima Underworld II: Labyrinth of Worlds.

Exult reimplemented Ultima VII: The Glack Gate.

Pentagram reimplemented Ultima VIII: Pagan (check out the code, the design based on actors being processes within a kernel is beautiful).

How long and how hard would it be ? After chatting with Gregory Montoir who did most of the reverse engineer on Another World I learned that working one

hour per evening allowed to reverse 10KB of assembly to C each month. There are many executable in Strike Commander and the initial discouraging time

estimate was :

INSTALL.EXE 7,793 bytes : 2 weeks MKTERR.EXE 203,744 bytes : 1.5 years SC.EXE 20,000 bytes : 1 month MKGAME.EXE 131,696 bytes : 1 year OPTTEST.EXE 870,528 bytes : 7 years STRIKE.EXE 746,304 bytes : 6 years

=============================================

15 years, 7 months and 2 weeks. Ouch.

That was upsetting: If someone had started back in 1993 then he would have finished six years ago and I would just have had to git clone it :( ! But after

starting up IDA and taking a quick look it turned out that not all of it would have to be reverse engineered: The 3D engine is fully contained within STRIKE.EXE

and a small team could do it in a reasonable amount of time.

Road Map

The road-map I initially drew in order to reverse engineer Strike Commander was as follow :

1. Gather as much documentation as possible.

2. Understand the Global Architecture of Strike Commander.

3. Reverse-Engineer the Game Assets.

4. Document step 3 and extrapolate (Visual Surface Determination method, Level Of Detail, ...)

5. Re-implement the 3D engine and build NEO_STRIKE.EXE

6. Add support for VR device Oculus Rift.

And then I got busy.

Next

Architecture and Documentation

Comments

14 Comments Fabien Sanglard's website Login

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 8/10

14 Comments Fabien Sanglard's website Login

Sort by Oldest Share

Join the discussion…

• Reply •

Steen Rasmussen • 8 months ago

Great, I see you managed to get your hands on the source code from "Building a 3D Game Engine in C++". I noticed that the copy I e-mailed you

never left my outbox, so I'll just go ahead and delete it.

Interesting and inspiring read as always.

• Reply •

Miles Maretich • 8 months ago

Do you need a Copy of the CD? I still have it.

• Reply •

Alejandro Haro Vukasovic • 8 months ago

Good luck. :)

• Reply •

DrMcCoy • 8 months ago

Very nice! :)

Good luck from me as well.

• Reply •

Asger • 8 months ago

Great stuff!

• Reply •

Muhammad Usman Azam • 8 months ago

I am following this project. I love reading unknown bytes. :)

• Reply •

racarate • 7 months ago

Wow, did not know there was a book chapter about ELITE. Thanks so much for the reference.

• Reply •

Bruce • 7 months ago

Remember this one from the 90ies. If memory serves me, I bought a CD version of it way later and played it on a P60.

Article is another stellar job - Props!

• Reply •

flyer • 5 months ago

see more

Ah those memories are fantastic, I plyed a floppy version (without speech packs) in 1994, then finally got a "collector's" edition double pack with

another Origin masterpiece Privateer on 1 CD (both included CD versions with extended speech packs and add-on missions) - that was in 1995

when I got a proper HW to run it flawlessly P133 64 MB RAM VESA Local Bus Graphics...one thing, the game had absolutly GREAT score this one hit

me, I loved "desert strike base" theme even back then listening to it looping :D on AWE 32, but this one is a Roland MT 32 record and it sounds way

better then on Sound Blaster due to real MIDI with sounds not present with the SB like "eagle and sand wind as a FX" SUPERB. Good luck with your

efforts!!!!

Desert Base Theme Roland MT 32 found on you tube credit goes to ClassicVGSounds (thx!!! for recording) http://www.youtube.com/watch?v...

• Reply •

Fabien Sanglard • 5 months agoMod flyer

I had the same evolution: Tried to play it in 1994 with the floppy version but my 386 was too flow. I got the SC + Privateer CD later but found

the loading time to be awful.

Thanks for the song that is also my favorite. If you are nostalgic don't forget to checkout the "Origin Soundtrack Series":

http://www.ultima.rabbitslair....

1

Favorite

Share ›

Share ›

Share ›

Share ›

Share ›

Share ›

Share ›

Share ›

Share ›

Share ›

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 9/10

Disqus helps you find new and interesting content, discussions and products. Some sponsors and ecommerce sites may pay us for these

recommendations and links. Learn more or give us feedback.

What's this?Also on Fabien Sanglard's websiteSHMUP, the best iPhone/iTouch/iPad shoot'em up

18 comments6 months agoAvatar

David Silva — Thanks for the game, I was just reading your blog, but couldn't resist to try it out.

Quake Source Code Review

10 comments6 months agoAvatar

Mehadi Hasan — Hi there, u have done a good job. but i am having some trouble to find out the quake server source which is compilable in windows. can usend me some links where i can download this version? all i have found is quakeforge which is not compilable on windows unless u do a lot of hassles. alsocan u give me a suggestion how the quake server can distributed among different servers in a dynamic way so that the load balancing can be dynamic. thatmeans u can dynamically create servers at designated hosts when the load is high and vice versa.thanks in advance.

iOS 3D engine source code

17 comments6 months agoAvatar

Fabien Sanglard — Uber shader pretty much refers to a single file that can generate shaders for many different effects... whether it uses defines, staticbranching, dynamic branching or proprietary pre-processing the method remains relatively similar.Now depending on the drivers you can get some weirdbehaviour of you use uniform for branching (like shader recompilation). By using #defines and caching I was sure to avoid this.

Computer Graphics: Principles and Practice, Third Edition

8 comments6 months agoAvatar

fratz — In this case of the rat and the pot, it could be an artistic choice for the sake of composition. One thing that points to this is that if you just look at thevalues of the image, you'll see that while everything of the environment uses fairly tame and realistic noisy values, remi has actual distinguishable shapes,

• Reply • 1

• Reply •

flyer • 5 months ago

see more

Fabien Sanglard

Pretty much the same, I recall the first time I saw Strike Commander it was on 386 and loading times were really painful. With P 133

and 64 MB EDO RAM things were just fine so I enjoyed it a lot.

Thank you for the post, I absolutly adore Origin's scores, especially those with creative touch by Nenad Vugrinec and co. Privateer is

also fabulous, personally I loved the Agricultural Planet score https://www.youtube.com/watch?...

• Reply •

Elwood • 5 months ago

Can't you use an ASM to C converter? If you need to purchase the tool, do a kickstarter project.

• Reply •

Fabien Sanglard • 5 months agoMod Elwood

IDA Pro can do ASM to C on PE format but not 16bits DOS (and especially not DOS 16bits overlay executables).

• Reply •

Elwood • 5 months ago Fabien Sanglard

Too bad. Anyway good luck as it's a big challenge, and an interesting one! Unfortunately I can't help coding :-(

×

Share ›

Share ›

Share ›

Share ›

Share ›

28/9/2014 Reverse Engineering Strike Commander

http://fabiensanglard.net/reverse_engineering_strike_commander/index.php 10/10

fratz — In this case of the rat and the pot, it could be an artistic choice for the sake of composition. One thing that points to this is that if you just look at thevalues of the image, you'll see that while everything of the environment uses fairly tame and realistic noisy values, remi has actual distinguishable shapes,most prominently the eyes and the nose as well as the ears. It draws the viewers gaze to the character, and informs him that this is the main point of interestof the image.The pot does not really look too out of place to me, however, it could stand out due to its placement, which can also be explained by deliberatecomposition to create a balance with the rat. (Imagine the scene without the pot, it'd look very odd)As for games it probably comes down to the amount ofdistinguishable detail you're putting into one object: a character will probably have more complex geometry and higher-resolution textures than the scenearound him. Plus, characters as dynamic objects are harder to light in real-time. Sometimes different lighting models for static and dynamic objects are usedin games for performance reasons.

Subscribe Add Disqus to your site

Fabien Sanglard @2014