Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Gez

Shadowcaster modding 2: the remoddening

Recommended Posts

Quasar said:

Very poor correlation with the RoTT source so far, so I doubt it's going to be very useful. I did find one thing in it so far, however.

It has a function called CA_RLEWexpand which expects data to start with varying headers depending on the point of call, one of which can be "RLE". It is possible that this is the function used to decompress resources with RLE compression in Shadowcaster as well. It can be found in the RoTT source code in RT_TED.C at line 1265.


Unfortunately, the RLE tag used by that function is dynamic, not part of the specs. I don't know if it's the same in Shadowcaster CD, or not. If not, I don't know the magic value. If same, then I don't know where it's stored (the obvious being the following word, but that's apparently not that). It's also possible they changed it to deal with bytes rather than words, though.

Judging from the strings, the function that is at work to read them is CA_CacheLump:

CA_CacheLump: %d > LumpCount.
CA_CacheLump: malloc failed, lump %d, size %d.
CA_CacheLump: lump %d is missing RLE0 tag.
CA_CacheLump: RLE malloc failed, lump %d, size %d.
CA_CacheLump: unknown compression %d.
The "unknown compression" message is not very promising. If there are several compression schemes implemented, it makes reverse engineering all that harder. I've looked at a few RLE0 lumps from HD_CASTR.DAT and compared them to their uncompressed versions from RAVDATA.DAT, and honestly it does not look like an RLE is taking place at all...

andrewj said:

EDIT: looking at demo1.ojt, it appears to hold the scenery objects of the map.

EDIT2: the CRT files consist of records of length 202, with no header or trailer.

Here is a "map" of demo1.crt:
<snip>

From that, I would deduce that the first and fourth longwords are the tile coordinates for creature. I'd guess that the fifth longword is the creature type/id.

Also the fifth creature stands out from the others (e.g. the missing 01), so perhaps that is the player spawn spot.

Interesting. I might experiment a bit with that.

Share this post


Link to post

SLADE3 can now open Shadowcaster's dat and lib file, and can read all its image formats -- sprites, walls, and interface.
Here's a little picture to show how well it works:

Share this post


Link to post

Evidently the RLE compression is only used in the CD version because I cannot find any references to a CA_CacheLump or RLE compression in the floppy version, which is the only one I have to work with.

Share this post


Link to post

