Strike Commander with Oculus Rift (Virtual Reality Headset) project.

fabiensanglard

Master Chief Petty Officer
Back in the 90s, my dream was to be able to play Strike Commander with a Virtual Reality headset.

Now in 2013, I have the Oculus Dev and the C++/OpenGL skills but not the source code of SC. It seems to have been lost...so I cannot add that feature :( !

1. I wonder if anybody have managed to reverse engineer SC.EXE. I found the Pentacle project (Ultima8 engine) and Exult project (Ultima 7 engine). Google returned nothing for SC so I assume no work has been done on SC but it cost nothing to ask here. I know that some people have the source of WC3 which uses the same RealSpace 3D engine as Strike Commadner: Maybe they did some work on SC based on that ?

2. I was thinking of an other approach to achieve my goal: Reverse engineer the assets and program my own flight simulator. That would not be the real deal but that would be close: I found Mario Brito amazing file format description for TRE and PAK files. I am in the process of writing something to extract the bitmaps to I will have the textures...but will still have to recover the 3D models from the IFFs. I wonder if anybody managed to reverse engineer the content of OBJECTS.TRE (../../DATA/OBJECTS) or it is documented anywhere ?
 

fabiensanglard

Master Chief Petty Officer
Well, it took me a week in my spare time but I have managed to extract the palette, 3D models, the texture and all the voices from the intro (.VOC Creative Labs format). It was very helpful that Origin uses IFF file structures:

Object Viewer:

screen-shot-2013-12-22-at-3-41-30-am-png.6820


Textures viewer :

screen-shot-2013-12-22-at-3-49-50-am-png.6821


Those were the low hanging fruits. Before starting up IDA I may try to see how the cinematic are encoded. Probably frame delta encoded with LRE compression. Problem is that they are stored in .PAK which were a little bit documented by Mario....but it still kinda looks like mashed potatoes.
 

Attachments

  • Screen Shot 2013-12-22 at 3.41.30 AM.png
    Screen Shot 2013-12-22 at 3.41.30 AM.png
    185.6 KB · Views: 1,227
  • Screen Shot 2013-12-22 at 3.49.50 AM.png
    Screen Shot 2013-12-22 at 3.49.50 AM.png
    161.5 KB · Views: 1,228
Last edited by a moderator:

wcnut

Rear Admiral
That is awesome! Occulus Rift aside that is quite an achievement, congrats! I recognize XCode. :) Do you know if the OR will be mac compatible? What about DOS compatible? DOS doesn't have OpenGL. Wont that be problem? Unless you plan of attack requires reconstructing the entire code and then redoing the entire game from scratch?
 
Last edited:

Bandit LOAF

Long Live the Confederation!
You might want to look at Wings of Glory, which uses the same engine and supports a pair of contemporary VR helmets including the mouse look /head tracking.. (One is the Forte VFX-1, which works well!)
 

fabiensanglard

Master Chief Petty Officer
@wcnut.

Programming for Oculus involves many steps. Among them, rendering twice at half the horizontal resolution (for each eyes) and more importantly perform a barrel distortion to counter the Oculus binocular distortion: I won't even mention that Strike Commander was using 24:8 fixed point math so I may not even have enough precision to move the POV slightly to right eye and left eye. It is not rocket science if you have a game engine based on float and if you have the source code. But in the case of Strike Commander, that makes patching the DOS executable impossible.

In terms of reverse engineering, I have done some work with IDA on SC.EXE (which is just a launched for MKTERR.EXE (the terrain map generator that took hours to run), MKGAME.EXE (the installer ?) and STRIKE.EXE (the actual RealSpace engine))...It was 8KB and quite easy to figure out....but STRIKE.EXE is 746KB: It is a COLOSSAL amount of work. Just as a reference, it took Gregory Montoir (an expert with impressive accomplishments) 2 months to revert ANOTHER WORLD from assembly to C...and ANOTHER.EXE is only 20KB. So if I don't manage to reach a critical mass and have other people interested like for Pentacle/Exult I will probably end up giving up.

