Torque2D on Patreon

2D version of the Torque engine.

Moderator: marauder2k9

  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
63 posts Page 3 of 7
Online marauder2k9
Posts: 304
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Thu Mar 21, 2019 6:52 pm
Today I checked in code to the development branch to start the process of creating the editors. I started weeks ago (or longer I can't remember) and quickly found that the GUI situation was so bad that nobody could use it without looking up the code to see what actually works. So I've been reworking much of the GUI code to make it usable again - all documented in the GUI guide in the wiki of course. Most importantly, my checked in code paves the way for the editors. It builds the folder structure and sets up a separate asset manager and module manager for the editor as well as some place holder managers. It's a long ways off still, but I think it shows what I'm gunning for. You can see it now in the dev branch. It's not stable.

Tilemaps are a lot different than TGB. They now work using the CompositeSprite instead of a dedicated tilemap object. If you know what you're doing they can be very fast. If not, well, you should know what you're doing...

T2D does not have lighting of any kind. There's no normal mapping. There's no shader support. It uses a fixed pipeline. Consequently, this seems like a good area to grow the engine.

Liquid fun is cool. Seems like a side note to me. Not really critical to the engine.
Okay i will download a fresh 3.4 source and work on adding some simple specular lighting and see if it works out. Composite sprites where u define cell sizes and such? i might actually try and add an option to use dedicated tilemap objects as well as a side option? or do u think composite sprites would be the best way to leave it? i can see how composite sprites would load quicker, are there any advantages u can think of to having dedicated tilemap objects?
greenfire27
Posts: 43
Joined: Tue Nov 03, 2015 8:18 pm
 
by greenfire27 » Thu Mar 21, 2019 7:29 pm
Composite Sprites do have dedicated cells like a tilemap, but they also have other modes for isometric tile maps or custom arrangements of sprites. There's no need for another tilemap object.

You can read about them here: https://github.com/GarageGames/Torque2D ... rite-Guide

In my game,Pirate Code, I use composite sprites for the ships (custom mode) and also for the world map's ocean (rectangular tile mode):
https://store.steampowered.com/app/370120/Pirate_Code/
Online marauder2k9
Posts: 304
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Thu Mar 21, 2019 7:40 pm
I can see what u mean about it being pretty straight through, the functions for lighting are loaded into memory om gl_types.cc and then disabled in dgl.cc but everything is there if i set up lights as a scene object and then a simple counter for each light this shouldnt be too difficult. Would be cool to get lighting like this working in torque 2d

[youtube]https://www.youtube.com/watch?v=nSf1MpsWKig[/youtube]
Online marauder2k9
Posts: 304
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sat May 11, 2019 8:58 pm
Okay after taking the time to go through the engines source code and looking for the best place to add the details for lighting and such i am a bit stuck, no matter where i add code to load a shader for lighting and i add a null light object into the scene i cant get it to work but i will persevere. I will say this though everything that is needed for lighting is already included in torque 2ds code also for some reason im not sure why but torque 2d has the ability to load in 3d models?
Online marauder2k9
Posts: 304
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sat May 11, 2019 9:32 pm
I think it may have to do with the stencil operations

Code: Select all

static void APIENTRY logglStencilFunc(GLenum func, GLint ref, GLuint mask) { SIG( "glStencilFunc" ); dllglStencilFunc( func, ref, mask ); }

Code: Select all

static void APIENTRY logglStencilOp(GLenum fail, GLenum zfail, GLenum zpass) { SIG( "glStencilOp" ); dllglStencilOp( fail, zfail, zpass );
fail, zfail, zpass, func, ref and mask all seem to be enums but they are pointing to default values in opengl i need to change these to GL_KEEP GL_ALWAYS GL_REPLACE and number values but i cant seem to find where they are used or defined and when i try to just type in gl declared variables it wont build
Online marauder2k9
Posts: 304
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sat May 11, 2019 11:48 pm
i found it its all defined in the batchrender.cc file how each element is rendered
Online marauder2k9
Posts: 304
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sun May 12, 2019 4:59 pm
So far i have found i will need to create separate render functions for different stencil options from the batchrender.

Using the example code here https://github.com/jacobbrunson/BasicLi ... /Main.java

So far i have found that in winGLSpecial.cc we have this

Code: Select all

static void APIENTRY logglBlendFunc(GLenum sfactor, GLenum dfactor) { char sf[128], df[128]; BlendToName( sf, sfactor ); BlendToName( df, dfactor ); fprintf( winState.log_fp, "glBlendFunc( %s, %s )\n", sf, df ); fflush(winState.log_fp); dllglBlendFunc( sfactor, dfactor ); }
Which is then referenced in the batch renderer here

Code: Select all

inline void setBlendMode( GLenum srcFactor, GLenum dstFactor, const ColorF& blendColor = ColorF(1.0f, 1.0f, 1.0f, 1.0f)) { // Ignore no change. if ( mBlendMode && mSrcBlendFactor == srcFactor && mDstBlendFactor == dstFactor && mBlendColor == blendColor ) return; // Flush. flush( mpDebugStats->batchBlendStateFlush ); mBlendMode = true; mSrcBlendFactor = srcFactor; mDstBlendFactor = dstFactor; mBlendColor = blendColor; }
Im going to create separate functions for stencilop and stencilfunc for rendering lights and light occluders but only if the scene contains a light. this way if your scene does not create a light there should be no difference in the render order at all, but if your scene does have lights, they need to be rendered first and past to frag shader
Online marauder2k9
Posts: 304
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Mon May 13, 2019 10:43 am
Im still working on this to get it working but have tailed off a bit, using some of simon loves work on creating a particle editor, i have begun work on an animation editor. I may make simon loves particle editor look a bit nicer to fit with design that i am going for with the animtion editor, it works perfectly with torque 3.4 with some minor tweaks, im thinking of consolidating all assets into a main assets folder with different sections for different types of items particles, sprites, gui etc for use with different editors. I see you have started work on implementing editors as well are there any code changes needed for the editors you are going to add? or is the editor going to load like a module ?
greenfire27
Posts: 43
Joined: Tue Nov 03, 2015 8:18 pm
 
by greenfire27 » Mon May 13, 2019 4:21 pm
Sounds like you were busy over the weekend :)

I have started work on the editors, but I was quickly side-swiped by how run-down the GUI has become. So I started refurbishing the GUI and writing documentation as I went. You can find it in the wiki and try it out in the dev branch.

I did manage to put in some scaffolding for the editors. They open with the console - separated by tabs. The editors will load everything they do as a module into a separate module manager (to keep the actual game stuff away from the editors stuff). I did the same thing with the assets. The editor assets are loaded by a different asset manager instance. This should make it much easier to build an asset editor.

So there are lots of code changes to the GUI and many of the controls are still broken or I removed them (there were 9 buttons). You can read about my changes so far here:

https://github.com/GarageGames/Torque2D/wiki/GUI-Guide

I also did several Patreon post about my changes that you could read.

https://www.patreon.com/Torque2D

I took a break from the editors to do an update to my game, but the update is almost done and I'll return to the editors soon.
Online marauder2k9
Posts: 304
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Mon May 13, 2019 5:01 pm
ah yes i downloaded that it looks brilliant with them being in the console!! i really like that, i have them at the moment as a dropdown menu.

One thing though with the latest dev branch its not registering touch events in the sandbox controls but is that because the gui elements are coded different?

It will be pretty cool when the editors are done i will keep trying to make my editors in the background with the 3.4 build, they should just drop into your editor folders without many changes being needed, are you going to be rolling the likes of animation editor, particle editor etc all into one main scene editor? or do u want to keep them separate?
  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
63 posts Page 3 of 7

Who is online

Users browsing this forum: marauder2k9 and 7 guests