Page 1 of 2

Mission Objects hook

Posted: Wed Nov 18, 2020 3:18 pm
by JeremyaFr
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

Re: Mission Objects hook

Posted: Wed Nov 18, 2020 10:24 pm
by baggy101
Is it possible to use this hook to swap the .opt of the Flightgroup?

Re: Mission Objects hook

Posted: Thu Nov 19, 2020 1:54 pm
by Trevor
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

Re: Mission Objects hook

Posted: Thu Nov 19, 2020 7:04 pm
by Vince T
Is there a limit to how many meshes can be hidden?

Re: Mission Objects hook

Posted: Thu Nov 19, 2020 7:13 pm
by JeremyaFr
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.

Re: Mission Objects hook

Posted: Thu Nov 19, 2020 7:38 pm
by Vince T
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.

Re: Mission Objects hook

Posted: Thu Nov 19, 2020 9:05 pm
by JeremyaFr
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.

Re: Mission Objects hook

Posted: Thu Nov 19, 2020 10:32 pm
by Trevor
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

Re: Mission Objects hook

Posted: Thu Nov 19, 2020 10:44 pm
by Vince T
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.

Re: Mission Objects hook

Posted: Fri Nov 20, 2020 2:36 am
by Bman
And shipyards and craft... :-) EaW/FoC game made good use of that idea too.

Re: Mission Objects hook

Posted: Sat Nov 21, 2020 10:25 am
by Vince T
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?

Re: Mission Objects hook

Posted: Sat Nov 21, 2020 1:54 pm
by JeremyaFr
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.

Re: Mission Objects hook

Posted: Sat Nov 21, 2020 2:49 pm
by Vince T
I se. Better not to challenge my luck then :)
Either way you have given us a powerful tool here! Thank you so much!

Re: Mission Objects hook

Posted: Sun Nov 22, 2020 5:28 pm
by JaggedFel
Is the # zero-indexed or one-indexed? Looking to add the [Mission].tie portion to the YOGEME dialog.

Re: Mission Objects hook

Posted: Sun Nov 22, 2020 6:54 pm
by Vince T
It's Zero-indexed, as far as I could tell

Re: Mission Objects hook

Posted: Sun Nov 22, 2020 7:05 pm
by JeremyaFr
It is zero-indexed.

Re: Mission Objects hook

Posted: Mon Nov 23, 2020 8:03 pm
by JeremyaFr
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

Re: Mission Objects hook

Posted: Thu Nov 26, 2020 11:16 am
by korekwerner
Thank you JeremyaFr this is another game breakthrough.

Kind regards
KW

Re: Mission Objects hook

Posted: Sun Dec 13, 2020 7:09 pm
by JeremyaFr
UPDATE

Hello,
I've updated the mission objects hook.
I've renamed the default profile to "Default".

Re: Mission Objects hook

Posted: Sun Jan 03, 2021 2:41 pm
by JeremyaFr
UPDATE

Hello,
I've updated the mission objects hook.

Now the object profiles are loaded in briefing and tech library.

Posted: Sat Jan 09, 2021 10:03 am
by Bman
.

Re: Mission Objects hook

Posted: Sun Jan 17, 2021 2:13 pm
by Will T
Hi Jeremy, quick question on this.

Is it possible to use the ObjectProfiles to hide meshes in the cockpit opt? If so, how? Obviously mesh numbers in the cockpit opt will not necessarily correspond to the numbers of their representative meshes in the exterior and base opts.

EDIT: Another question: could the profile call functionality be added to the hangar objects hook as well? I've got some ideas I want to try with the shuttles, but also at a very base level I'm wondering about creating object profiles for all the fighters for an 'empty' version - one with the pilot and possibly astromech meshes hidden so that the parked ships in the hangar don't have pilots sitting in them.

EDIT2: Hey @JeremyaFr, just thought I'd throw you a tag on this in case you hadn't seen it. Not rushing you for an answer, and if it can't be done that's totally fine. I've got some time this weekend and thought I'd ask the question again in case it gives me something I could work towards.

Re: Mission Objects hook

Posted: Thu Jul 28, 2022 3:43 pm
by JeremyaFr
UPDATE

Hello,
I've updated the mission object hook.

You can now use object profiles for weapons.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To define an object profile for a weapon, create a file named "[MissionDir]\[Mission]_Objects.txt" or create a section named "[Objects]" in "[MissionDir]\[Mission].ini".
The format is
ObjectProfile_#1_#2 = ProfileName
Replace #1 with the craft name.
Replace #2 with the weapon model index.
The default ProfileName is "Default".
For example, if the craft is a BWing and the weapon model index is 281, then the key is ObjectProfile_BWing_281.

Re: Mission Objects hook

Posted: Sun Jul 31, 2022 9:04 am
by JeremyaFr
UPDATE

Hello,
I've updated the mission objects hook.

You can now define object profiles based on object markings.
The default ProfileName is "Default" or "Default_#" where # is the markings index.

Re: Mission Objects hook

Posted: Sun Jul 31, 2022 11:23 am
by Ace Antilles
Thank you for all your achievements Jeremy :)