But you must load the file in the same order you saved it and need to encode certain variable types appropriately.īelow, you’ll find an example of saving character data to binary. To further slow them down while reverse-engineering your data format, you can save and load data in a particular order and omit variable names in the file.īinary also creates small and compact files since it takes out all the extra characters text-based files require for parsing. Programmers or people who are savvy with hex editors can figure out your system with some patience. They convert values to chains of ones and zeros.īinary makes it harder for most people to use the data, although some still can. To do so, you will use the store_*() functions in Godot’s File class. If you want to prevent players from reading the saved data, whether it’s to slow down cheating or data mining, you should use binary files. Preventing players from reading the saved data For example, if the player can draw a flag in-game and you want to save that image to the disk, it should be separate from the savegame.Įither that or you would have to create a tool for your player to see and edit the data. If you must store complex binary objects, you should store them separately to keep the text file lightweight and editable. Anyone can open such a file in a text editor to see and edit the data in a text editor. If you want your players to either read or edit savegames, your file format should be text-based. What are the pros and cons of each of these formats.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |