
May 2nd, 2003, 07:16 PM
|
|
Junior Member
|
|
Join Date: May 2003
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Data manipulation algorithm
Hello everybody. I'm currently developing a space exploration game project and I need some help.
Here is the situation :
I have a 3D cubic universe that is divided into cells. Each cell have a fixed size. Two cells are not necessarly side by side ( in a two cells universe, you can have one at (0,0,0) and another at (20,20,13)). The universe don't have a fixed size. The cells can have negative coordinates.
Roughly, I need a way to manage the cells in memory and on the disk. On the disk, it's not too bad, i can store them in a file easily.
But I need a fast way to manipulate the cells in memory. I've thought about a tridimensional array, but my universe can be almost empty, so the ressource cost will be useless. I've thought about octrees, but the whole system is too much complex and I think that there is another possibility. So I thought about a hash table with the coordinates of the cell for key.
here is what I'm asking :
If anybody can explain me the way a hash table can be implemented manually, or if someone have some documentation about it, please, drop me a line. I've used hash tables in Perl and in PHP, but I'm programming in Delphi and it's not built-in
Thanks a lot in advance,
Blaise Bernier
URL
|