Space Chase

This is where you can post your Commander Keen related stories, artwork, or other stuff that is related to Commander Keen but otherwise doesn't belong in another forum.
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Space Chase

Post by K1n9_Duk3 »

Levellass wrote: Sat Oct 28, 2017 14:28I'm not getting anything with STORM2.SSP and STORM3.SSP. They're the same format... does this program not generalize?
I'm not sure which "program" you're talking about. All I can say is that I haven't seen STORM2.SSP and STORM3.SSP, and I never claimed that my extractor was able to read these files.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Malvineous
Shikadi Webmaster
Posts: 382
Joined: Wed Oct 31, 2007 21:48
Location: Brisbane, Australia
Contact:

Re: Space Chase

Post by Malvineous »

DoomJedi wrote: Sat Oct 28, 2017 9:06 xmi2mid <xmi.file.xmi> <midi file.mid>

Already extracted all midis. can upload.
Did your conversions come out at the correct tempo? I used XMI2MID as well but I have to play the MIDI files at half speed to match the tempo they are played at in the game.
User avatar
DoomJedi
Vorticon Elite
Posts: 888
Joined: Mon Dec 14, 2009 11:22
Location: Israel

Re: Space Chase

Post by DoomJedi »

Well, I didn't know the correct tempo for those tunes...I did play only one level.
So maybe midis are faster than they should be? Need to check.

I did attach link to "my" midis, so you can compare. Maybe it's the player? I played them in latest winamp.
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Space Chase

Post by K1n9_Duk3 »

From what I've seen so far, the game uses a proprietary external sound system (Miles) for AdLib compatible music, along with the id Software/Softdisk PC Speaker sound routines. Since both require timed intervals to run properly, the programmers had to write their own interrupt routine to handle these intervals. That means the playback speed is set to a fixed rate dictated by the game and not by the XMI files. I think the music us updated at about 291 Hz and the PC Speaker effects run at half the speed (145 Hz).

Speaking of bad code design, this sort of music hack doesn't seem uncommon. Math Rescue uses a similar hack (it uses the same PC Speaker sound format, but different music code), so its songs don't sound right when played in a CMF player.

Long story short:
Playing/converting the XMI files won't produce reliable results, because the converter/player uses the speed setting defined in the XMI file (or its own default speed, I'm not too familiar with the XMI format). The game uses its own (different) speed setting, so the music sounds different in the game.

I know this doesn't solve the problem, but now you know what causes the problem. 8)
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Levellass
S-Triazine
Posts: 5265
Joined: Tue Sep 23, 2008 6:40

Re: Space Chase

Post by Levellass »

K1n9_Duk3 wrote: Sat Oct 28, 2017 20:14
Levellass wrote: Sat Oct 28, 2017 14:28I'm not getting anything with STORM2.SSP and STORM3.SSP. They're the same format... does this program not generalize?
I'm not sure which "program" you're talking about. All I can say is that I haven't seen STORM2.SSP and STORM3.SSP, and I never claimed that my extractor was able to read these files.
These are the archives for episodes 2 and 3, they follow the exact same format as the first episode. As such a plain extracter like this should easily be able to simply remove all the files from them. I don't expect winzip to only be able to unzip a single file. I'm honestly surprised. Maybe I should have coded something after all...
What you really need, not what you think you ought to want.
User avatar
DoomJedi
Vorticon Elite
Posts: 888
Joined: Mon Dec 14, 2009 11:22
Location: Israel

Re: Space Chase

Post by DoomJedi »

We could slow down the tunes if we'd know by how much.
All I can say is that I haven't seen STORM2.SSP and STORM3.SSP
This is shareware episode, just episode 1, so the other files should be quite empty. I need to search the web for the full game, if it was released.
User avatar
DoomJedi
Vorticon Elite
Posts: 888
Joined: Mon Dec 14, 2009 11:22
Location: Israel

Re: Space Chase

Post by DoomJedi »

