XpertWorlock Posted January 6, 2009 Share Posted January 6, 2009 I'm hoping to use AJAX technology to try and build a game. The map will be built on a X/Y axis. I'm hoping for on the fly loading, instead of loading the entire map (which seems pointless on a big map) Now let's say you get close to the edge of "your" viewable map, instead of querying the database for the information and relaying it back, could it be less straining and maybe faster if the information was retrieved from an XML file? or maybe multiple XML files? Quote Link to comment Share on other sites More sharing options...
Philip Posted January 7, 2009 Share Posted January 7, 2009 Using xml would probably be better in this case - unless you were interacting with other users, then it could get complicated and I would switch to database. Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted January 7, 2009 Share Posted January 7, 2009 Depends on the amount of data that you are retrieving and what is in the xml/database. If you have a huge map with tons of data cramming it all in a xml file would just slow things down. Is the database or xml suppose to store links of image segments that will be shown on the map? Quote Link to comment Share on other sites More sharing options...
Philip Posted January 7, 2009 Share Posted January 7, 2009 If you have a huge map with tons of data cramming it all in a xml file would just slow things down. Thats why you could break it up into sections, not all into one file. Quote Link to comment Share on other sites More sharing options...
XpertWorlock Posted January 7, 2009 Author Share Posted January 7, 2009 The only way I could see it work correctly with XML, is if there were multiple XML files, that way if there were 5000 people all on at the same time, they wouldn't all be accessing the same XML file? The best way would be to have the XML file tell you what it's going to be and than have the javascript load the image at the correct spot......? Quote Link to comment Share on other sites More sharing options...
Philip Posted January 8, 2009 Share Posted January 8, 2009 Yeah, that's what I would do. I'm no server load guru or anything, but it would make sense to split it up. Like you said, if you have 5000 users, its highly unlikely that they will be loading the same file at the same time. Whereas with mysql, you could run into a 'too many connections' error, even if they aren't loading the same part of the map. I'd recommend putting something like 9 squares of the map in each xml file (you decide how big the squares are) - that way when the user walks into an outside square you know which direction they are heading and you can preload the next images. Example (look at your numpad): 1 2 3 4 5 6 7 8 9 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.