Trapdoor above the main room in Privateers Hold

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
User avatar
Interkarma
Posts: 5686
Joined: Sun Mar 22, 2015 1:51 am

Re: Trapdoor above the main room in Privateers Hold

Post by Interkarma » Tue Mar 10, 2020 7:52 am

The trapdoors in Direnni Tower's tall room use the TRP tag, but they shouldn't get an automatic action. They should only be opened by the appropriate wheels and their linking action records.

As far as I'm aware, we're already importing the action records here. Do you have a specific example of a trapdoor in classic not behaving the same way in DFU? It would be ideal to inspect the action records. Perhaps something isn't being linked up.

User avatar
pango
Posts: 2473
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Trapdoor above the main room in Privateers Hold

Post by pango » Tue Mar 10, 2020 11:51 am

Interkarma wrote:
Tue Mar 10, 2020 7:52 am
Do you have a specific example of a trapdoor in classic not behaving the same way in DFU? It would be ideal to inspect the action records. Perhaps something isn't being linked up.
I took the first screenshort in Castle Faallem, Sentinel, it works in classic but not in DFU. The game save is attached to the original post.
I don't have access to the editor right now, but the ActionRotation was Vector3.zero (other fields like Magnitude were not 0 though)
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
pango
Posts: 2473
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Trapdoor above the main room in Privateers Hold

Post by pango » Tue Mar 10, 2020 6:15 pm

Castle Faallem trapdoor action:
trapdoor parameters.jpg
trapdoor parameters.jpg (25.11 KiB) Viewed 382 times
vs Direnni Tower trapdoor action:
direnni trapdoor parameters.jpg
direnni trapdoor parameters.jpg (25.88 KiB) Viewed 382 times
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Interkarma
Posts: 5686
Joined: Sun Mar 22, 2015 1:51 am

Re: Trapdoor above the main room in Privateers Hold

Post by Interkarma » Tue Mar 10, 2020 10:24 pm

I'm not in front of my dev PC right now, but I'd hazard a guess the problem is one of the rotation axes not being converted properly. Based on that Faallem screenshot, the raw value and magnitudes are populated, the action flag is set to "rotation", so everything looks correct other than the final rotation vector being zero.

Will need to step through action setup for when "action axis raw value" is 13 to see why it's not applying any rotation amount to that axis.

Edit1: just checking code online, the following values are used to determine rotation axes in RDBLayout by GetRotationActionVector() and GetTranslationActionVector().

Code: Select all

public enum RdbActionAxes
{
     /// <summary>Axis unspecified.</summary>
     None = 0x00,

     /// <summary>Negative X axis.</summary>
     NegativeX = 0x01,

     /// <summary>Positive X axis.</summary>
     PositiveX = 0x02,

     /// <summary>Negative Y axis.</summary>
     NegativeY = 0x03,

     /// <summary>Positive Y axis.</summary>
     PositiveY = 0x04,

     /// <summary>Negative Y axis.</summary>
     NegativeZ = 0x05,

     /// <summary>Positive Z axis.</summary>
     PositiveZ = 0x06,

}
The value 13 isn't currently supported in a direct comparison. Maybe we're reading 1 too many bits when populating or comparing this value? I note that 13=1101 and 5=0101. Is NegativeZ appropriate for that Faallem trapdoor? We might need to & out that 4th bit. Again, just a guess for now until I'm back in front of my dev environment.

Edit2: So in theory making the following two changes starting from line 987 of RDBLayout should fix this globally, including other actions with the same problem.

Code: Select all

case DFBlock.RdbActionFlags.Translation:
{
    action.Magnitude = magnitude;
    GetTranslationActionVector(ref action, (DFBlock.RdbActionAxes)(axis_raw & 7));
}
break;

case DFBlock.RdbActionFlags.Rotation:
{
    action.Magnitude = magnitude;
    GetRotationActionVector(ref action, (DFBlock.RdbActionAxes)(axis_raw & 7));
}
break;
Will need to regression this heavily, but seems fairly sound in theory. :)

User avatar
Interkarma
Posts: 5686
Joined: Sun Mar 22, 2015 1:51 am

