Oh boy, this is my jam
What is the difference in cost between adding multiple tiles or adding multiple tiles inside Tile Containers and than added to the tilemap?
In the current haxelib version of openfl (8.9.1) there is a small loophole in logic that adds a lot of overhead to tilecontainers. If you have a really deep and complex tree you will notice some slowdown. Otherwise, the performance hit is the one that comes from the applying the parent transformation to his children, for the ease of use it brings I consider that performance hit negligible.
If I have different tilset between the sprites in game and the ground and I can’t fit both in one tileset, should I create 2 separate tilemaps, find a way to switch between tilesets with one tilemap,
My general advice would be to set each tile “tileset” to the correct one and that allows you to mix and match tilesets in one Tilemap. Now, keep in mind that the batched render renders from back to front and it will have to flush (stop batching) as soon as it needs to change the tileset.
Would pooling for tiles be worth it, or is the cost for creating and deleting tiles minimal?
Technicallyyyy a tile is a super duper simple structure that is really cheap to make from scratch when needed. That being said, if you add some logic to it (say, you extend Tile to make Enemy) you might want to pool it. (For pooling, Lime has the ObjectPool that works reaaaaally good)
Now, something important to keep in mind: Tilemap will cull (not render) any tiles outside his boundaries. (negative x and y, and x and y above his own width and height). It doesn’t know where your stage starts or ends so it will not cull what is “outside the screen”. To make this I advice to have a Tilemap the exact size of your stage and then have a tilecontainer called “tileStage” and add all your tiles there. That should allow you to migrate from the DisplayList to the Tilemap somewhat seamlessly.
Any other question, hit me up