Giter VIP home page Giter VIP logo

defaultecs's People

Contributors

dagobertdev avatar doraku avatar gitter-badger avatar helco avatar markwilds avatar monodop avatar nrader95 avatar quahu avatar ripwin 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

defaultecs's Issues

How to use DefaultECS to create game loop?

Hi,

First... wow... It's still updated. Good job.

I'm making a terminal game (like in PowerShell or something). I have a problem with creating a game loop. I looked and you used some XNA feature to do it, but that's not gonna work for me.

Should I make a SequentialSystem and update it in some while(true) kind of loop?

Create communication channel

First of all. Great project. I really appreciate it and I'm gonna use it in my own project.

My proposition is, could you create Discord server or something like Discrord, where all users (and you) could cooperate?

add pool object for entities

Have already something like that in my game prototype, move it here?
Could probavly use World.AliveFlag to enable/disable entities from pool on EntitySet but that would leave the component alive in ComponentPool making World.GetAllComponent and AComponentSystem kinda a false representation. Knowing this on a peoject basis is ok but framework wide seems weird.
Does this need an api to initialize/cleanup entities or is that the user responsability?

Probably goes in pair with #13 and #12

useful collection types:

  • Pool of object
  • Thread safe circular buffer

add WithAny filter for EntitySet

Adding two filter ComponentEnum in EntitySet to handle one case of those rules would be easy but it would double the checks needed on component change.
It would also be possible to add one filter for each of those rules so that you could define multiple family (WithOneOf<A, B>().WithOneOf<C, D>() should this be handled as WithOneOf<A, B, C, D>() or two separate rules?) then each familly would add one check, kinda snowballing...

There may be a way to simplify the rules application so we don't add needless check when a group is not defined. To look into.

bad method names pending

edit: doing it

  • EntitySetBuilder.WithAny(type[])
  • WithAnyAttribute
  • EntitySetBuilder.WithAny<>() helper methods
  • code documentation

Component change detection

Hi

Is it possible to detect when the component has changed?
This is important as it greatly simplifies gameplay logic.

add a way to enable/disable an entity without removing it

Current target API:

public readonly struct Entity
{
    public bool IsEnabled { get; } // can't have set because of readonly struct

    public void Enable();

    public void Disable();
}

Only problem is that disabling an Entity only removes it from EntitySet, its components are still present when doing World.GetAllComponent() and will still be exposed in AComponentSystem<TState, TComponent>.
Need to decide whether this is correct (making an action on a component, independently of its Entity state) or not.

  • is it ok for disabled entities components to still appear in World.GetAllComponent? I'll go with yes, a component can be shared between multiple entities and it would be too complicated to handle otherwise
  • is it ok for disabled entities to not be serialized? Yes also, there is no way to get disabled entities when deserializing a world, maybe add this feature later but for now let's keep things simple now they are!

Allow use of Non-generic types for EntitySetBuilder

Currently the EntitySetBuilder uses generics on all but WithAny. Generics limits the ability to create entitysets from unknown types at runtime. For example, referring to #20 , the use of generics makes that issue impossible to resolve because type names read from a file cannot be parsed into generic arguments (as of C# 7.2).

Entity.Has returns true incorrectly....or Entity.Remove doesn't remove

I'm running into this issue regularly and it's pretty easy to reproduce. Basically, the following code ends up falling through to the log call. Now the odd bit is that it isn't 100% of the time. If I create 50 Entities about 25 of them will exhibit the bug.

entities[i].Remove<BoxCollider>();

var hasBoxCollider = entities[i].Has<BoxCollider>();
if (hasBoxCollider)
     Debug.Logger.log("why do we still have a BoxCollider???");

To reproduce

  • add a bunch of Entities with some Components
  • in a System some time later, call Remove then check for the Component with Has

Screen Shot 2019-04-10 at 10 38 04 PM

I am not sure if this is related or not, but the System is also getting duplicate Entities in the EntitySet:

bug_2

Any ideas what is going on with this one? I don't see any obvious issues in the Remove or Has code paths...

add IsEnabled property on ISystem

gives an easy way to enable/disable system built in.
Adding this now would break compatibility with existing code, wait for c#8 default interface implementation or screw it let's do it now?
Create global message to enable/disable everything into the framework or leave it to the user?
Is using the flag the callee or the caller responsabilities?

