Commit Graph

92 Commits

Author SHA1 Message Date
Serhii Snitsaruk fd1ac1cbb8
Fix `BBNode::get_value()` crash with a freed object in GDExtension
It may be a bug in GDExtension. I optimized the code, and, as a workaround, removed casting to Object* from Variant. This fixed the issue. The same code worked well using module.

(cherry picked from commit 689c8fab6f)
2024-09-15 15:15:10 +02:00
Serhii Snitsaruk 16a3bb0273
Override _to_string() to print useful info about objects in GDExtension 2024-09-05 13:39:47 +02:00
Serhii Snitsaruk 43035839b1
Don't warn of mismatch between Object & NodePath 2024-08-16 00:44:37 +02:00
Serhii Snitsaruk cfacd57f15
Warn about type mismatch when populating blackboard 2024-08-15 23:41:39 +02:00
Serhii Snitsaruk 000f9c15d8
Fix BTState overwriting blackboard variables on init 2024-08-15 23:41:36 +02:00
Serhii Snitsaruk e12beee51e
Fix mapping failing for NodePath variables with prefetch enabled 2024-08-14 20:34:56 +02:00
Serhii Snitsaruk fc26f51ff2
Implement BTInstance - runtime instance of BehaviorTree 2024-08-03 11:07:06 +02:00
Serhii Snitsaruk 3ceedbebad
Fix BlackboardPlan arrays shouldn't be shared between instanced agents
Variable values are deep copied now using Variant.duplicate(true). Note that currently it doesn't duplicate objects.
2024-07-06 10:04:36 +02:00
Wilson E. Alvarez d2ca303c5e
Fix List<T> access
Due to upstream change:

	955d5affa8
