Open BscotchSeth opened 1 year ago
The various collision list functions are another one that uses ds_lists, would be nice to have array versions
+1
Much appreciated feature I think. If compatability with older projects is an issue, I could see some toggleable option within the project settings that could enable/disable this behavior, like how we have a collision compatibilty mode and the old copy-on-write behavior for arrays. We could have a "prefer ds_maps over structs" toggle (Could probably have a better name tho) that could enable the old behavior for imported projects.
Gonna mention the collision_list_*
functions too, as I think they should have been arrays from the start tbh
Just want to mention structs are not maps; primarily difference being maps can use any type of key, while structs use only string keys.
While I 'think' all the above functions listed in feature request currently do use string keys this difference should be reviewed.
Personally I would prefer the DS_* types to be refactored/updated into garbage collected equivalents, instead of replacing maps with structs.
Is your feature request related to a problem?
There are a large number of built-in systems, such as asynchronous file operations, web events, spine events, etc... that all require the user to create and/or interact with ds_maps and ds_lists.
Given that
ds_maps
andds_lists
are hard to work with and are fragile due to their "manual cleanup" requirement, and because they have numeric IDs that can be accidentally interacted with, even Game Maker's own documentation suggests that we avoid using these data structures wherever possible. But then it forces us to use them all the time, because so many built-in functions require them!A great example of this is
skeleton_bone_state_get()
. In the Game Maker manual, here is some example code for setting the information on a bone.In this scenario, you have to create your own map first, pass the map into the function, and then destroy the map afterwards. If instead this function used structs, it would be cleaner and less prone to error, like this:
Here are just some of the features and functions that require us to use ds_maps and/or ds_lists, which would be much easier to work with if they used structs and arrays instead.
Spine functions:
Built-in Events:
Describe the solution you'd like
Describe alternatives you've considered
None, really. It's a pretty straightforward problem, though the implementation of the solution will definitely take some time.
Additional context
No response