Mission Objects hook

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderator: JeremyaFr

Post Reply

Mission Objects hook

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2745
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Wed Nov 18, 2020 3:18 pm

WIP

Hello,
Here is a WIP version of the mission objects hook.

You can now hide meshes of a craft for flightgroups of a mission.

# object profiles
Suppose that the new craft is "FlightModels\[Model].opt".
To hide meshes for a craft, create a file named "FlightModels\[Model]ObjectProfiles.txt" or create a section named "[ObjectProfiles]" in "FlightModels\[Model].ini".
The format is:
ProfileName = indices
indices are a comma separated list.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To define an object profile for a flightgroup, create a file named "[MissionDir]\[Mission]_Objects.txt" or create a section named "[Objects]" in "[MissionDir]\[Mission].ini".
The format is
ObjectProfile_fg_# = ProfileName
Replace # with the flightgroup index.
The default ProfileName is "Full".

EDIT: link removed

baggy101
Cadet 2nd Class
Posts: 71
Joined: Mon Feb 02, 2015 9:32 am

Post by baggy101 » Wed Nov 18, 2020 10:24 pm

Is it possible to use this hook to swap the .opt of the Flightgroup?

User avatar
Trevor
Ensign
Posts: 466
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Thu Nov 19, 2020 1:54 pm

Awesome, so you can have a "damage model" and hide it under "Normal" circumstances but then for a mission enable "Damaged" profile showing all the hole meshes.

performance wise, how does the hook hide meshes? is the whole model still considered for rendering or does the hook change the model before the game considers rendering (Meaning for example, a heap of extra scorch marks only cause a performance hit when that profile is loaded otherwise the model is just as before?)

Trev

User avatar
Vince T

Fleet Admiral (Administrator)
Posts: 13105
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Thu Nov 19, 2020 7:04 pm

Is there a limit to how many meshes can be hidden?
Your ship, Captain. I need a drink. - Vince Trageton

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2745
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Nov 19, 2020 7:13 pm

Trevor wrote:
Thu Nov 19, 2020 1:54 pm
performance wise, how does the hook hide meshes? is the whole model still considered for rendering or does the hook change the model before the game considers rendering (Meaning for example, a heap of extra scorch marks only cause a performance hit when that profile is loaded otherwise the model is just as before?)
The profile is read when the game initializes a new craft struct.
Vince T wrote:
Thu Nov 19, 2020 7:04 pm
Is there a limit to how many meshes can be hidden?
There can be up to 50 meshes.

User avatar
Vince T

Fleet Admiral (Administrator)
Posts: 13105
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Thu Nov 19, 2020 7:38 pm

I just tried it out and it works perfectly.

Now I've got a few more questions:
1) About the engine in general: If there is a mesh below or within another, for example a damaged or under-construction version of a mesh, will that be rendered, although it's not seen, or does the game only render, what you really see?

2) Related to 1, Could a default Profile be defined, which is used, if no other profile is specified? That way one could ensure that certain "interior" meshes are hidden by default to safe performance.
Your ship, Captain. I need a drink. - Vince Trageton

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2745
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Thu Nov 19, 2020 9:05 pm

1) They will be rendered but you can hide them with the hook so they are not rendered.

2) The default profile is named "Full". When no profile is defined, this profile is used.

User avatar
Trevor
Ensign
Posts: 466
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Thu Nov 19, 2020 10:32 pm

This is awesome.
It also means no more transparent texture hack for droids/pilots on different FG's
Vince T wrote:
Thu Nov 19, 2020 7:38 pm
That way one could ensure that certain "interior" meshes
Sounds intriguing... cant wait to see what you have planned.

Trev

User avatar
Vince T

Fleet Admiral (Administrator)
Posts: 13105
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Thu Nov 19, 2020 10:44 pm

oh nothing fancy, really. :D
Just some scaffolding for unfinished or under-construction ships, stuff like that could be useful, e.g. for my Blue Phantom Campaign :D

But seriously, the longer I think of it, the more crazy ideas I get on how to implement stuff. Combine several OPTs into one.
Your ship, Captain. I need a drink. - Vince Trageton

Bman
Lieutenant
Posts: 915
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Fri Nov 20, 2020 2:36 am

And shipyards and craft... :-) EaW/FoC game made good use of that idea too.
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

User avatar
Vince T

Fleet Admiral (Administrator)
Posts: 13105
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Sat Nov 21, 2020 10:25 am

Hmmm this is interesting.

I've created a test opt with more than 50 meshes, 65 to be precise. And set up 2 profiles:
NoBlue: Hides meshes 41-50
NoRed: Hides meshes 51-65

This is what I got in the test environment:
Tests.jpg
Here, the NoBlue profile works, meshes 41-50 are hidden.
Strangely tho, the second profile hiding meshes 51-65 doesn't.
In the past, if an OPT had more than 50 meshes, the surplus ones would not be rendered. Now however, those are still there, regardless.

Have I somehow missed the mesh limit being lifted?
You do not have the required permissions to view the files attached to this post.
Your ship, Captain. I need a drink. - Vince Trageton

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2745
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Nov 21, 2020 1:54 pm

The exe has several array to store data related to the meshes. These arrays have 50 elements. So the limit is 50 meshes per opt.
With more than 50 meshes, there will be buffer overflow. So there could be unpredictable behavior.

User avatar
Vince T

Fleet Admiral (Administrator)
Posts: 13105
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Sat Nov 21, 2020 2:49 pm

I se. Better not to challenge my luck then :)
Either way you have given us a powerful tool here! Thank you so much!
Your ship, Captain. I need a drink. - Vince Trageton

User avatar
JaggedFel
Ensign
Galactic Empire
Posts: 278
Joined: Wed Sep 06, 2006 11:01 pm
Contact:

Post by JaggedFel » Sun Nov 22, 2020 5:28 pm

Is the # zero-indexed or one-indexed? Looking to add the [Mission].tie portion to the YOGEME dialog.
Ye Olde Galactic Empire Mission Editor v1.8
Current software WIPs: TIE Layout and Cutscene Editor, TIE/XvT Cockpit Editor
Libraries / Format specs: *.tie, *.plt, *.tfr, *.lfd , *.act, *.dat image files, *.fnt

User avatar
Vince T

Fleet Admiral (Administrator)
Posts: 13105
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Sun Nov 22, 2020 6:54 pm

It's Zero-indexed, as far as I could tell
Your ship, Captain. I need a drink. - Vince Trageton

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2745
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Nov 22, 2020 7:05 pm

It is zero-indexed.

User avatar
JeremyaFr
Commander
XWAU Member
Posts: 2745
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Nov 23, 2020 8:03 pm

UPDATE

Hello,
I've merged the changes from the WIP version into the stable version.

You can see how the "hide meshes" feature works in this commit:
hook_mission_objects: add profiles to hide meshes

korekwerner
Cadet 1st Class
Posts: 129
Joined: Wed Mar 20, 2019 7:04 pm

Post by korekwerner » Thu Nov 26, 2020 11:16 am

Thank you JeremyaFr this is another game breakthrough.

Kind regards
KW

Post Reply