HOW-TO: Find and debug encounters
Learn how to find spawn trees and debug encounters - both in the game and in the Editor.
This tutorial will help you with new ways of finding encounter nodes, areas and tags.
Finding Spawn Trees
Spawn Trees are groups of nodes that can be found and edited in the Encounter Editor.
In gameplay > community > community_templates > prologue you can find community templates. Spawn Trees also get stored there (like plg_redanian_camp).
You need a Spawn Tree for the community to set up spawn conditions in various nodes. Set up the timetable for day and night. There’s also a runtime debugger so you can debug the actual signal of the nodes. Set the timetable for day and night (4: 0 to 21:0 and 21: 0 to 4:0).
You can also right-click on a Spawn Tree file in the Asset Browser to find the encounters which use it.
In the context menu choose Find resources that use this.
Then, in the new Encounters pop-up, you can select the found encounters in the world via Select in the world.
Additionally you can use Filter tree to only show the encounter in the Scene Tree. Please note that the filter stays turned on.
If you have CEncounter node in your scene, you can use its context menu to find the spawn tree associated with it.
Finding encounter nodes
There are encounter nodes that can be found in layers which reference these Spawn Trees.
If you expand nodes you can see sub-nodes, like Work SmartAI, which defines actionPointSelectors with different categories. Check the screenshot below:
Finding areas
If you want to use simple communities, that you don’t want interaction with, you can set up CEncounter nodes , and then edit it’s spawn tree using its context menu. When we take a look at areas used by communities ( like prolog_village > community > redanian_camp > area > redanian_camp_encounter > ...) you will notice that these CEncounters use TriggerAreaComponent-s. These are the ones responsible for spawning the Encounter when the trigger is made by some condition.
Going back to the Spawn Tree in the Encounter Editor, you will find a CAreaComponent on the left side:
Take a look at includedChannels in the TriggerAreaComponent. These channels define the conditions which trigger the trigger. When any layer enters this trigger, something will happen - and most of the time what happens is simply enabling an encounter.
Finding tags
Selecting a CEncounter inside the scene (like redanian_camp_encounter) and checking out its properties, we will find it’s tags in the CNode section.
You can also find actionPoint tags inside the Encounter Editor’s Spawn Trees in the Work smartAI:
Debugging Encounters
Learn how to debug encounters with general and specific profiler.
Profilers in-game
To access this tool, you need to start the game in Editor and then press F8 (enable the debug filter if you cannot see it or press Fn+F8 on laptops). You will see a new toolbar in the upper part of the game window and you can move a blue mouse. Go to Profilers > Game World.
When the Game World Window is opened, click on Encounters. You should be able to see all available encounters now. Click on Spawned to filter the ones which are active and spawned NPCs will be at the top.
Let’s assume there are two encounters with 50 entities - this would mean we have a problem, since we should never go over 100 entities at the same time.
The numbers will change dynamically when entities spawn and despawn. To see new encounters on the top of the list when they get active, you have to click on Spawned again.
You can open individual encounters by clicking on them.
In the new window to the right you will see Entries and Parties. You can check how many entities are spawned for every entry or party which you have in your encounter.
If you want to play simultaneously, please note that:
You can't press F1 for free camera while the tool is opened.
You can set the transparency of the tool in the upper right corner of your game window.
Debug in the editor
If you are playing the game in the editor, move the cursor to the Scene Panel (you might night to tab out of the game) and search for your encounter on the layer. Then right-click the encounter and choose Debug Spawn tree from the context menu.
This will show you the encounter Spawn Tree in debug mode, with active branches highlighted.
Table of contents:
______________________________________
The Witcher 3: Wild Hunt Complete Edition © 2024 CD PROJEKT S.A. Published by CD PROJEKT S.A. Developed by CD PROJEKT RED. CD PROJEKT®, The Witcher®, REDengine® are registered trademarks of CD PROJEKT Capital Group. All rights reserved. The Witcher game is set in the universe created by Andrzej Sapkowski in his series of books. All rights reserved.