Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A non generic ISystem #175

Open
Soren025 opened this issue Dec 17, 2022 · 3 comments
Open

A non generic ISystem #175

Soren025 opened this issue Dec 17, 2022 · 3 comments

Comments

@Soren025
Copy link

Soren025 commented Dec 17, 2022

For my project, I don't have anything to use the generic parameter of ISystem<T>. Would it be possible for there to be a non generic version?

For context, I am using DefaultEcs to simulate the result of a puzzle solution for a puzzle game that will run for a few minutes at most. It will run in in fixed time so there is no need for the generic parameter to be a time delta value like in many of the examples. The only external influence is the tick update and the initial seeding of the player's solution at the start.

@Soren025
Copy link
Author

Soren025 commented Dec 18, 2022

I realized ISystem<T> and it's implementing classes are all decoupled from World. Knowing that, I ended up implementing it locally for my self by creating a non generic ISystem and implementing it as wrappers around the generic system classes.

It's crud, but it works.

@Doraku
Copy link
Owner

Doraku commented Dec 19, 2022

Hey, an other possibilities would be to pass your game/pizzle state to the systems instead of the elasped time like in the sample, after all it's just a T without any constrains.
But as you noted the system implementation is completely optional and you can do your own thing. In a game I would expect some data to be passed to the executing, Duplicating all existing type into their non generic form would be easy enough, heck since I'm lazy I would probably do it this way :D public abstract class AEntitySetSystem : ASentitySetSystem<int>, ISystem I just need to look into the code generation package what it will change, no promise.

@Hecksa
Copy link

Hecksa commented Apr 12, 2023

I'd have found some built-in non-generic systems helpful too. I'm currently building a game that updates based on ticks using DefaultEcs. The visuals in the frontend will need a float for frame delta, but the rendering itself is going to be using different technologies, decoupled from the backend via messages, so the DefaultECS backend won't need to worry about real-time in any way. Because of this, the vast majority of systems will not need to know any information except about the components they're operating on.

As you both point out, there's ways around it so this is not a major concern by any stretch of the imagination, but I thought it might be helpful if I added some more context on use-cases for the non-generic versions. Thanks for a great project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants