Jump to content

Torque 2D Editor Work


marauder2k9

Recommended Posts

Very quick update:-


I have split up the assets that are currently working into their own scripts to allow space for working on module creation, loading and saving.


Once this is done scene saving and loading will be added.


So the order of operations required by the user will be:

Module->Scene->Assets


So a module needs to be defined, then a scene.


All assets imported after that will be assigned to that module and called by each scene as needed.


For clarification the start menu for your game will technically be a scene and atm you can place objects in a scene you will still have to go into script and modify them to load another scene. This will be sorted out later on but not when the initial module setup is released. I want people to be able to make scenes so that people can start using the editor asap and then sort out these features later on.

Link to comment
Share on other sites

  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

Update:-


Sorry it has been a few days since the last update, i know some people may assume a project is dead in here after a few days of silence and i apologize for that this project is not dead! and never will be.


So far i have modules working and scenes. I was hoping to have the editor set up so that assets are separate to their module rather than being global but this presents more problems with the file object. At the moment when a file object is loaded it is given a default folder location you can see this in action when u import an imageasset. If u load up an image asset from a certain folder in the editor as it is now it will start at the default folder for all modules then you can browse to a folder nearby for any image to be copied to the editor directory for use. Then when u load up a sprite it goes back to the folder that was last browsed to which shouldn't be happening it should be defaulting to the folder where the image assets were copied to. It seems to be loading up the same default location and settings from the previous FileDialogue. I am trying to figure it out hopefully will be sorted soon and then the module and scene creation can be released.

Link to comment
Share on other sites

hay it not a problem am sure you get it done and make us all happy lol

 

I wont stop until i do lol this is going to hopefully streamline the creation of games for everyone including myself. I have 10 game ideas so far that are heavily reliant on an editor to make them substantial games.

Link to comment
Share on other sites

Small Update:


I think i figured out the file dialogue problem but for whatever reason if i change the first file dialogue instance's changepath to true it affects all other file dialogues. So with that in mind each time u want to add an image to the editor it will default to the main modules folder. The whole idea of this editor is to do it without needing to make any source code changes.


The reason for this is because the features that may make things handier in the editor will not be good/useful features for the engine and therefore may not make it into the default git for torque2d and a downloadable module that can be dropped into any project that is already built will not interfere with anyone's previous work. So far on my personal github i have the editortoy sitting at version 4.9.7 with module and scene support bringing it to version 5.0.


What else will come with this version?


So far image asset loading, sprite creation and collision shape creation features are released. The features that are working but not yet released are animation asset creation and assigning it to a sprite. CompositeSprite creation and editing. Sound placement and linking. In editor scripting.


The only feature that i will be releasing with 5.0 is the compositesprite creation and editing because it is the only one that is working without problems.


AnimationAsset creation is working but is very unstable sometimes when loading an image asset in to create an animation it will load some frames and miss out others. If the image asset has roworder set to false the animation asset gui will load the frames in the wrong position. These will undoubtedly make people angry as in the animation preview window it will look one way yet in the game it will look different.


Audio placement is a tricky subject. The problem is a lot of the time a sound needs to play at an event and as we know most events are dictated through script calls. My idea is to create a gui menu for attaching sounds to certain object events. This will then create the script to play these sounds automatically. For example in the gui there will be the setting to link a sound to Sprite1 this will be a sound that will play all the time. Then at the bottom there will be an audio events tab that will allow a sound to be attached to say sprite1s death, sprite1s collisions etc etc. Another idea i had was that in much the same way torque 3d has the ability to create triggers on certain frames of an animation, a simple update through an animation to see which image frame is loaded at which time we can attach sounds to that frame and then play them when that frame is active.


In editor scripting is working but the main reason i will not release it is because at the moment it is just a gui multi line text element and i have no way to check the script before it is output to the module. This may need to be the norm but i want to be sure because if there is a way i want this in place before i release this feature. If no way exists i will release this feature to be used only when certain things happen to an object. This could come in very handy to test out certain dynamic fields for example and tie them in an on updatecallback for an object.


For the longest while this forum has been mainly here to both keep everyone updated but also to keep my mind focused on the goal. This hasn't been an easy undertaking but it is becoming a very rewarding one.


Some truths:


