Timeline for How do components access one another in a component based entity system
Current License: CC BY-SA 4.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 21, 2021 at 21:12 | history | edited | Stephan | CC BY-SA 4.0 |
given the relatively high traffic of this answer (at least by my standards), i've updated class names to better reflect the example descriptions
|
| Dec 17, 2017 at 15:34 | vote | accept | MoustacheSpy | ||
| Dec 12, 2017 at 21:36 | comment | added | Stephan | Yes, exactly so. | |
| Dec 12, 2017 at 21:20 | comment | added | Krupip | So systems would instead just check before hand, for each component, if the GUID for the component matches a real entity, and if not, deletes that component from the components list? | |
| Dec 12, 2017 at 21:09 | comment | added | Stephan | One approach I saw with this had each system check for the existence of the GUID before processing its behavior. It would purge any entries that didn't have a matching GUID in the entities collection. This made purging less explicit, as you just delete the GUID, and let the systems clean it up for you on their next pass. | |
| Dec 12, 2017 at 21:04 | comment | added | Stephan | You can, but you don't necessarily have to if you order your various systems in the update loop. if you group all your "potentially purging entities" functions toward the top of the loop, then purge, then do the others that don't change purge state of anything, you could potentially save cycles on the systems that never purge anything. You cant always do this though. Moving an player to a pickup should purge the pickup entity. depending on the order, the pickup may sit there for a frame too long. In all though, it's an optimization you have to evaluate on a case by case basis. | |
| Dec 12, 2017 at 20:59 | comment | added | Krupip | Don't you have to check if something is purged first before you do anything? | |
| Dec 12, 2017 at 20:49 | history | edited | Stephan | CC BY-SA 3.0 |
fixed examples to me more accurate
|
| Dec 12, 2017 at 20:33 | history | edited | Stephan | CC BY-SA 3.0 |
typo
|
| Dec 12, 2017 at 17:29 | history | answered | Stephan | CC BY-SA 3.0 |