Yes, it's only used in the CD version. I don't really get why they felt that they needed to save space on a CD version, but hey. (To be fair, they split RAVDATA.DAT into HD_CASTR.DAT and CD_CASTR.DAT; and the only RLE'd lumps are in the HD version. But then again, the installer gives the option of copying all the files on the hard drive for greater speed; and the space saved is marginal at best. Seems to me that they included this mostly because one of their coders just wrote it and they wanted to use it.)

Share this post


Link to post
Guest DILDOMASTER666
Gez said:

* mapname.arc - archetypes?
* mapname.crt - creatures?
* mapname.dor - doors
* mapname.itm - items
* mapname.map - map geometry
* mapname.ojt - ?
* mapname.scr - scripts
So I guess these data would be in .crt or maybe .arc.


EDIT: I'm stupid and didn't read the whole second page.

Out of curiosity, for this particular .lib format that Shadowcaster uses, where is the offset to the beginning of the lump directory stored? I didn't find anything that looked like a pointer to the beginning of the directory last I checked around SHADOW.LIB and SHADOW2.LIB.

Share this post


Link to post

Yeah, I remember your "libtool" code. Finding the alpha code was one of the things that decided me to crack this nut, as it gave me a first reference.

The trick is that there is no pointer to the directory offset. Instead, you have to go at the very end of the file. The last two bytes contain the number of entries. Then from that number of entries and the fact that an entry takes 21 bytes, you can compute the start offset of the directory.

You can take a look at the code in SLADE3. Namely, LibArchive::open() here.

    // Read lib footer
    mc.seek(2, SEEK_END);
    uint32_t num_lumps = 0;
    mc.read(&num_lumps, 2);     // Size
    num_lumps = wxINT16_SWAP_ON_BE(num_lumps);
    uint32_t dir_offset = mc.getSize() - (2 + (num_lumps * 21));

Share this post


Link to post

Here's the original code if you're curious. Comments are mine.

int __fastcall CA_ReadLibrary(char *a1, int a2)
{
  int result; // eax@11
  int v3; // eax@5
  char *fn; // [sp+0h] [bp-Ch]@1
  int v5; // [sp+4h] [bp-8h]@1
  int v6; // [sp+8h] [bp-4h]@5

  fn = a1;
  v5 = a2;

  // open file and store FILE * into structure
  *(_DWORD *)(v5 + 2) = fopen_(a1, "r+b");
  if ( !*(_DWORD *)(v5 + 2) )
    Error("Could not read file %s.\n");

  // seek to 2 back from the end of the file (SEEK_END)
  if ( fseek_(*(_DWORD *)(v5 + 2), -2, 2) )
    Error("Could not read file %s.\n");

  // read two bytes
  v3 = fread_((void *)v5, 2u, 1, *(_DWORD *)(v5 + 2));
  v6 = v3;
  if ( v3 != 1 )
    Error("Could not read file %s.\n");

  // allocate room for # * 21 bytes and store into
  // structure
  *(_DWORD *)(v5 + 6) = nmalloc_(21 * *(_WORD *)v5);
  if ( !*(_DWORD *)(v5 + 6) )
    Error("Error allocating memory for library entries.");

  // seek back # * 21 bytes + 2 from end of file
  if ( fseek_(*(_DWORD *)(v5 + 2), -(21 * *(_WORD *)v5 + 2), 2) )
    Error("Could not read file %s.\n");

  // read # * 21 bytes from the file into buffer in structure
  v6 = fread_(*(void **)(v5 + 6), 0x15u, *(_WORD *)v5, *(_DWORD *)(v5 + 2));
  result = *(_WORD *)v5;
  if ( result != v6 )
    Error("Could not read file %s.\n");

  return result;
}

Share this post


Link to post
Gez said:

I do not have CyClones, so it'll be difficult. :)

Great news! Thanx for this. So CyClones not so far from a ShadowCaster i have CyClones textures (ripped my self) i guess sprites in cyclones uses same coding that in ShadowCaster

Share this post


Link to post

I've looked at the Cyclones data files (CYCLONES.CD and CYCLONES.HD) and they use the same format as Shadowcaster's DAT files. Furthermore, the graphic formats used by sprites, textures and HUD elements are the same. So basically all I had to do was convert the palette from 6-bit to 8-bit and add the .cd and .hd extensions to the dat archive type...

Share this post


Link to post

So you've figured out Cyclones too? Shadowcaster and Cyclones sprites now readable? Very, very cool.

Share this post


Link to post
Enjay said:

So you've figured out Cyclones too? Shadowcaster and Cyclones sprites now readable? Very, very cool.

I didn't figure anything out. I opened a file in a hex editor, skipped directly to the end, saw a bunch of file names all bunched together like a bunchy bunch of bunched stuff, and thought "heh". Open with Slade, bingo, it works. And even the graphic formats are the same. :)

The extent of the work I did to add Cyclones support was adding the .cd and .hd extensions to the .dat extension for that archive type, and convert the palette to 8-bit. Took literally less than a minute.

Share this post


Link to post

Well, regardless of how much work it was or wasn't, I still think it's cool and thanks for doing it.

I don't suppose you could put together a Cyclones sprite sheet similar to the Shadowcaster one could you? I only have a clear memory of some of the sprites.

Share this post


Link to post

At this point is it worth it for us to go digging in our piles of obscure FPS games to see if their formats also match anything supported by Slade so the DooM community can properly engage in the only form of copyright infringement it sanctions without question? ;)

Speaking of that, wtf is CyClones? *googles* Wow. Nothing other than Raven's (typically simple) page and a pile of abandonware links. It's easier to find pirate copies of the game than any information about the game! Hehehe, the deletion log on Wikipedia just says "blatant copyright infringement." Perhaps it was a copy of the Raven page.

Share this post


Link to post
Enjay said:

I don't suppose you could put together a Cyclones sprite sheet similar to the Shadowcaster one could you? I only have a clear memory of some of the sprites.

It's very Strifey I think. Graphic style is not exactly the same, but some of them are quite close. There are mutants, robots, turrets, mines, and traps. And aliens. The latter are more pulp sci-fi and less cosmic horror; but I think the robots and turrets at least could fit in Strife.

Aliotroph? said:

Speaking of that, wtf is CyClones?

Share this post


Link to post

