WC1 turned inside out

delMar

Rear Admiral
Hi,

as recently mentioned in another thread, I'm currently taking a deeper look at the WC1 data files.
I want to use this thread to post some information which was not available in such a cohesive way before.

First things first:
Kudos go to HCl and ZOmegaZ for digging deep into the data files and providing their findings to the community. Without your efforts, I would not even have been able to start.

For a start, I'm posting some debug output which lists the contents of the campaign files of wc1, sm1 and sm2.
They were taken from the PC Gamer Kilrathi Saga Cover Disk Version which is available for download in the CIC's file section. Unfortunately, the gog version comes with compressed data-files which I have not yet been able to uncompress (also, it seems it will not be necessary as long as uncompressed files are available).

The files consist of three blocks, whereas the content of the first block is not yet known.
If someone wants to dig in and find out, I'd be more than glad to incorporate your findings into my code.
For a guideline on the layout of the camp.00x files, checkout camp_format.txt by ZOmegaZ in one of the other threads.

Maybe there's some information which is worth adding to the WCPedia (victory points, persons in the bar, ...).

The next post will be about the briefings files, which contain a little bit more interesting information, like cutscenes etc.

Feedback's very welcome

Martin
 

Attachments

  • camp.000.txt
    12.6 KB · Views: 96
  • camp.001.txt
    12.5 KB · Views: 73
  • camp.002.txt
    12.5 KB · Views: 63

Quarto

Unknown Enemy
Cool stuff! Wonder what the first block is... it looks to me like each of those entries corresponds to a single mission (notice how 3 and 4 are empty, in the same way that the third and fourth mission of the first series are absent), but that seems to be about all you can tell. Given all the info present in the other two blocks, I have a hard time figuring out what campaign-related info is still unaccounted for...
 

delMar

Rear Admiral
Here comes the really good stuff.

The briefing files contain more or less all of the dialogues of the game.
Again, it's just debug output. That helps me make sure that I have parsed the data correctly.
Reading through all those dialog lines is pretty cool :)
And it may come in handy in completing the mission guides with dialog information.

The text-commands are just printed as hex values so far. With those commands you can eg switch between characters in a cutscene etc.

Also, the funeral, halcyon and medal ceremony stuff is not yet included because it requires additional work. That data is a little bit different.

Again, Kudos to ZOmegaZ and HCl for doing the hard work
As with the camp files, any help in decoding the missing parts is really appreciated...

Hope you have fun,
Martin
 

Attachments

  • briefing.000.txt
    472.2 KB · Views: 75
  • briefing.001.txt
    199 KB · Views: 59
  • briefing.002.txt
    204.8 KB · Views: 65

HCl

WC EXE archaeologist
Hey good stuff here!

I may be able to help with the commands somewhat, i remember looking at those briefly, years back. I'll see what I can dig from my notes!
 

HCl

WC EXE archaeologist
Ok no news on the commands yet... but, as i was looking at the text files, it hit me that the camp unknowns might correspond to the background planets and stellar objects found in the several systems, i'm guessing 4 per system (or rather, 4 per series, although each series tends to occur in a different system).

My reasoning is: planets.vga has 11 blocks of sprites (or rather 12, but the first block is special, it's a series of smaller 2-3 pixel stars, instead of a single sprite block), and planets1.vga has a set of 16 sprites. If you check the first value, it is limited in the interval 0..10 for the series 000 and 001, and between 12..27 for series 002 (with a few smaller values in there, most likely allowing access to both the sprites of planets.vga and planets1.vga by SM2.EXE). Quickly launching the first WC1 mission, i see that Enyo has a blue spiral galaxy on the background, as well as a blue planet. This checks out, as they are entries 3 and 4 in planets.vga (subtract 1 to exclude the first "special" block, and it checks out with values 2 and 3 in camp.000).

The rest, i'm guessing, are coordinates or transformations that place these objects in space. Probably in the form of a set of rotations (rx, ry, rz)? We'll know for sure when we start experimenting :)

(edit: more or less implicit, but to clarify, i was interpreting the bytes as a set of 4 int16 each)
 
Last edited:

Ijuin

