Gary L. Simmons  rev 08/28/03  http://battlecatslitterbox.com/Anvil/HAS/Shapes2.html
Litterbox  Anvil Tips  Hamish Sanderson's EditNotes


The Battle Cat's Litterbox


Anvil Tips | HAS Tutorials | Edit Notes | Sounds & Music | Images File | Tools | Nonstandard Colors | Control Modifications | HUD Modifications | Prefs Modifications | PICT Notes | Engine Hacking | Documentation | Bandwidth Saving | Unused Sounds | Hakvil | Shapes 1 | Shapes 2 | Color Clippings | Custom Icons | Clut Notes


Shapes 2


Shapes again. Just when you thought Hamish Sanderson was going to shut up about shapes he fires off another volley of information about this very important Marathon game file. Does your brain hurt yet? Take two aspirin and hold them between your teeth and let Hamish kick your jaw shut with his steel toed combat boot. Does your brain hurt now? Try squeezing your head into the muzzle of a rocket launcher and shrieking shapes patch ResEdit resource numbers for the SPNKR while gnawing the warhead off of a rocket. Does it hurt now? OK, you are either really tough or really full of it, in either case read the tutorial below and see if you can withstand the full force of yet another tutorial. Me, my brain hurts, I'm going to SPNKR suicide against a wall and sit this net game out. - gls


Adding extra textures to texture sets

Under the Shapes menu, select 'Activate Expert Mode'.

Under Expert menu, select 'Create New Bitmap'. This adds a new bitmap slot to the collection, into which you paste your texture.

Switch to the Sequences Editor. Under the Expert menu, select 'Create New Sequence'. This adds a new sequence to the collection (walls collections don't normally have any). Select the Sequence (top-left list), then 'Views in Sequence' and 'Frames in View' (bottom-left lists). The preview window (top-right) will show the bitmap currently defined for that Frame, so enter the number of your new bitmap in the Bitmap Index filed (beneath the Preview window).

To add further new bitmaps, repeat the process. If you prefer, you don't have to create a new sequence each time (you can set the existing one to >1 Frames [max 9 frames per view] and then set each of those for an individual texture. It's less hassle to leave Views set to One and just add new sequences whenever you need them, rather than mess around setting them for Four/Five/Eight, mind you. The practical limit for number of sequences per collection is something pretty damn high (the limit for bitmaps is also pretty damn high; some folks have added up to 100 textures to a collection, although it's worth remembering just what this does to the file size!).

 

Deleting unused bitmaps, sequences, etc.

In short, you can't. But what you can do is minimize the amount of unused leftovers left over in a collection. Pasting 1x1 pixel bitmaps into unused bitmap slots is the best way to reduce file size and reduce the amount of data that the game engine has to load into RAM.

 

Standard and Custom collections

It's amazing how many folks still manage to get tripped up on this one. In the Marathon Infinity Shapes file, most collections come in a single version only (Standard). However, the Weapons-in-Hand and Landscapes collections all come in two versions: Standard and Custom. Standard is used when playing in 256 colors mode, whilst Custom is used in 1000s and millions of colors. It is very important that when editing these collections that you remember to change both versions; all too often folks edit the Standard collection but forget to change the Custom one too (resulting in patches that only work in 256 colors - which is really annoying). This is one of those really embarrassing newbie mistakes that you really, really want to avoid if you wish to retain any sort of personal credibility.:)

When editing in Anvil, you will see a pop-up menu labeled 'Color' appear at the top of the bitmap editing window whilst viewing collections that contain both Standard and Custom collections:

Color collections dialog window

The menu isn't visible whilst in the Sequences editing mode, so make sure you pick the correct version whilst in the bitmap editing view before going to the sequence editor. Standard and Custom versions of the collection exist completely independently of each other as far as editing goes (e.g. changes to the Standard sequences are not automatically reflected in the Custom version; you must apply the same mods to both versions yourself).

The advantage of all this Standard+Custom business is that Custom collections aren't limited to using the standard Marathon Infinity colors (as they operate at 16-bit/24-bit color depths where CLUTs are not used by the Mac's display routines), so the Custom versions can use a custom palette (which is best suited to the artwork - this generally makes for a smoother-looking result). Don't forget that the first 3 colors in the custom CLUT are still your transparency colors, however, you don't need to worry about colors being arranged in smooth ramps or anything. As usual, when indexing your artwork, use 253 colors max, as Anvil retains the existing 3 transparency colors when importing a new CLUT.

BTW, it is possible to remove Custom collections if unwanted (removing custom weapons-in-hand might be worthwhile if you really need to reduce file size). However, I'm unsure if the the application for doing this is in general circulation (Charles Lechasseur's Custom Set Remover) - still, if you needed to do this you could probably ask him. I'm unsure if the current version of SJ fully supports replacing of Standard+Custom collections with Standard-only ones (last time I checked was some time ago, and it was only part-way there).

 

