Replies: 7 comments
-
Not sure I get the question to be honest. The |
Beta Was this translation helpful? Give feedback.
-
It is more of a usage or implementation question. In the example in the documentation, the system is run in the program's main function, by explicitly running the system's loop function. My question is, if you know how this process can be automated, so that I don't have to manually run each system, but instead just mark their declaration as being a system, e.g. similar to how you can mark classes in UE4 with Unity's DOTS has the same feature: If you declare a system by inheriting a class from the system base class, the system will be automatically run at runtime. |
Beta Was this translation helpful? Give feedback.
-
Well, the example is intentionally minimal and definitely not indicative on how you should do things in large projects. This wouldn't be a good choice for a README file.
It depends on how and where you're using EnTT. If you've a job scheduler on your side, you can use it. If you're combining it with an engine like UE4 or the like, you can use it's job system. Otherwise, you can use something like enkiTs or Taskflow from GitHub. If you don't care about multithreading and you only want a singlethreaded collaborative tool, you can give a look to the process directory of EnTT or, yeah, just have your own loop that runs systems in order. There is nothing wrong with it. As I said, EnTT ECS part is designed as a container. You can plug and play with it at any time. Though, it's not meant to invert the control and take over the application or part of it, like how you process your systems. Honestly, it would have been easier and the chosen approach is even more challenging at the end of the day, but it's what I wanted and needed, so... 🤷 |
Beta Was this translation helpful? Give feedback.
-
Regardless of how systems are run in the end at runtime, you still have to somehow add/register the system to the scheduler or loop function that in the end runs the system.
And this would be picked up before compilation by a reflection system, similar to Unreal Header Tool (I'm not familiar with reflection system, but I think UHT is one?) and then added in a macro, which is placed in the game loop, where it is then run. Unity DOTS does it, where you only have to inherite a class from a system base class and it is then run automatically. In the system update's function you can explicitly run the code on multiple threads. Does this makes my question more clearly?
|
Beta Was this translation helpful? Give feedback.
-
The question is clear and I've already answered it. |
Beta Was this translation helpful? Give feedback.
-
I've just realized that you're last comment was partially covered by the quote. I fixed it. I'm closing the issue because this is better suited for a GH discussion or a chat on gitter/discord if you like. 👍 |
Beta Was this translation helpful? Give feedback.
-
Yes that was the question :)
👍 By chance, someone mentioned UE4s subsystems today, and it looks like they are exactly what I was looking for.
Yes, a discussion thread would be very good. |
Beta Was this translation helpful? Give feedback.
-
How could I use a macro to declare a class/struct to be a system and then have that system's "run" function be called automatically in another function, which has a "target" macro (e.g. the game instance's tick function)?
Unreal Engine already uses macros to find Blueprint-exposed classes and structs in your code.
Would this be a reflection system?
Beta Was this translation helpful? Give feedback.
All reactions