Admiral
I always wondered about the spiral galaxy in the background in Wing Commander games--there are only two spiral galaxies that are at all visible to the naked eye from within our galaxy--Andromeda and Triangulum.
 

delMar

Rear Admiral
Hi,

the last two evenings I was investigating the module.000 file from WC1.
Unfortunately it is not in the least as clear as the campaign and briefing files.

I took the wc1 and wc2 editing file descriptions by HCl for reference. I will attach the archive containing them to this post as well, so anyone wanting to help out can have them handy at once.
Also I'll attach some primitive dump from the second block of the module.000 file. Maybe it helps with verifying some of the data.

To the questions:
'How to edit Wc1 v0.9' starts with some offsets for each part.
Unfortunately, I did not recognize, to which parts the paragraphs of the document belong.

Also, the offsets in my mission.000 file from wc1 do not comply with those described in the textfile. Can someone verify/falsify this?

BTW, I downloaded the HxD viewer which lets you switch between hex and dec. So the offsets being decimal is no big problem.

In addition to those generic questions:
Code:
the attached s01m01.000.txt file is taken from wc1 module.000 at offset 1E2C-1E78.
length: 77 bytes

I was able to allocate some of the contents, but not all. I'd be glad if anyone could clarify some bits and bytes :)

the offsets are in decimal and refer to the s01m01.000.txt file

0-29:  Name of the navpoint (invisible, if first byte is .), filled with zeroes.
fully understood, nothing to add here

30,31: navpoint characteristics
0x01 most common. what does "will always be there or be number 1" from the wc1 document exactly mean?
0x00 "second wave of ships". do I have to set this, if I want several waves of attackers to appear?
0x02 only at invisible nav-points. exception: kilrathi base. is described as "appearence of a new nav". does it mean, the nav becomes visible on the map upon visiting?

32,33: x-coordinates
34,35: unknown
36,37: y-coordinates
In the document, z-coordinates are mentioned as well. Not sure if that is true.
The coordinates look good to me, but sometimes they are negative values. The game engine just seems to be wrapping coordinates. Because Tiger's Claw is always 0/0 but hardly ever in the center of the map.
Maybe some of the unknown bytes contain some map-offset info?

38,39: unknown. described as "don't change"
40,41: the wc2 file mentions that this is jump-point info. Is this true for wc1 too? Examining the drayman escort mission it does not seem so.

45-52: nav point manipulation. Up to 4 Nav points can be shown/hidden this way. What is meant with "dominant" nav point in the wc1 document?

53-??: ship-types to load (2 bytes each), how many are possible at most?
??-76: "ship's characteristics" according to the wc2 file. Did not understand this, but I haven't dealt with ship's assignments so far.

Thanks for your help, looking forward to having fully decoded data-files at our disposal.
The more we know, the more we can edit :)

bwt: I'm more the architectural software development guy and not so much the number-crunching one. Therefore, this surely will not be the last of questions. So please bear with me.

Thanks again,
delMar
 

Attachments

  • info.zip
    69.8 KB · Views: 59
  • block2.txt
    29.1 KB · Views: 57
  • s01m01.000.txt
    77 bytes · Views: 68
Last edited:

HCl

WC EXE archaeologist
Working late tonight, but here are a few quick notes while i'm on my break:

0x01 most common. what does "will always be there or be number 1" from the wc1 document exactly mean?
0x00 "second wave of ships". do I have to set this, if I want several waves of attackers to appear?
0x02 only at invisible nav-points. exception: kilrathi base. is described as "appearence of a new nav". does it mean, the nav becomes visible on the map upon visiting?

From memory:

- Value 0x01 means that the nav point is active. Meaning, you go to the nav map and it's visible there, and once you get in range the ships within the nav point are activated. You can think of this as the "default" case.

- Value 0x00 marks following waves. So, you could have something like:

Nav 1 - 0x01
.wave2 - 0x00
.wave3 - 0x00
Nav2 - 0x01 (next nav)
.wave2 - 0x00 (wave2 of nav2)

