Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411613 Posts in 69390 Topics- by 58447 Members - Latest Member: sinsofsven

May 10, 2024, 12:01:00 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Is there a limit to write data on a ini file?
Pages: [1]
Print
Author Topic: Is there a limit to write data on a ini file?  (Read 1675 times)
MaloEspada
Guest
« on: December 01, 2009, 06:08:17 AM »

I've been facing a problem for a few months and just now found the cause.
I use ini files to keep track of what rooms the player has visited, so I can use this data to display a map screen.
Whenever he enters a room, the game stores this information and when he saves, it writes the information on a .ini file.

The problem occurs after visiting a certain number of rooms: after you save the game, it instantly freezes. I've tried making alternate ways to see if it was a problem with that specific room, but it seems the problem happens after you've visited "x" rooms.

My question is, is there a limit to write data on a .ini file? Because the system works through all the game until a certain number of rooms is visited, so I can only think it has reached a limit or something.

Parts of my code below.

After saving the game:
Quote
global.data_structures_loaded=false
save_ds()
ds_list_destroy("visited")
game_save("Save.dat")

save_ds():
Quote
ini_open("E111111.dat") //this is the ini file, btw
    ini_write_string("data","visited",ds_list_write(visited))

    ini_write_real("data","room",room)
ini_close()

When loading the game, an object has this in its begin step:
Quote
if global.data_structures_loaded=false
    {
         load_ds()
         alarm[2]=2
         global.data_structures_loaded=true
    }

load_ds():
Quote
if file_exists("E111111.dat")
{
        ini_open("E111111.dat")
        if ini_key_exists("data","visited") && ini_key_exists("data","room")
        {
            visited = ds_list_create();
            ds_list_read(visited,ini_read_string("data","visited",""))
            global.myFont = font_add_sprite(font_spr, ord(' '), false, 4); //just adding the font again, ignore
           
        }
        else
            textbox(-1,bck_text,"Error! File corrupted!")
    ini_close()
}
else
    textbox(-1,bck_text,"Error! File not found!")



Any help deeply appreciated. And sorry for the confusing post..
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #1 on: December 11, 2009, 11:39:57 AM »

there is no limit to my knowledge. however, this is *not* with .ini files were intended for. use normal files instead, they're much faster. .ini files are intended for game settings, for user options and preferences, not game data like saved games or saved levels.
Logged

Tycho Brahe
Level 10
*****

λx.x


View Profile
« Reply #2 on: December 11, 2009, 02:18:41 PM »

From a technical viewpoint (correct me if I'm wrong) INI files should be just like any other windows files, which if you have a 32 bit operating system means a max size of 2gb

you SHOULD be able to write to them up until this limit...
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #3 on: December 11, 2009, 02:37:09 PM »

i also don't get why you are trying to open a .dat file as an .ini file -- game maker's .ini functions only work with the .ini file extension (to my knowledge), changing the file extension to .dat may cause problems.
Logged

pgil
Guest
« Reply #4 on: December 11, 2009, 02:59:05 PM »

I would just use a binary file for this. INI files are plain text. They're meant to be easily changed by either the user or the program. Since players don't need to edit the the map files themselves (unless they're cheating), you'd be better off using binary files.

You can make it so each byte represents a room on your list, and its value represents that room's status (0=not visited, 1=visited, etc...). Much simpler than using an ini file, and more importatnly, there's less room for error.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic