1
\$\begingroup\$

There have been a lot of word games (apps) lately and some use graphics but others use photographs and I was hoping that someone could explain how these games manage to get so many photos in an app without taking up huge amounts of memory?

The easiest example I can give is an app called '4 pics 1 word' it has over 350 levels and obviously 4 pics on each level and the photos are good quality on retina screens but the memory of the app is less than 40mb, if I have remembered correctly. I was curious as to how this works, is it each photo being optimized in photoshop (save for web and devices) (png or jpeg) or is it something to do with the code or something else?

I know this question is quite broad but any answers, help, links to anything would be greatly appreciated.

\$\endgroup\$
2
  • \$\begingroup\$ Another, perhaps more pertinent question is where did all the pictures originally come from in order to make sure that there was no copyright infringement. Thats alot of photos to take yourself. \$\endgroup\$
    – RobCurr
    Feb 28, 2013 at 20:05
  • \$\begingroup\$ They came from an image library called fotolia but I think the developers must have had a deal with fotolia. I have read the terms and condition and to use the photos commercially at least you have to buy them, so either they bought all the photos they used or had some sort of deal with fotolia to use the images. There are some public domain photo libraries, which let you use all the photos there for free, but some photos may require a credit of some kind (name of person who took the photo or the website you got it from). \$\endgroup\$
    – Hunter
    Feb 28, 2013 at 22:18

4 Answers 4

4
\$\begingroup\$

It's probably mostly a matter of being smart with 1) unloading of assets when no longer needed and 2) threaded loading of assets (if necessary, sometimes you can hide loading hitches behind "loading" screens). You likely don't have all the images loaded in memory at once.

That being said, the on-disk space is pretty irrelevant when it comes to in-memory size. See this answer: https://gamedev.stackexchange.com/a/48311/51

\$\endgroup\$
1
  • \$\begingroup\$ Thanks the link you posted really helped explain things, thanks. \$\endgroup\$
    – Hunter
    Feb 28, 2013 at 11:08
1
\$\begingroup\$

One other possibility: The game has network communication access. Here's the Google Play store page for 4 Pics 1 Word. It has the following permissions:

NETWORK COMMUNICATION FULL NETWORK ACCESS Allows the app to create network sockets and use custom network protocols. The browser and other applications provide means to send data to the internet, so this permission is not required to send data to the internet.

So maybe it's downloading images while you play.

\$\endgroup\$
1
  • \$\begingroup\$ I thought about that but then I realized that'd kill all offline play. \$\endgroup\$ Feb 28, 2013 at 2:08
0
\$\begingroup\$

If you mean download size when you say "memory" then the answer is that jpegs at that size can be quite small, especially if you don't use the maximum quality setting.

It's also possible they share images between levels to save space.

\$\endgroup\$
0
\$\begingroup\$

I see a few possibilities here. You mentioned that the app is less than '40MB in memory' which implies you know the amount of memory its consuming - but I'm going to go ahead and assume you actually meant the package is 40MB.

Without knowing the exact internal workings, I'd take a gander at the fact that a simple JPG of only 200px200px can be quite small - around 30 kilobytes if optimized properly. If we do a bit of math, this doesn't seem so unreasonable.

350 levels * 4 per level * 50 size of pictures per level = 70000 kilobytes

70000 / 1000 = 70 megabytes uncompressed

This is uncompressed which of course when it's shoved into a package will shrunk from all sorts of fancy tricks.

50 kilobytes can be quite large however, and it's defintely not a fair representation neccesairly. Take this picture:

http://upload.wikimedia.org/wikipedia/en/d/d0/Ofa_logo_low_res.jpg enter image description here

It's approximately 44KB - now run it through Photoshop with some optimizations.

enter image description here

Whoa, 6 kilobytes!

Lets run through our math again... yup. The entire thing would fit into 8.4MB (350 * 4 * 6 / 1000). This trick can apply to even higher resolution images as well - the game in particular relies on a lot of photographs which JPGs can compress well as it's lossy and still look great.

\$\endgroup\$
3
  • \$\begingroup\$ What your saying makes sense but the only thing I am still wondering is the quality of the image (in your example) has decreased dramatically while in the game the images are clean and crisp and not really pixelated. The theory of what your saying makes sense and the example helped, thanks for the response and effort. \$\endgroup\$
    – Hunter
    Feb 28, 2013 at 16:28
  • \$\begingroup\$ What he said though was that real life pictures tend to look better than computer generated images when compressed with jpeg. It has to do with the lossy compression, lines and hard edges tend to cause alot of noise which gets washed out in a photo but not so much in an image with lots of nice even gradients. \$\endgroup\$
    – RobCurr
    Feb 28, 2013 at 20:02
  • \$\begingroup\$ @Hunter Yes, the example is a bad one since the gradient is a pretty harsh but the concept applies. Take your favourite Photograph and scale it down - you'll see that since there's some noise it scales down quite nicely in fact. \$\endgroup\$ Mar 1, 2013 at 0:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .