As far as I know GDScript only has a signed 64bit integer type. I want to make an editor for my game because data needs to be loaded. Can I just store things in 64bit blocks? and what order is it with respect to the file position, increasing or decreasing?
In what order does Godot read bytes in a binary file
I use the ConfigFile class for this purpose. The data that's saved and loaded is kept in a Dictionary. It works, and I don't need to be concerned about how the data is read and written at a low level.
I want to edit my file with an external editor
- Edited
Okay.
If you make successive calls to the File class's method store_64(), I would expect the values to be stored in the file in the expected manner. You could easily try it to check. https://docs.godotengine.org/en/stable/classes/class_file.html#class-file-method-store-64
- Edited
Byte order in Godot is little-endian by default, but you can change it to big-endian in the File class by setting the endian_swap
property to true
. (Big endian mode was removed in Godot 4.0 as it's no longer relevant nowadays, with all common CPU architectures being little-endian.)