Re: Trapdoor above the main room in Privateers Hold

Post by Interkarma » Wed Mar 11, 2020 5:46 am

Can confirm the above fixes this issue and doesn't cause any regressions. Have submitted a fix now.
https://github.com/Interkarma/daggerfal ... 82ee62b010

Thank you for the save and good eye Pango. :)

User avatar
pango
Posts: 2473
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Trapdoor above the main room in Privateers Hold

Post by pango » Wed Mar 11, 2020 7:23 am

Well, we're getting there, but with that fix the rotation doesn't match classic: First the trapdoor rotates upward instead of downward, as makes sense for a trapdoor; And secondly, it rotates in the other direction, classic opens the widest in the direction of the main door, making it as dangerous as possible.
Like in my hack above, the final ActionRotation should be something like Vector3(-70.66f, 0, 0)
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Interkarma
Posts: 5686
Joined: Sun Mar 22, 2015 1:51 am

Re: Trapdoor above the main room in Privateers Hold

Post by Interkarma » Wed Mar 11, 2020 8:34 am

OK, but we need to use with the data attached to the action record. I'll revert that change as I've clearly made a wrong conclusion and we'll move forwards from there. :)

I'll push a compromise change instead that will only apply to that very specific example. I still feel there's some bitwise chicanery we're missing here, but I'd like some more examples of actions with axis_raw > 6 if someone can find any.

User avatar
BadLuckBurt
Posts: 557
Joined: Sun Nov 05, 2017 8:30 pm

Re: Trapdoor above the main room in Privateers Hold

Post by BadLuckBurt » Wed Mar 11, 2020 9:27 am

Interkarma wrote:
Wed Mar 11, 2020 8:34 am
I'll push a compromise change instead that will only apply to that very specific example. I still feel there's some bitwise chicanery we're missing here, but I'd like some more examples of actions with axis_raw > 6 if someone can find any.
I did a search through all the RDB files, I've found 111 occurrences. The number in front of the Axis property is the line number in the RDB JSON dump:

Let me know if it needs to be narrowed down further to specific model IDs because I can easily do that through Javascript.

Code: Select all

Targets
    Occurrences of '"Axis": ([7-9]|\d{2,100})' in Directory Z:\git-repo\daggerfall-worlddata-editor\js\RDB
