Code Monkey home page Code Monkey logo

morpeh's People

Contributors

formatcvt avatar gallardo994 avatar golovchanskyva avatar krvs avatar mininaleksandr avatar olegmrzv avatar r1nge avatar sh42913 avatar stinkysteak avatar vanifatovvlad avatar warmerko avatar xk0fe avatar zudl 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

morpeh's Issues

SizeOf<T> Issue

Unity 2021.1.14 Unity.Collections.LowLevel.Unsafe.UnsafeUtility.SizeOf() возвращает неверный результат для компонента с одним булевым полем из-за чего тип помечается как маркер. System.Runtime.InteropServices.Marshal.SizeOf(default(T)) отрабатывает как надо.

Public setter for BasePair.System

When writing the editor extension for the inspector Installer script, I had a problem in that I could not initialize BasePair normally from the script, because the BasePair.System field does not have a public setter.

Add search to WorldViewer

It's too hard to use WorldViewer without search.
I added this feature to may project ([Searchable] parameter of private List Entities at WorldViewer) and it works fine.
Maybe it's good idea to add this feature to master.

Null default world during manual world creation

При попытке создавать и контролировать World вручную, World.Default всегда возвращает Null, вследствии чего перестают работать Entity/MonoProviders.

Тут проблема в том, что список с мирами при инициализации всегда добавляет по индексу 0 null ссылку

image

[Feature Request] Разделить проект на отдельные пакеты

Если разделить проект на отдельные пакеты, то появится возможность использовать в проекте только нужные части морпеха (например, отказаться от использования утилит и заменить глобалы собственной реализацией)

Morpeh

  • ECS Core

Morpeh.UnityIntegration

  • World browser
  • Unity Installers
  • Unity Providers
  • Unity Systems
  • Discover (?)

Morpeh.Globals

  • Global Singleton
  • Global Variables
  • Global Events
  • BigNumber (?)
  • SceneReference (?)

Morpeh.Utils

  • AndroidKeyStore
  • CompilationTime
  • DependencyResolver
  • EditorSceneSetup
  • IconsSetter (?)
  • iOSPostProcessBuild

[Native] Detect Burst support in Unity

Currently, ENABLE_BURST_AOT define is set in non-burst Unity projects (for some strange reason). We need a better solution to detect Burst installations with defines.

Namespace modification warning

I've got this warning at first startup in Unity 2020.3.41f1 for unknown reason, but it didn't lead to any other issues, everything works fine.
image

Replace Trailing Zeros

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private int NumberOfTrailingZeros(int i) {
        switch (((uint)(i & -i) * 0x077CB531u) >> 27) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 28;
            case 3: return 2;
            case 4: return 29;
            case 5: return 14;
            case 6: return 24;
            case 7: return 3;
            case 8: return 30;
            case 9: return 22;
            case 10: return 20;
            case 11: return 15;
            case 12: return 25;
            case 13: return 17;
            case 14: return 4;
            case 15: return 8;
            case 16: return 31;
            case 17: return 27;
            case 18: return 13;
            case 19: return 23;
            case 20: return 21;
            case 21: return 19;
            case 22: return 16;
            case 23: return 7;
            case 24: return 26;
            case 25: return 12;
            case 26: return 18;
            case 27: return 6;
            case 28: return 11;
            case 29: return 5;
            case 30: return 10;
            case 31: return 9;
        }
        return 0;
    }

Can't select bag for components with one boolean value

При попытке взять bag для компонента, в котором содерржиться только 1 булевое поле выдает ошибку.
You Select<ECSAction> marker component from filter! This makes no sense.

Предполагаю что ошибка в методе подсчета размера компонента.
Простое добовление поля типа Int убрало ошибку

image
image
image

ComponentsCacheDisposable doesn't work with AOT

I've got error

ExecutionEngineException: Attempting to call method 'Morpeh.ComponentsCacheDisposable`1[[Tanks.GameInput.GameUser, Tanks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]::.ctor' for which no ahead of time (AOT) code was generated.

while trying to build morpeh.examples.tanks for Windows with IL2CPP using Unity 2019.4.40f1.
But everything works fine, when I change ComponentsCacheDisposable visibility to public and call constructor directly from system's OnAwake().

Ошибка You're trying to get on entity a component that doesn't exists! в едиторе

Если кодом в рантайме удалить компонент, у которого есть провайдер, и при этом будет открыт инспектор этого объекта, тогда падает эта ошибка
Пример:

