Jump to content

Torque 2D Editor Work


Recommended Posts

Particle Asset Creation

So far the particle asset creation is not in the editor that is released but i can talk about it a bit.

At the moment i have it setup that each variation field can have 4 datafields, their time values are heavily controlled by the datakey that comes before it. This also means that defaults are easily set for these and the code is more easily diagnosed. If you need more than 4 fields it would be pretty easy to load up the taml file in an editor and add that extra key. I understand this may be pretty counter intuitive as the main focus of this editor is to try and stop any need to modify scripts. But we all know that is impossible no matter what. No matter what game you will try to make it will require some form of scripting in order to make it work. This has been heavily minimized however as you can tell by trying out the editor at its current state. You can create levels in a much easier and much simpler way now with visual feedback as you are creating them. This will be the same for any ParticleAsset created.


I should point out that when you create a particleasset it is displayed in the same scene as everything else for the moment. You can just move to another portion of the scene if u want to see very faint particles. If it becomes too much of a problem i will create a separate scene for particle creation much like how the image asset importer is done. For the time being i was thinking it may be good to be able to visualize very directly how your scene interacts with particles.

Kind of relevant:

With this editor i was thinking of creating some custom "objects" that will help with game development such as:-



PathFinding(if you've been watching the videos you would see some simple steering behaviors)

Checkpoint System

Parallax Scroller

Parallax Sprite

To name a few.

Showcasing The Editor

To showcase the editor i am working on creating a couple of examples, much like the Toys that already come with torque. Just to show a few examples of how easy it is now to create different objects, set up different values for objects etc.

Link to comment
Share on other sites

  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

ParticleAsset Update:

So the particle asset creator is taking a little bit longer because i cant find a way to change the time of a key without completely removing the key and then adding a new one in place of it with the new values. This is done through simsets and simobjects (almighty simsets praise be to thee :-P ) but there is a problem in that if you have say key 1 (the second key) at time 0.6 and key 2(the third key) at 0.2 it will just write out key 3 and skip over the second key so creating a way to modify the lowest values allowed by each keys time value is proving a little sketchy. Because the gui has to be built sort of dynamically each gui object has an EmitterId value that is created when a new emitter is added to the particle asset. This is then added as a dynamic field for the SimObjects when each gui element is created. Then each key is cleared on each update of any field and recreated with a special function for any of the values that are at Key0 because key 0 needs to be at 0.0 time when keys are cleared they automatically create this default key so only the value of that key is updated rather than the time. As each SimObject is added to the SimSet it is pushed to the bottom of the simset so when the objects are iterated through they are done in the correct order. There is a simset now for each and every Graphfield value in the particle emitter asset and soon there will be for particle asset as well.

Link to comment
Share on other sites

Example of ParticleAsset Output

Below is an example of the ParticleAsset files that will be output from the creator. This is without the proper assetname being defined on output this was just written out from the console to create the file without actually saving it and loading it back into the editor.


                    Value="0" />
                    Value="20" />
                    Value="2" />
                    Value="20" />
                    Value="5" />


You can see the DataKeys are now working properly :)

Link to comment
Share on other sites

So final quick update before the ParticleAsset creation is released for some reason there is no visual feedback in emitters when changing their Src Blend Factor and their Dst Blend Factor yet when selecting intense particles they get the blend settings from this. The gui is setting the relevant properties properly as is visibly seen by echoing out getsrcblendfactor and when saving the file the settings are there. But no matter what they are set to there doesnt seem to be any change in the visual.

Link to comment
Share on other sites


So the ParticleAsset creation is added to the editor now.

Be advised this is still very buggy and really reliant on users making sure that they don't change a value without pressing return on their keyboard. Because the gui objects for most of the options in the particle editor being class based simple object updates and returns cannot be used because if you think about it Emitter 0 cant be updated without effecting Emitter 1. So the values for the graph field values will not show a visible update unless you either press return on the field or edit the field then select another (onLoseFirstResponder)

Other than that every function for particle assets and emitters are made available for editing and creation apart from the ability to switch Emitters around because this will change the emitter Index and this is used to link the gui elements to each other.

Link to comment
Share on other sites

So whats next:

