FYI for "Loading" Characters in 0.17.3 CSC and Beyond
Posted: Tue Sep 22, 2020 11:24 am
Enabling/Disabling NPCs
I will eventually add this to the tutorial series when time allows.
For additional detail, refer to the second post below.
For an example of this new system in action, refer to the third post below.
For known issues regarding Enabling/Disabling NPCs, refer to the fourth post below.
As of 0.17.3, you will need to Enable NPCs before you can make use of them, as NPCs start the game Disabled and do not actually "exist" in the game world until your story scripting tells them to. In other words, you will need to Instantiate them.
If you do not Enable them at the beginning of a game (or before they are needed), you will not be able to control or affect them with many of the Game Events available in the CSC (for more on this see the 2nd post below). They will not be visible to the Player or other Characters, and will not be able to interact with the Player, other Characters, or game world.
Why is this system in place now? To improve performance. Having fewer Enabled NPCs improves load times, frame rates, etc.
The Player never needs to be Enabled. This only applies to NPCs.
So how do we Enable an NPC? With one of two Game Events: EnableNPC, or EnableNPCAsync.
EnableNPC: Immediately Instantiates an NPC. This will cause a noticeable hiccup in game play. It's recommended that you only use this event at the start of the game (as a Game Start Event; see 1st picture below). The LOADING... screen and built-in Fade In transition into the game world will hide any hiccups caused by using this Game Event. Tip: a Fade In Game Event followed by a Fade Out Game Event 3-4 seconds later can also be used to mask hiccups.
EnableNPCAsync: Asynchronously loads the data for an NPC and finalizes Instantiation once this is completed. Results in a noticeably smaller hiccup, if any at all, but can result in strange visual behavior if performed while the Player can see the NPC loading. Should be used while an NPC is offscreen or during a Fade In/Fade Out sequence of Game Events.
How do I Disable an NPC?
Do I really need to Disable them, or, why would I want to?
Can I still warp NPCs to the loading dock to hide them?
You can Disable NPCs with the DisableNPC Game Events. This will immediately Disable the NPC.
You do not NEED to Disable them at any time, but disabling NPCs improves application performance and to a large degree ensures that that NPC can never interfere with your story again, with a few exceptions.
Yes, you can still warp NPCs to the loading dock to temporarily hide them. Note that you cannot do this if they are already Disabled.
So I can just use one of the two Enable Game Events above and start doing story stuff with NPCs?
For some stories (or at least those in the midst of being developed), yes! Once an NPC is enabled, you can go nuts and that NPC will do anything any Game Event tells them to. For simpler stories where all Characters are meant to be present at all times, all you should need to worry about is using EnableNPC as a Game Start Event (found in the Story Script object dropdown), like so:
https://imgur.com/lptyU7L
Is there anything else I should be aware of?
Yes. For those of you constructing larger stories or who will have Characters that show up "late" to the party and/or who anticipate enough game play or scene diversity to make saving and loading a likelihood, there's more. More more more...continued below.
I will eventually add this to the tutorial series when time allows.
For additional detail, refer to the second post below.
For an example of this new system in action, refer to the third post below.
For known issues regarding Enabling/Disabling NPCs, refer to the fourth post below.
As of 0.17.3, you will need to Enable NPCs before you can make use of them, as NPCs start the game Disabled and do not actually "exist" in the game world until your story scripting tells them to. In other words, you will need to Instantiate them.
If you do not Enable them at the beginning of a game (or before they are needed), you will not be able to control or affect them with many of the Game Events available in the CSC (for more on this see the 2nd post below). They will not be visible to the Player or other Characters, and will not be able to interact with the Player, other Characters, or game world.
Why is this system in place now? To improve performance. Having fewer Enabled NPCs improves load times, frame rates, etc.
The Player never needs to be Enabled. This only applies to NPCs.
So how do we Enable an NPC? With one of two Game Events: EnableNPC, or EnableNPCAsync.
EnableNPC: Immediately Instantiates an NPC. This will cause a noticeable hiccup in game play. It's recommended that you only use this event at the start of the game (as a Game Start Event; see 1st picture below). The LOADING... screen and built-in Fade In transition into the game world will hide any hiccups caused by using this Game Event. Tip: a Fade In Game Event followed by a Fade Out Game Event 3-4 seconds later can also be used to mask hiccups.
EnableNPCAsync: Asynchronously loads the data for an NPC and finalizes Instantiation once this is completed. Results in a noticeably smaller hiccup, if any at all, but can result in strange visual behavior if performed while the Player can see the NPC loading. Should be used while an NPC is offscreen or during a Fade In/Fade Out sequence of Game Events.
How do I Disable an NPC?
Do I really need to Disable them, or, why would I want to?
Can I still warp NPCs to the loading dock to hide them?
You can Disable NPCs with the DisableNPC Game Events. This will immediately Disable the NPC.
You do not NEED to Disable them at any time, but disabling NPCs improves application performance and to a large degree ensures that that NPC can never interfere with your story again, with a few exceptions.
Yes, you can still warp NPCs to the loading dock to temporarily hide them. Note that you cannot do this if they are already Disabled.
So I can just use one of the two Enable Game Events above and start doing story stuff with NPCs?
For some stories (or at least those in the midst of being developed), yes! Once an NPC is enabled, you can go nuts and that NPC will do anything any Game Event tells them to. For simpler stories where all Characters are meant to be present at all times, all you should need to worry about is using EnableNPC as a Game Start Event (found in the Story Script object dropdown), like so:
https://imgur.com/lptyU7L
Is there anything else I should be aware of?
Yes. For those of you constructing larger stories or who will have Characters that show up "late" to the party and/or who anticipate enough game play or scene diversity to make saving and loading a likelihood, there's more. More more more...continued below.