The main reason why i have had a lot of time on my hands, and some real urgency to get this made this past while is because i quit my job. In my previous employment i was passed over for a promotion and the only reason they could give me for it was because of my personal appearance. They wanted me to stay on to train the next person who was going to be doing my job so instead of becoming a puppet i decided to pack it in. I know my game development career was not very successful with only one not very good title released and expecting updates coming soon i am rushing towards the release of an editor to increase productivity. This rush towards an editor is going to mean a lot of mistakes are going to filter through to the end release and for that i apologise in advance. I have been working on this editor day and night, and will continue to, and have been drafting my ideas and getting them ready for development in the background. Once i have most of the features in place i will be taking a break from developing the editor while i work on my ideas and again for this i apologise but the good thing is that anything i learn while creating these games will then be used to make the editor better.

Link to comment
Share on other sites

thanks for the update and sorry about you job

am not working even as i've been off sick for over 2 years. even with all the free time you still dont have time to do stuff lol


anyway love reading what you doing and have done so looking forward to breaking it all for you when i have time

Link to comment
Share on other sites

Short Update:


Okay so i got stuck for a while on a loading and unloading problem for a bit but i think i have it sorted out.


To explain - in the editor each object is loaded in a simset. This simset is named the same as the object such as sprite, compositesprite, scroller etc


All the simsets were created when the particular object was created so when you did this it created the sprite simset. The way i was trying to load up objects was to already have the simset loaded and then assign them to it as they are read back in. This wont work as long as you have a simset object already created. My own stupidity got me stuck on this one. Previously i was loading saved scenes through the console, at this point i had an object automatically being created because i was also testing out autosave, and auto load upon relaunch. This was creating the simset before a new scene could be loaded. So not only do i have it changed so we don't have to load scenes in through the console, i also have a new script in place that deletes these simsets if they are present. So if you load up a scene that new scene creates the simsets along with the objects that were saved, along with all their saved attributes.


At the moment a module is really just a place marker in script until the module is exported. All assets are loaded as assets of the editortoy so in their associated taml file the file name for example would be EditorToy:ImageName. Upon export of the module this is changed to your module name.


CompositeSprites: Almost completely finished off but unfortunately they will need some further work. The problem i am facing is i have no way to load work previously done by a user into the composite sprite again. for example: Say you are working on rect layout for a tilemap say, you would choose a width in sprites and a height in sprites say 10 x 10. Then you load in your assets into a paintmode that allows you to change the default rect texture to whatever imageasset you have selected in your palette. This is a very easy and comfortable way of editing composite sprites.... until you decide after your work is done that you need a 10 x 11... then you have to start over from scratch. Granted you could just add another composite sprite for the extra row but there has to be a better way. and one way i was thinking of doing it was making a tilemap designer specifically for it. Instead of loading up a composite sprite it will load up a number of shapevector squares. These squares will be used to number the sprites that are painted over the top of them. These shapevectors will never be able to be changed and they will have an id number. This id number is assigned to whatever sprite you choose to paint over the top of it. Now if u change the row and column count the shapevector count will update and will be assigned a new number (much like it does in the imageasset viewer function) then each sprite will be checked to see if it's id matches the id of the shapevector at the same position. Then when u click create each sprite is iterated into a simset by name then placed into a composite sprite in that same order but positioned based on the id. because object 0 should always be the top left, once we know the number of columns and rows it should be easy to figure out the positions of all other sprites.


I haven't even begun working on a designer as it is just a concept at the moment but the basic composite sprite painting is working, but takes some planning before you start, and i'm not that disciplined i want to get into it and start drawing and figure things out later lol. Granted it shouldn't take too long to just do a composite sprite over again if its only a 10 x 10 but if your working on say 100 x 100 level. Tensions will rise if you have to start that all over again. The option to add or remove rows and columns to a compositesprite without losing all your hard work is a must.


Good things to come! Watch this space ;)

Link to comment
Share on other sites

First update of February :D


Sorry this isn't really what you guys were waiting for but it shows the additions to the sprite setup. Now you have scene layer, scene group. Collision layer, collision group and Blending options. Blending should be a lot easier now that we have the ability to see what those options are actually doing :)


6MtRisyPoAw


As you can see from the video i got a bit confused as to why the collision layers werent working. Turns out the collision layers and collision groups are connected to scene layer and scene group. So if both objects are on scene layer 1 and you want them to collide, the collision layers should be set to 1. Same for groups if both objects are on scene group 1 and you want them to collide you set their collision group to 1.

Link to comment
Share on other sites

Another short video showing module creation


C7M-xf9tmu8


Closing in on that 5.0 release for the editor! I am now working on making it all a bit more pleasing to work with and making a better gui for it. This way it will just look a bit more professional. Another thing i forgot to show in the video, when u create a module it will automatically add it to the sandbox's list of tools on category 5 for games :D


This should be almost ready for proper use. The only thing left to do is sort out scene creation, loading and saving.

