Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

The key phrase you're looking for is game state serialisation.

Game state is what it says. Your game has some sort of structure to keep the current state of the game. In an RPG game, you want to store the list of quests the player is on, how far they are into those quests and what their characters' stats are.

Serialisation is the reversible conversion of a data structure and its contents into a storeable format. You can find serialisers for various languages. The key here is reversible. The serialised program state can be used to sufficiently completely restore a program's state. Just for tasters, here's a Java explanationhere's a Java explanation and a list of Lua implementations.

If your game state is fairly simple, you might want to write your own serialiser for the data. As a trivial example, consider a boring game in which a player is able to move on a 2D plane. They have coordinates x and y. To serialise the game's state (the x and y) you could simply write them onto two lines of a text file. To restore the game state, read the text file and parse the first two lines into numbers that you assign to the variables x and y.

The key phrase you're looking for is game state serialisation.

Game state is what it says. Your game has some sort of structure to keep the current state of the game. In an RPG game, you want to store the list of quests the player is on, how far they are into those quests and what their characters' stats are.

Serialisation is the reversible conversion of a data structure and its contents into a storeable format. You can find serialisers for various languages. The key here is reversible. The serialised program state can be used to sufficiently completely restore a program's state. Just for tasters, here's a Java explanation and a list of Lua implementations.

If your game state is fairly simple, you might want to write your own serialiser for the data. As a trivial example, consider a boring game in which a player is able to move on a 2D plane. They have coordinates x and y. To serialise the game's state (the x and y) you could simply write them onto two lines of a text file. To restore the game state, read the text file and parse the first two lines into numbers that you assign to the variables x and y.

The key phrase you're looking for is game state serialisation.

Game state is what it says. Your game has some sort of structure to keep the current state of the game. In an RPG game, you want to store the list of quests the player is on, how far they are into those quests and what their characters' stats are.

Serialisation is the reversible conversion of a data structure and its contents into a storeable format. You can find serialisers for various languages. The key here is reversible. The serialised program state can be used to sufficiently completely restore a program's state. Just for tasters, here's a Java explanation and a list of Lua implementations.

If your game state is fairly simple, you might want to write your own serialiser for the data. As a trivial example, consider a boring game in which a player is able to move on a 2D plane. They have coordinates x and y. To serialise the game's state (the x and y) you could simply write them onto two lines of a text file. To restore the game state, read the text file and parse the first two lines into numbers that you assign to the variables x and y.

Source Link
Anko
  • 13.5k
  • 10
  • 56
  • 82

The key phrase you're looking for is game state serialisation.

Game state is what it says. Your game has some sort of structure to keep the current state of the game. In an RPG game, you want to store the list of quests the player is on, how far they are into those quests and what their characters' stats are.

Serialisation is the reversible conversion of a data structure and its contents into a storeable format. You can find serialisers for various languages. The key here is reversible. The serialised program state can be used to sufficiently completely restore a program's state. Just for tasters, here's a Java explanation and a list of Lua implementations.

If your game state is fairly simple, you might want to write your own serialiser for the data. As a trivial example, consider a boring game in which a player is able to move on a 2D plane. They have coordinates x and y. To serialise the game's state (the x and y) you could simply write them onto two lines of a text file. To restore the game state, read the text file and parse the first two lines into numbers that you assign to the variables x and y.