Now that basically all assets, all apart from Font Assets, are able to be created in the editor and separated out into their own simset it is possible now to create quick menu buttons to create different sceneobjects such as sprites, animated sprites, scrollers, and particle players.

If you guys would rather keep it to the toolbar at the top with a separate window popping up to choose an image for these objects then let me know because i quite like the toolbar too but the original editor for Torque2d (TGB) had a handy section for creating different objects in the scene instead of having to navigate through a file browser window.

Plus sides to this:-

-You can see all assets that are available to your module at a glance

-You can create sceneobjects instantly spawning the correct asset at the camera position

-Affords more of the gui real estate to allow for modifying scene settings and module settings

Down sides to this:-

-Modules with a lot of assets will need to be navigated through every asset every time you want to choose one, you might think this already happens with the file open window but take into account in a file window you can adjust the scaling of objects to show quite a lot more items than what would be able in the editor without becoming distracting

-ImageAssets can be used for everything from sprites to scollers to composite sprites so the same image asset will be appearing multiple times which could cause some jarring experiences. imagine you would be scrolling through a section tagged as static sprites, then going through scrollers and seeing all the same imageassets again until you get to the one you need

I will ultimately leave this up to everyone else because i am not sure about how the file system in torque works on other operating systems. On windows it works fine but for the likes of mac and linux i wouldnt know unless people test it out and let me know.

Link to comment
Share on other sites


Latest update includes the ability to change the camera size for the scene. This update also comes with a few fixes on how scaling is applied, now you can resize the window and objects should look the same no matter what. This is done by scaling the camera rather than objects. The camera outline should still be used for reference as this represents what the end user will see. If you wish to use this function in your product it will require testing on multiple devices to make sure unsightly blackness is not visible to the end user.

ParticlePlayer asset property guis are in place and ready to be linked up next gui update will include the particle player creation button. Then once particle player is all done the next object to be created will be the TextSprite. :)

Link to comment
Share on other sites

Animation builder fixes

Now the animation loop checkbox will not crash when pressed without frames in the frame stack and you can create multiple animations from the same imageasset without closing the window. Unfortunately now looping cannot be visualized for some reason. When i have it set up to visualize it it keeps trying to get a to a frame that doesnt exist and then the animation gets deleted.

Link to comment
Share on other sites

Text Sprite

So the next object to be added is going to be the text sprite. This presents a few problems first and foremost the font asset. This asset is very tricky to make a creator for. Its not as simple as the imageasset or animationasset etc. The problem is font assets need an fnt file that then points to png files and the fnt file has a line for each character represented like this

code snippet from Arial.fnt file:-

char id=32   x=507   y=0     width=3     height=1     xoffset=-1    yoffset=127   xadvance=32    page=0  chnl=15


I think making people have to build this file through an editor would just cause more problems than it will fix as this file can be created outside of torque with BMFont.

Running your ordinary font file through this program will automatically set the different font characters automatically and generate png files as well.

At this point a creator to create fontassets wouldnt be very intuitive and because of the 100s of characters in a font it would probably cause more problems than it would fix.

Link to comment
Share on other sites


Okay i know i said i was going to work on the TextSprite asset next but due to my own Game needs i had to work on Behaviors instead. So latest push now has the ability to select behaviors for SpriteObjects.

When you add a behavior it will automatically create a gui for each behavior object that will let you set the values for the behavior fields. If your behavior spawns objects there is a small change you will need to implement.

Using spawnArea in the DeathballToy as an example after all the defaults for the %clone are set In the spawn function you will need to add:-


   %scene = %this.owner.getScene();
Link to comment
Share on other sites

Small error

Because of the way the behavior fields are setup for sprites if you have a behavior field that has 2 words in its value it will cause problems

For example the spawnGroup behavior has an enum for spawnLocation of Horizontal Line and Vertical Line. In order to keep behaviors to one dynamic field on each object these fields are set for one word per field. Otherwise each field of a behavior will become a dynamic field on the object. So changing the behavior to be Horizontal or Vertical instead fixes the issue and the behavior works as designed.

Link to comment
Share on other sites

