create tiled layer in behavior

catinas

  • Posts: 54
i need to create 900 tiled layers

and i will need it on difrent scenes so by hand it is stupid

so can u help me create tiled layers with behavior or extension

JeffreyDriver

  • Posts: 2262
You'll be able to do this by using loops, but you will have to have all your images properly named to help you out, e.g. "BG 1", "BG 2"

Then you can use the current loop count to pull the correct image, though I'm assuming that each is different. Can you give a little more detail?

One thing I need to mention, is that I don't know how well Stencyl will handle 900 layers.

catinas

  • Posts: 54
JeffreyDriver im so glad someone replied

what details u need cause i think if u use behaivior block only lets u to use  background layer and what i need is tiled layer

what is an imige never used it before

« Last Edit: January 24, 2018, 07:54:36 am by catinas »

merrak

  • *
  • Posts: 2738
Short answer: Yes, it's possible.

Longer answer: For such a large number of layers, you'll probably want to write a new layer manager that handles clipping. Stencyl isn't well suited for isometric (which is what I assume you're doing from the screenshot you posted in the other thread) rendering on a large scale. Earlier versions of my isometric renderer used a model similar to the default layer handler and I ran into problems at around 300 images. What I ultimately ended up having to do was render each face of a tile separately and clip out the overlapping areas so redundant parts of it aren't drawn. This required writing a new layer manager "from scratch".

Organizing layers is not too hard to do. If you haven't yet, take a look at the Stencyl engine files and see how it uses sprites to handle layers. My own solution is similar, just using a new class with procedures to handle the 3D problems that Stencyl won't solve for you. I wrote a bit about how I put that solution together in the journal thread I maintain in the journals forum. The hard part is the actual clipping.

Note: Stencyl is well suited for isometric and 3D rendering on a small scale. There are a lot of good examples of these kinds of games as well. 90 to 900 is a large range, but I suspect that you'll need to invest some time in researching a good rendering routine if your needs are consistently trending toward the upper end of that range.

catinas

  • Posts: 54
around 300 images

im sorry but why u say imiges... cause i want to use tiled layers to draw on

merrak

  • *
  • Posts: 2738
around 300 images

im sorry but why u say imiges... cause i want to use tiled layers to draw on

You wouldn't need 300 layers if you didn't have 300 things to draw.

catinas

  • Posts: 54
i dont have 300 things
 i just need items to be in folder from 0 to 900

is there a way to upload my game so u could see?

catinas

  • Posts: 54
why stencyl no longer lets upload your games ?

merrak

  • *
  • Posts: 2738
You can export the .stencyl project and attach it to one of your posts. If you construct 900 layers but aren't drawing on a significant fraction of them, then you have a lot of waste and may run into resource usage issues. 90 should be fine.

Stencylforge was closed down a while ago.

catinas

  • Posts: 54
look i just dont know how to create 900 layers not by hand

anyway game controls:

mouse press and moving x and y axies
arows up down left right
zoom and zoom out z x
change camera c or v

« Last Edit: January 24, 2018, 03:15:11 pm by catinas »

merrak

  • *
  • Posts: 2738
I'll put it this way... there are several good answers to your question and knowing more about what you're trying to do will help me give you the best answer I can. I'm on mobile right now but can look at your game later.

merrak

  • *
  • Posts: 2738
Ok, I think I see where you're coming from. You're using drawing events, right? And you need all the layers so that you can draw the tile faces in the correct order?

You can open Engine.hx and look at the draw() function (around line 3060) to see how the Stencyl engine is handling drawing events. It looks like you need to create more Layer class instances and add them to the interactiveLayers list in the engine. There may be a simpler way to approach it, but I wouldn't know--I've never done it. I don't see why you couldn't do it, but you may be the pioneer on this one. The demo is pretty cool, though. I'd certainly be interested in seeing how this develops.

Have you tested the number of shapes you can render on one layer? I have a bad feeling about using layers to solve the depth ordering problem. I built up an entire rendering engine using that idea and ultimately ended up having to tear it down and build something else. It can work, but you'll likely hit a CPU roadblock by the time the number of polygons is in the order of hundreds... or even lower, depending on screen size and what else is happening in the game.

catinas

  • Posts: 54
i really dont know what is engine.hx.....
i onlly use stencyl blocks....
and ya alot of blocks kinda make it ruth for cpu....

did u turn camera around?... did u use a difrent camera?...

merrak

  • *
  • Posts: 2738
did u turn camera around?... did u use a difrent camera?...

I played around with the different cameras and views. Seems to work well for me. What problems were you having with the block you were already using?

catinas

  • Posts: 54
im u sing no block its hand made layers...

andthat block creates background layers.... what i need is tiled layer (atleast i thik thats what i need)......