If you don't know what MVC is it's model, view, controller. This is the design pattern I follow when programming, even games!
C# makes it pretty easy to follow, but GDScript has me scratching my head...
If you don't know what MVC is it's model, view, controller. This is the design pattern I follow when programming, even games!
C# makes it pretty easy to follow, but GDScript has me scratching my head...
I remember viewing a Unity tutorial on setting up MVC with gameobjects; he described having an empty gameobject for the model, the view, and the controller, and would then place more child gameobjects into those root gameobjects depending on what he wanted each one to do. It was then just a matter of dependency injection. There was no special coding involved, the MVC pattern was implemented in the editor itself.
In Godot, you could think of the base node as an empty gameobject, and then just add more child scenes to the three root nodes (with some 'master' node to hold them.) You would resolve dependencies via get_node(). Everything else is business as usual I would imagine.
Not exactly, MVC is strictly code not editor bound. I think the extend function in GDScript can work might have to play around with GDscript more, might write a tutorial on MVC with GDScript sometime this weekend.
I'm working on something like this for godot. It allows you to add an extra Binds node inside each control, which has bindings to a 'model' which lives at the scene root.
It auto-connects signals when possible to provide two-way-binding
between the data model and the controls in your scene, decoupling the
layout structure from the workflow/data.
https://github.com/jamie-pate/godot-control-data-binds#readme