Landscape bitmaps

The last section mentioned that Landscape collections come in 2 flavors - Standard and Custom - so I won't bother repeating those details again. There is some other useful information to be had though...

Note that Marathon Infinity's Standard and Custom Landscapes are of different sizes (Standard = 270x512, Custom = 540x1024). This is so that players who have plenty of memory [so can afford to set color depth to 1000s/millions of colors] get to see a much better-quality landscape - not only are the colors smoother (see above), but the pixel size is much reduced too.

Note that the scaling of the Landscape texture when displayed in Marathon Infinity is dependent on the width of the bitmap itself - normally 512 or 1024 - Marathon Infinity simply scales it up so that the width fits a 180° view; the height is scaled by the same amount to keep the proportions the same. [Interestingly, a 256 wide bitmap can also be used ok; it tiles 4 times (90° each) instead of 2.] The scaling has nothing to do with what slot (Standard or Custom) is being used - you could, for example, put a 540x1024 texture in a Standard slot (though this would kind of defeat the space-saving advantage of having the low-res texture in there in the first place, so I'd not suggest it) or a 270x512 in a Custom slot (but you'd lose the nice quality of the Custom LSs which I think is well worth keeping).

Landscape height is completely arbitrary, by the way. The values 270/540 are simply those that suit the default Maximum Elevation in Marathon Infinity (the maximum angle you can look up or down), which is normally set as 42.6666 in the Physics. Thus, if you increase the Max Elevation, you also need to increase the height of your landscapes to avoid any smearing when looking up/down at a landscape view; since LS textures don't tile vertically, smearing occurs when the player's view goes above/below the edge of the texture.

[BTW, note that because Marathon Infinity is not a true 3D engine (unlike eg. Quake/Unreal), the view will look increasingly distorted as you increase the Max Elevation - so although you could increase the value considerably the results would probably look pretty ugly (both walls and sprites would look exrememly strange as a result). A modest increase might be worthwhile if you are replacing all your landscapes and wish to add a little bit of oomph to game play (nothing like an extra 5° when trying to take out pesky snipers on a high ledge;).]

One other point of interest; it is possible to have more than 1 LS texture in a collection, just as it's possible to have more than 30 (36 for set 4) textures in a walls collection. Again, you need to do the Sequences thing to make them load (and remember to do the same for both the Standard and Custom versions). This sort of thing will bloat your file size and Marathon Infinity memory requirements something awful, mind, and is really of limited use (i.e. if you've any notions of creating 360° panoramas, forget it; I've done it and it's impossible to make work except within very specialized maps, and will be worthless in the usual sort of Marathon Infinity map). I have used it in a situation where I required 2 different LS textures in a single level (an above-ground LS, and a below-surface one), although again this was some pretty weird and wonderful mapmaking I was doing (and using 90° tiling textures [i.e. half normal width], the file size would actually work out the same as before).

 

Cloning collections

Personally, I still have a lingering suspicion that the Cloning function is a bit flaky. However, giving it sufficient benefit of doubt, I'll move it from the 'Bugs' section to the 'Techniques' section, as there are a good few other tricks to be had in this particular topic.

When using the Clone function, I'd suggest you do the necessary Cloning operations, then save, close and then re-open your Shapes file before continuing with further modifications. One note, however: A Clone operation on its own is not recognized by Anvil as being a 'change' to the Shapes file (i.e. this smacks of bugginess); therefore you cannot select Save in the File menu. If you Clone a collection in an otherwise unmodified Shapes file then you should then switch to another collection and make a minor change (e.g. the simplest is just to copy a bitmap and then paste it back over itself). Anvil will then allow you to select Save.

There is an alternative, and rather more flexible method for moving collections around the Shapes file, however:

Obtain a copy of Shapes Juggler. Create a Shuttle containing the collection you want to move/duplicate (whether from the same Shapes file, or from another). Open the shuttle in ResEdit, and open the .256 resource picker:

Shuttle collection dialog boxIn this example, the collection being shuttled is 1017 (aka. Walls 1 [the Water set]). These 4-digit IDs break down as follows:

First digit indicates whether the collection is a Standard (1) or Custom (2) version.

Second digit is 0.

Last two digits denote which collection it actually is (e.g. Interface=00, Weapons-in-Hand=01, Cyborg=31).