- Value 0x02... As i recall (but this could use some double-checking, it's been a few years...) means a nav point that is inactive by default but gets activated somehow. How exactly it is activated, i don't think i ever got to the bottom of that, but i'm guessing it would be in the same way as how ship refueling is handled. I think this case is used on the SO1 mission where Blair goes searching for the Gettysburg, and a nav point appears after a cutscene where coordinates for the rendezvous nav are sent. Worth checking out and confirming!

I'll try to dig out some more info soon.

In the meantime... just a quick reminder that those files were written back in 1996, when I was around 16 (and it shows :p) ... so when going through those, please try to be patient with my 16 year old self ;)
 

delMar

Rear Admiral
Thanks for your input, HCl.

Digging through resource files at the age of 16 is awesome.
And still being interested in doing so after all these years is even more awesome.

I'm grateful for all and any input.

Maybe I should focus on getting some UI started which not only allows editing values bytes but also unknown ones.
Being able to edit those raw bytes in a convenient manner would probably make it much easier to find out about their meaning...
 

Quarto

Unknown Enemy
Ok! I dug up my old editor today. No way I can get it running, as I don't have Visual Basic installed - and as I understand, any version of VB beyond 6.0 (released back in 1998...) would not work with this anyway. Oddly enough, I never even got around to compiling it to an executable - presumably simply because it was never actually completed.

Let's start with the most important thing, though: how did I even put together an editor? I've never had the patience to learn programming properly. I'm excellent at scripting languages, which means I probably have what it takes to be a good programmer, but... I just could never be bothered. Visual Basic was the only programming language that I sorta liked (because it really was a fast and easy way of putting together something in Windows), but even then, I didn't learn it that well. So... this editor, where did it come from? It's a question I honestly could not remember an answer to. It just seemed plain impossible.

The answer, as it turned out once I found my archive, is... hydrochloric acid ;). HCl. He did most of the work for me. Way back in the 1990s, he released an editor for WC1 written in Basic. I even don't know if he ever released a compiled version of it, but he released the source code, and that's more important. Or did I get the source code from him? I don't remember. What matters is that I have it here - attached to this post.

One caveat: I was using HCl's code as the basis of my Visual Basic editor, and the way I used it was literally cut-and-paste - I would take sections of the code, move them over to the relevant place in the code of my VB editor, and delete them from the original file, so that I could see from the size of the shrinking file how much I had done and still had left to do. Now, I *believe* that the source you'll find in WC1.bas.zip is the original, unadulterated, uncut code from HCl - but unfortunately, it might not be. It's definitely the oldest version I have in my archives, though, so at least it's the closest to being complete.

I'm also attaching the last known version of my editor, with at least half of HCl's Basic code transferred into VB. I'm actually tempted to install an ancient copy of VB5 and finish the job :p. In this last version, I did actually incorporate a little bit of my own research - for example, I definitely remember supporting at least one more type of mission order for ships (I called it "beeline", because that's the word Halcyon used in one of the briefings - used mainly for transports, this order simply made a ship fly in a straight line towards a... err, navpoint? Ship? Position? Don't remember the details). Unfortunately, while the .frm files can be opened with any text editor, .frx files are more bothersome, requiring a hex editor - so, given the difficulty of opening this stuff up without Visual Basic, you may find it easier to just ignore my editor and concentrate on HCl's original version.


Edit: I did install VB 5.0. I was able to run the editor, and found it to be pretty awful :). It doesn't even read the data from module.000, all it does is allow you to overwrite it with your own data. All in all, there really isn't much mileage to be had from it, HCl's version is almost certainly more useful :).
 

Attachments

  • WC1.bas.zip
    7 KB · Views: 59
  • WCVB.ZIP
    24.9 KB · Views: 55
Last edited:

delMar

Rear Admiral
I definitely remember supporting at least one more type of mission order for ships

That's exactly the point why I am asking for every single thing that has once been programmed. I cannot remember reading about mission types anywhere else.
So I guess the code will be of good use to me.

I will grab the attachments in the evening and take a look at them.

Thanks alot Quarto for digging up all that stuff.
 

Quarto

Unknown Enemy
That's exactly the point why I am asking for every single thing that has once been programmed. I cannot remember reading about mission types anywhere else.
I'm not sure, but I think mission orders for ships might have been specific to just WC1 - at least, I don't remember anything exactly like that in WC2, though logic dictates that something similar must have been present.

