[Stencyl 3.5/4.0.x] Away3D Extension

NerdinaNutshell

  • *
  • Posts: 251
Split-screen is not something that I've been looking at.  For a puzzle game it should be no problem, but when you want kind of like what GTA5 is doing I wouldn't know how to do that.
Oh, that's a bummer. Oh well
*Puff*

NerdinaNutshell

  • *
  • Posts: 251
One of the things I've noticed with the extension is that it's quite finicky with which textures in the extras folder it will actually load. For me, it will load the first few textures I add-in fine and then it feels like complete luck for the rest.
*Puff*

mdotedot

  • Posts: 1640
Propably the textures are not a power of two and/or too large.
Running to HTML5 and opening the browser console mostly give good messages on what is wrong.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

NerdinaNutshell

  • *
  • Posts: 251
Any plans to bring this to 4.0.2+? Doesn't seem to work in it as of now.
*Puff*

mdotedot

  • Posts: 1640
Hi NerdinaNutshell,

On the download page there is now a 4.0.2 version of the extension.

Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

NerdinaNutshell

  • *
  • Posts: 251
Download button for 4.0.2 is not working as of now. Also, the downloaded: X times text just copies the 3.5 download one. (Found a workaround, you can inspect element the download button and then you should see the downloadable file in the code).

« Last Edit: February 01, 2020, 01:46:16 pm by NerdinaNutshell »
*Puff*

NerdinaNutshell

  • *
  • Posts: 251
Do you know if it's possible to get the name of an object that a tile is bound to? And more importantly, delete it?
*Puff*

mdotedot

  • Posts: 1640
Another way of ' binding ' meshes to tiles:


when using the [ 3D: Bind TileSetID ] you have the limitation of 32px usage and you need to modify the Bind.hx in the extension to make them accessible.

Around line 390 in that file:


Code: [Select]
// set scale
scaleMesh(newMesh,getTileHeight());

Add this below those lines:
Code: [Select]
// Add to Meshes (For NerdinaNutShell)
A3D.setObject(newMesh.name, newMesh);



Then you can access the tile by this name : TILE.tsid.id.row.col.

Like so:




Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

NerdinaNutshell

  • *
  • Posts: 251
The code you posted above doesn't seem to work. I copied everything exactly how you said to and didn't work. Alt tile binding just doesn't work and attempting to remove the tiles just crashes. Are you on a different version and maybe that could be causing issues?
*Puff*

mdotedot

  • Posts: 1640

Away3D extension with the bind code change:
Stencyl 4.0.2 Extension with Bind change

Demo (Don't do anything and wait 10 seconds to get the tiles removed) . Check the code in 3DLevelBehavior
Demo






Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

NerdinaNutshell

  • *
  • Posts: 251
I was working on a project with this earlier and found that the “3D remove” block no longer functions with HTML5 in the 4.0.2 version. I tested this on multiple different demo games that previously worked fine and my own and they all crashed. However, I did find that using ‘add ‘3D: get name ‘....’ to ‘...’” and “3D: name: ‘Scene0’ call method: ‘removeChild’ argument list: ‘...’” works
*Puff*

mdotedot

  • Posts: 1640
Thank you for the report!!

Indeed HTML5 has a problem when switching from 3D. I usually make games all in 2D or all in 3D. Since running HTML5 locally gives problems with assets I tend to use Windows or Flash for those.

That is why I didn't catch this error myself on the Demonstration Game.
Code: [Select]
lay3D_Program3D.dispose (Program3D.hx:113)
    at away3d_core_managers_AGALProgram3DCache.destroyProgram (AGALProgram3DCache.hx:126)
    at away3d_core_managers_AGALProgram3DCache.dispose (AGALProgram3DCache.hx:76)
    at openfl_events__$EventDispatcher_Listener.away3d_core_managers_AGALProgram3DCache.onContext3DDisposed [as callback] (AGALProgram3DCache.hx:65)
    at away3d_core_managers_Stage3DProxy.__dispatchEvent (EventDispatcher.hx:402)
    at away3d_core_managers_Stage3DProxy.dispatchEvent (EventDispatcher.hx:246)
    at away3d_core_managers_Stage3DProxy.freeContext3D (Stage3DProxy.hx:557)
    at away3d_core_managers_Stage3DProxy.dispose (Stage3DProxy.hx:177)
    at away3d_containers_View3D.dispose (View3D.hx:889)
Stage.hx:1457 Uncaught TypeError: Cannot read property 'deleteShader' of null
    at openfl_display3D_Program3D.__deleteShaders (Program3D.hx:597)
    at openfl_display3D_Program3D.dispose (Program3D.hx:113)
    at away3d_core_managers_AGALProgram3DCache.destroyProgram (AGALProgram3DCache.hx:126)
    at away3d_core_managers_AGALProgram3DCache.dispose (AGALProgram3DCache.hx:76)
    at openfl_events__$EventDispatcher_Listener.away3d_core_managers_AGALProgram3DCache.onContext3DDisposed [as callback] (AGALProgram3DCache.hx:65)
    at away3d_core_managers_Stage3DProxy.__dispatchEvent (EventDispatcher.hx:402)
    at away3d_core_managers_Stage3DProxy.dispatchEvent (EventDispatcher.hx:246)
    at away3d_core_managers_Stage3DProxy.freeContext3D (Stage3DProxy.hx:557)
    at away3d_core_managers_Stage3DProxy.dispose (Stage3DProxy.hx:177)
    at away3d_containers_View3D.dispose (View3D.hx:889)

I will look into this.


EDIT:
It appears that this is reported before and that it is a bug in Program3D. (open since january)
https://community.openfl.org/t/best-way-to-dispose-of-away3d-views/12223
Code: [Select]
__deleteShaders Program3D.hx:597
dispose Program3D.hx:113
But there was no mention of it being a HTML5 specific thing.


Maybe I find more ...
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

NerdinaNutshell

  • *
  • Posts: 251
Just ran another test, the bug is also present on Mac and results in the game instantly crashing.
*Puff*

mdotedot

  • Posts: 1640
Hello NerdinaNutshell,

Can you test the following Extension?
http://photoquesting.com/stencyl/A3D_402_switchscene.zip

I've ran the Demo and ofcourse there was a problem with HTML5 not loading resources locally so that part didn't work.
But the switching scenes did work.

Also I ran a test on Android and that worked with the modifications.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

NerdinaNutshell

  • *
  • Posts: 251
It worked for both Mac and HTML5 for me (flash as always worked as well) on both my own project and one of the demo games. To get it working I had to turn off the original Away3D extension and then save and quit the project.
*Puff*