When variables are declared for a sprite, is there a way to force the type? e.g. Make a bool for something which is only returning true/false or a short int for something which you know will only have a small value. Can this also be done for scene and global variables?
For now, there is only two types of variables : strings ( texts ) and numbers.
The type of a variable is set when you use an action: If you set a number to a variable, it will be considered as a number, and if you set a string, it will be considered as a string.
Note that if you use, for example, a condition to compare a variable which is a string to a number, Game Develop will try to convert the variable to a number. But do not rely on this and keep using only string conditions/actions for variables containing a string, and number related conditions/actions for variables containing a number. If you need to convert a string to a number, use the ToNumber function ( or ToString for the inverse operation ) :
Do =ToString(Variable(Score)) to the text of the variable TheScoreStoredAsAString
How much is this affecting the efficiency of programs that are checking and modifying large numbers of integers? Could various types be implemented in a future GD version?
I’ve made some benchmarks some time ago and the difference between native numbers and GD’s variables was negligible. The main bottleneck was the time to find the variable: When you’re using scene or global variables, make sure to declare them ( in the variables list ). When doing this, Game Develop is able to heavily optimize the way the variable is accessed ( No search has to be perform ).
I do not think that specific types of numbers ( large/small integers ) are needed for now. I’ve been thinking about some kind of other variables types ( essentially structures ) but nothing is planned.