I'm creating a 2D game in plain ANSI-C using SDL2. I'm planning to let users create their own graphics. So, to achieve this, I'll use an information file which will hold some data such as Width, Height, X and Y position of each frame. But I have two views of this. One is to use a single file which will hold the information of all graphics. The other is to use one file for each graphic. Which one is faster and cleaner? Or it's just the same?
Use one or multiple files for graphics properties?
c
Using one file is cleaner, but also, files have to take up a minimum space (On my disk, 16kb, this is called the cluster size). So if you're creating lots of small files, even if each one is only one byte long, if you have 1000 files, that's nearly 16 megabytes!It depends on the size of the files stored with each graphic, to summarize:Multi-File advantages:A corrupted file will not effect all graphics. You don't need to search for the part of the file you want. Clearer codeSingle file advantages:You don't have issues with cluster sizePotentially faster accessing as you don't need to open multiple filesIt also depends if this information will be streamed, or read once at startup. If it's read once at startup, then speed of accessing doesn't matter so much. Personally, if you're going to end up with lots of really small files, I'd go with one larger file, but if you're going to end up with less files of more reasonable sizes, I'd go for a file per graphic