Simple question about images directory

If I put my assets inside a folder name “images/background” and other ones in “images/icons/set1”, etc, to keep the project organized It would be limiting the performance of the App vs if I put all the images in a single folder, or in the same folder where is main.lua?

Thanks in advance
DoDi

No difference.

What is all this worry about performance?  Just make the game, then identify issues later.  

Worrying about performance early is putting the ‘cart before the horse’

While I agree with @roaminggamer in that there is no difference and that you don’t need to micro-manage performance until you hit a performance issue, getting off to a good organization from the start is a good thing.  I don’t know if doing:

images/subfolder/subfolder

is a bit too much. I tend to just dump all the art into an images folder and don’t sub-categorize further, but I can see where another level would be useful depending on the number of images.  I would definitely not dump the images in the folder with main.lua.

Rob

Yes it’s a lot of images, I think more than 300. I have 8 images sheets from 1600*900 to 2300*1400, some extra images (16) and a folder with 68 images 34 1024*1024 for @2x and 34 512*512 for the regular images.

That said, I’ve done a test placing all the images next to main.lua and it’s how best everything runs. I’m going to test what @rob says in a single folder to store everything.

TL;DR - Organize with folders to improve your dev/debug/maintenance efficiency.  It won’t affect the performance (run speed) of your game.

I didn’t say it in my last post, and I should have.

Using folders is about being organized and improving your ‘development efficiency’, ability to debug, etc.  It has nothing ( * ) to do with how fast your game will run.  

I do think it is a terrible idea to put 300 images in the same folder as main.  (I don’t even like putting icons in that folder and I was very happy when we could stop doing that for iOS.)

I would put them in a folder called images and I would also probably organize them in sub folders by general category.  Perhaps: ‘images/interface’ and ‘images/game’.  You need to develop your own org style that is meaningful to you you.

Again, this is really just about being organized in your development, debug, and maintenance.

So, why an asterisk? When one makes an absolute statement, there is always a scenario where you are wrong.  From my past experience with a dozen plus operating systems, there are scenarios where the OS performs better or worse when looking up files.  In some cases having too many files in one folder is a big negative.  In others, having really long filenames is a negative.

Having said all that, iOS and Android (as well as Windows and OS X) are modern OSes.  They do not suffer from any limits you could possibly hit with your game.  By the time you hit those limits, your game would be too big for mobile and really huge as a desktop game.

Last note.  This is a typical layout for my games and apps:

  • build.settings
  • config.lua
  • main.lua
  • Icon-*.png - Icky, but you still need to put Android icons in root folder.
  • data\ - Optional folder for text lists, databases, etc.
  • fonts\ - I hate content in root folder, so any fonts go here.
  • images\
    • ​fillW.png - 16 x 16 white fill
    • fillT.png  - 16 x 16 transparent fill
    • sub-folders as needed …
  • levels\ - Optional folder for tiled levels and images.
  • scenes\ - A folder for my composer.* scene files if I use composer.
  • scripts\
    • ​common.lua - scratchpad module used by all other game modules
    • game.lua - Core game module (usually requires others)
    • more files and folders as needed
  • sounds\
    • ​sfx\
    • music\
  • ssk2\ - SSK2 of course.
  • Images.xcassets\ - iOS Icons
  • LaunchScreen.storyboardc - iOS launch screen stuff.

@roaminggamer
Very organized! Thanks!

No difference.

What is all this worry about performance?  Just make the game, then identify issues later.  

Worrying about performance early is putting the ‘cart before the horse’

While I agree with @roaminggamer in that there is no difference and that you don’t need to micro-manage performance until you hit a performance issue, getting off to a good organization from the start is a good thing.  I don’t know if doing:

images/subfolder/subfolder

is a bit too much. I tend to just dump all the art into an images folder and don’t sub-categorize further, but I can see where another level would be useful depending on the number of images.  I would definitely not dump the images in the folder with main.lua.

Rob

Yes it’s a lot of images, I think more than 300. I have 8 images sheets from 1600*900 to 2300*1400, some extra images (16) and a folder with 68 images 34 1024*1024 for @2x and 34 512*512 for the regular images.

That said, I’ve done a test placing all the images next to main.lua and it’s how best everything runs. I’m going to test what @rob says in a single folder to store everything.

TL;DR - Organize with folders to improve your dev/debug/maintenance efficiency.  It won’t affect the performance (run speed) of your game.

I didn’t say it in my last post, and I should have.

Using folders is about being organized and improving your ‘development efficiency’, ability to debug, etc.  It has nothing ( * ) to do with how fast your game will run.  

I do think it is a terrible idea to put 300 images in the same folder as main.  (I don’t even like putting icons in that folder and I was very happy when we could stop doing that for iOS.)

I would put them in a folder called images and I would also probably organize them in sub folders by general category.  Perhaps: ‘images/interface’ and ‘images/game’.  You need to develop your own org style that is meaningful to you you.

Again, this is really just about being organized in your development, debug, and maintenance.

So, why an asterisk? When one makes an absolute statement, there is always a scenario where you are wrong.  From my past experience with a dozen plus operating systems, there are scenarios where the OS performs better or worse when looking up files.  In some cases having too many files in one folder is a big negative.  In others, having really long filenames is a negative.

Having said all that, iOS and Android (as well as Windows and OS X) are modern OSes.  They do not suffer from any limits you could possibly hit with your game.  By the time you hit those limits, your game would be too big for mobile and really huge as a desktop game.

Last note.  This is a typical layout for my games and apps:

  • build.settings
  • config.lua
  • main.lua
  • Icon-*.png - Icky, but you still need to put Android icons in root folder.
  • data\ - Optional folder for text lists, databases, etc.
  • fonts\ - I hate content in root folder, so any fonts go here.
  • images\
    • ​fillW.png - 16 x 16 white fill
    • fillT.png  - 16 x 16 transparent fill
    • sub-folders as needed …
  • levels\ - Optional folder for tiled levels and images.
  • scenes\ - A folder for my composer.* scene files if I use composer.
  • scripts\
    • ​common.lua - scratchpad module used by all other game modules
    • game.lua - Core game module (usually requires others)
    • more files and folders as needed
  • sounds\
    • ​sfx\
    • music\
  • ssk2\ - SSK2 of course.
  • Images.xcassets\ - iOS Icons
  • LaunchScreen.storyboardc - iOS launch screen stuff.

@roaminggamer
Very organized! Thanks!