2024-06-29 14:52:05 -04:00
Serhii Snitsaruk c793c8ba53
Fix `Blackboard.unbind_var` failing for existing bound variable 2024-06-01 10:53:56 +02:00
Serhii Snitsaruk 29532113c0
Change to typed array in `BlackboardPlan::list_vars` 2024-05-31 11:57:27 +02:00
Serhii Snitsaruk 35f2c3c142
API: Add `Blackboard` methods to enable iteration, state inspection and serialization 2024-05-31 11:46:11 +02:00
Serhii Snitsaruk 361eb3eb15
Fix compile-time errors with updated godot-cpp 2024-05-28 19:50:57 +02:00
Serhii Snitsaruk 064d00fdfa
Editor: Check if variable is of correct type for BBParam subtypes 2024-05-18 14:12:00 +02:00
Serhii Snitsaruk 7ab7a9d098
BlackboardPlan: Improve inspector update while manually typing in mappings
Fixes property glitches observed while a map variable is typed in.
2024-05-17 21:54:50 +02:00
Serhii Snitsaruk dc77ecd2b2
Fix `parent_scope` argument in `create_blackboard` should have a default value 2024-05-17 10:36:25 +02:00
Serhii Snitsaruk d08018b7b1
BlackboardPlan: Update mapping after variable renamed
Currently, only for owned variables, not parent's.
2024-05-17 10:00:12 +02:00
Serhii Snitsaruk d920060dee
Update class documentation 2024-05-15 20:58:38 +02:00
Serhii Snitsaruk 2718271bb1
Clean up & renames 2024-05-15 20:43:24 +02:00
Serhii Snitsaruk 3cf90f9387
BlackboardPlan: Don't show mapping in root plans 2024-05-15 13:13:27 +02:00
Serhii Snitsaruk c6b1a40627
BlackboardPlan: Update inspector upon mapping editing finished 2024-05-15 12:52:50 +02:00
Serhii Snitsaruk a572613001
BlackboardPlan: Utilize mapping in LimboHSM
Also changes how parent plan providing is implemented (used for editor hints).
2024-05-15 11:38:53 +02:00
Serhii Snitsaruk 3b12288ae0
BlackboardPlan: Serialize only non-empty mapping values 2024-05-14 20:25:18 +02:00
Serhii Snitsaruk a1cdff2e2e
Fix issues with mapping in BTSubtree 2024-05-14 19:47:05 +02:00
Serhii Snitsaruk 0d1e846d93
BlackboardPlan: Use mapping with BTSubtree 2024-05-14 11:39:32 +02:00
Serhii Snitsaruk 2d493a76bd
BlackboardPlan: Improve mapping and serialize 2024-05-14 09:29:56 +02:00
Serhii Snitsaruk bdfe5f52c2
BlackboardPlan: Implement rudimentary mapping 2024-05-13 23:21:55 +02:00
Serhii Snitsaruk 506d8aa967
Use `scene_root` with `BBParam` 2024-05-01 23:39:09 +02:00
Serhii Snitsaruk c6bb5bad74
Fix: BBParam saved_value defaults to null 2024-05-01 18:09:06 +02:00
Serhii Snitsaruk c739a876b0
Blackboard: Add `create` parameter to `bind_var_to_property` and `link_var` 2024-04-09 11:34:22 +02:00
Serhii Snitsaruk 302de87e32
Prevent using external resources for derived blackboard plans in `BTPlayer` and `BTState` 2024-04-01 15:25:54 +02:00
Serhii Snitsaruk d48daf2135
BlackboardPlan: Avoid circular references in derived mode
If the same plan resource is assigned in BehaviorTree and in BTPlayer, simply use the resource as is. Using the same resource for `BehaviorTree` and `BTPlayer` will disable derived mode, and allow managing from `BTPlayer` . There is a risk of using `NodePath` variables with different scenes: the path may actually be different if node structure is not the same. It will lead to fetching breaking for some of those scenes.
2024-04-01 01:45:40 +02:00
Serhii Snitsaruk a5aea72a17
Plan: Fix syncing derived plan sometimes fails on var rename 2024-03-25 01:04:07 +01:00
Serhii Snitsaruk 1de6256401
Plan: Don't store unmodified variables in a derived plan
Fixes "sticky" old values in a derived plan.
2024-03-25 00:56:08 +01:00
Serhii Snitsaruk 12fd9d00d6
Update file headers and fix whitespace 2024-03-21 21:38:57 +01:00
Serhii Snitsaruk 9e62fe8fa3
Fix `BBParam` stored value defaulting to `null` in GDExtension 2024-03-20 23:57:42 +01:00
Serhii Snitsaruk cbd467f97f
Blackboard: Assigning variables via code might have no effect if done before initialization 2024-03-13 22:00:50 +01:00
Serhii Snitsaruk 06ebff7518 Fix includes and build errors 2024-03-12 21:09:28 +01:00
Serhii Snitsaruk ca6b497019 Sync order of variables in derived `BlackboardPlan` 2024-03-12 17:11:01 +01:00
Serhii Snitsaruk 434545ebad Blackboard: Linking vars with `Blackboard::link_var` 2024-03-12 16:17:34 +01:00
Serhii Snitsaruk a6e6b53e18 Improve prefetching 2024-03-12 00:30:38 +01:00
Serhii Snitsaruk 7de582c4e6 Fix complain parameter is not respected in `Blackboard::get_var` if parent scope is assigned 2024-03-11 23:04:34 +01:00
Serhii Snitsaruk e2edb083ff When prefetch fails, don't print error if variable is on blackboard 2024-03-11 22:12:44 +01:00
Serhii Snitsaruk b09006a11b Fix issues with blackboard plan system 2024-03-11 18:58:40 +01:00
Serhii Snitsaruk 9957ef2ea7 Expose additional `BlackboardPlan` methods for custom tooling 2024-03-08 15:33:28 +01:00
Serhii Snitsaruk 2658060b1c Move prefetching code into `BlackboardPlan` and add checkbox to the plan editor 2024-03-06 21:28:06 +01:00
Serhii Snitsaruk 4c26583007 Remove "p_" from the argument names in the `ClassDB` bindings 2024-03-04 21:36:16 +01:00
Serhii Snitsaruk d66f1e83fd Refactor BlackboardPlan to use StringName
Also update demo BTs.
2024-03-04 16:56:57 +01:00
Serhii Snitsaruk 7cf4a4b3b8 Fix setter/getter types in BBVariable 2024-03-04 16:19:39 +01:00
Serhii Snitsaruk 350c27abbc Change BB variable members to StringName 2024-03-04 12:54:45 +01:00