Anyway, in WC1, each ship has a mission order. You can read about where these are in module.000 in the code, and here's what we know of what they actually do:
0 - Attack Fighters
1 - *Escort (Out)
2 - Strike Capships
3 - Defend
4 - Follow
5 - *Unknown
6 - Jump Out
7 - Jump In
8 - *Unknown
9 - Escort/Rendezvous
10 - *Beeline

Some of these orders are general and require no additional data, while others read an additional value - a ship or nav number. So, most Kilrathi fighters will only have the general "attack fighters" order (which, I suspect, may actually be a misnomer, in the sense that they should be able to attack capships as well), while those who are to hit a particular target will have the "strike capships" order (and again, this may be a misnomer - I suspect it works just as well for targetting a specific fighter).

#1, #5, #8 and #10 are not completely certain. I believe I had #1 and #10 well figured out - which is why they have names, while #5 and #8 are total unknowns. You would need to find an example of their use in a mission to figure out what they actually do.

#1, escort (out) appears to be the order used when escorting a ship which is going to jump out. An interesting question occurs to me now - were these used for the player? Presumably, because there's no other situation where they would be applicable. Did having the player fly with this order change anything, given that the player is autonomous anyway? Not sure - maybe it made a difference when it came to victory points?

#4, follow, actually means following a wingleader, doing the same thing he does - not to be confused with escorting. I don't remember if anyone verified this, but presumably if a wingleader is destroyed, one of his wingmen with a follow order inherits the wingleader's order.

#6, jump out, means to travel to a set navpoint and then jump out after reaching it.
#7, jump in, means ONLY jumping in. IIRC, it is not used for ships that travel after jumping in.
#9, escort/rendezvous is what a fighter does when meeting up with an inbound ship - it's the equivalent of escort (out).
#10, beeline - as I mentioned earlier, the term comes from a briefing, it just sounded appropriate :). It means flying towards a navpoint (or ship? More likely navpoint). A ship like this will move straight regardless of autopilot - in other words, unlike in most later WC games, if you choose to simply fly alongside your escorted transport without the use of autopilot, you will eventually complete the mission. What I do not remember is whether this order incorporates a jump-in as well, or if the ship is already visible when we arrive. I believe it is the latter.
 

HCl

WC EXE archaeologist
Hey, thanks for posting my old WC1 editor :D In between a hard-drive crash and a collection of CDs I lost last time I moved, i thought this was lost.

For context: back then, given where I lived, it wasn't that easy for me to get access to more advanced programming tools. I got my hands on Turbo C++ when i finally got into college in 1997, but before then, I ended up doing some quick and dirty programming in some old BASIC dialect included in MSDOS (GWBASIC, or QBASIC? Can't remember which... I think i programmed a bit in both, there were some differences between the two which i pretty much already forgot). The WC1.bas you posted was developed in one of these two BASIC variants.

Then i decided that BASIC was too limiting and bought a book on x86 Assembly which came with a free assember on a floppy disk. That's when I started tinkering with WC3. At that time, i knew software development was for me :D

Anyway, good stuff on this thread! I'll try to post some more info when I get off work.
 

HCl

WC EXE archaeologist
Ok here are a few more nuggets:

40,41: the wc2 file mentions that this is jump-point info. Is this true for wc1 too? Examining the drayman escort mission it does not seem so.
Out-system nav points were only introduced in wc2, so this is only valid for wc2 (and so1/so2)

45-52: nav point manipulation. Up to 4 Nav points can be shown/hidden this way. What is meant with "dominant" nav point in the wc1 document?
Yeah that part is not very clear... Basically, i got the impression that when you have the following:

Nav 1 - 0x01
.wave2 - 0x00
.wave3 - 0x00

... the game apparently tends to treat this as a single group of nav points. Following waves tend to trigger automatically once all enemy fighters have been destroyed, for example, but you can also enable these nav points marked as 0x00 through those byte commands. Since this is (apparently) treated as a single group, i think the game expects only one of these navs to be enabled at one given time. But i'm going by memory, so we should test if this is true.

