quabug / entitiesbt Goto Github PK
View Code? Open in Web Editor NEWBehavior Tree for Unity ECS (DOTS) framework
License: MIT License
Behavior Tree for Unity ECS (DOTS) framework
License: MIT License
Hi @quabug ,
Thanks for creating the amazing project. I'm the creator of OpenUPM, a public upm registry with automatic build pipelines that publish new package bundle based on semver git tags. You can read the announcement to get the basic idea, so far it hosts 80+ packages as of December 2019.
I have added this package: https://openupm.com/packages/entities-bt/. To make it useful, could you please
What is the license on this work?
Create a tree of variant from a string input.
class Assign<T> : IVariant<T> where T : unmanaged
{
public IVariantWriter<T> Left;
public IVariantReader<T> Right;
}
class Add<T> : IVariantReader<T> where T : unmanaged
{
public IVariantReader<T> Left;
public IVariantReader<T> Right;
}
class Normalize<T> : IVariantReader<T> where T : unmanaged
{
public IVariantReader<T> Value;
}
class SomeExpressionReader<T> : IVariantReader<T> where T : unmanaged
{
public IVariantReaderAndWriter<T> Foo;
public IVariantReader<T> Bar;
public string Expression; // "$Foo = $Foo + normalize($Bar)"
// => Assign(Left: Foo, Right: Add(Left: Foo, Right: Normalize(Value: Bar)))
}
This issue only happens when two or more entities have the same tree source. Any cleanup steps are required before destroying an Entity with BehaviourTreeRoot?
The full call stack is as follows.
InvalidOperationException: The BlobAssetReference is not valid. Likely it has already been unloaded or released.
Unity.Entities.BlobAssetReferenceData.ValidateNonBurst () (at Library/PackageCache/[email protected]/Unity.Entities/Blobs.cs:253)
Unity.Entities.BlobAssetReferenceData.ValidateNotNull () (at Library/PackageCache/[email protected]/Unity.Entities/Blobs.cs:270)
Unity.Entities.BlobAssetReference`1[T].get_Value () (at Library/PackageCache/[email protected]/Unity.Entities/Blobs.cs:358)
EntitiesBT.Entities.NodeBlobRef.get__blob () (at Library/PackageCache/[email protected]/Runtime/Entities/NodeBlob.cs:43)
EntitiesBT.Entities.NodeBlobRef.GetTypeId (System.Int32 nodeIndex) (at Library/PackageCache/[email protected]/Runtime/Entities/NodeBlob.cs:49)
EntitiesBT.Core.VirtualMachine.Tick[TNodeBlob,TBlackboard] (System.Int32 index, TNodeBlob& blob, TBlackboard& bb) (at Library/PackageCache/[email protected]/Runtime/Core/VirtualMachine.cs:22)
EntitiesBT.Core.VirtualMachine.Tick[TNodeBlob,TBlackboard] (TNodeBlob& blob, TBlackboard& bb) (at Library/PackageCache/[email protected]/Runtime/Core/VirtualMachine.cs:15)
EntitiesBT.Entities.VirtualMachineSystem+<>c__DisplayClass_OnUpdate_LambdaJob0.OriginalLambdaBody (Unity.Entities.Entity entity, Unity.Entities.DynamicBuffer`1[T] buffers, EntitiesBT.Entities.CurrentBehaviorTreeComponent& currentBehaviorTree) (at Library/PackageCache/[email protected]/Runtime/Entities/VirtualMachineSystem.cs:47)
EntitiesBT.Entities.VirtualMachineSystem+<>c__DisplayClass_OnUpdate_LambdaJob0.IterateEntities (Unity.Entities.ArchetypeChunk& chunk, EntitiesBT.Entities.VirtualMachineSystem+<>c__DisplayClass_OnUpdate_LambdaJob0+LambdaParameterValueProviders+Runtimes& runtimes) (at <cb18d41fc64e4dec8d7325227d4e62b0>:0)
EntitiesBT.Entities.VirtualMachineSystem+<>c__DisplayClass_OnUpdate_LambdaJob0.Execute (Unity.Entities.ArchetypeChunk chunk, System.Int32 chunkIndex, System.Int32 firstEntityIndex) (at <cb18d41fc64e4dec8d7325227d4e62b0>:0)
Unity.Entities.JobChunkExtensions.RunWithoutJobs[T] (T& jobData, Unity.Entities.ArchetypeChunkIterator& chunkIterator) (at Library/PackageCache/[email protected]/Unity.Entities/IJobChunk.cs:182)
EntitiesBT.Entities.VirtualMachineSystem+<>c__DisplayClass_OnUpdate_LambdaJob0.RunWithoutJobSystem (Unity.Entities.ArchetypeChunkIterator* archetypeChunkIterator, System.Void* jobData) (at <cb18d41fc64e4dec8d7325227d4e62b0>:0)
Unity.Entities.InternalCompilerInterface.RunJobChunk[T] (T& jobData, Unity.Entities.EntityQuery query, Unity.Entities.InternalCompilerInterface+JobChunkRunWithoutJobSystemDelegate functionPointer) (at Library/PackageCache/[email protected]/Unity.Entities/CodeGeneratedJobForEach/LambdaJobDescription.cs:378)
EntitiesBT.Entities.VirtualMachineSystem.OnUpdate () (at Library/PackageCache/[email protected]/Runtime/Entities/VirtualMachineSystem.cs:32)
Unity.Entities.SystemBase.Update () (at Library/PackageCache/[email protected]/Unity.Entities/SystemBase.cs:413)
Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystemGroup.cs:435)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at Library/PackageCache/[email protected]/Unity.Entities/Stubs/Unity/Debug.cs:19)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystemGroup.cs:440)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystemGroup.cs:387)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystem.cs:113)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/[email protected]/Unity.Entities/ScriptBehaviourUpdateOrder.cs:333)
Hi @quabug,
You have a good monorepo setup, but your sub-package versions are inconsistent. i.e. for Git tag 0.21.2
, some package may be still versioned with 0.21.0
. This is not a problem, but it confused openupm build pipelines that not all package versions are matched with the tag version.
Two options
random
prefix. The author @reeseschultz is creating a tool called https://github.com/reeseschultz/ubump to automate the process.You can also ignore the issue, and version conflict errors on your openupm page like https://openupm.com/packages/com.quabug.entities-bt.builder.component/.
It takes more than 5s on 5800x for generating variants of all primitives and Unity.Mathematics
types.
I have tried create a NativeHashMap<int/*TypeIndex*/, ArchetypeChunkComponentTypeDynamic>
and pass it into Job, but ArchetypeChunkComponentTypeDynamic
cannot be used in NativeContainer
.
struct Job : IJobChunk
{
// ArchetypeChunkComponentTypeDynamic is not a valid type of NativeContainer
public NativeHashMap<int, ArchetypeChunkComponentTypeDynamic> Types;
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
{
chunk.GetDynamicComponentDataArrayReinterpret<A>(Types[ComponentType.ReadOnly<A>().TypeIndex], UnsafeUtility.SizeOf<A>());
}
}
Here is what it looks like:
Here is the relevant manifest.json sections
Attempting to Play prints the following error log
NullReferenceException: Object reference not set to an instance of an object
EntitiesBT.Components.BehaviorTreeRoot.Convert (Unity.Entities.Entity entity, Unity.Entities.EntityManager dstManager, GameObjectConversionSystem conversionSystem) (at Library/PackageCache/[email protected]/Runtime/Components/BehaviorTreeRoot.cs:27)
Unity.Entities.Conversion.ConvertGameObjectToEntitySystem.Convert (UnityEngine.Transform transform, System.Collections.Generic.List`1[T] convertibles) (at Library/PackageCache/[email protected]/Unity.Entities.Hybrid/GameObjectConversion/ConvertGameObjectToEntitySystem.cs:44)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
Unity.Entities.Conversion.JournalingUnityLogger:LogException(Exception, Object) (at Library/PackageCache/[email protected]/Unity.Entities.Hybrid/GameObjectConversion/JournalingUnityLogger.cs:50)
UnityEngine.Debug:LogException(Exception, Object)
Unity.Debug:LogException(Exception, Object) (at Library/PackageCache/[email protected]/Unity.Entities/Stubs/Unity/Debug.cs:29)
Unity.Entities.Conversion.ConvertGameObjectToEntitySystem:Convert(Transform, List`1) (at Library/PackageCache/[email protected]/Unity.Entities.Hybrid/GameObjectConversion/ConvertGameObjectToEntitySystem.cs:49)
Unity.Entities.Conversion.<>c__DisplayClass1_0:<OnUpdate>b__0(Transform) (at Library/PackageCache/[email protected]/Unity.Entities.Hybrid/GameObjectConversion/ConvertGameObjectToEntitySystem.cs:57)
Unity.Entities.EntityQueryBuilder:ForEach(F_C`1) (at Library/PackageCache/[email protected]/Unity.Entities/EntityQueryBuilder_ForEach.gen.cs:230)
Unity.Entities.Conversion.ConvertGameObjectToEntitySystem:OnUpdate() (at Library/PackageCache/[email protected]/Unity.Entities.Hybrid/GameObjectConversion/ConvertGameObjectToEntitySystem.cs:57)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystemGroup.cs:472)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystemGroup.cs:417)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.GameObjectConversionUtility:Convert(World) (at Library/PackageCache/[email protected]/Unity.Entities.Hybrid/GameObjectConversion/GameObjectConversionUtility.cs:152)
Unity.Entities.ConvertToEntitySystem:Convert() (at Library/PackageCache/[email protected]/Unity.Entities.Hybrid/ConvertToEntity.cs:176)
Unity.Entities.ConvertToEntitySystem:OnUpdate() (at Library/PackageCache/[email protected]/Unity.Entities.Hybrid/ConvertToEntity.cs:67)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystemGroup.cs:472)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystemGroup.cs:417)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/[email protected]/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/[email protected]/Unity.Entities/ScriptBehaviourUpdateOrder.cs:333)
What did I do wrong?
no need to create a new BTNode
for each INodeData
.
Is this a clearer and distinct way to declare IBlackboard
?
public interface IBlackboard
{
T GetData<T>() where T : strcut, IComponentData;
ref T GetDataRef<T>() where T : strcut, IComponentData;
T GetManagedData<T>() where T : class, IComponentData;
T GetSharedData<T>() where T : strcut, ISharedComponentData;
T GetUnityComponent<T>() where T : UnityEngine.Component;
}
which free the dependency from com.unity.entities
and possible make an ECS free version to work on GameObject without ECS packages.
https://github.com/quabug/EntitiesBT/blob/4fb2629904b62721b37748d51b4dd4ba325c7bff/package.json
Bump to 0.3.2 will fix this.
Should generate necessary code to avoid stripping on il2cpp.
Would be great if we can have a very simple "How to Start" section for the Visual Graph Tree Builder
#83
LINQ FirstOrDefault / LastOrDefault / Where(?) etc.
yield
The graph input data is not properly serialized into BlobVariable
which still require runtime value of GraphInstance
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.