Downloaded registered version/episodes. I'll try to rip more stuff.

...doesn't work...if I send you the files can you make extractor for the registered episodes?

...man, this game is lame...graphics with no dithering, unfair enemies you can't avoid, weird jumping dynamics...
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Space Chase

Post by K1n9_Duk3 »

Levellass wrote: Mon Oct 30, 2017 3:05These are the archives for episodes 2 and 3, they follow the exact same format as the first episode.
Obviously they don't use the "exact same format", otherwise my extractor would be able to read them. And you're implicitly expecting me to pirate a game I'm not even interested in just to check if my tool works on versions of the game that weren't even discussed here. Thanks, 'lass.
Levellass wrote: Mon Oct 30, 2017 3:05As such a plain extracter like this should easily be able to simply remove all the files from them. I don't expect winzip to only be able to unzip a single file. I'm honestly surprised.
Now you're just trolling me, are you? Taking a throw-away tool that was written in matter of minutes and implements a specification I just guessed by looking at the SORM1.SSP file in a hex viewer, and comparing it to a tool that has been commercially available for decades and implements a well-designed and publicly documented specification? Thanks, 'lass.
Levellass wrote: Mon Oct 30, 2017 3:05Maybe I should have coded something after all...
By all means, go ahead and do it. And then tell me why my tool doesn't work and how I should have coded it to avoid the error you were getting, without knowing what the files for episodes 2 and 3 look like.
Thanks in advance, 'lass.

DoomJedi wrote: Mon Oct 30, 2017 6:59We could slow down the tunes if we'd know by how much.
I don't know enough about the format to answer this question. I have found the original source code for the miles system here (AIL Version 2, at the bottom of the page), but I haven't looked at it yet. I guess you won't be able to use a fixed factor to get the music to the correct speed. MIDI songs can contain so-called "events" that change the speed at which the song is supposed to be played, so the actual speed of the timed intervals can change bewteen songs and even within a song.

So I guess you have two possible options:
- Take the AIL source code and analyze it to figure out how the fixed timer interval affects the speed of the playback.
- Let the game play the songs in dosbox and record an OPL capture, then compare it to the (converted) MIDI file and adjust the speed of the MIDI file accordingly. Or just keep the OPL capture instead of the MIDI version.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Levellass
S-Triazine
Posts: 5265
Joined: Tue Sep 23, 2008 6:40

Re: Space Chase

Post by Levellass »

K1n9_Duk3 wrote: Mon Oct 30, 2017 22:16 By all means, go ahead and do it. And then tell me why my tool doesn't work and how I should have coded it to avoid the error you were getting, without knowing what the files for episodes 2 and 3 look like.
Thanks in advance, 'lass.
*Cricks*

Extracter with files from episodes 1 and 3 extracted for example purposes here: https://www.dropbox.com/s/401uwik4lxo20 ... R.zip?dl=0

Ok, so the basic file format is list of file lengths, list of names, list of offsets and data. The first thing my program does is check to see that the first word is less than 256; anything bigger than that is likely another format, no game needs >256 files. After that it takes the first and second file sizes and looks in the file for long(x1) + long(x1 + x2). This is a near cast-iron check for the format, if the file lacks this it's not the right format, if it has it the chances of a false positive are near zero.

After this we just have to get the sizes, names and offsets. My program just runs through the file dividing it into chunks based on long stretches of nuls that appear between them. Chunk sizes must be at $2, names start after a patch of blank space after that, the offsets we found the start of earlier with our search and after the blank space at the end of that we get the data. (For STORM1 these offsets are 2, 514, 8839 and 9478 respectively) (For the last check I don't check for alphanumeric values as I did with the names but any non-nul value, and I only check a little bit of the file just to make totally sure there's no false positives.)

After that it's just a matter of stepwise extracting the files. No filename will be bigger than 8 + 4, I was lazy so just searched for nuls between names (Which brings up the possibility of making invalid filenames but eh.) Get a chunk of data ChunkSize long from DataStart + Offset and dump it to the file, rinse and repeat.

