Beneath a Steel Sky source code

Discuss coding, porting and creating games
User avatar
DOSGuy
Website Administrator
Posts: 1063
Joined: September 2nd, 2005, 8:28 pm
Contact:

Beneath a Steel Sky source code

Post by DOSGuy »

Revolution Games said that they think BASS was programmed with Watcom C++, but it was over 10 years ago. If anyone successfully compiles a copy of BASS, please let me know. Being x86 Assembly, it looks like it would be no simple task to port it to other architectures, but I suspect it could be ported to Windows, Linux, FreeBSD, etc., fairly easily.
Today entirely the maniac there is no excuse with the article.
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

Well... I just came across this site this week and took this as a challenge.

I'm happy to say I succeeded.

It turns out that BASS was compiled with Zortech C (or C++) using the DOSX (X32VM) Dos Extender and MASM for assembly.

Luckily, Zortech has sort of been resurrected by the original creator as the new Digital Mars compiler. X32VM is still maintained, kind of, and course MASM is still available.

I did have to make some minor changes to support changes in compiler linkages, but it all seems to compile and work. I've never played it, but it goes through the opening intro sequence (which appears to be built into the executable and not the DSK file), and starts the game. I played through the initial puzzle and it seemed to work. Music, sound, and voice acting all seemed to work.

Someone who knows the game should try playing with the new executable to see if it makes it through the entire game.

TheDumbGamer
User avatar
DOSGuy
Website Administrator
Posts: 1063
Joined: September 2nd, 2005, 8:28 pm
Contact:

Post by DOSGuy »

That's awesome! I've played through this game and would be happy to test it out. Feel free to send me an email or private message.
Today entirely the maniac there is no excuse with the article.
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

Sent a PM.

TheDumbGamer
User avatar
DOSGuy
Website Administrator
Posts: 1063
Joined: September 2nd, 2005, 8:28 pm
Contact:

Post by DOSGuy »

Ah, silly me! You can't click the email button in my profile because I left "User email via board" disabled. I can only do it because I run the place!

I think I did that because I was afraid of members getting spammed. Obviously we can all talk to each other by posting or private messaging. Does anyone think I should turn on emails between users?
Today entirely the maniac there is no excuse with the article.
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

I think you should enabled it. Each user, I think, has the ability to make themselves emailable or not.

TheDumbGamer
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

OK, I guess I screwed up. I thought the recompiled version was working for me, but it's not. The problem, I'm guessing, is some unintialized variables and will take quite some time to verify and track it down.

I can only imagine I accidently ran the original executable when I thought it all worked correctly.

Sorry about that. I'll keep plugging away.

TheDumbGamer
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

Goodness! It's been a year since my last post.

I got really fed up with this and shelved it for awhile, but I recently put some serious time into it and have made some progress.

I believe that, while we have a source code set, that it doesn't include the original tools and configuration for the game. I cannot believe those original compiled data files (Xcompact.inc, etc.) were manually typed. There'd be too much of a chance for error.

The major problem appears to be that the data file was originally extracted from the original executable at some point in development. It seems to embed absolute addresses in the data, which means that the data segments (some of them, at least) need to be positioned in the exact same places.

Unfortunately, the current version of the 32-bit extender is a bit larger and forces the data segments up by about 6K. I haven't determined if all segments (including code) need to be fixed, but that seems to be the crux. The code compiles and compiles correctly. I either need to position the segments or figure out if there's a way to rewrite the datafile with the 'updated' addresses.

TheDumbGamer
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

This time, I think I really do have it completed.

I solved the data segmentation problem about an hour after my last post, but then had to spend several hours tracking down why the 'X' character in speech and rollovers was rendered as a different character. It worked just fine in the Save/Restore window.

It turns out that the source code you have (and I have) must not have been the final release, or at least not the last release. They had a special bitwise compression algorithm to store character text more effectively and the routine which extracted them was buggy. Since this isn't a problem in the released code, I assume my source was old.

It also affected many of the digits and special characters.

Finally, the source still included the copy-protection security check, which the release version has disabled.

In any event, I think it's all good now, and I've been running it for a couple of hours. I've never actually played it before, so I'm struggling along. I've managed to D-Linc LAMB, but that's as far as I've gotten. (I've JUST solved the character issue, so I need to make sure I didn't break anything else.)

I'm not sure why you wanted this done, as ScummVM runs on everything, but if you still want to test out my package, let me know and I'll send it to you.

