Speed vs Redundant Data

I am learning DOTS and have a question, obviously; I have two groups of Entities; Roads and Autos. The Roads have Lanes, and the Lanes have Points (along the length of the road/lane) Each Auto is on a specific lane on a specific road.

During a job it iterates through the Autos to affect it’s Translation. To do this I need to query the Road entities to get the matching Road and Lane Identity and with that get the next Point. I pass the road objects to the job and iterate through those and this seems to work… but looping through all roads seems expensive. I just watched another ECS video and it showed me I can add an Entity as a child to an another entity. So I am trying that as well, the current Road is a Component to the Auto entity. (that comes with it’s own set of issues… oh the joy of DOTS)

Anyway, I was thinking it might be easier/quicker if the Auto entity has the current set of road/lane points on it’s own archetype, so I only have to go fetch the next series of points fewer times.

However, that is redundant data, so that’ll take some more memory. This is for a VR app, so I have memory, but more importantly I want to hear feedback on the value of the redundant vs the time it takes to get the correct; Road/Lane/Points

Thanks kindly

Redundant / duplicate data for the purposes of faster execution time. Especially when it is in a different format that allows more efficient access in different uses is generally a good pattern and very much recommended in DOTS.

Redundant data in the source authoring data (MonoBehaviour) on the other hand is a bad idea since it leads to version control conflicts, larger files, things going out of sync etc. Now that the two things are separated, it’s easy to get the best of both worlds.

5 Likes

Thank you kindly for the info.