Exception: [MORPEH] You're trying to get on entity 212 a component that doesn't exists!
Morpeh.ComponentsCache`1[T].GetComponent (Morpeh.Entity entity) (at Library/PackageCache/com.scellecs.morpeh@22b6b7c1ca/Core/ComponentsCache.cs:148)
Morpeh.MonoProvider`1[T].get_Data () (at Library/PackageCache/com.scellecs.morpeh@22b6b7c1ca/Unity/Providers/MonoProvider.cs:24)
(wrapper dynamic-method) System.Object.Morpeh.MonoProvider`1[[HealthBarRenderComponent, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].get_Data(Morpeh.MonoProvider`1<HealthBarRenderComponent>&)
Sirenix.OdinInspector.Editor.GetterSetter`2[TOwner,TValue].GetValue (TOwner& owner) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Infos/GetterSetter.cs:270)
Sirenix.OdinInspector.Editor.AliasGetterSetter`4[TOwner,TValue,TPropertyOwner,TPropertyValue].GetValue (TOwner& owner) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Infos/AliasGetterSetter.cs:70)
Sirenix.OdinInspector.Editor.PropertyValueEntry`2[TParent,TValue].UpdateValues () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Value Entries/PropertyValueEntry.cs:1049)
Sirenix.OdinInspector.Editor.PropertyValueEntry.Update () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Value Entries/PropertyValueEntry.cs:226)
Sirenix.OdinInspector.Editor.InspectorProperty.UpdateValueEntry () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1436)
Sirenix.OdinInspector.Editor.InspectorProperty.Update (System.Boolean forceUpdate) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1090)
Sirenix.OdinInspector.Editor.InspectorProperty.OnStateUpdate (System.Int32 treeID) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:663)
Sirenix.OdinInspector.Editor.InspectorProperty.OnStateUpdate (System.Int32 treeID) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:668)
Sirenix.OdinInspector.Editor.PropertyTree.BeginDraw (System.Boolean withUndo) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:450)
Sirenix.OdinInspector.Editor.PropertyTree.Draw (System.Boolean applyUndo) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:388)
Sirenix.OdinInspector.Editor.OdinEditor.DrawTree () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:93)
Sirenix.OdinInspector.Editor.OdinEditor.DrawOdinInspector () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:216)
Sirenix.OdinInspector.Editor.OdinEditor.OnInspectorGUI () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/OdinEditor.cs:85)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <2758fd44916644e3a3b65c9d4809b7f9>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

[Feature Request] Добавить EntityID

Проблема

На данный момент морпех переиспользует ID поэтому их нельзя хранить отдельно от Entity (например, для передачи в Job и обработки в следующем кадре).

[Test]
public void EntityIdUniqueness()
{
    var world = World.Create();

    var entity1 = world.CreateEntity();
    var entityId1 = entity1.ID;

    entity1.Dispose();
    world.Update(0.01f);

    var entity2 = world.CreateEntity();
    var entityId2 = entity2.ID;

    Assert.AreEqual(entityId1, entityId2);
}

Предложение

Добавить уникальное поле entity.EntityID, где EntityID это

public struct EntityID {
    public int ID; // индекс 
    public int Gen; // уникальное число

    public bool Equal(EntityID other);
    public static bool operator ==(EntityID a, EntityID b);
    public static bool operator !=(EntityID a, EntityID b);

    public static EntityID Invalid => new EntityID {ID = -1, Gen = -1};
}

и метод-расширение

// возвращает true только если 
// entityID != EntiyID.Invalid && world.entities[entityId.ID].IsAlive() && world.entities[entityId.ID].Gen == entityId.Gen
public static bool TryGetEntity(this World world, EntityID entityID, out Entity entity);

Пример использования

public class DamageEvent : CustomGlobalEvent<DamageEvent.Args> {
    public struct Args { public EntityID targetID; }
}

public class AttackSystem : UpdateSystem {
    public DamageEvent damageEvent;

    public override void OnUpdate(float deltaTime) {
        Entity target = ...;
        damageEvent.NextFrame(new DamageEvent.Args { targetID = target.EntityId });
    }
}

public class DamageSystem : UpdateSystem {
    public DamageEvent damageEvent;
    
    public override void OnUpdate(float deltaTime) {
        if (!damageEvent.IsPublished) {
            continue;
        }

        foreach (var evt in damageEvent.BatchedChanges) {
            if (!this.World.TryGetEntity(evt.targetID, out var targetEntity)) {
                continue;
            }

            // use targetEntity
        }
    }
}

License doesn't show as MIT on GitHub page

Summary

Hi there, I noticed a very small issue when reading the GitHub page for this library. Even though the license reads as an MIT license for some reason GitHub is not picking that up and indicating you should read the contents for more details.

image

Though its a very small thing, when other people read this page or view it in their search results this project would not show as having an MIT license. I've had this problem before and the way I've usually resolved it is to delete the existing license and re-add it through the GitHub website. Its usually some very slight, inane formatting or naming issue that causes it to not show correctly..

I hope this is helpful for you!

Auto warmup not working on IOS build

IOS build crashes at startup with this message:

ExecutionEngineException: Attempting to call method 'Morpeh.TypeIdentifier`1[[MyTestComponent, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]::Warmup' for which no ahead of time (AOT) code was generated.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <00000000000000000000000000000000>:0 
  at Morpeh.WorldExtensions.InitializationDefaultWorld () [0x00000] in <00000000000000000000000000000000>:0 
UnityEngine.UnhandledExceptionHandler:PrintException(String, Exception)
UnityEngine.UnhandledExceptionHandler:HandleUnhandledException(Object, UnhandledExceptionEventArgs)
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)

I fixed this wrapping these 'warm types' codes in InitializationDefaultWorld method with !UNITY_IOS define. Not sure if this problem exists on other AOT platforms too

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.