2019 RogueLike Tutorial Port #136
Replies: 1 comment 3 replies
-
I'm not familiar neither with the source codebase, nor with Specs - the structure is considerably different from the book project. Based on a cursory look of the source code, and the related tutorial chapter, dispatchers need to be exclusive because multiple threads may run concurrently. I'm not sure about the reason for the port to use a global for the effects queue, but globals of this type are modeled by resources (that is, you put the queue in a resource, and essentially it becomes an ECS-managed global). An advantage of proper modeling, is that the ECS will manage concurrent access, and won't schedule two systems concurrently if they both perform writes (AFAIK). Given this, you won't even need the world lock. After this consideration, the next consideration is that yes, Bevy events may be the closest concept that model the effects queue - as a matter of fact, events are queues themselves 😄. There's a caveat: I haven't had a look at the project design around queues, but Bevy events are consumed indipendently by events. Based on my cursory look at the source project, if a systems pops a queue element, the element will be permanently consumed; this is not the case in Bevy, where a given event is consumed per-system (as a matter of fact, in Bevy you don't "consume" events, you read them. I think it's a good idea to ask to somebody in the Bevy discord server, also 😄 |
Beta Was this translation helpful? Give feedback.
-
Hey guys! I am currently working on porting Brackets 2019 rougelike tutorial to bevy. Bevy Port.
I setup the effects system to work just like it does in the tutorial but I think I could be more bevy with it. Instead of a exclusive system that runs at the end of all the system stages, I was thinking of removing the queue completely and turning all the effects into events. What are y'all thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions