Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a game where, based upon the visible tiles in the viewport, I need to retrieve data of items in the visible tiles. I am planning to use Javascript to AJAX request a batch based upon the visible tiles which contain image tags like Google Maps. The item information will be in JSON format.

What is the best approach to fetch the data? I currently have class I wrote in javascript which determines the visible columns/rows and offsets relative to the visible area shown. Each item is also user contributed and will be rendered in canvas or SVG layer .

share|improve this question
5  
The "best" approach would probably be one that works. What problems are you having with your current one? – Nicol Bolas Mar 28 '12 at 5:35
This is what I got as a prototype. jsfiddle.net/mac1175/p2GqB/16 – mitch Mar 28 '12 at 10:13
@NicolBolas I am trying to incorporate DOM elements in order to have some kind of backwards compatibility with older browsers (I have messed a lot with Canvas and the implementations and their performance varies, especially with mobile devices). One of the problems after I fetch the data is figuring out the offset of my items relative to the container. – mitch Mar 28 '12 at 10:17
Question subject and body talk of completely different things. – Jari Komppa Jan 8 at 10:01
Following Jari Komppa's comment, i strongly suggest a clarification in both title and body. – Vincent Piel Feb 12 at 5:47

1 Answer

I would really suggest using HTML5 for this. You can send AJAX requests using javascript, but have a much easier time displaying graphics, and making tile-based maps. It's very simple to learn once you're fluent with javascript.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.