PDA

View Full Version : Multiple CRES' w/Slots, etc?


trezero
16th Jun 2008, 7:00 AM
As a brief intro, I'm involved in a personal project (for my personal edification ;D) to develop a generic resource tree, showing how all possible object resources link together. Most of it's known, but scattered all over MTS2/Wiki, which bugs me.

Aaanyways: While looking through in-game objects, I came across the party balloons, which are a fascinating study. They have 2 CRES', and 3 SHPEs, GMND, GMDCs, and multiple MMAT/TXMT/TXTR. One CRES deals with the unpopped state (one SHPE chain for shadows, one for the balloons), and one for the popped state. The BHAVs involve logic to discover what kind of party is occuring, and applies the correct textures accordingly. (p.s. I couldn't find the 'controller - party' object using the SimPE finder or object workshop. :/) The BHAV's also change the mesh accordingly when the idler runs out and the balloons pop.


BUT - the balloonPopFx is throwing me off. There is a target SLOT, but (by name reference through STR 90) it takes the location from the Practical block in the POPPED mesh. :/


So now I'm mightily confused about target slots/CRES. I'd always assumed multiple CRES mean multiple possible meshes, and only one is used at a time. Multiple SHPEs can be used by (basically) rendering both at once. Am I wrong on this?

Relatedly, how are CRES' tied to their respective objects? I notice in the balloons, the init function explicitly declares (through STR 85) which mesh to render. But single CRES objects don't do so.


Sorry if that was long and/or disorganized. Thanks Muchly!

Inge Jones
16th Jun 2008, 8:23 AM
Just to the last bit - it seems the 3D model defaults to that named on line 0x01 of the textlist, and under those circumstances the object doesn't have to be initialised to that.

Jasana_BugBreeder
16th Jun 2008, 9:22 AM
Value of the OBJD/'0x0048: object model guid 1 - Read-only' is the number of row in STR# 0x85, CRES which listed in that string is used as default graphic state. (By the way, value of 0 always means no graphic, even if you put some valid cres name in row 0.) In single-cres objects this value is usually 1, but it's not restricted.
I'd always assumed multiple CRES mean multiple possible meshes, and only one is used at a time. Multiple SHPEs can be used by (basically) rendering both at once.Different CRESes usually mean different states, and cannot be used at the same time. Each chain under CRES is independent, though it's not restricted - TXMTs should be shared for recolorability, for example.
One CRES can refer to 1 or more SHPEs (there are exceptional cases when cres refers to 0 shpes, i.e. thumbnail camera cres, but they are rare). If two shapes are referenced in some cres, they will be rendered at the same time; if there are two creses and each of them have their own shapes - those two shapes will not be rendered at the same time. All depends of cres, shapes are just slaves :)

Echo
16th Jun 2008, 10:42 AM
BUT - the balloonPopFx is throwing me off. There is a target SLOT, but (by name reference through STR 90) it takes the location from the Practical block in the POPPED mesh. :/

Yup. That means that if the object is showing the "Popped" cres at the time the effect is played, it will play in that slot. Otherwise it will play at the origin (the center of the floor of the appropriate tile). My guess is that when it switches to the popped mesh, it plays the popfx straight away so that when the effect fades away you're left with a popped mesh. Certainly how I'd do it! :)

Inge Jones
16th Jun 2008, 2:26 PM
Value of the OBJD/'0x0048: object model guid 1 - Read-only' is the number of row in STR# 0x85, CRES which listed in that string is used as default graphic state.

So this is a mis-labelled field? It's meant to contain a line number, not half of a GUID?

Jasana_BugBreeder
16th Jun 2008, 4:03 PM
Inge, seems to be so :) I learned of this field when making food - it has separate CRES for food-and-plate state, and 'object model guid 1' pointed to the row with that cres in STR#85; if I deleted that chain, thumbnail icon turned empty.
I don't know, though, why there are two fields. My graphics cannot be set to more than 0xFFFF, right? so there cannot be more entries in STR#85?