A more realistic approach is to attempt to understand the MAP format....and then write my own engine (which is actually not that hard) using the MAP, MODELS and TEXTURES from Strike Commander. I may have to dive into MKTERR.EXE but it is "only" 204KB so it may be doable with a gross amount of work.

@Bandit LOAF

Wings of Glory is an excellent suggestion. Unfortunately, it is SC that i am dreaming to play with: For the longest time I only had 2MB of RAM and couldn't even run the game. Then when I sold a kidney and reached 4MB, my 386 could only run the game at 10fps....with minimal details (it was slightly less ugly that Stunt Island or Flight Simulator 4)....and I still played it days and nights. It is a bit like a childhood dream that I am pursuing.

Unless you meant that the source code has been somehow "released"...which would help me tremendously to understand the MAP format.
 
Last edited:

wcnut

Rear Admiral
Well whatever you do, just the fact that you are digging into the files is of tremendous interest to the people here, I'm sure, and I wish you the best!
 

HCl

WC EXE archaeologist
Hey here you are :), I didn't notice you started a thread on this topic until now.

I sent you a small e-mail regarding the PAK format. It really is standard WC1/WC2 packaging, with RLE data. Once you become familiar with the WC1 RLE format you'll be able to decode it. As a test, i ran it through one of the Matlab scripts i put together for research and decoding WC data and it decodes the various blocks perfectly. (small screenshot below)

Strike.png


Anyway, great project, keep up the good work!
 

fabiensanglard

Master Chief Petty Officer
Thanks Mario, your hard work and generous explanation have been incredibly helpful. I can now read the PAK archives....at least partially !

I was hoping the RLE format was used to stored full animation but it looks like it is made of layers.....which means there is more work to be done in order to understand the full animation format:

screen-shot-2013-12-25-at-1-07-57-pm-png.6826

screen-shot-2013-12-25-at-1-08-13-pm-png.6827


There are still some data at the bottom of the PAK that I cannot made sense of....my worse fear is that it is some kind of bytecode to reconstruct the animation. It doesn't look like there is enough data to be it but how knows.

Looking at those format is a surprise of every moment: The PAK archive is made of blocks. If a block contains images, you must search for an IFF file to see it if contains a palette. If you find one, use it...but the color channels are on 8 bits each. If you don't find an IFF that contains a palette then use the default one....BUT there, color channels are encoded in the standard VGA way: 6 bits. OMFG !!!!!!

I wonder if I can look toward the Pentagram project since they seem to be able to read U8 animations. It may not help: U8 was a Lord British project and SC was a Chris Robert project. I don't know if the team collaborated/shared technologies. I don't even know if they were working from the same offices.


Anyway, back to work....

screen-shot-2013-12-25-at-1-04-34-pm-png.6831


screen-shot-2013-12-25-at-1-08-24-pm-png.6828


screen-shot-2013-12-25-at-1-08-40-pm-png.6829
 

Attachments

  • Screen Shot 2013-12-25 at 1.07.57 PM.png
    Screen Shot 2013-12-25 at 1.07.57 PM.png
    12.3 KB · Views: 1,176
  • Screen Shot 2013-12-25 at 1.08.13 PM.png
    Screen Shot 2013-12-25 at 1.08.13 PM.png
    42 KB · Views: 1,182
  • Screen Shot 2013-12-25 at 1.08.24 PM.png
    Screen Shot 2013-12-25 at 1.08.24 PM.png
    39.3 KB · Views: 1,139
  • Screen Shot 2013-12-25 at 1.08.40 PM.png
    Screen Shot 2013-12-25 at 1.08.40 PM.png
    13.2 KB · Views: 1,147
  • Screen Shot 2013-12-25 at 1.02.40 PM.png
    Screen Shot 2013-12-25 at 1.02.40 PM.png
    28.9 KB · Views: 85
  • Screen Shot 2013-12-25 at 1.04.34 PM.png
    Screen Shot 2013-12-25 at 1.04.34 PM.png
    39.2 KB · Views: 1,188
  • Screen Shot 2013-12-25 at 1.05.19 PM.png
    Screen Shot 2013-12-25 at 1.05.19 PM.png
    53.2 KB · Views: 86
Last edited by a moderator:

delMar

