Closed ammaraskar closed 11 months ago
Okay it seems like TS3 and TS2 use slightly different formats here, so we won't be able to use the wiki 1:1. Documenting my exploration of TS2 effects here:
u16
- Version number? Always 0.u32
- Number of particles to follow.Particle
s.u32
- Number of metaparticles to follow.MetaParticle
su32
- Number of decals to follow.Decal
sand so on.
The format for the individual effects also seems different. Unfortunately there's no length prefix or anything so skipping the ones we're not interested in right now will probably be hard.
Slowly chipping away at this, the following kaitai specification will parse the particles from effects resource from tsdata/res/effects/effects.package
. The version always seems to be 3:
https://gist.github.com/ammaraskar/bc9b613e26f1a262ce0ea5dcf1e58478
Next up, meta-particles etc.
Woo, got the full binary format down. Updated the gist. Some fields still need to be reverse-engineered and their names figured out.
Here's a full dump of the parsed file: effects_dump.json.txt
As an example of what using the format ends up looking like. The strangetown fly through shows up in the effects list as:
{
"effectName": {
"length": 24,
"string": "strangetown_flythroughfx"
},
"effectId": 1534
},
And if we go to that effect:
{
"flags": 0,
"short1": 1,
"short2": 0,
"int2": 0,
"int3": 0,
"vec1": {
"x": 0,
"y": 0
},
"numVisualDescriptions": 2,
"visualEffectDescriptions": [
{
"baseEffect": {
"length": 16,
"string": "strangetowndummy"
},
"blockType": 8,
"flags": 0,
"transform": {
"byte1": 0,
"float1": 1,
"matrix1": {
"elements": [
{
"x": 1,
"y": 0,
"z": 0
},
{
"x": 0,
"y": 1,
"z": 0
},
{
"x": 0,
"y": 0,
"z": 1
}
]
},
"vec1": {
"x": 0,
"y": 0,
"z": 0
}
},
"lodBegin": 1,
"lodEnd": 5,
"emitScaleBegin": 1,
"emitScaleEnd": 1,
"sizeScaleBegin": 1,
"sizeScaleEnd": 1,
"alphaScaleBegin": 1,
"alphaScaleEnd": 1,
"short1": 0,
"short2": 0,
"selectionGroup": 0,
"selectionChance": 0,
"timeScale": 1,
"blockIndex": 39
},
{
"baseEffect": {
"length": 22,
"string": "strangetowncamsequence"
},
"blockType": 6,
"flags": 0,
"transform": {
"byte1": 0,
"float1": 1,
"matrix1": {
"elements": [
{
"x": 1,
"y": 0,
"z": 0
},
{
"x": 0,
"y": 1,
"z": 0
},
{
"x": 0,
"y": 0,
"z": 1
}
]
},
"vec1": {
"x": 0,
"y": 0,
"z": 0
}
},
"lodBegin": 1,
"lodEnd": 5,
"emitScaleBegin": 1,
"emitScaleEnd": 1,
"sizeScaleBegin": 1,
"sizeScaleEnd": 1,
"alphaScaleBegin": 1,
"alphaScaleEnd": 1,
"short1": 0,
"short2": 0,
"selectionGroup": 0,
"selectionChance": 0,
"timeScale": 1,
"blockIndex": 79
}
]
},
So it consists of strangetowndummy
and strangetowncamsequence
. The strangetowncamsequence
has a "blockType": 6
so it's a sequence block and the index is "blockIndex": 79
, so we find that to be:
{
"version": 1,
"numSequences": 3,
"sequence": [
{
"activateTime": {
"x": 14.548999786376953,
"y": 14.548999786376953
},
"effectName": {
"length": 16,
"string": "strangetown_0Cam"
}
},
{
"activateTime": {
"x": 5.004499912261963,
"y": 5.004499912261963
},
"effectName": {
"length": 16,
"string": "strangetown_1Cam"
}
},
{
"activateTime": {
"x": 3.5934998989105225,
"y": 3.5934998989105225
},
"effectName": {
"length": 16,
"string": "strangetown_2Cam"
}
}
],
"flags": 0
},
So it's a sequence of strangetown_0Cam
, strangetown_1Cam
and strangetown_2Cam
. Following this we get to a camera effect that looks like:
{
"version": 1,
"flags": 229426,
"life": 14.548999786376953,
"shakeFadeLength": 1,
"shakeAmplitude": {
"typeAndLength": 0,
"curveValues": []
},
"shakeFrequency": {
"typeAndLength": 0,
"curveValues": []
},
"shakeAspect": 1,
"shakeType": 0,
"heading": {
"typeAndLength": 146,
"curveValues": [
-0.06689999997615814, -0.06669999659061432, -0.06650000065565109, -0.06629999727010727, -0.06620000302791595, -0.06599999964237213, -0.06589999794960022, -0.065700002014637, -0.06539999693632126, -0.06520000100135803, -0.0649000033736229, -0.06449999660253525, -0.0640999972820282, -0.06360000371932983, -0.06300000101327896, -0.06239999830722809,
-0.06159999966621399, -0.06080000102519989, -0.05979999899864197, -0.05869999900460243, -0.0575999990105629, -0.05620000138878822, -0.05480000004172325, -0.053199999034404755, -0.051500000059604645, -0.04969999939203262, -0.04780000075697899, -0.045899998396635056, -0.04390000179409981, -0.041999999433755875, -0.03999999910593033, -0.03799999877810478,
-0.03610000014305115, -0.0340999998152256, -0.03200000151991844, -0.029999999329447746, -0.02800000086426735, -0.026000000536441803, -0.024000000208616257, -0.021900000050663948, -0.019899999722838402, -0.017899999395012856, -0.01590000092983246, -0.013799999840557575, -0.011800000444054604, -0.009800000116229057, -0.007799999788403511, -0.005799999926239252,
-0.003800000064074993, -0.0017999999690800905, 0.00019999999494757503, 0.002300000051036477, 0.00430000014603138, 0.006399999838322401, 0.00839999970048666, 0.010499999858438969, 0.012600000016391277, 0.014700000174343586, 0.01679999940097332, 0.01889999955892563, 0.0210999995470047, 0.02319999970495701, 0.025299999862909317, 0.027499999850988388,
0.029600000008940697, 0.031700000166893005, 0.033799998462200165, 0.03579999879002571, 0.03790000081062317, 0.039799999445676804, 0.04170000180602074, 0.04349999874830246, 0.04500000178813934, 0.04619999974966049, 0.04699999839067459, 0.04749999940395355, 0.04740000143647194, 0.046799998730421066, 0.045499999076128006, 0.04349999874830246,
0.040800001472234726, 0.03709999844431877, 0.032499998807907104, 0.027000000700354576, 0.020600000396370888, 0.013399999588727951, 0.005499999970197678, -0.003100000089034438, -0.012400000356137753, -0.022099999710917473, -0.03240000084042549, -0.0430000014603138, -0.05389999970793724, -0.06509999930858612, -0.07639999687671661, -0.08780000358819962,
-0.09910000115633011, -0.11029999703168869, -0.12120000272989273, -0.13169999420642853, -0.14259999990463257, -0.15410000085830688, -0.16599999368190765, -0.17820000648498535, -0.19050000607967377, -0.2029000073671341, -0.21529999375343323, -0.22750000655651093, -0.23960000276565552, -0.2513999938964844, -0.2630000114440918, -0.2743000090122223,
-0.2851000130176544, -0.2955000102519989, -0.3052999973297119, -0.31450000405311584, -0.3230000138282776, -0.33070001006126404, -0.3377000093460083, -0.34389999508857727, -0.34940001368522644, -0.3544999957084656, -0.35910001397132874, -0.36340001225471497, -0.36739999055862427, -0.37130001187324524, -0.3750999867916107, -0.3788999915122986,
-0.38260000944137573, -0.3862000107765198, -0.38999998569488525, -0.3937999904155731, -0.3978999853134155, -0.40220001339912415, -0.4066999852657318, -0.4115000069141388, -0.4163999855518341, -0.42149999737739563, -0.42660000920295715, -0.4316999912261963, -0.4368000030517578, -0.4415999948978424, -0.44600000977516174, -0.45010000467300415,
-0.4535999894142151, -0.45649999380111694
]
},
"pitch": {
"typeAndLength": 146,
"curveValues": [
0.06939999759197235, 0.06939999759197235, 0.06939999759197235, 0.06949999928474426, 0.06949999928474426, 0.06949999928474426, 0.06949999928474426, 0.06949999928474426, 0.06960000097751617, 0.06960000097751617, 0.06960000097751617, 0.06970000267028809, 0.06970000267028809, 0.06970000267028809, 0.0697999969124794, 0.06989999860525131,
0.06989999860525131, 0.07000000029802322, 0.07010000199079514, 0.07020000368356705, 0.07029999792575836, 0.07039999961853027, 0.0706000030040741, 0.07069999724626541, 0.07090000063180923, 0.07100000232458115, 0.07119999825954437, 0.07129999995231628, 0.07150000333786011, 0.07159999758005142, 0.07180000096559525, 0.07190000265836716,
0.07209999859333038, 0.0723000019788742, 0.07240000367164612, 0.07259999960660934, 0.07270000129938126, 0.07289999723434448, 0.0729999989271164, 0.07320000231266022, 0.07339999824762344, 0.07360000163316727, 0.07370000332593918, 0.0738999992609024, 0.07410000264644623, 0.07429999858140945, 0.07450000196695328, 0.07479999959468842,
0.07500000298023224, 0.07519999891519547, 0.0754999965429306, 0.07580000162124634, 0.07609999924898148, 0.07639999687671661, 0.07670000195503235, 0.07699999958276749, 0.07739999890327454, 0.07779999822378159, 0.07819999754428864, 0.0786999985575676, 0.07909999787807465, 0.07970000058412552, 0.08020000159740448, 0.08079999685287476,
0.08139999955892563, 0.08209999650716782, 0.0828000009059906, 0.08349999785423279, 0.08429999649524689, 0.08510000258684158, 0.0860000029206276, 0.0869000032544136, 0.08780000358819962, 0.08879999816417694, 0.08980000019073486, 0.09080000221729279, 0.09189999848604202, 0.09300000220537186, 0.094200000166893, 0.09529999643564224,
0.09650000184774399, 0.09769999980926514, 0.09889999777078629, 0.10000000149011612, 0.10100000351667404, 0.10199999809265137, 0.10300000011920929, 0.10379999876022339, 0.10459999740123749, 0.10530000180006027, 0.10580000281333923, 0.10620000213384628, 0.10649999976158142, 0.10670000314712524, 0.10679999738931656, 0.10670000314712524,
0.10660000145435333, 0.10620000213384628, 0.10580000281333923, 0.10520000010728836, 0.10450000315904617, 0.10360000282526016, 0.10249999910593033, 0.10130000114440918, 0.09989999979734421, 0.09849999845027924, 0.09700000286102295, 0.09549999982118607, 0.0940999984741211, 0.09279999881982803, 0.09160000085830688, 0.09049999713897705,
0.08940000087022781, 0.08839999884366989, 0.08739999681711197, 0.08640000224113464, 0.08550000190734863, 0.08460000157356262, 0.08370000123977661, 0.08299999684095383, 0.08229999989271164, 0.08160000294446945, 0.08100000023841858, 0.0803999975323677, 0.07989999651908875, 0.07930000126361847, 0.0786999985575676, 0.07810000330209732,
0.07739999890327454, 0.07660000026226044, 0.07590000331401825, 0.07509999722242355, 0.07429999858140945, 0.07349999994039536, 0.07280000299215317, 0.07209999859333038, 0.07129999995231628, 0.0706000030040741, 0.06989999860525131, 0.06920000165700912, 0.06849999725818634, 0.06780000030994415, 0.06710000336170197, 0.06650000065565109,
0.06599999964237213, 0.06560000032186508
]
},
"roll": {
"typeAndLength": 146,
"curveValues": [
-0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898,
-0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.008299999870359898, -0.00839999970048666, -0.00860000029206276, -0.008899999782443047, -0.009200000204145908, -0.009600000455975533, -0.00989999994635582, -0.010300000198185444,
-0.010700000450015068, -0.011099999770522118, -0.011500000022351742, -0.011900000274181366, -0.012299999594688416, -0.01269999984651804, -0.013100000098347664, -0.013500000350177288, -0.013899999670684338, -0.014299999922513962, -0.014600000344216824, -0.014999999664723873, -0.015300000086426735, -0.015699999406933784, -0.01590000092983246, -0.016200000420212746,
-0.016499999910593033, -0.016699999570846558, -0.01679999940097332, -0.017000000923871994, -0.017100000753998756, -0.01720000058412552, -0.01720000058412552, -0.017100000753998756, -0.017100000753998756, -0.016899999231100082, -0.01679999940097332, -0.016499999910593033, -0.016300000250339508, -0.01590000092983246, -0.015599999576807022, -0.015200000256299973,
-0.014700000174343586, -0.014299999922513962, -0.013799999840557575, -0.013199999928474426, -0.01269999984651804, -0.01209999993443489, -0.011500000022351742, -0.01080000028014183, -0.010200000368058681, -0.009499999694526196, -0.008799999952316284, -0.008100000210106373, -0.007300000172108412, -0.006599999964237213, -0.005799999926239252, -0.005100000184029341,
-0.00430000014603138, -0.0035000001080334187, -0.0027000000700354576, -0.0019000000320374966, -0.0010999999940395355, -0.0003000000142492354, 0.0005000000237487257, 0.0013000000035390258, 0.0020000000949949026, 0.00279999990016222, 0.003599999938160181, 0.00430000014603138, 0.005100000184029341, 0.005799999926239252, 0.006500000134110451, 0.007199999876320362,
0.007899999618530273, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898,
0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898,
0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898, 0.008299999870359898,
0.008299999870359898, 0.008299999870359898
]
},
"orbit": {
"typeAndLength": 0,
"curveValues": []
},
"fieldOfView": {
"typeAndLength": 1,
"curveValues": [
0.12470000237226486
]
},
"nearClip": {
"typeAndLength": 1,
"curveValues": [
20
]
},
"farClip": {
"typeAndLength": 1,
"curveValues": [
1000
]
},
"zoom": 0,
"rotate": 0,
"attachRadius": 0,
"cameraSelect": {
"length": 0,
"string": ""
}
},
which has the roll/pitch/yaw embedded in it, the translation comes from a strangetown_0campart
effect.
As of https://github.com/LazyDuchess/OpenTS2/commit/e3137704c2cac67f4d46fa5010e5ae0c0637bd29 this is now parsed, there are still some fields that are unnamed but I'll reverse engineer them as they come up rather than all up front.
Gonna make a separate issue to actually start rendering the effects.
Stored in
tsdata/res/effects/effects.package
. These contain things like particle effects and the camera fly through from when you load a neighorhood.Documentation from TS3 effects resource: https://simswiki.info/wiki.php?title=Sims_3:0xEA5118B0