TheDumbGamer
User avatar
DOSGuy
Website Administrator
Posts: 1063
Joined: September 2nd, 2005, 8:28 pm
Contact:

Post by DOSGuy »

I'm not sure if I necessarily wanted it done, but I do think it would be cool to be able to play it without having to load another program first. Congratulations on your accomplishment. I know the game quite well, so I can definitely test it out for you.
Today entirely the maniac there is no excuse with the article.
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

Sorry... my word choice isn't the best at 1:30 AM.

Now that I've gotten it to compile, I think I can say that getting it to run natively on the PC or other platforms isn't a huge issue, but will require some detailed work for the first platform in order to get away from the fixed addressing scheme it uses. The dataset will essentially have to be decompiled the modified.

The game runs on a data-driven engine so should be fairly portable once you remove the PC-specific peculiarities from the data set.

I see from various sites that Revolution provided their source and engine details (Virtual Theater, I think) to ScummVM who then incorporated it into their product. Essentially ScummVM replaces the executable provided and runs off of the same dataset. I don't know if they modified the dataset or not, but they may have additional tools/information, such as higher-level data descriptions, which isn't included in the source you have.

Again, the source you have and that I used was obviously not the final form of the source code, so if you have contacts with ScummVM, you might want to find out what they received.

When I get upstairs, I'll send you the new executable to play with. Note that it still requires DosBox or equivalent to run.

TheDumbGamer
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

I had never taken a close look at ScummVM before, as I ca barely keep up with the new games that come out.

But, it looks like they pretty much did what you wanted, which was to make the game playable on other platforms.

They use a container method to allow them to play one of many games, but they essentially rewrote the engine to use the same data file (I'm repeating myself, I know), so you aren't really loading a separate program to play it. You are running a port of the original game engine to your current platform.

Was there something else you were hoping to do?

TheDumbGamer
User avatar
DOSGuy
Website Administrator
Posts: 1063
Joined: September 2nd, 2005, 8:28 pm
Contact:

Post by DOSGuy »

I meant that you have to run ScummVM before you can run BASS. It would be nice to just be able to double click on the BASS exe file and have it run in modern Windows. While you're quite right that porting the game to Windows isn't necessary, it's still an interesting accomplishment to be able to produce a compiled binary that doesn't require a virtual machine to load it. I think this is the sort of thing that one does just to be able to say that it's been done. Why climb Mount Everest? To prove that it can be done.

I'll pass along your notes to Revolution Software to see if they can provide anything else to help you. So often source code gets released and then no one does anything with it. I think they'll be interested to know that someone has put this much effort into compiling a game with their source code.
Today entirely the maniac there is no excuse with the article.
TheDumbGamer
Less than a nibble
Posts: 14
Joined: October 11th, 2006, 2:47 pm

Post by TheDumbGamer »

I guess I'm not understanding.

ScummVM does exactly what you're asking for. It's not an emulator providing a virtual environment like DOSBox or whatever. It is a rewritten engine to take the same data file and run the game off of it.

Are you under the assumption that the executable is actually the game? In reality, the executable is a general engine which is driven off of the data stored in the SKY.DSK and SKY.DNR files. If you changed those files, you could completely change the game. The data makes the game, not the executable engine. It contains the scripts, graphics, audio, video, etc.

This is really no different in concept than the Z-Engine, used in all those Infocom games. The same executable running different z-code files created different games.

It was an interesting projects to be able to locate all the necessary tools and recreate a compatable DOS binary, especially considering that my original source code was incorrect.

TheDumbGamer
User avatar
DOSGuy
Website Administrator
Posts: 1063
Joined: September 2nd, 2005, 8:28 pm
Contact:

Post by DOSGuy »

BASS is made up of two parts: an engine and some data files. ScummVM is a collection of engines that can run the data files for various games. It could play Infocom games if someone added an engine to do so. It's like MAME or Project 64, in that you start up ScummVM, choose the game you want to play, and then play it. That's a poor example because MAME and Project 64 are actually emulators, but the point is that is that you have to start Program A before you can play Game B. Having a standalone Win32 engine just eliminates one of the steps before you can start playing BASS. It's not a big deal, but I respect that you bothered to do it.

I ask authors to send me the source code for their games so that the code can be preserved. To the best of my knowledge, this is the first time that anyone has done anything useful with one of those source code releases. Even if it's been done before, it's still pretty cool.
Today entirely the maniac there is no excuse with the article.
Post Reply