Why do games pause the game while saving the game?

Started by
22 comments, last by Nicholas Kong 10 years, 4 months ago


If I was engineering a single-threaded game, I'd keep the handler as simple as possible, or use a write with no handler and just rely on Future's isDone check once a frame.

What is a "Future's isDone check? Is it mandatory to create a thread object that can save the game state?

isDone is a method of the Future interface.

No, nothing is mandatory.

Advertisement

On desktop PCs, the buffers involved are HUUUUUUUGE, so you almost never see your file I/O block until you start getting into hundreds of megabytes worth of data. Typically, saved games will not be this large.
you mean that when you call fwrite it does not wait and can
return before the data was saved? I am not sure but always
thought that it returns after the saving

fwrite in C is buffered, you need to do a fflush on the stream to force it to write (fclose also does a fflush).

Although the OS and the disk controller also buffers data.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley


If I was engineering a single-threaded game, I'd keep the handler as simple as possible, or use a write with no handler and just rely on Future's isDone check once a frame.

What is a "Future's isDone check? Is it mandatory to create a thread object that can save the game state?

isDone is a method of the Future interface.

No, nothing is mandatory.

oh i see. thanks

This topic is closed to new replies.

Advertisement