Link to comment
Share on other sites

  • 2 weeks later...

It has been a busy couple of weeks! lol here is the first look at the new gui for the editor


AcGqHIh.png


Atm not all of these settings are tied in but the functionality for new scene,load scene, save scene, scene settings and camera are all linked up, so are the buttons to create physics shapes and import image assets. The reason the sprite in the screenshot is saying cannot render is because i just loaded up a sprite in the launch of the editor so i could show the sprite menu, the sprites asset is tied to a project and therefore because i dont have that module loaded it wont render the texture. The menu at the bottom also hides itself when a module is created or loaded.


I am going to create a menu bar for all of these functions as well as loading and creating a module dont think it is a good idea making module buttons at the top bar be too easy to hit them by accident which atm will break the editor and make you lose work.

Link to comment
Share on other sites

In the Image builder i have implemented the cell stride function. I am still running into the same error when it is being used. When an image is created it is claiming that the cells are cutting off the right side of the image now due to offset and stride together.


As an example the cannonball image has a 4 x 4 grid of images for a cannon ball, whenever i set the cells up properly to cover the full 4 x 4 it pushes out the error. But if i change the number of cells on the x axis to 3 instead of 4 it works fine and when you load it up as a sprite asset the cells seem to be fine so i think the viewer is showing everything in the correct position.


Does anyone know if there is any correlation between offset and stride. As far as i know the offset is just to set the distance from the top left of the image to put the first cell and then the stride is the distances between each cell. But again no matter what image is used if you try to use the correct amount of cells it fails on the export and creation due to the error mentioned before.



This is the output from the image asset importer. With the blocks.png file set up properly with a cell on every visible block.


	AssetName="Blocks"
	ImageFile="Blocks.png"
	FilterMode="Nearest"
	CellCountX="8"
	CellCountY="7"
	CellWidth="32"
	CellHeight="32"
	CellOffsetX="16"
	CellOffsetY="16"
	CellStrideX="64"
	CellStrideY="64"
/>

 

If i change CellCountX to 7 it will work, as it is now it doesnt.

Link to comment
Share on other sites

So far this is what i have done:

Key: red = not started, blue = in progress, green = done


Module Creation

Module Load

Scene Creation

Scene Load

Scene Save

Scene Auto Save

ImageAsset import

AudioAsset import

ParticleAsset creation

Scroller Creation

Sprite creation

CompositeSprite creation

TextSprite Creation

Trigger Creation

ShapeVector creation

ForceController Creation

Joint Creation


Getting the list down to only a few to go, once this is finished i have been toying with the idea of working on a gui editor but in all seriousness an ingame gui can just be made with anything in a 2d game doesnt have to be an actual gui object, any sprite can be handled as if it is a gui object but i can understand how gui objects changing sizes between device resolutions can be quite jarring so it may need to be implemented for these reasons.


Once the items listed above are ready there should be enough for people to create their games in a visible way and should make development a lot easier for everyone. Future implementations will include:


//These i have already tested and should work

Behavior creation

Behavior linking (to in game objects without needing to write scripts)

Dynamic Fields for objects

Event Management

Callback Event Management


//Ideas that will need source code changes

Wave Machine

LiquidFun implementation(Physics Particles)

Object Debris(i already have a basic idea of this in my app CritterBits but to be able to create debris dynamically will need source code changes)


Big things are coming!


EDIT:

Finished off scene autosave, now whenever you exit torque2d with the editortoy loaded it will automatically save the scene you are working on and if u load another scene. I don't think saving on a timer is necessary but it can be implemented if you guys want.


TextSprite is also finished off with most of the available options for a text sprite including the jumping text type effects


An idea i have had to save messing up scenes when playing physics simulations, the scene creates a temporary save file when the play button is pressed and then that temp save is loaded when the rewind button is pressed. To continue adding and manipulating objects the physics simulations have to be stopped/paused first. If u manipulate an object or add another object, this temporary save will be deleted.


Default camera size when creating a scene is set to 16x9 the reason for this is because torque is built with Box2D physics and in box2d 1 unit = 1 meter so for expected physics results this should yield the best visual representation or atleast 1 that should be expected. Furthermore i have researched quite extensively on resolutions and such and most devices these days especially the latest are 16:9 aspect ratio with some later devices being 16:10 as well. You can change this if you want and due to being able to change this in the editor you can also change what you want the default size of added objects to be.


The editor views camera size is worked out from whatever camera size you want for your module and the aspect ratio of your windows view to allow for a bit of screen space around your scene. The cameras view is represented with a box shapevector. I am trying to make this a gui element instead so it will always be on top but for a while it will be a light blue shapevector box.

