L
L
Legebocker2017-08-16 16:22:52
Programming
Legebocker, 2017-08-16 16:22:52

How to make saves in the game?

How to make saves in the game? Let's say the player survived the night and the game was saved. How should this be done?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Maxim Timofeev, 2017-08-16
@webinar

Do you have any problems with the rest of the game development? In my opinion, you started on the wrong side.
But in general, we determine what to store, how to store and store. In the case of a game on the web, this can be localStorage or a database on the server and a config for recovery in the form of json, for example. On the desktop, this will be a file, at least txt. There are more options on the desktop, so without specific initial data, it is unlikely that they will advise something.

T
twobomb, 2017-08-16
@twobomb

Well, you save all the necessary data (time, player position, hp, etc.) for example in an xml file and that's all. Well, what language do you write in, or what engine do you use. It's just that the engine may already have everything to save and not have to reinvent the wheel.

A
Alexander Ter, 2017-08-16
@alexsandr0000

There are many tools, but which one to use depends on the task. From your question, the details of how much information should be stored, how often inf. will be saved, etc.
To save, you can use:
- streams and directly write binary or text data to a file, probably the fastest way, but there may be problems with access if the file is opened in exclusive mode or the write is performed. from multiple streams;
- serialization of objects in xml, json, a slower way (although in fact it is still the same write to disk), but it is easier to implement than creating your own data structure for storage;
- saving in the database (sqlite and co);
- saving on the server, but there are still a lot of ways.
I can advise you to take a sheet of paper and a pencil and try to formalize your thoughts on paper.

D
devalone, 2017-08-16
@devalone

Well obviously save what needs to be restored next time you start

A
Amfore, 2017-08-16
@Amfore

Saving game data to file
Save and load system, in the game
Here is the Unity3D implementation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question