It's inelegant but gets the job done, about a quarter hour or typing so Lord knows how many bugs there are in it. I included the source code (But can't understand yours sorry, not my language.) I'm wondering about doing a PCX->BMP converter but there seem to be some out there already. The format looks devious to me, possibly your extracter isn't flexible enough; working with KeenGraph taught me that sometimes things you think you can rely on (Surely all sound files must have 64 entries! Surely all offset values are 3 bytes!) can't be. I try to let my programs 'work out' as much as possible within the limits of the format. That's why when I heard this used the same engine as Keen I thought KeenGraph could work with it; if that were true KeenGraph is flexible enough to extract the graphics. Sadly it uses a totally different engine.
What you really need, not what you think you ought to want.
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Space Chase

Post by K1n9_Duk3 »

Thanks, 'lass.

Nice ideas in general. Speaking of "things you think you can rely on", your tool would be totally useless if the first actual file file in the archive would start with one or more nul bytes. Just sayin'.

Edit: I can't understand your source code either.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Levellass
S-Triazine
Posts: 5265
Joined: Tue Sep 23, 2008 6:40

Re: Space Chase

Post by Levellass »

That's quite true, though given the format I'm assuming it lists the number of files there. I COULD rewrite it easily enough simply to assume the chunk list and get the number of files from that, but it was a rush job.

It's wonderful how neither of us can figure out what the other's source is doing. This is the future of programming.
What you really need, not what you think you ought to want.
User avatar
Malvineous
Shikadi Webmaster
Posts: 382
Joined: Wed Oct 31, 2007 21:48
Location: Brisbane, Australia
Contact:

Re: Space Chase

Post by Malvineous »

That's what happens when you don't use a real programming language... *ducks*

Seriously though, two extractors and nothing on the ModdingWiki?? C'mon now :garg
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 781
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Space Chase

Post by K1n9_Duk3 »

I'm currently examining all the SSP files I could find and I'll add the information to the wiki later.

One thing I found out so far: There are at least three(!) different versions of the SSP format, and all three of them can be found in the various downloads at classicdosgames.com. So I guess I would have been able to notice the different file formats (without pirating anything), I just didn't look at all the different versions that were available.

I apologize for my angry posts above.

Sorry, 'lass. :o

Edit: Now that we've all come to the conclusion that this game is not based on any Commander Keen engine, would somebody please move this thread into "The Classics"?
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Levellass
S-Triazine
Posts: 5265
Joined: Tue Sep 23, 2008 6:40

Re: Space Chase

Post by Levellass »

This game... this game... I wish I had the free time to poke about in it more, just for he obtuseness of its formats. I'd really have liked to have been there to hear some of the programming choices they made. Keen is delightfully robust, Duke II is astoundingly capable, this... "EGA in PCX form? Makes perfect sense!"
What you really need, not what you think you ought to want.
User avatar
Malvineous
Shikadi Webmaster
Posts: 382
Joined: Wed Oct 31, 2007 21:48
Location: Brisbane, Australia
Contact:

Re: Space Chase

Post by Malvineous »

It does tell you a lot about the experience of the programmers. Word Rescue also uses EGA PCX files for its graphics. It suggests that the programmers weren't very experienced, so instead of learning about graphics formats and video memory, they took the quick option and used a code library written by someone else. Not that there's anything wrong with this, I just think it's an interesting observation.

Space Chase appears to do this for the graphics, and it certainly does so for the sound with the Miles AIL, so it's probably no surprise that you found the file formats aren't very space efficient. The programmers were probably so focused on trying to get the thing to compile and run, that being efficient was too far down the list of priorities.

As a side note, I have often wondered what it would be like to go back now and write a DOS game to run on early 90s hardware, but using all the things we have learned since - hardware tricks, more efficient compression, and other optimisations. I wonder how favourably it would compare to the original games from back then...
Post Reply