Torque 2D Editor Work

2D version of the Torque engine.

Moderator: marauder2k9

  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
70 posts Page 3 of 7
marauder2k9
Posts: 417
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Wed Jan 08, 2020 4:27 am
Tonights video shows another addition, the collision shape editor loading collision shapes in for individual editing of restitution, density and friction.

Menu items are a little buggy because at the moment each rollout control is made on the fly and because it is collision shapes they need to be deleted and re-made each time a value is changed and so the menu is re-creating each input any time anything is changed. this isnt good i know but unfortunately its either this or creating the rollout menus before hand which means imposing a limit on the amount of collision shapes allowed.

marauder2k9
Posts: 417
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Thu Jan 09, 2020 3:59 am
Yo Dawg! I heard you like steering behaviours so i put some steering into your steering so you can steer :D lol



Edit: Updated video link to a new video with steering behaviours and rotation :D
trident
Posts: 11
Joined: Wed Feb 18, 2015 11:58 pm
by trident » Fri Jan 10, 2020 3:48 pm
lol looks good trying to remember what game you had to control the ship like that

anyway well done
marauder2k9
Posts: 417
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Fri Jan 10, 2020 4:26 pm
lol looks good trying to remember what game you had to control the ship like that

anyway well done
Damn uve made me wonder what that game is now too, was it an old dos game?

Anyway this steering behavior is all work towards an ai class :)
marauder2k9
Posts: 417
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sun Jan 12, 2020 3:40 am
Okay so its been a couple of days since an update, bit off since ive been putting an update up here almost every day for the past week lol

What i am doing now:-

I think the most important thing at the moment is to be able to create modules inside the editor and to present the tools in a user-friendly way. Figuring out this loading and saving is becoming a bit of a challenge.

What is happening at the moment is every object added to the scene is put into its own simset, animations,sprites etc. Because the EditorToy is a module itself it looks for images in its own module. Loading another module inside the editortoy as far as i know is possible but at the moment because the objects are being created in one module and then added to a simset within that module, when it gets saved out and loaded back into the editor, the simset for the objects already exists and so it will not add them to it. Now i am working to fix this atm im almost certain its just a problem in my code.

But for exporting your projects and levels out i plan to do it the CS file route.

With the cs file route you can write out line by line the file that you want to put out. So for example if you have 10 sprites with a particular image asset, u you only have to have your constructor for that object in place once and have a create function in your reset script with different variables like so:
function MyToy::reset(%this)
{
%this.createBackground( static,10,10,1,1,1,31,"blue");
%this.createBackground( static,10,10,1,1,1,31,"red");
%this.createBackground( static,10,10,1,1,1,31,"green");
}

function MyToy::createBackground( %this, %bType, %posX, %posY, %sizeX, %sizeY,%pBool,%sLayer,%blndColor )
{    
    // Create the scroller.
    %object = new Sprite();
    
    // Set the sprite as "static" so it is not affected by gravity.
    %object.setBodyType( %bType);
       
    // Always try to configure a scene-object prior to adding it to a scene for best performance.

    // Set the position.
    %object.Position = %posX SPC %posY;

    // Set the size.        
    %object.Size =%sizeX SPC %sizeY;
    %object.PickingAllowed = %pBool;
    // Set to the furthest background layer.
    %object.SceneLayer = %sLayer;
    // Set an image.
    %object.Image = "ToyAssets:checkered";
    // Set the blend color.
    %object.BlendColor = %blndColor;
    // Add the sprite to the scene.
    SandboxScene.add( %object );    
}
The above code is just an example for sprites using one imageasset. So if u have this sprite in your code 50 times it will create 50 create functions at the top to build the level. As far as i know this should be the best way to do it and it will mean an export with 20 lines of code for that 1 item instead of 1000 so if u do have to do any edits after export you wont have to delv through all that code to find the one object that isnt correct, you shouldn't have to do this anyway as long as you keep your modules save file, but for quick fixes sometimes we just like to jump into the script file and modify a single value while loading the module itself.

The old torque 2d (TGB) used to have different levels as different scenes and so this is the way i think i will do it with this editor too. Each level will be a different scene file that is loaded. This will in turn clear the previous scene removing it from memory and add another scene to the game that has function mentioned above added to it. Each scene will have its own settings too for camera size, gravity etc. each scene again will be saved as a taml file for the editor but exported as a cs file upon export for gameplay.

Each module will be saved for editing as a cs file, which will include a list of scenes which will in turn be linked to its respective objects taml files.
marauder2k9
Posts: 417
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Thu Jan 16, 2020 9:08 am
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.
marauder2k9
Posts: 417
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sun Jan 19, 2020 8:59 am
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.
trident
Posts: 11
Joined: Wed Feb 18, 2015 11:58 pm
by trident » Mon Jan 20, 2020 12:35 am
hay it not a problem am sure you get it done and make us all happy lol
marauder2k9
Posts: 417
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Mon Jan 20, 2020 10:27 am
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.
marauder2k9
Posts: 417
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Wed Jan 22, 2020 1:53 pm
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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
70 posts Page 3 of 7

Who is online

Users browsing this forum: No registered users and 2 guests