• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

INI File Size Limit and Compatibility

B

BitRoarGames

Guest
Version: Game Maker Studio 2 Full - IDE v2.2.1.375 - Runtime v2.2.1.291

Hello! I'm currently developing a game with a pixel by pixel character creator and need to log every pixels x, position, y position, and color however, I have read that .INI files have a 64KB limit of the data they can store. This may present a problem for me.

Also, I'm not sure if this is allowed to be answered here but I'd like to make this game compatible with the PS4 and Nintendo Switch platforms for future purposes and would like to avoid any functions that may cause incompatibility with these platforms. I'd like to know if .INI can even be read for save files on those platforms and maybe find some information on the compatibility of .zip files. Thank you!
 
B

BitRoarGames

Guest
INI files have limits?
"INI files are small, lightweight files which are compatible with most platforms. They are ideal for storing small pieces of information, like interface preferences, local high scores, level data etc... and as such are a great and easy way for you to start saving information from your games. However, it is worth noting that they do have a limit on the data they can store, which is a maximum of 64KB, so if you are saving things like Data Structures, you may wish to look at some of the other file functions like TEXT FILES."
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
If you are saving pixel-by-pixel data, why not use a buffer? It's made for such things
 
B

BitRoarGames

Guest
If you are saving pixel-by-pixel data, why not use a buffer? It's made for such things
I have never used buffers or learned much about them. I've used .ini files and text files. Considering multiple characters can be created and saved, I'm not sure if buffers would be the right way to go about this or not. Essentially, I just create a .ini file, encrypt it with a basic encryption method and rename the extension to .cchar.
 
D

dannyjenn

Guest
The problem with *.ini is that it has a lot of unnecessary text and stuff in it, which inflates the file size and increases the loading time. Even text files are often larger than they need to be. You're better off using bin files. Or buffers, as YellowAfterlife suggested. (Buffers are newer so I haven't worked with them much, but they seem to be the way to go.)

But if you only need each pixel's x, y, and color, with no additional data, you could simply use a surface. (However, a surface would be a bad idea if you need to be able to quickly access those color values, because draw_getpixel() is slow...)

As for compatibility with PS4 and Switch, I have no idea. Sorry.
 
Last edited by a moderator:

SeraphSword

Member
If .ini isn't big enough you can look up Shaun Spaulding's tutorial on using JSON save files, which can be as big as you want I believe. I can't post links, but it's called "Gamemaker - Better Saving & Loading (JSON)". It took me a bit to wrap my head around it, but it seems to be pretty effective, and it involves buffers as people have mentioned.
 

Binsk

Member
As YellowAfterlife has said, a buffer is a better idea. Half of programming is about learning and researching so if you want to be a programmer learning how to use buffers shouldn't scare you. They are really quite easy and very efficient.

Secondly, buffers have a built-in save / load method so you don't even have to worry about formatting a file nicely and reading it back in. It just takes one function call.

Thirdly, they don't have the ini file limit and are significantly smaller in size to begin with because they don't have all the bloat.

Fourthly, there are built in encoding and compression tools for the buffers.
 
Last edited:
B

BitRoarGames

Guest
Thank you guys for the suggestions! I'd love to look in to buffers but as I've stated before, I need to know ahead of time if consoles would accept that save format. I'm not sure about .ini files or buffers but I'm fairly certain nearly every platform accepts text files and I'm seriously considering using them for compatibility purposes unless anyone knows whether or not PS4 and Nintendo Switch would accept buffer saving and loading. Thank's again guys!
 

Pfap

Member
I'm not an expert, but if compatibility across all platforms is your goal then yes you will need buffers as they are needed for the html5 export if loading and saving from a server... I've never actually done the previously mentioned, but have been scouring the manual lately. The buffer functions will work for all platforms however, and you can actually save a buffer into a text file. I actually don't think there is such a thing as a buffer file... as a buffer is just a space in memory to hold data and all platforms support holding data in memory. I think binary files are only supported on the desktop platforms and I have not learned any good rules for picking buffer sizes as far as the amount of bytes to allocate... but, it would be a safe bet to use buffers even if the manual does not explicitly state they are for use with the console exports.
 

TheouAegis

Member
A buffer is just raw 8bit data. The file you save a buffer to isn't even normally readable without a hex editor, so it's a tad more secure too. Since it is just raw 8bit data, it's compatible with ALL platforms.

The only data you need to store is the size of the sprite, the pixel colors, and other sprite properties like origin and bounding box offsets (if you allow them).

At the most basic level, it would just be 1 byte for the width, 1 byte for the height, and 1 byte for each color. This would allow for a 256x256 sprite using up to 255 colors with transparency. If you don't want to restrict the palette to 255 colors, you will need to store each pixel's color in either BGR or RGB format, with either 15 bits per color (2 bytes each) or 24 bits per color (3 bytes each).

There are lots of other things you could do with it. Read the official documentation on GIF files as an example. lol
 

SeraphSword

Member
RE: Consoles, the JSON/buffer stuff I mentioned was specifically developed with consoles and other platforms in mind. It was used in Sword of Ditto, which is on PS4 and Switch. You can find JuJu Adams's talk on Youtube about it if you want.
 
Version: Game Maker Studio 2 Full - IDE v2.2.1.375 - Runtime v2.2.1.291

Hello! I'm currently developing a game with a pixel by pixel character creator and need to log every pixels x, position, y position, and color however, I have read that .INI files have a 64KB limit of the data they can store. This may present a problem for me.

Also, I'm not sure if this is allowed to be answered here but I'd like to make this game compatible with the PS4 and Nintendo Switch platforms for future purposes and would like to avoid any functions that may cause incompatibility with these platforms. I'd like to know if .INI can even be read for save files on those platforms and maybe find some information on the compatibility of .zip files. Thank you!
As someone already recommended, using binary file writing would be to your advantage, or as others have suggested JSON files ( which I need to investigate , since I know nothing about it ). I would avoid using .INI files, unless you know that your data file will be a size that is exactly 64kb or less, every time. The problem with using files on consoles, is that consoles ( varying by brand name ) define how much storage space you are allowed and how big of a file you can create, for uniform compatibility for all console setups of a brand name, of that model. So if a file exceeds a certain size in run time, the game might become unstable in run times after that.
 
Last edited:

SeraphSword

Member
As someone already recommended, using binary file writing would be to your advantage, or as others have suggested JSON files ( which I need to investigate , since I know nothing about it ). I would avoid using .INI files, unless you know that your data file will be a size that is exactly 64kb or less, every time. The problem with using files on consoles, is that consoles ( varying by brand name ) define how much storage space you are allowed and how big of a file you can create, for uniform compatibility for all console setups of a brand name, of that model. So if a file exceeds a certain size in run time, the game might become unstable in run times after that.
If you want to know more about JSON saves, these are the videos I was referencing (I have enough posts now that I can add links):
www.youtube.com/watch?v=QmxQb1BFQRE

www.youtube.com/watch?v=Uj7nr6vSRvs
 

TheouAegis

Member
Except in this case he doesn't need the data to be human-readable. What does it matter to a human what color each pixel is defined as in the JSON file? lol That's just a whole lot of wasted space and time. He should still read up on them for when he actually does have use for JSON, but for defining sprites he may as well use buffers and .bin files and keep his files concise.
 
B

BitRoarGames

Guest
I decided to go with the JSON method and after a night of studying up on them and watching some tutorials, I got it just fine. I changed my original character import and export functions to reflect this. Everything is working like a charm and should now be better suited for export across all platforms. Thank you guys for all the recommendations! Now I just need answers on some console functions but that's probably better left for another post.
 
Top