53-??: ship-types to load (2 bytes each), how many are possible at most?
Good question. I think only two in WC1, and maybe 3 in WC2. It is consistent with what I remember and with most missions in WC1, where you typically have:

- Player ship (loaded by default)
- Enemy ship of a given type
- Capship (friendly or enemy)

Remember that on the rare occasion where you face two different enemy ship types at one nav point, you see one of the enemy ships being the same as the player ship. Case in point: the mission in SM2 where you are flying a Dralthi and encounter a Dralthi wing with a few surviving Rapiers from the Gwenhyvar.

In the case where a capship autopilots with the player, i'm pretty sure the game keeps the necessary ship types loaded.. so you can work over this limit.

Still, I do recall the main problem was getting the game to actually load the specified ship types, due to memory constraints. This was especially problematic in WC1, as it apparently did not use EMS as extensively as WC2 (or it could be due to hardware constraints of my machine at the time, i probably had around 2mb ram at the time...).

??-76: "ship's characteristics" according to the wc2 file. Did not understand this, but I haven't dealt with ship's assignments so far.

These are 2 values duplicated directly from the ship file. I named them as "Size" and "Class" in my old WC2 ship editor (wc2se). These are probably not the most appropriate descriptions, but let's go with that for now. wc2se gives them the following interpretation (take these with a grain of salt):

"Size":
0x0c - Small (used on fighters)
0x0d - Medium
0x0e - Large

"Class":
0x30 - Light Fighter
0x31 - Medium Fighter
0x32 - Heavy Fighter
0x33 - Bomber
larger than 0x33 - Capital Ship

From what i recall, the 0x33 flag gives the ship the Broadsword / Crossbow bomber behavior (no afterburner, shield values on display divided by 10, etc).

(edit: small correction)
 
Last edited:

Quarto

Unknown Enemy
Hey, thanks for posting my old WC1 editor :D In between a hard-drive crash and a collection of CDs I lost last time I moved, i thought this was lost.
Well, I'm glad to have kept it, then :). One of these days, I should look through my archives and see what other old tools I have stored here - a bit hard to tell, actually, since mostly they're just poorly labelled zip files. Well worth cataloguing and preserving, though. The unfortunate thing is that for most tools, the source code was not included. I'm pretty sure, for example, that I have your WC2 mission editor somewhere out there, but if I do, it's almost certainly without the source code.

Your files, incidentally, are relatively untroublesome - the only "lost" files are really old ones, in many cases superseded by new research, and in other cases - can be recreated with relatively little difficulty because you documented your research. Far more regrettable today is the loss of so much WCP-related research. For instance, Thomas Bruckner's WCPPas editor would be potentially one of the most fantastic tools we have (it's not only good for WCP, it's a great editor for all kinds of IFF files), if only someone were able to continue its development. Won't happen, though - Thomas disappeared years and years ago, there's no source code, and ironically, the very last version of WCPPas added a couple of really severe memory leak bugs, essentially becoming unuseable.

Thinking about it now, it seems a bit ironic to me that people in the editing community were just as secretive about their source code as the developers had been :). But I guess in most cases, it wasn't so much a question of unwillingness to share, but rather the fact that until Solsector happened, most of us had our websites hosted on free servers that usually allowed about 50MB of space.

Then i decided that BASIC was too limiting and bought a book on x86 Assembly which came with a free assember on a floppy disk. That's when I started tinkering with WC3. At that time, i knew software development was for me :D
Wow, you jumped from Basic to Assembly? That's... something. No wonder you decided to go into software development... :)
 

Quarto

Unknown Enemy
Good question. I think only two in WC1, and maybe 3 in WC2. It is consistent with what I remember and with most missions in WC1, where you typically have:

- Player ship (loaded by default)
- Enemy ship of a given type
- Capship (friendly or enemy)

Remember that on the rare occasion where you face two different enemy ship types at one nav point, you see one of the enemy ships being the same as the player ship. Case in point: the mission in SM2 where you are flying a Dralthi and encounter a Dralthi wing with a few surviving Rapiers from the Gwenhyvar.