So, if I wanted to put a copy of the Walls 1 set into the Walls 5 set, I would change 1017 to 1021. If all you wish to do is duplicate an existing collection into another slot in the Shapes file, you are probably just as well to use Anvil's Clone function as previously described. This trick gives you greater flexibility, however; for example, you could swap the two collections Walls 1 and Walls 5 by exporting both and swapping their IDs. Or you could very quickly create a patch that fills all your unused slots with an 'empty' collection (i.e. a collection reduced to the smallest size possible; useful for making a Shapes file as compact as possible <to be covered elsewhere>).

Note that things become rather more complicated if trying to work with Standard+Custom collections using Shapes Juggler in this way. Replacing the Standard+Custom contents of a slot with new Standard+Custom collections is fine with Shapes Juggler (as long as you remember to turn on the 'Support Custom Collections' option in its Preferences), as is installing Standard+Custom collections over a Standard only one.

But there is a problem with Shapes Juggler shuttles in that a Shuttle containing a Standard-only patch intended to replace all contents of a Standard+Custom slot only seems to replace the Standard collection; the original Custom one remains intact after the patching. This is a Bad Thing, and is basically a bug/oversight in the way Shapes Juggler operates. This does not mean you can't replace a the Standard+Custom contents of a slot with a Standard-only collection; just that you need to take other steps whilst doing so.

So, as an example, let's say your shapes file has run out of slots to add new monster (i.e. Standard-only) collections, but has some spare Landscape (Standard+Custom) slots available.

e.g. I have an unused Landscape 4 slot and wish to add something like the 'SPNKR Marine Patch' to my Shapes file without it replacing the Bob slot it normally occupies. I would open the Patch's shuttle in ResEdit and change the .256 resource ID to 1030, in order to make good use of that spare slot. However, there is a catch here; the Landscape slot I'm inserting the new collection into currently contains both a Standard and a Custom version of the collection, and this shuttle would only replace the Standard one, leaving the original Custom one still intact. As you can imagine, this would still work fine in 256-colors (once you'd arranged a suitable PM, of course), but in 1000s or millions life would become very ugly indeed (i.e. hard crash). To get rid of that Custom collection beforehand, I'd use Anvil's internal Clone function to clone a Standard-only collection (any one will do) into the Landscape slot and save. Then I'd run the modified patch as intended.

Note, BTW, that because of this problem, Shapes Juggler is not a suitable device for distributing such a patch (not a problem if you're going to distribute an entire [i.e. totally modified] Shapes file, mind you); you'd need to use ResCompare or something like that instead. Or maybe Shapes Juggler will get fixed one of these days...:)

And there are still a couple more tricks that can be done with Shapes Juggler...

You could, for example use it to strip Custom Collection(s) from your Shapes file (e.g. to remove the Custom Weapons-in-Hand to get a smaller Shapes file): export the Weapons-in-Hand collection to a Shuttle, open the Shuttle in ResEdit (remove the 2001 resource if there is one), use Anvil's Clone function to replace the entire Weapons-in-Hand slot's contents with a Standard-only collection (as per the method previously described), then run your Shuttle.

And the reverse is also possible: to add a Custom collection to a Standard-only slot, you'd first export the collection from that slot to a Shuttle. Open the Shuttle in ResEdit, duplicate the 10xx resource, giving the copy the ID 20xx (where xx is the same as for the 10xx one), then reinstall. Then when you open your Shapes file in Anvil you should find both Standard and Custom collections in that slot. At this point, the Custom one will be identical to the Standard one (naturally!), but it can then be edited like any other Custom collection (i.e. usually more of a butt-pain than it's worth).

[Note: I've already tried this last method to add Custom collections; however, I've not worked much with the modified files as I've little use for more Custom collections. Thus, I cannot vouch for it's reliability as editing method and cannot comment on whether there might be additional unpredicted problems with it. But, more importantly:

What is easily forgotten here is that Custom collections aren't often very useful in practice, as you are still limited to a 256 color palette. For example, you might think that adding a Custom Walls set would be a splendid idea, allowing you to add wall textures in Thousands of colors, but this is not so; all you are actually adding is a set of textures indexed to a custom CLUT instead of the Marathon one. Considering that your average Walls collection probably contains well over 200 colors already, that really leaves you very little space to add extra colors for the smoother effects you'd like to think you could get (but in practice you probably won't; and meanwhile you're bloating the size of your Shapes file considerably). Before you even think of this as a good idea, go and read the space saver notes in this guide to put some proper perspective on the matter.]



Anvil Tips | HAS Tutorials | Edit Notes | Sounds & Music | Images File | Tools | Nonstandard Colors | Control Modifications | HUD Modifications | Prefs Modifications | PICT Notes | Engine Hacking | Documentation | Bandwidth Saving | Unused Sounds | Hakvil | Shapes 1 | Shapes 2 | Color Clippings | Custom Icons | Clut Notes

Top of page

Back to the Litterbox