Snapshots in QB64?
#2
(02-15-2023, 03:03 AM)40wattstudio Wrote: Recently I've been learning about saving data in games. It seems like most games only save the variables that have changed during the course of gameplay. But with this method you have to specify which variables get saved and that can be an extremely long list to keep track of.

So my question is: I've heard about some games using snapshots (hoping that's the right term), where instead of saving just a handful of variables, it saves the entire state of the entire game at that moment so it can be loaded later. Is there a way to do that in QB64? Though I've never used them before, I'm aware of all the _MEM commands and I imagine it can be done using those, but I have no clue how to do so and haven't seen any practical tutorials.

As a game writer the way I would approach this would be to create a global UDT that contains values relating to the current state of the game. Something like:

TYPE GAMESTATE
    CurrentScore AS LONG
    PlayerHealth AS INTEGER
    EnemiesRemain AS INTEGER
    PlayerLocationX AS INTEGER
    PlayerLocationY AS INTEGER
    etc..
    etc..
END TYPE

DIM GameState AS GAMESTATE

Then, if the player wished to load a saved gamed the values in GameState could be loaded from a file and the values distributed out where needed. In my opinion a game would need to be designed from the onset with saved game states in mind.

As far as snap shots? Well, you would still be doing the same thing, saving the states of all variables. I see what you are getting at though, sort of like saving the state of a VM in Virtualbox instead of shutting the virtual PC down. I would have no clue how to do that however with QB64.
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply


Messages In This Thread
Snapshots in QB64? - by 40wattstudio - 02-15-2023, 03:03 AM
RE: Snapshots in QB64? - by TerryRitchie - 02-15-2023, 03:51 AM
RE: Snapshots in QB64? - by 40wattstudio - 02-15-2023, 02:48 PM
RE: Snapshots in QB64? - by TerryRitchie - 02-15-2023, 06:35 PM
RE: Snapshots in QB64? - by bplus - 02-16-2023, 01:50 AM
RE: Snapshots in QB64? - by 40wattstudio - 02-16-2023, 02:24 AM
RE: Snapshots in QB64? - by TerryRitchie - 02-16-2023, 03:24 AM
RE: Snapshots in QB64? - by SMcNeill - 02-16-2023, 04:17 AM
RE: Snapshots in QB64? - by 40wattstudio - 02-16-2023, 10:57 AM
RE: Snapshots in QB64? - by mnrvovrfc - 02-16-2023, 01:38 PM
RE: Snapshots in QB64? - by SpriggsySpriggs - 02-17-2023, 05:38 PM
RE: Snapshots in QB64? - by TempodiBasic - 02-19-2023, 10:38 PM



Users browsing this thread: 1 Guest(s)