Thanks. There's a lot more to come. I have added a fix so that when an object is locked any object of the same type will show its menu, a silly oversight on my part objects need to be checked on select. there was also an error in the polyeditor that i havent narrowed down yet. When you create a polyshape sometimes when trying to change the values in the guitexteditctrls it will close the window. Touches shouldn't be getting passed through to the scene underneath. Particle Emitter creator only creates particles at 0.0 atm and while i thought it was a good idea to have the particles in the scene after using it a bit i think its best to move this to a separate window. Only problem is scaling the particles properly

Link to comment
Share on other sites

  • 4 weeks later...

Latest Update

Thought i would write a little bit giving an update on how things are going. For the last month i have been fixing and updating one of my releases and working on a couple of new ones. The editor has made this a lot quicker but i have found quite a few problems that i have been fixing along the way but i have remained focused on finishing my own projects for this reason i have been a little quiet here and i apologize for that.

The good thing that came from this is i have been updating and fixing problems a long the way things that i found easier to work with throughout developing my own apps and games. The new features that will be added as soon as i finish these products and get them out are as follows:

New Main window - now there is a scene list that has every object in the scene added to it, this includes joints and force controllers with the options for hiding them and locking them. At first i thought this may take up too much screen real estate but it became more and more necessary throughout development to be able to select objects etc.

Move to Object - Now with the scene list you can select objects and modify their settings(fairly standard stuff) but now also you can move the camera to that object.

Camera Layer - A few changes have been made to the camera but one thing i found quite useful is the ability to choose which layer to make visible. This is only used in the editor any output from the editor will render all layers.

Camera Link - Now you can link the camera to an object and set the link properties. These settings are only visible when the scene is playing as the camera object in the scene becomes the settings for the scene window to help visualize the settings and how a game might play out.

Triggers Added - Now triggers have been added as a visual but only a visual unfortunately. The scripting for how these triggers work is being confined to simple behaviors. So for example you would have a change level behavior for a trigger that will let you choose which scene to switch to when the trigger has been entered. Now these triggers are only going to work when the level is exported for obvious reasons. Not good when testing a scene and it changes when your character enters a trigger.... not fun... it happened more than once lol

Extra Menus - Now there are extra menus for handling how a module operates and how a scene operates. For example you can now press F2 to bring up scene specific settings such as gravity batch render settings etc and press F1 for module settings that so far only really has a setting for choosing what the default scene is.

Particle Asset - this was a difficult one but now creating particle assets now takes you to a completely empty scene with the same camera settings as the scene you are working on so scaling can work. This seemed more and more necessary the more and more i worked on a level as a level became more populated.

Scene Object menu - Now this one was difficult to come to terms with. As you may know if you went through the source code of the EditorToy every object was separated out because each object required different settings but they all shared certain settings. For example everything a sprite has access to a scroller has access to they just have specific settings for scrolling the image. So now every object specific menu has been moved to one file. A check is made when an object is selected to see which type of object is selected and a new menu item loads for the specific settings for that object so for example every setting that is available for a sprite is available for the scroller but now the scroller has a specific scrolling section for the scroll settings. This works faster for the editor. The other file that will need work soon is the ParticleAsset creation. While moving it off to a separate window it still has about 100 calls to completely similar settings that should be able to be simplified such as all the data keys. While they work well at the moment you just have to look at the size of the file for the particle asset. Thats a lot of code to call for one file and while i haven't experienced any slow down working on a particle asset it is an accident just waiting to happen. So i am planning on re-working the particle asset gui and data keys to be procedural. Really you don't need 4 keys being handled if you only have 2 keys with settings in them.

A bunch of other fixes have been made in the background and i still haven't really figured out a good way to modify assets that have already been made. But the answers are being worked on and may become a reality as the longer you work on a project the more and more you need to modify assets. While it is quick and easy to just add a new asset for images and sounds, working with animations is a little trickier the more you play your game you notice this could use an extra frame here or a frame less there and having to create a brand new asset and then go through each object and change it to the new animation asset is a little tedious.

Big things are on the horizon. Time wise i will be hoping to get all these changes up before the End of June. I am still dedicating most of my time to finishing my current projects. These changes were worked on in the background. They may have some serious problems that i haven't noticed but they seem to be a lot better for the time being.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...