Jump to content
  • Advertisement
Sign in to follow this  
VertPingouin

Game directory data structure

This topic is 1355 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone,

 

I was trying to implement some sort of global directory for my game where all actors are registered with some tags.

For example, all objects I need to update over timùe are tagged UPDATABLE, ennemies are tagged too... so with a simple getbytag function, I can get an iterable list of these, or single.

 

Groups are pre constructed when objects are registered to improve speed as I'm in python and it works pretty well.

 

But now, I wan't to implement a positionning grid and add some functions like :

  • is_there_a(tag, direction distance) (returns True if there is an object with tag within a direction in a certain distance)
  • get_the_nearest(tag, direction, distance) (returns gameobject)

But I'm stuck with my first implementation, I had a dictionnary by object and a dictionnary by tag, but If I add a position criteria, it's naturally getting more like a relationnal database. Besides, I'll need to update positions maybe 2 or 3 times by seconds. Could be a performance bottleneck for sure...

 

My question is what data structure to use in this case.

Maybe sqlite living in memory but in this case I've no idea how to store an object refernce in it, and no idea whatsoever of the perfs...

 

Thanks in advance for your answers !

Share this post


Link to post
Share on other sites
Advertisement

For what I've tried, sqlite in memory seems affordable.

For 50 objects I get the nearest object with a certain tag : results are thrown in less of 1/100 seconds.

So doing it 2 or 3 times by seconds won't be an issue.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!