In the case where a capship autopilots with the player, i'm pretty sure the game keeps the necessary ship types loaded.. so you can work over this limit.
Yep. The limit was two ships in WC1, plus the player. Also, I believe that in WC1, the game actively took steps to remove excess ships from memory. How? By destroying them. It's not something you can see too often, but in a couple of escort missions, it is possible to drag the attacking Kilrathi fighters back to the Tiger's Claw - and they self-destruct the moment the Tiger's Claw is loaded, because there are two other ship types in memory, and both are essential (essential, I guess, just means friendly). The game is not able to cope in a situation where you have three essential shiptypes around, IIRC, and instead of self-destructing one of them, it would get a bit buggy. You'd be able to see all three shiptypes flying around you, but one of them would not display proper info on the HUD - it would just be empty shield brackets with no ship icon between them.

This is also the reason why in so many WC1 missions, the fighters flying CAP around the Tiger's Claw are of the same type as the player - any time you escort a capship to the Claw, escort something away from it, or in any scramble mission with Kilrathi fighters around.

I'm trying to recall how this worked in WC2. You definitely could sometimes end up with four kinds of ships (player included) at one navpoint, which would suggest that the limit was now three ships plus the player. However, I think this might only have happened if you escorted one of the shiptypes to another navpoint - in other words, I think the limit was two additional ships being loaded at a navpoint, but a third ship could be brought onto the scene if it had already been loaded elsewhere. If this was the case, then maybe by this point the issue was more about loading speed rather than the ability to keep multiple ships in memory?
 

delMar

Rear Admiral
Wow, all that information popping up here is really impressive. The Holy Grail of Wing Commander, if I may say so :)
Thanks alot.

I'm currently working on providing some user interface which should enable us to more easily analyze the unknown contents.
For a start, it will be read-only mode and just display all known values along the unknown bytes. At least as far as I am able to allocate the unknown bytes accordingly.
So far this is mostly the case for the campaign and the briefing file.

BTW: the wcsav.zip file which contains the savegame editor, also contains a file called missions.wc
That's an incredibly detailed file about all the WC1, SM1 and SM2 missions including waves, victory points, etc.
Is the author David S. "Center" Raley still around this place? (or has he ever been)


To keep up the conversation:
I started programming BASIC on the Commodore 64. I wasn't able to accomplish much, but I loved it nonetheless. I think it was at the age of 13 or 14.
Later on the PC I was working with QBASIC (that was the dialect that came with MS-DOS) and TurboPascal.
As Windows became the replacement for DOS, I sticked pretty much to Visual Basic. All the other languages just seemed too complicated to me.
On university I started with Java and I am still hooked today.
I admit that it's very memory intensive to run java applications compared to native binaries. But luckily, that's not much of a problem anymore these days.

So much for that, stay tuned. I'm confident that I'll be able to show off some early stuff to you this weekend.
 

Quarto

Unknown Enemy
No, I don't think David S. "Center" Raley has ever been around at the CIC. He's one of those people who contributed immensely at the very start of Wing Commander, and then seemed to disappear - or, to be more precise, it seems most likely that he simply never joined the WC community on the web (you can tell from the Compuserve PIN that he provides inside the guide that these files were originally published back in the days of the Compuserve forums).

He did also do a similar WC2 mission guide, though. It's just as detailed and accurate, although ironically, there's less detail to put into a WC2 guide - no victory points, hardly ever any follow-up waves (no more than 16 ships per mission, unlike WC1's 32!). Oh, and also, the WC1 savegame editor was his work. Is that how he was able to figure out the WC1 victory point system? Or did he also decode module.000, years before anyone else tried? We'll never know...
 

delMar

Rear Admiral
Sorry, no release this weekend.

But I have also been analyzing the savegames that are produced by WCSAV.
I did this by just changing one value, compared the new file to an unmodified reference file and wrote down all offsets.

So a savegame editor will also be part of my work.

I admit that the available editor is working perfectly, but it does not work on 64-bit systems anymore and therefore it is a bit tiresome to get it running using dosbox etc.
For the time being, I'll attach my savegame format findings here
 

Attachments

  • savegame_format.txt
    2.5 KB · Views: 66
Top