britzl,
Thank you for a developer’s response that is very encouraging. I’m very new to defold and I suspect my feedback won’t be higher quality for some time, but after years I should have much more direct and meaningful suggestions for improvements. For now, all of my ranting should be seen as a newbies pain points, I know there is room for the way it’s currently done to be improved but I’m not experienced enough in defold (or game programming in general) to be able to articulate it yet.
For example, everything you said about messages could be kept, and the existing msg.post() functions and msg.url() functions could be kept, but the following syntax could be used instead IMO
for example:
msg.post("cursor.sprite.enabled", "true")
or even
msg.post("cursor.sprite", "enable")
instead of relying on a (hashed?) game_object id, which is tricky to get. For example, in the editor if I name something “cursor”, I can start writing about it, or its child like cursor.sprite, instantly, without having to first use go.get_id(cursor) to get the go_id and then msg.url(nil, go_id, “sprite”) to get the sprite.
While I don’t necessarily think defold will change to this syntax, I see potential opportunities for perhaps an extension of some kind that enables something like this, or perhaps defold implements working with this syntax in addition to the current syntax.
I do like the idea of first-in-first-out queues, rather than blocking code - which messaging seems to better handle, I just don’t think we should be limited to using defold’s URLs since lua table URLs like cursor.sprite
would be a lot more intuitive to any new-to-defold but not-new-to-lua user.
Some additional friction is caused by having to use
go.set(sprite, "tint", vmath.vector4(r, g, b, a))
when really I’m tinting a sprite, not a game object, but I’m using a go.set function. Why can’t I use msg.post(“cursor#sprite”, “tint”, color) for example to be more consistent in sending messages to everything?
Intuitively I would expect there to be something like sprite.tint() functions exposed by defold, rather than a go.set function which then takes sprite as a parameter, etc.
The go.set first parameter is also expecting a go_id - which is not hinted at by the name. A personal lua best practice IMO is to have the function name explain what kind of parameters you’re expecting. For example,
sprite_tint(sprite, color) is a lot more informative that you need to specify a sprite, and then a tint, for sprite_tint to work. go.set does too much for one function IMO for it to be descriptive.
Another question - why do sprites, which are named components in the editor, have a url, which I use with their functions, but I have to use something called an instance_id with game objects - why not URLs everywhere for game objects just like with components (sprites)?
So a way to make this more consistent would be to add a function called go.get_url(go_name) instead of using go.get_id(go_name), and then use URLs for both components and game objects in all functions.
However, if I have to use go.get_url() for game objects and msg.url() to get a url for sprites, it’s still not as consistent as it could be. A better function would be something like go.get_url(go_name, sprite_name)