Help understanding COS files

Discussions regarding the development of the mod "Grim Fandango Deluxe"

Moderator: ScummVM Team

Post Reply
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Help understanding COS files

Post by JohnnyWalker2001 »

I'm currently grappling with the GF assets, trying to think of ways to make sense of everything that we need: 3DO, MAT, CMP and COS files.

Most MAT files that aren't mentioned in COS files (I assume they're referenced in 3DO files), but a few that are.

Usually in COS files CMPs are assigned to 3DOs. Are they ever used in any other capacity? (Being assigned to MATs directly, perhaps?)

My main question is: What are COS files used for? Are there any 3DO files that are used without a COS file, or does a 3DO have to appear in a COS file for it to be used in the game?

Are COS files exclusively used to link (amongst other things) CMPs with their 3DOs?
User avatar
giucam
Posts: 139
Joined: Mon Mar 21, 2011 9:20 am

Post by giucam »

Costumes (.cos files) are a thing i found quite hard to grasp when starting to work on the engine, and i still find hard to explain.
Quoting myself from here:
Every actor has one or more costume. A costume is a set of components and chores. Each component represents an on-screen object, like an object state, a 3D mesh, a material, or a keyframe animation, or a sound effect; each chore, diminutive for choreography, gives a set of instructions for how to move, change state or activate or deactivate each component at certain times.
Colormaps are never assigned to materials directly.
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 »

Thanks. I'm finding it tricky building a hierarchy without understanding where the "top" is...

Your explanation is very good though, and really makes it clear. Looking at a COS file now, I can see what you mean about how they're split up.

Do all 3DO and CMP files appear in a COS file somewhere? (Is the COS file the "mother" file?)

---

Hmm. I keep finding odd discrepancies that go against my understanding. For example, in INVENTORY.COS you can see the following:

Code: Select all

#	ID	TagID	Hash	ParentID	Name
 	35	4		0		15			eggs.3do
But there's no reference in the file to a CMP that has 35 as its parent ID. How does it know which CMP goes with eggs.3do?
Jon N/A
Posts: 15
Joined: Tue Aug 23, 2011 9:05 pm

Post by Jon N/A »

Is it possible that there is no pattern to find with these COS files? Or is it that there certainly is a pattern but it's not discovered yet?

What I take from giucam's description is that each of these files were made manually for specific scenarios in the game. As if the devs shoved everything that wouldn't fit in a category into a COS file.
User avatar
giucam
Posts: 139
Joined: Mon Mar 21, 2011 9:20 am

Post by giucam »

Do all 3DO and CMP files appear in a COS file somewhere? (Is the COS file the "mother" file?)
I'm not sure what you mean with "mother file" there. All 3do, cmp, mat, bmp, ... files are referenced by a costume to be shown on screen. Exceptions are lua and wav files (and maybe snd, i'm not sure), which have other mechanisms.
But there's no reference in the file to a CMP that has 35 as its parent ID. How does it know which CMP goes with eggs.3do?
item.cmp is the default cmp, and if there is no colormap assigned to a model that is used. Also, a costume may have another one as parent, and may use a colormap defined in the parent costume. You can't see that hierarchy in .cos files though, you'd have to inspect the state of the engine at runtime.


What I take from giucam's description is that each of these files were made manually for specific scenarios in the game. As if the devs shoved everything that wouldn't fit in a category into a COS file.
I'm not sure what you mean, costumes have a specific and fundamental role in the game engine. Every object has at least one costume, manny has several of them depending on the year, mainly.
User avatar
JohnnyWalker2001
Posts: 405
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 »

giucam wrote:I'm not sure what you mean with "mother file" there. All 3do, cmp, mat, bmp, ... files are referenced by a costume to be shown on screen. Exceptions are lua and wav files (and maybe snd, i'm not sure), which have other mechanisms.
Hmm. Not all of the MAT files appear to be referenced by COS files. And when they are referenced, it's only in the comments section of Chores. Looking inside 3DO files you seem the list of MATs used by it. Such lists are not mentioned in any COS file that I can see...?

What I really want to know is: Is every 3DO file mentioned in a COS file somewhere? I.e. Is it the COS file which tells the game engine where to find a 3DO file?

GAME ENGINE -> COS -> 3DO

And it never goes:

GAME ENGINE -> 3DO (a direct reference to a 3DO)

Does that make it any clearer? Thanks for your help!
item.cmp is the default cmp, and if there is no colormap assigned to a model that is used.
Great. Is that a game-wide default? (Providing the following isn't true in a specific instance, of course...)
Also, a costume may have another one as parent, and may use a colormap defined in the parent costume. You can't see that hierarchy in .cos files though, you'd have to inspect the state of the engine at runtime.
Oh man. Things just got more complicated :(
User avatar
giucam
Posts: 139
Joined: Mon Mar 21, 2011 9:20 am

Post by giucam »

JohnnyWalker2001 wrote: Hmm. Not all of the MAT files appear to be referenced by COS files. And when they are referenced, it's only in the comments section of Chores. Looking inside 3DO files you seem the list of MATs used by it. Such lists are not mentioned in any COS file that I can see...?
You're right, i recalled incorrectly. They indeed are referenced by the 3dos directly.
JohnnyWalker2001 wrote: What I really want to know is: Is every 3DO file mentioned in a COS file somewhere? I.e. Is it the COS file which tells the game engine where to find a 3DO file?

GAME ENGINE -> COS -> 3DO

And it never goes:

GAME ENGINE -> 3DO (a direct reference to a 3DO)
That's right. The lua scripts only set some costume on an actor, then the costume loads the 3dos.
JohnnyWalker2001 wrote: Great. Is that a game-wide default? (Providing the following isn't true in a specific instance, of course...)
Yes. (keep in mind though that there's a point where manny turns orange with residualvm, so the cmap handling is not perfect)
Post Reply