Jump to content
  • Advertisement
Sign in to follow this  
ElCas

how to convert a 2D dynamic Matrix to an array or DB Table

This topic is 2572 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

I have a location map and I have created a 2D Matrix based on the currently existing entries where each rows and cols are the names of the location and the cell value are the number of hops to that destination. This matrix will shrink and grow as I add and remove locations from the DB.

Loc1|Loc2|Loc3|Loc#|
Loc1| 0 | 2 | 1 | # |
Loc2| 2 | 0 | 1 | # |
Loc3| 1 | 1 | 0 | # |
Loc#| # | # | # | # |

I figured could create a table with locations and number of hops and just create an entry for each possible combination but that would quickly eat up memory or HDD space as the list grows
i.e.
Distance
{
Origin
Destination
Hops
}

My question is, Is there a way to accomplish this more efficiently? The game is web-based so I want to find a solution that will not kill my bandwidth as users make their selections and attempt to find the quickest route to take to their final destination.

Share this post


Link to post
Share on other sites
Advertisement
How frequently does your data change and how many locations will you have(10s? 100s? 1000s?)?

edit: You could probably generate it with a view, but I have to imagine it would be expensive. Unless your data is changing constantly I do not see storing the distance matrix on the db being the most efficient way to do it.

Share this post


Link to post
Share on other sites

How frequently does your data change and how many locations will you have(10s? 100s? 1000s?)?


Currently there are 15 locations and I don't see it changing that often for now. I just want to have a system in place for future growth.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!