Rear Admiral
Great thread, fabiensanglard.

I am currently dealing with the Origin FX engine over at www.wcworkshop.net.
My project's not there yet when it comes to graphics but maybe you'll be able to benefit from it as well some day.
 
Last edited by a moderator:

fabiensanglard

Master Chief Petty Officer
@delMar

Sweet, so the Origin FX system may have been used for the midgames (intro, cut-scenes) in Strike Commander ? Do you have any source code or idea of how the codec worked ? I am thinking of maybe bytecode that allows to program the animation and compose all the layers into one.

I have made some great progress in the last 24 hours:

- I have parser for the voices in the game (VOC) and XMIDI musics. I don't have a player but it is peanuts since I can leverage the players from the great people of Exodus project.

- I am now able to locate and extract the map texture !!!

6833-1872eb093c0422b8b86d2deba63215e0.jpg
6834-47eb0daec84b922bd9edcab5cc0d9db9.jpg


I have even found assets that I never saw in the game, like crop circles:

6835-75dbb964e8983560cd368ef0b461518c.jpg
6836-e0cbd96ff3c551bd9cce6081e6939f1b.jpg
6837-9bc1d03dcda60204958d349f3cbca9b3.jpg


I also have a good idea of how maps are organized (they seem to features precalculated gouraud color or gradient)....but so far it is still mashed potatoes.

The two BIG things that I am missing are the ability to understand MAPS and ANIMATION. I hope some people with reverse engineering skills will join the project, I know from experience that a one man effort is usually very hard to carry on for a while....
 

Attachments

  • Screen Shot 2013-12-26 at 4.01.27 PM.png
    Screen Shot 2013-12-26 at 4.01.27 PM.png
    26.2 KB · Views: 78
  • Screen Shot 2013-12-26 at 4.02.33 PM.png
    Screen Shot 2013-12-26 at 4.02.33 PM.png
    23.9 KB · Views: 72
  • Screen Shot 2013-12-26 at 4.02.24 PM.png
    Screen Shot 2013-12-26 at 4.02.24 PM.png
    22.7 KB · Views: 74
  • Screen Shot 2013-12-26 at 4.02.15 PM.png
    Screen Shot 2013-12-26 at 4.02.15 PM.png
    22.9 KB · Views: 65
  • Screen Shot 2013-12-26 at 4.01.36 PM.png
    Screen Shot 2013-12-26 at 4.01.36 PM.png
    28.6 KB · Views: 69

delMar

Rear Admiral
Nice job, fabiensanglard.
I never become tired of viewing images which were extracted right out of a game's resource files :)

Currently, I am busy with getting some UI and basic editing done. Once that's working, I may try to work on the images.

Did you already browse the various mission editing tools available here?
Also, you might want to check out this thread.
The last post on the first page contains a tool called WCNAV which also allows to view midgame animations.
Not sure, how well that fits SC.
According to HCl, there should be some serious relationship between SC and WC.
It really is standard WC1/WC2 packaging, with RLE data.
 
Last edited by a moderator:

HCl

WC EXE archaeologist
Hey great work here! :)

For everyone's benefit, i'll elaborate a bit on WC1/2 cutscenes, which have a lot in common with cutscenes from Armada, Academy and Strike Commander:

Animations are stored exactly the same way, with frames coded in "blocks". Each block, as you noticed, share the same palette (this strategy in fact is not so different from the encoding of some Origin FMV movie codecs, for example WC3/4 and Privateer 2). I've been able to rip to AVI, with a Matlab script, sequences from WC2, Armada, even Academy. Needless to say, I want to import new animation sequences into WC1 / 2 at some point in the near future, it's part of what I have in mind for WC2 modding ;)

In *all* these games, from what i've seen, animations are encoded with typically has three possible modes:

- Fully differential encoding, where the first frame has the entire image and subsequent frames only have the differences (like the Niven Landing or the pic below: figure 1 is the full image, figure 2 is just the current frame difference).
- Frame + background: in each frame, draw the background, then the animation frame in order.
- Full frames: simple wipe and draw.

wc2anim.jpg


