OpenFL - TileMap advices?

Could be related to max number of vertices in the graphic card.

When you dezoom you could pre render or something (by creating a BitmapData?).

Another tester with a huge computer had strictly the same result.
I was thinking it may be because I was setting scaleX, scaleY with addTile.call()
Some internal limits.
But even without scaling, I could not retrieve more than 16384 tiles.

While the bunnymark let me go far far far away that score, and is perceptible (disabling move/gravity).

65536 (4 vertices * 16384) is a limit for any graphics card (anyway, for WebGL and flash) for rendering ONE set of triangles at a time.
For example, when you create a particle system in Away3D with more than 16384 particles (each particles has 4 vertices), particle helper splits geometry to several subgeometries with the same material, and draws it one by one.
I have not tried to use Tilemap yet, but it looks like it not designed for rendering SO HUGE amount of tiles, and it not tries to split the internal vertices. Maybe i’m wrong about tilemap, but limit of 65536 vertices is definitely exists.

EDITED: I just looked into BunnyMark. And yeah, when i’m using Tilemap and try to render 16400 bunnies at one time - it only draws 16384 in right places, other appears in wrong places (or just disappers).

for (i in 0…164)
for (j in 0…100)
addBunny(i * 5, j * 7); (x,y of new bunny)

1 Like

I will test again.
Because setting the BunnyMark to display tiles with just :
• an incremented x = tileIndex%stage.stageWidth
• an incremented y = Math.floor( tileIndex / stage.stageWidth )
I could really see that above the 20000th or 40000th or 60000th tiles were still displayed unlike my project (while still not occupying all the screen.pixel, that said…)

Are you sure that you are using tilemap in BunnyMark? There are two modes, look at the source…

You’re damn right, Egis. :+1:
It was not tilemap.addTile() but graphics.drawQuads() who let me beat the score of 16384.
It’s a technical limit.
I’ll try to do with it.
I’m now understanding more the suggestion of Laudo about prerendering with bitmapData by example.
Thanks to both of you for your time. :kissing_heart:

I think pixijs splits the rendering in more than one drawcall when there are too many vertices. We could do the same with openfl I think.

Internally we flush if the shader or texture changes:

…but I think we pack everything into the same data array.

There’s no other reason (other than a developer putting in the effort) that Tilemap couldn’t make an extra draw call here