Sunday, January 7, 2024

ODOS Update - Massive breakthrough, new model handling, and skyrim-style weapon racks!

I'm pretty excited to say that I have managed to solve one of the biggest problems I had when creating the original display system: item physics, or havok. It was so much of a problem that I resigned myself to making models for each display where I manually removed the havok using Nifskope, a process that, although simple enough, was tedious and really slow. But now, Nifskope is no longer needed!

Finding this solution meant I went back and took a totally different approach to the displays, which in turned enabled me to have as close a weapon rack system as Skyrim's!

And what is even better, with this new system, modders only have to drag a display in, make it a permanent reference, and it is good to go! If you want it to filter that display to accept only certain items (so they act like in Legacy of the Dragonborn for Skyrim), simply drop the item you want displayed in a cell (preferably in a separate unaccessible cell), parent it to the display, and you're done!

    These weapon marker are visible in the CS for placement, but invisible in game.

The only difference to Skyrim's system is that I had to make separate displays for each weapon type, because of the way the models are positioned. For example, placing a warhammer on a sword display will work, but the hammer will be upside down...

 


The New Method

Item havok in Oblivion is baked into the item mesh, so even if the model is used on a static object (like tables or walls), it can still be moved. But I noticed something: until the item is triggered, either colliding with something or grabbed by the player, the item is "static", the physics aren't being calculated by the engine, and it acts just like any static object, so its performance is good. 

Then I discovered that the OBSE function Update3D, which reloads the item's model, resets that trigger! At least, on models that have just simple collision boxes (like weapons). So my script detects when the item placed moves too far away from its original position (with a small deadzone to avoid spamming the function all the time), updates its model, and repositions itself, returning to its static, non-havoc, state. The script has very good performance, as shown in this stress test, where I run over 1000 swords. I added some earlier attempts too, just to show the difference...



As for items that have more complex collision boxes, or several points of physics, Update3D alone doesn't reset the havoc. Items like floppy clothes or armors, or quivers, which have one collision for the arrow being shot, and one for the quiver itself. However, I found a solution: As soon as the item moves too far away, I change its model to an empty .NIF file I made, which has no havoc. Waiting about 1.5 seconds gives time for the game to "forget" that item ever had physics, and when I return it to its original model, it is once again static! So some items will be a little slower to display, but I can live with that for now.

Now I just need to look again at the auto sorting to send those items to the display from a remote location, and I will be well on my way to a big milestone in ODOS! 

 

In other news, I have a pretty robust storage system created, which I will be developing more as soon as the display system is finished.

No comments:

Post a Comment