Giter VIP home page Giter VIP logo

entitiesbt's People

Contributors

quabug avatar xphyro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

entitiesbt's Issues

License

What is the license on this work?

Expression variant

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)))
}

https://github.com/datalust/superpower

`InvalidOperationException` after an Entity is destroyed

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)

monorepo and inconsistent sub-package versions

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

  1. Keep all sub-packages versions synced with your Git tag version. This will also send your user a clear signal that whether all packages are synced, but a user may force to do unnecessary updates for packages not get real updated.
  2. Create a Git tag for an individual package with a related prefix, and ask openupm-cli to track the Git tag prefix instead. ReeseUnityDemos is an example. The sub-package com.reese.random ask our pipelines to track 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/.

How to access entity data by ComponentType in Job?

https://forum.unity.com/threads/is-it-possible-to-access-data-of-entity-by-componenttype-or-typeindex-in-job.802569/

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>());
            }
        }

Behavior Tree Root script shows a red "Null (Assign)" in the Source property

Here is what it looks like:

Screen Shot 2021-12-05 at 7 56 32 PM

Here is the relevant manifest.json sections

Screen Shot 2021-12-05 at 7 56 24 PM

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?

Use constraint type interfaces for `IBlackboard`?

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;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.