Well, that was embarrassing. If you're going to use people from the office to make videos, at least use the ones who can read! That game looks horrible. It reeks of bad level design, clumsy controls, bad acting, awful music, etc. The dynamic lights are nice I suppose.

Share this post


Link to post

I am fan of Raven Software games because they masters of graphic =). No sense all other, i love play their games, they have many interested thing and ideas, experiments with game play.
If CyClones remake to use Doom(with slopes, jumps etc. so Raven even make more enhanced engine than doom early. Doom developed after) engine this is become much better, but no sense, i am just fan of RavenGames and love their nonstandard games.
For id Software and Raven Software in this time ->ShadowCaster, CyClones, Doom need to be best strategy -> they need to develope doom both id & Raven -> imagine Doom in 1993 year with all these features that has these 3 games =0 i can just say WOW. They blow everyone and everything.
P.S. Sorry for offtopic and long message please(

Share this post


Link to post
Gez said:

image

Thanks Gez. Some interesting stuff there. I'll have to dig out my copy of the game and poke around in it with SLADE sometime soon. :)

Share this post


Link to post
Gez said:

A game called CyClones


Damn, that bulky guy in the top right of your sprite sheet looks like a pimped out fighter from Hexen.

This oddly also makes me wanna play Chill Manor o_O

Share this post


Link to post
Aliotroph? said:

Well, that was embarrassing. If you're going to use people from the office to make videos, at least use the ones who can read! That game looks horrible. It reeks of bad level design, clumsy controls, bad acting, awful music, etc. The dynamic lights are nice I suppose.


I think you're a bit too harsh with it. The engine doesn't seem too bad for the era -- it trades off non-orthogonal walls for 3D floors and slopes, so it's technically about on-par with Doom I'd say -- and you can't really make a fair review off of a vid of someone playing a tiny bit of the first level.
http://www.mobygames.com/game/dos/cyclones

Share this post


Link to post
Gez said:

I think you're a bit too harsh with it. The engine doesn't seem too bad for the era -- it trades off non-orthogonal walls for 3D floors and slopes, so it's technically about on-par with Doom I'd say -- and you can't really make a fair review off of a vid of someone playing a tiny bit of the first level.
http://www.mobygames.com/game/dos/cyclones


I agree with Aliotroph about the controls. The engine and everything for Cyclones and Shadowcaster are decent, but the controls are just clumsy and annoying.

I'm still very interested in editing both of those games. Do you plan on coding a level designer for shadowcaster?

Share this post


Link to post

Maybe. I'm at least interested in understanding as much as possible of the map format. I'm not sure I could figure out the scripting system, though.

Share this post


Link to post
Gez said:

SLADE3 can now open Shadowcaster's dat and lib file, and can read all its image formats -- sprites, walls, and interface.

Congratulations for figuring out the file-format!

Also, look where that bestiary monster came from hahaha! Did someone hack the CyClones graphics file before?

Share this post


Link to post

I wasn't knocking the engine, just the awful map design. Really, they could do better than that. The engine is ok for the time; long, arrow corridors everywhere make for frustrating maps.

Share this post


Link to post

Cyclones was quite awesome in it's day.
Like Shadowcaster and System Shock it's one of those halfway games between FP RPG games of that day and the FPS shooters like Doom and Wolf3d.

There's a huge cultural context to take into consideration here. For instance, a lot games of that day had shall we say "questionable" controls. They were still exploring. And in particular how to design interesting and challenging levels.

Share this post


Link to post

It's scary how long that takes. System Shock 2 is the oldest of those strange hybrid games I find playable due to the controls. It took that long to invent the console-like inventory tabs it seems. I got the impression with games like Shadowcaster the huge HUD was also designed to help the frame rate.

I like the shape-shifting idea. It could be cool if Raven did something like that again.

Share this post


Link to post
Aliotroph? said:

It could be cool if Raven did something like that again.

Which are the chickens, pigs and sheep. No excuse for staying there and doing just a Doom clone.

Share this post


Link to post
printz said:

Which are the chickens, pigs and sheep. No excuse for staying there and doing just a Doom clone.

If you mean the morph ovum, porkelator and staff of ovinomancer, those things have nothing to do with the metamorphoses in Shadowcaster.

Share this post


Link to post

They have the ability to morph the player into other classes, giving them other statistics and other "weapons" (weak as they are). Is the voluntary player-morphing in Shadowcaster more advanced in what it affects?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×