Found Occurrences  (111 usages found)
    Usage in string constants  (111 usages found)
        daggerfall-worlddata-editor  (111 usages found)
            js\RDB  (111 usages found)
                N0000004.RDB.json  (1 usage found)
                    7567"Axis": 21,
                N0000006.RDB.json  (1 usage found)
                    5058"Axis": 13,
                N0000007.RDB.json  (1 usage found)
                    5540"Axis": 11,
                N0000008.RDB.json  (1 usage found)
                    5044"Axis": 13,
                N0000010.RDB.json  (1 usage found)
                    1994"Axis": 9,
                N0000033.RDB.json  (1 usage found)
                    7715"Axis": 10,
                N0000035.RDB.json  (1 usage found)
                    4786"Axis": 16,
                N0000090.RDB.json  (1 usage found)
                    6415"Axis": 12,
                N0000091.RDB.json  (1 usage found)
                    6955"Axis": 12,
                N0000092.RDB.json  (1 usage found)
                    6678"Axis": 12,
                S0000001.RDB.json  (1 usage found)
                    4162"Axis": 99,
                S0000002.RDB.json  (2 usages found)
                    1281"Axis": 32,
                    1727"Axis": 8,
                S0000003.RDB.json  (3 usages found)
                    1802"Axis": 8,
                    4118"Axis": 8,
                    5854"Axis": 8,
                S0000004.RDB.json  (1 usage found)
                    1301"Axis": 141,
                S0000005.RDB.json  (1 usage found)
                    533"Axis": 36,
                S0000020.RDB.json  (18 usages found)
                    976"Axis": 20,
                    1001"Axis": 20,
                    1026"Axis": 15,
                    1184"Axis": 15,
                    1234"Axis": 10,
                    1309"Axis": 20,
                    1334"Axis": 10,
                    1459"Axis": 10,
                    1484"Axis": 10,
                    1509"Axis": 10,
                    2271"Axis": 20,
                    2773"Axis": 10,
                    2898"Axis": 20,
                    3352"Axis": 15,
                    3910"Axis": 10,
                    3960"Axis": 15,
                    3985"Axis": 15,
                    5320"Axis": 15,
                S0000021.RDB.json  (6 usages found)
                    2018"Axis": 20,
                    2515"Axis": 10,
                    2540"Axis": 10,
                    2665"Axis": 50,
                    2690"Axis": 10,
                    3662"Axis": 20,
                S0000022.RDB.json  (3 usages found)
                    2744"Axis": 12,
                    3546"Axis": 12,
                    5649"Axis": 11,
                S0000070.RDB.json  (1 usage found)
                    1229"Axis": 24,
                S0000080.RDB.json  (25 usages found)
                    736"Axis": 10,
                    1784"Axis": 20,
                    2192"Axis": 10,
                    2217"Axis": 10,
                    2317"Axis": 10,
                    2342"Axis": 10,
                    2367"Axis": 10,
                    3187"Axis": 20,
                    4116"Axis": 50,
                    4141"Axis": 20,
                    4191"Axis": 20,
                    4216"Axis": 10,
                    4750"Axis": 20,
                    4775"Axis": 20,
                    5261"Axis": 20,
                    5577"Axis": 21,
                    5602"Axis": 11,
                    5627"Axis": 20,
                    5652"Axis": 10,
                    5677"Axis": 10,
                    6318"Axis": 10,
                    6343"Axis": 10,
                    6518"Axis": 10,
                    6568"Axis": 10,
                    6593"Axis": 10,
                S0000081.RDB.json  (16 usages found)
                    2368"Axis": 20,
                    2393"Axis": 20,
                    2643"Axis": 20,
                    2668"Axis": 20,
                    2693"Axis": 10,
                    2718"Axis": 10,
                    4006"Axis": 15,
                    4031"Axis": 15,
                    4106"Axis": 10,
                    4191"Axis": 10,
                    4216"Axis": 10,
                    4241"Axis": 10,
                    5065"Axis": 15,
                    6472"Axis": 15,
                    6497"Axis": 15,
                    6572"Axis": 10,
                S0000082.RDB.json  (5 usages found)
                    547"Axis": 20,
                    797"Axis": 20,
                    1835"Axis": 50,
                    1860"Axis": 50,
                    3158"Axis": 20,
                S0000140.RDB.json  (1 usage found)
                    3216"Axis": 43,
                S0000160.RDB.json  (16 usages found)
                    912"Axis": 15,
                    1500"Axis": 50,
                    1525"Axis": 50,
                    1829"Axis": 50,
                    1879"Axis": 15,
                    3261"Axis": 10,
                    3286"Axis": 10,
                    4026"Axis": 10,
                    4338"Axis": 30,
                    4688"Axis": 50,
                    4713"Axis": 50,
                    4822"Axis": 30,
                    5057"Axis": 50,
                    5082"Axis": 10,
                    6353"Axis": 20,
                    6750"Axis": 20,
                W0000005.RDB.json  (1 usage found)
                    4877"Axis": 13,
                W0000029.RDB.json  (1 usage found)
                    6523"Axis": 12,
Daggerfall Unity on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
Daggerfall Unity on Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

User avatar
Interkarma
Posts: 5686
Joined: Sun Mar 22, 2015 1:51 am

Re: Trapdoor above the main room in Privateers Hold

Post by Interkarma » Wed Mar 11, 2020 9:31 am

That's very lovely! Any chance you could also output magnitude and model desc in that dataset? And perhaps limit to just rotations?

User avatar
Hazelnut
Posts: 2293
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Trapdoor above the main room in Privateers Hold

Post by Hazelnut » Wed Mar 11, 2020 9:35 am

Hmm axis 141 kinda sticks out there a bit... :)

As this was done from the data files dumped, just be aware that the values have already been read by DFU code and serialised - just wanted to mention in case this made any difference to how you interpret the numbers.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply