Hi, I am coding a map engine and my first approach was to use arrays to hold the tiles information, preferable 2 dimension arrays. Unfortunately there are several layers to the map. Like layer 1 would be ground tiles, then 2 would be like shadows, and so on. I have up to 15 layers with individual tile information. Btw, each layer would get its own database row (mysql).
Second approach was to make the whole thing one big 3 dimension array. When I did that, it turned out that the amount of text for the array wouldn’t even fit in the text field in the mysql database 🙁
Third approach was to build the map with xml and use the markup language to define each attribute to each tile...
<tile>
<id>1</id>
<tile>grass.gif</tile>
<shadow>tree1shadow.gif</shadow>
</tile>
Something like that. However I ran into the same problem as the 3D array...WAY to big. And not only that, it took php to the point of a 'ive been running to long' error to parse the whole thing.
SO, if any of you out there have any suggestions to how I should go about storing or creating this project it would be greatly appreciated 🙂
Some Other info that might be helpful:
- MySQL
- PHP 5
- Map size is 32x32 tiles and max width/height is still undetermined (limited by how big the array will be or whatever I use)
- Users will only see a portion of the map at a time, again, that’s undetermined
- AJAX for movement and combat and whatnot