By the way, since we're talking of milti-CRES objects and thumbnails - if someone missed it by a chance, take a look at OBJD/'0x0037: Ignore Current Model Index In Icons' - when this field is set to 1, the default model (referenced by OBJD:0x0048) is used for thumbnail, no matter what current model is. Very handy.

Inge Jones
16th Jun 2008, 5:54 PM
I don't know, though, why there are two fields. My graphics cannot be set to more than 0xFFFF, right? so there cannot be more entries in STR#85?

The 2nd field may be completely unrelated. Just an assumption baed on the error about what the first field was.

I shall pass all this on to Peter.

trezero
16th Jun 2008, 9:54 PM
Thank you all! :D I didn't even think about the OBJD, although I should have.


In reply to Echo, I forgot to mention that the PopFx plays before the mesh officially changes. (I think)

To be precise, the Bhav goes:

My graphic := Literal 0x0002 (not sure what this does?)
Expressions to change niceness, crapness, popped/unpopped attribute, etc.
Effect Stop/Start (Soft start, My object ID, "balloonPopFx")
Change Material (Material type, mesh group, etc.)

. . .
. . .
. . .

Whoamg. I think I've just had an apostrophe. ;D My graphic IS the line of STR# 85, and change material just deals with the mesh group.

Okay, I think I just solved my problem. xD

Echo
17th Jun 2008, 12:24 AM
Whoamg. I think I've just had an apostrophe. ;D My graphic IS the line of STR# 85, and change material just deals with the mesh group.

Snork! Possibly even an epiphany? (Although unexpectedly discovering punctuation is exciting too.) ;) But yes, "My Graphic" is the line of STR# 85 which is currently being used as the source of the scenegraph. Change material does just that, it changes the MMAT being used to colour a specified mesh subset. :)

trezero
17th Jun 2008, 6:38 AM
Hey - There are few things as exciting as finding new punctuation! ;D I only wish my keyboard easily supported diacritical marks! (and greek letters, but that's another issue) Actually, it was a vague reference to the movie 'Hook.'

But to follow up on a parallel topic (if one keeps jumping parallels...will one end up back where one started?) Where does the Refresh BHAV come in, then? It doesn't occur in this object, even though the meshes and textures are changed.

Also, I just realized...I know absolutely nothing on effects, beyond the STR#. Is it an animation? A separate BHAV? I didn't find anything using the forum search or the wiki. And there's nothing in my extracted package named balloonPopFx. :/

Echo
17th Jun 2008, 7:50 AM
Refresh BHAV? Not sure what you're referring to there...

Effects are pretty much unknowns as far as modding still. They're things like particle systems or render effects. Things like waterfalls and steam, or like the 'z's when sims are sleeping and the thought bubbles above sims heads. They're pretty much unmoddable at the moment, and I wouldn't be surprised if they remain that way. We can play them on command, we can remove them from existing objects, but we can't really change what they do or what they look like. They're all in the core game packages if you want to look them up, and referred to via text lists.

Jasana_BugBreeder
17th Jun 2008, 8:35 AM
AFAIK Refresh - [prim 0x0007] Refresh (my graphic) - is only needed if all of these true:
1) game is paused at the moment of changing graphic
2) you need to update your object immediately
3) 'simulate on pause' not set for it
Otherwise, simply assigning 'my graphic' to a value is enough. Nothing bad will happen if you will call Refresh, though (if your object is all correct).

Effects are separate type of resource - FX - which contain a reference to effect object's mesh, and EA/Maxis knows what else :( But there are no wrappers for this format, sadly.
There's some info on FX format in Sims2Wiki, and at least one known case of FX editing (playing with hex format, I guess) - by Cevic, for woohoo effect of his car.
I know Stormwench was studying them, too, but hadn't seen her for a while - anyone knows how is she, by the way? - so don't know if she got it all working.