Optionally, the screen can be "wiped" at points. On my scripts, i cheat a bit, since this is extra information, not present in these files, and explicitly tell it at which points it happens. But it ends up working rather well.

Now, where are this additional information stored? (sound effect triggers, background triggers, etc) It depends on the game, and not all is good news:

- On WC2, this info is apparently on INCIDENT.Sxx (although i haven't broken it down yet)
- On Armada... this seems to be hardcoded on the EXE(!), at least for the Armada intro sequence. But, by cueing the triggers manully, the intro can be ripped. For example, from one of my Matlab scripts:
Intro
- On Academy, whatever triggers seem to be hardcoded on the EXE as well... but there's only 2 sequences in there, so I can understand why they are not configurable. For example:
Academy Logo
- On Strike Commander? Good question, and i don't have my CD with me to check. But i'd bet there's a file in there similar to INCIDENT.S00 that allows configuring the triggers of the animation sequences.

My plan for importing new cutscenes:
- For WC2: use my current RLE encoder to convert an AVI to RLE frames, then add the necessary information to INCIDENT.S02 (this approach can most likely be reused for Strike Commander and Privateer)
- For WC1... well, let's say i hope to achieve something with some COM-magic when the time comes ;)
 

fabiensanglard

Master Chief Petty Officer
Here is the PAK format that contains the map data:

Code:
Strike Commander TERRAN format :

Example MAURITAN,PAK

Triangles are probably within MAURITAN.TRI
MAURITAN.TRI seems to have indexes at the bottom of the file (0x00 to 0x75)

MAURITAN.PAK contains 7 unique entries (0 duplicates):

    Entry[0] size: 540 bytes.
        Block[0] size: 540 bytes:    IFF  block which describe textures in MAPS chunk
                                                    2 bytes unknown
                                                   8 bytes textureName
                                                   2 bytes unknown
                                                   Textures are references to TXM_LIST.IFF
                                                   TXM_LIST.IFF is referencing TXMPACK.PAK (which is full reverse-engineered).
                                                    
    Entry[1] size: 778900 bytes.
        Block[0]    size: 2400 bytes (IMAGES block ?).
        Block[1]     size: 2400 bytes (IMAGES block ?).
        Block[2]     size: 2400 bytes (IMAGES block ?).
        Block[3]     size: 2400 bytes (IMAGES block ?).
        .....
        Block[323] size: 2400 bytes (IMAGES block ?).
                                                            My guess is that it is the pre-gouraud ground MipMap level 0.
    Entry[2] size: 195700 bytes.        
        Block[0]    size: 600 bytes (IMAGES block ?).
        Block[1]     size: 600 bytes (IMAGES block ?).
        Block[2]     size: 600 bytes (IMAGES block ?).
        Block[3]     size: 600 bytes (IMAGES block ?).
        ......
        Block[323] size: 600 bytes (IMAGES block ?).
                                                            My guess is that it is the pre-gouraud ground MipMap level 1.
    Entry[3] size: 49900 bytes.
        Block[0]    size: 150 bytes (IMAGES block ?).
        Block[1]     size: 150 bytes (IMAGES block ?).
        Block[2]     size: 150 bytes (IMAGES block ?).
        Block[3]     size: 150 bytes (IMAGES block ?).
        ....
        Block[323] size: 150 bytes (IMAGES block ?).
                                                            My guess is that it is the pre-gouraud ground MipMap level 2.

                                                             Pretty sure the atomic unit in those
                                                            is 6 bytes. 6 can divide all of them
                                                            And I can see a nice pattern in the hex editor
    Entry[4] size: 15196 bytes.
        Block[0] size: 15196 bytes (TRIANGLES .TRI).        -> MAURITAN.TRI Map Triangles. Mashed potatoes for now.
    Entry[5] size: 3480 bytes.
        Block[0] size: 3480 bytes (OBJECTS .OBJ).        -> MAURITAN.OBJ (Object types and coordinates on the map)
    Entry[6] size: 648 bytes.
        Block[0] size: 648 bytes ( .AVG block).            -> MAURITAN.AVG (No idea what is this)

Intriguing that for each PAK (QUEBEC, SANFRAN, ...) there are 323 entries in the three "mipmap" parts (1,2 and 3). Even more interesting is that 150 x 4 = 600. And 600 x 4 = 2400. So clearly, entries 1, 2 and 3 are very connected: 3 is a mipmap of 2 and 2 is a mipmap of 1. I wonder if they are textures of the pre-calculated gouraud shading. Gouraud is diffuse lightning which does not depend on the Point of View like Specular does...so it is a viable theory.
 
Last edited:

fabiensanglard

Master Chief Petty Officer
I have finished the 3D models exporter and added a Renderer with texture and gouraud shading:'

F-22:
screen-shot-2013-12-30-at-8-16-47-pm-png.6840


F-15:
screen-shot-2013-12-30-at-8-18-10-pm-png.6841


A:10
screen-shot-2013-12-30-at-8-18-45-pm-png.6842


F-16:
screen-shot-2013-12-30-at-8-19-05-pm-png.6843


YF-23 :
screen-shot-2013-12-30-at-8-24-39-pm-png.6844
 

Attachments

  • Screen Shot 2013-12-30 at 8.16.47 PM.png
    Screen Shot 2013-12-30 at 8.16.47 PM.png
    42.8 KB · Views: 1,094
  • Screen Shot 2013-12-30 at 8.18.10 PM.png
    Screen Shot 2013-12-30 at 8.18.10 PM.png
    39.3 KB · Views: 1,092
  • Screen Shot 2013-12-30 at 8.24.39 PM.png
    Screen Shot 2013-12-30 at 8.24.39 PM.png
    29.2 KB · Views: 1,057
  • Screen Shot 2013-12-30 at 8.19.05 PM.png
    Screen Shot 2013-12-30 at 8.19.05 PM.png
    26.8 KB · Views: 1,055
  • Screen Shot 2013-12-30 at 8.18.45 PM.png
    Screen Shot 2013-12-30 at 8.18.45 PM.png
    35.2 KB · Views: 1,075
Last edited by a moderator:

fabiensanglard

Master Chief Petty Officer
I am releasing the source code of the tools I have build for Origin Systems RealSpace engine:

LibRealSpace :

https://github.com/fabiensanglard/libRealSpace

RealSpace was used for many other Origin games :

Strike Commander
Pacific Strike
Wings of Glory
Wing Commander III
Wing Commander IV

I hope this library will benefit anybody working on those games.

A list of what libRealSpace can do so far:

  • Full TRE Support.
  • Full IFF Support.
  • Full PAK Support.

  • Render Textures 3D Jets for all Level Of Details

  • Render animation layers (individually).
  • Render Map Textures.

  • Guess PAK contents:
    • VOC sound effects.
    • XMidi music
    • Animations.
    • IFF
    • Images
    • Map Textures
    • Sub-pack structure

The thing I would really want to do next are extracting the 3D maps and full animations.
 
Last edited:

fabiensanglard

Master Chief Petty Officer
A few more pretty pictures I came across in the PAKS :

screen-shot-2013-12-25-at-1-01-42-pm-png.6845


screen-shot-2013-12-25-at-1-02-05-pm-png.6846
 

Attachments

  • Screen Shot 2013-12-25 at 1.01.42 PM.png
    Screen Shot 2013-12-25 at 1.01.42 PM.png
    48.9 KB · Views: 1,055
  • Screen Shot 2013-12-25 at 1.02.05 PM.png
    Screen Shot 2013-12-25 at 1.02.05 PM.png
    34.8 KB · Views: 1,048
Last edited by a moderator:

delMar

Rear Admiral
I am releasing the source code of the tools I have build for Origin Systems RealSpace engine:

This awesome.
I'm really looking forward to finding the time and dig through :)
 

fabiensanglard

Master Chief Petty Officer
I am still horribly stuck on the maps and animation. So in order to cheer myself up, I rebuilt the Object Viewer, DogFight and MainMenu:

screen-shot-2014-01-03-at-7-08-01-pm-png.6848
 

Attachments

  • Screen Shot 2014-01-03 at 7.08.01 PM.png
    Screen Shot 2014-01-03 at 7.08.01 PM.png
    42.7 KB · Views: 1,073
Last edited by a moderator:
Top