Godot Version
4.5
Question
So I am working on a JRPG with a LOT of story variables, majority of them booleans. To make saving and loading simple, I have the data resource full of those variables which are accessible via an autoload Data node. (The data resource just sits on the node, and isn’t saved to an actual file until you’re saving, and at that point it’s a duplication of the current data rather than assigning it.)
Do we know for sure if there is a performance hit if I have a ton of variables? If there is I’m willing to move it all to a Dictionary[String, bool] inside that data resource, but I really really like being able to use the autocomplete/intellisense when accessing story variables.
The data file’s code is below. Take notice underneath where it says Story Flags, later on there will be a TON of variables there for story progression.
class_name DataFile
extends Resource
#Routine Information
@export var current_map:String
@export var player_location:Vector2
@export var items:Array[int]
@export var item_quantities:Array[int]
@export var weapons:Array[int]
@export var weapon_quantities:Array[int]
@export var armors:Array[int]
@export var armor_quantities:Array[int]
@export var actors:Array[PackedScene]
@export var party:Array[int]
@export var actor_info:Array[Dictionary]
@export var quests:Array[Quest]
@export var bgm_track_path:String
@export var bgm_volume:float
@export var sfx_volume:float
#Story Flags
@export var first_cutscene:bool
@export var first_battle:bool
@export var first_armor_cutscene:bool
@export var first_outside_cutscene: bool
@export var switches:Dictionary[String,bool] = { #This was me testing if there is intellisense when using a typed dictionary... there is not :(
"first_outside_cutscene" : false
}