Link to comment
Share on other sites

  • 2 weeks later...

Short video to show the scene saving and loading. I need to set it to hide any active menus when a scene is being loaded, also when a scene is not loaded or created buttons are active that shouldnt be but its all easy to link up, saving and loading is working properly :)


pMtqGSQMeG8

Link to comment
Share on other sites

Another short video, showing scene preferences file and this time you can see the camera object being displayed and i really have to figure out some sort of scaling for those handles :D lol big green squares don't look good.


gwdgTBkt_Yk


Because this is really just loaded as a scene just you have other functions that save it out and allow modifying of object properties on the fly, you get to see what your game will look like on different resolutions on the fly.


For example if you have an object sitting at point 0 0 at a size of 2 by 2, each of its 4 corners from top right will be 1,1 1,-1 -1,-1, -1,1 and no matter what resolution is displayed this is where each corner will stay, this causes stretching on certain resolutions so say you have a level designed for a 16:9 camera it will look stretched or squished on 4:3 displays. But to be fair if you are designing your game for todays hardware, there really shouldnt be any reason to be setting it up for 4:3 least not to my knowledge and if you want to do that it can still be done it just needs to be designed with a 4:3 camera which you can easily do

Link to comment
Share on other sites

Latest pushed to Github repo


Added

-Control camera with middlemouse

Now you click and hold the middle mouse button pressed in order to move the camera. This should mean now that while moving the camera there is less of an opportunity to accidentally grab an object.


-Modules auto load a scene

Now modules have their own pref file as well that will automatically load the last scene that was active the last time you loaded that module.


-GUI Changes, now the default object size is under the scene options, this will also be saved with scene prefs in future update. Def size is not yet hooked up either but will be soon.

Link to comment
Share on other sites

Latest push to github

Added

-Play pause ability for scenes

-Camera zoom with zoom out limit so scene doesnt disappear

-PolyLines now rotate based on angle of object selected


Fixed

-When choosing selector twice in succession the mouse would completely disappear more on this below

-Errors being reported on CollContainers not being ready when object selected


Mouse Error:

Something that has often been a bit of a problem in Torque2d was the mouse showing over the top of custom cursors. At the moment you can actually see this if u load up the paint tool in the composite sprite editor toolbar you will see that if u click and drag the mouse appears above the graphic. Now something discovered quite by mistake is that if you call Canvas.resetCursor() twice in succession, the mouse disappears completely and will not flicker in and out on mouse callbacks. So if you want a custom cursor in your game calling Canvas.resetCursor() in your create block and then again in the reset block, then send the code to a block to create a custom cursor should make a proper custom cursor that shouldnt cause problems. Not sure why this works, maybe trying to set the nativecursor twice freaks out windows and creates some sort of null exception. Not sure but it works, and creates a flicker free custom cursor.


Why releasing in stages:

I have been asked why i am releasing this in stages when i have more features ready. The fact is while each feature is ready releasing it in full makes it harder to get to errors, the full Editor has just shy of 50,000 lines of code(script). So at the moment yes the main meat of the features are available these features work quite well and if anyone has any errors now i will know what needs to be fixed. Get these features to a more stable state and then add the more advanced features in afterwards. The composite sprite features in particular are quite advanced in a sense but compositesprites are so important to the creation of a level. TileMaps should all be composite sprites in rect layout for speed and ease on the engine. You can create a full game in the EditorToy as it is but it just needs some after work in script to do it(mainly the creation of a main.cs).



My next release should be fixing all errors that i have found or have been brought to my attention in this iteration and linking up scene settings and camera settings. Then move on to ParticleAsset creation and particle player creation (both of which may end up being the same functions).

Link to comment
Share on other sites

Hey Marauder, fantastic work on all of this! I will be DL and testing your editor, I am excited to see t2d being worked on. I love this 2d engine. Let me know if there are any areas in specific you wish to see tested out. I will reply back with some feedback when I do some tests.

Link to comment
Share on other sites

Hey Marauder, fantastic work on all of this! I will be DL and testing your editor, I am excited to see t2d being worked on. I love this 2d engine. Let me know if there are any areas in specific you wish to see tested out. I will reply back with some feedback when I do some tests.

 

Pretty much everything lol i have a few more fixes to go up today for a few things, like creating a new module while having a scene loaded would load that scene into the new module :-S so gonna be pushing that up now soon and the starting of splitting out assets into their respective categories :)

Link to comment
Share on other sites

Join the conversation

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

Guest
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...