0

I'm developing a game where the main element of gameplay is an image of 2400x1600 pixels. So we are having some discussion about what's the best approach we could follow and confirm that we are not missing anything in order to download the image from the server and get it displayed on the device. So we thought about the different approaches and see what everyone else's thoughts are. I would really appreciate if you can list another approach you can think of. Before getting into the approaches themselves, some things that we need to take for granted:

  1. User experience since gameplay started should be smooth. This made us get rid of one possible approach that was to implement it like Google Maps i.e. downloading tiles from the server as the user pans/zooms the map since there will be for sure some delay until the tile is finally displayed.

  2. Images cannot be shipped within the binary file since they will be updated frequently.

  3. All the tiles of each image weight around 6MB

So possible solutions we see so far:

  1. Download and tiling the images in a background process/task all at once as they get updated. The big loading time here will be the first time the user launches the app. Images don't get updated together neither very frequently - one day minimum.
  2. From the moment the user gets to the screen to select the image to play, start the process of downloading and tiling. User can select between 2 pictures only.
  3. If user is on WiFi, use solution 1. If user is over cellular network then use solution 2.

Thanks in advance.

mdonati
  • 1,049
  • 11
  • 24
  • Check out the new `NSURLSessions`. You can do a lot with them. For a starting point, look at this comprehensive tutorial : http://mobile.tutsplus.com/tutorials/iphone/networking-with-nsurlsession-part-1/ – Sam Fischer Jan 28 '14 at 21:14
  • Great tutorial. Thanks for pointing this out. I'll need to make some tests before accepting this. – mdonati Jan 29 '14 at 03:02
  • I've added it as an answer. Hope it helps. :) – Sam Fischer Jan 29 '14 at 04:48

2 Answers2

0

Use SDWebImage. It provides a ton of features for caching images, downloading in background, and much more.

WrightsCS
  • 50,551
  • 22
  • 134
  • 186
  • This seems to be a great library. Same as NSURLSessions, I'll need to make some tests and see how it performs before accepting this as an answer. – mdonati Jan 29 '14 at 03:03
0

The NSURLSession class in iOS 7 is well-suited for your needs. It allows for background downloads, resuming and pausing downloads, and is heavily customisable.

Now, I know this is a little vague, so here are some great references to start with :

Sam Fischer
  • 1,442
  • 19
  • 35