Visualization of world state

What are your thoughts about the visualization of the world state?

For example, in Entitas (In Unity) we have the ability to see all executing systems and all entities with all components and the ability to add/change/remove components

Maybe you have implemented something for XNA already?

add a way to get Entity world events

Concerned events:

  • EntityCreated
  • EntityDisposed
  • EntityEnabled?
  • EntityDisabled?
  • EntityComponentAdded<T>?
  • EntityComponentRemoved<T>?
  • EntityComponentEnabled<T>?
  • EntityComponentDisabled<T>?

First idea was to handle it like #34 but it seems unnatural to pass an observer to a world constructor like for an entityset to me. Also added generic events for component notification would be impossible. Maybe for world events it would be better to use the publish/subscribe mechanism. Also current namespace observer is bad a bad >_<

optimize component memory layout during runtime

As entities and components are added/removed, the layout in memory may not be in the order of ids since last element takes the place of removed item.
It could be interesting to allow the sorting of the memory through the api to optimize the layout (for example when presenting a frame ect...).
Something like this?

public class World
{
    // completely reorder layout to be optimized
    public void Optimize();
    // reorder layout as long as a cancellation is not requested
    public void Optimize(CancellationToken token);
}

add a way to enable/disable a component on an entity without removing it

Current target API:

public readonly struct Entity
{
    public bool IsEnabled<T>();

    public void Enable<T>();

    public void Disable<T>();
}
  • is it ok for disabled components to still appear in World.GetAllComponent? yes, Entity and component are different beast, same reason for disabled entities #13
  • is it ok for disabled component to still be serialized? yes, but they should still be disabled once deserialized

add serialize feature to World and Entity

  • create BinarySerializer
  • handle component reference (SetSameAs)
  • cleanup name for backing field
  • handle reference types
  • handle null reference type
  • handle array
  • handle interface / abstract type a67d3ff
  • handle type with no default constructor -> #19
  • create entity factory from file -> #20

No easy way to access Entity.Parent

This isn't really an issue but an enhancement request. Currently, parenting Entities only allows an Entity to fetch it's children. There is no way to get a parent without looping through all the Entities and enumerating their Children.

When dealing with parented Entities in a spatial system (typical Transform component), you have to calculate the transform matrices top-down which isn't currently possible. Pseudo code:

  • loop through all Entities
  • for each Entity that has no parent (this is the part that cant currently be done performantly)
    • calculate the transform matrix
    • propagate the transform matrix to all children so they can calculate their own transform matrix

add some kind of EntityCommandBuffer

It's not possible to add/remove components or create/dispose entities when updating a system. There should be an easy mechanism to deffer those action at the end of a multithreading update. Problem is we do not want to stress gc so the model need to be allocation free apart from the initialization. How to handle component operations that way? custom memory allocator?
All Entity operations should be available.

edit: this will probably be used for #20 afterward.

Improvements to ISystem with Entity Addition/Removal

I don't know this fits in with your design for your ECS.

I propose a addition to ISystem with Added/Removed methods that deal with Entities being added/removed from the world (or activated/deactivated).

This would be useful for dealing with collections that depend on a Entity being active in the world or not and knowing when it is not so that it can be removed from the list/collection.

Even better would be for systems like AEntitySystem to automatically filter Entities based on their relevancy to that system's EntitySet.

Or create a public subscribe event for the end developer to hook into when a entity is added/removed.

If none of those are feasible or in the design strategy, please let me know. If there is a way to do that in the existing design, I'm all ears.

Find entity by component value

Hi :D

There is one more feature I used all the time in Entitas https://github.com/mzaks/EntitasCookBook/blob/master/chapters/1_ingredients/106_index.md

TLDR: Have an API to find an entity OR entities with a specified component value

Use cases:

  • Networking: A lot of times you need to modify entity with specific Id.
  • Grid-based games: Get entity standing on a specific position (under mouse cursor, near explosion, etc)

What do you think about it?
It's possible to get away with messages, yes.

add a jobs system working with the SystemRunner

  • make a custom barrier to be able to process job instead of blocking when done with current System fa5936e
  • add API on SystemRunner for job (API to define)
  • make SystemRunner an ISystem for a way to synchronize with the jobs

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.