Reducing duplicated template scripts
by Daniel Buckmaster · in Torque 3D Professional · 12/21/2014 (8:32 pm) · 7 replies
Working branch
What I did is rip several directories out of the templates that are identical to both - the core/ folder, shaders/, and tools/. I put these in Packages/, which is a new top-level directory (next to Templates/) which contains components of templates. The directory structure is identical - so what used to be Templates/Full/game/tools is now Packages/Editor/game/tools.
I also renamed the Empty template to Lite, and introduced an Empty template that is actually empty.
I urge you to have a browse of this branch - particularly in the Templates and Packages directories. Is this something you could live with if we introduced it in 3.7, including an updated Project Manager that would let you check boxes to include Packages when you create a new project? The idea would be that certain templates can 'require' or 'recommend' certain packages. Required packages are always included when you create a new project from a template (for example, both Full and Lite require Core). However, 'recommended' packages are simply checked by default - users can uncheck them if they think they know better (for example, I imagine almost all projects will recommend the Editor package, but if a user really doesn't want the editor, they can uncheck it because it's not vital to the template functioning).
About the author
Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!
#2
@Jed for some context, the T3D script-base is explicitly written in such a manner that it's intended to be fully capable of popping the entire tools directory right out when shipping. Seems like this would be an extension of that, though in reverse.
12/22/2014 (11:26 am)
Seems a sane suggestion.@Jed for some context, the T3D script-base is explicitly written in such a manner that it's intended to be fully capable of popping the entire tools directory right out when shipping. Seems like this would be an extension of that, though in reverse.
#3
At the moment, I think I'll shoot for getting this working without UI for it - so, only "required" packages will actually have any effect. Maybe, for now, "recommended" also means "required", so that editors end up getting included for everyone. This won't end up providing any different user experience at all, but means we have less code duplication.
12/30/2014 (12:19 am)
Here's what I have so far to specify template packages. The idea is that you can have "required" packages which are necessary for the template to function (like the Core package, which is required by the current templates), and "recommended" packages which are selected by default. Maybe there could also be "prohibited" packages which are known to conflict with the template.At the moment, I think I'll shoot for getting this working without UI for it - so, only "required" packages will actually have any effect. Maybe, for now, "recommended" also means "required", so that editors end up getting included for everyone. This won't end up providing any different user experience at all, but means we have less code duplication.
#4
12/30/2014 (6:26 am)
Actually, it's always annoyed me more that /core contains scripts that are duplicated in /scripts. You know, things like network settings that have to be changed in two places and all that noise....
#5
There should be no change if you use the new PM with the existing templates.
The problem with going ahead with the actual script refactor, of course, is that doing so would break any PRs that make changes to the template scripts. Which is sad, but could be worked around. I'll resubmit them all myself if we have to :P.
01/01/2015 (2:48 am)
PR to the project manager to enable the most basic support for these packages. More description in the PR. Currently no UI, as I think that would be not incredibly feasible for 3.7, though we do have a whole month :P. If anyone knows how Qt works, feel free to jump in. This code was done super messily - literally only what it needed to make it work. This is because I plan on digging in and rewriting the PM in Torque as soon as feasible (i.e. for the next PM version). This will at least let us start to consolidate the template scripts, and mean we only have to make changes in one place each time :P.There should be no change if you use the new PM with the existing templates.
The problem with going ahead with the actual script refactor, of course, is that doing so would break any PRs that make changes to the template scripts. Which is sad, but could be worked around. I'll resubmit them all myself if we have to :P.
Torque 3D Owner StuporMundi