Game Development Community

Plastic Gem #38: Plastic Tweaker Application

by Anthony Rosenbaum · 08/13/2008 (6:16 am) · 3 comments


i936.photobucket.com/albums/ad202/vincismurf/banner.jpg


Advanced Tweaking

If you have been following the Plastic Gem series you have been introduced into a wealth of powerful code snippets not to mention the power of the Plastic Tweaker. I would like to take this gem to get into more of a constructive discussion on how the Plastic Tweaker could be applied to solve a multitude of other issues. Additionally I would like to hear from you on how you can used the Plastic Tweaker for your project.

Particle Editor
Essentially a tweakable particle, particle emitter or particle emitter node would automatically turn the Plastic Tweaker into a Particle Editor. In fact we used this feature in our Zombie Game Prototype to improve our blood spurts. The only caveat is that certain particles have a lifetime, meaning they won't continuously generate particles, to get around this, we binded a key to generate the particle's node on the fly.


Profile Editor
Profiles are clients side datablocks used by GUI elements to set the formatting. It is quite cumbersome to go in and out of the application to get the right look. Tweaking a profile can improve this process but it is not a perfect solution just yet. The out of the box implementation of the Plastic Tweaker is not a comprehensive solution as an in game profile editor but it is a great start. For instance, trying to change a font's size does not take effect unless you save and reload the application, but changing a font's color as well as many other Profile properties are possible in real time. Clearly like the reload state functionality for shapebaseimages some sort of setTweakedProfile interface would be required to have the Plastic Tweaker become a full fledged profile editor. Interested?


GUI Editor
What is the difference between a GUI editor and a Profile editor? Well, the profile editor will only change some aspects of a GUI , while a GUI editor will allow you to set a GUI's position, extent and any other property which does not reside within a GUI's profile. Of course Torque has a GUI editor and you might just want to stick with it. The main issue here is that if you choose to incorporate tweaker comments in a GUI file be sure not to save that file with the standard Torque GUI editor, because the saving process will overwrite the comments in the file.

Material Editor
A material is nothing more than a datablock for a shader, which means they can be exposed to the tweaker. The Plastic Tweaker works best with procedural materials because you can do quite a lot more with one datablock. Custom materials also work with the tweaker but the flexibility is limited due to how custom shaders usually serve a singular purpose.

RPG Dialog Editor
After seven year of following the GG site I have seen a lot of RPG dialog resources and forum posts. From my exposure I have seen one thing in common with all of them; they store the necessary information as scriptObjects or global arrays, which makes the tweaker a great addition to the multitude of existing RPG resources. The key of course is that if the scriptObjects are being dynamically generated, that you need to write the object out to file line by line (as opposed to using the .save method) so you can incorporate the tweaker comments in the file which will be picked up during the parsing phase.

AFX Editor
I don't have any experience with the AFX pack, but if it is used in Torque there is a good chance the FX are encapsulated in a datablock, and if that is true then the Plastic Tweaker should easily pick up the values and allow you to adjust them as you see fit. If Jeff Faust is reading, I'd be happy to test it on your pack if you'd like to send me a build with the C changes already implemented =)

Mod Editor
When you throw all these ideas together you essentially have a mod editor. The nice part is that because the tweaker only shows what you want exposed you can limit your community's modding experience. This is actually a good thing because there is a tendency for inexperienced modders to start adjusting everything at once without testing changes individually. That type of design approach lends itself to unpredictable behavior and in turn could ruin scripts. Additionally, because the Plastic Tweaker is GUI driven, it can allow people with less programming experience to mod faster than before. This will allow users to wear the hat of designer longer. *cough* Instant *cough* Action.

*Synopsis*
The most important thing to remember is that the Plastic Tweaker does not seek out all the properties for a datablock. It only makes tweaks for those which are supplied in the datablock available to the tweak panel. If you wish to tweak everything then you need to make sure your datablock is comprehensive and has all the properties you wish to tweak. If you are an OOP designer and wish to only expose what is necessary at any level, the tweak listener system does allow you to design a function which can mitigate changes from the root datablock to their children.

Next Gem
In the next Gem we are going to use the Plastic Tweaker with a state machine to transition between GUIs. This will be is a comprehensive tutorial which uses many of the Plastic Gems. So while you wait be sure add:
Plastic Gem 3: Ease(Apply ease to GUI transitions)
Plastic Gem 4: Animated GUI (for the guicontrol changes and the PlasticBitmap)

#1
08/13/2008 (2:49 pm)
I wasn't as excited initially by the Tweaker, but as you've added more resources on it I have to say I'm completely sold. This is fantastic stuff, really fantastic.

And here's a big "Yes" to interest in profile and GUI editors.
#2
08/15/2008 (9:50 am)
YES! I can think of many an hour wasted on profiles and gui...
#3
12/06/2008 (8:29 pm)
Very powerful tool... must have if you need to edit script values with realtime feedback.

Would really like to get hold of the .cs files, Any info on that?. : )