Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualKhatharr

Posted 05 May 2013 - 11:53 PM

Another way is: instead of storing entities by location have each entity store its own location and simply store them in an agnostic container. Pick a container that will allow you to quickly locate entities matching a position through iteration.

 

Which method is better depends on what you're doing. Having entities store their own location means that isolating all entities in a specific location takes longer. Having locations store more than one entity means iterating through all entities takes longer.

 

There's also the possibility of hybridization. That is, have a master list of entities which are aware of their own location and also retain a 2D array of containers that point to all entities that occupy each location. This is the most expensive in terms of storage and architecture but has the best access time for any method.


#2Khatharr

Posted 05 May 2013 - 11:01 PM

Another way is: instead of storing entities by location have each entity store its own location and simply store them in an agnostic container. Pick a container that will allow you to quickly locate entities matching a position through iteration.

 

Which method is better depends on what you're doing. Having entities store their own location means that isolating all entities in a specific location takes longer. Having locations store more than one entity means iterating through all entities takes longer.

 

There's also the possibility of hybridization. That is, have a master list of entities which are aware of their own location and also retain a 2D array of containers that point to all entites that occupy each location. This is the most expensive in terms of storage and architecture but has the best search time for any method.


#1Khatharr

Posted 05 May 2013 - 11:00 PM

Another way is: instead of storing entities by location have each entity store its own location and simply store them in an agnostic container. Pick a container that will allow you to quickly locate entities matching a position through iteration.

 

Which method is better depends on what you're doing. Having entities store their own location means that isolating all entites in a specific location takes longer. Having locations store more than one entity means iterating through all entities takes longer.

 

There's also the possibility of hybridization. That is, have a master list of entites which are aware of their own location and also retain a 2D array of containers that point to all entites that occupy each location. This is the most expensive in terms of storage but has the best search time for any method.


PARTNERS