Hi!
I'm building this RPG-like game with Stencyl. The Player roams through 2D scenes, and interacts with other actors (mobs, switches, etc). Zelda-like, if you want. I'm using Box2D because I want collision shapes to be more specific than full squares.
For all my actors, I've disabled Continous Collisions, rotation, gravity.
My regular/test scenes are 30x23 tiles, i.e. 960x736 pixels. I have about 7 layers per scene : two layers for the terrain/background, two layers for the furniture/obstacles/decorations, one layer for the player/actors, two layers for the canopy/foreground. I'm drawing only with tiles, 5% of them being animated (by the way, I don't understand the quote "break up concave polygon into 2 or more convex polygons instead" when defining collision shapes for tiles explained in the
Stencylpedia, since the collision shapes of tiles above override the ones existing below)
For such scenes, the FPS is OK (20-25) until I get too many actors on screen at the same time. I hard-coded a limitation: there can only be 20 of them at any time, and I'm fine with this.
But I decided I wanted one big scene, for the main village, not divided into quarters/suburbs. It's 100x100 tiles (i.e. 3200x3200 pixels), and it
should be OK, as I've read around here that scenes would tend to bug mostly when the width is bigger than
16k pixels. Again, 7-8 layers of tiles (most of them moderately populated). After 4 days of work, my scene is completely drawn, with tiles only.
Now I put actors in it, and I place my Player to test it (no point in testing it beforehand, as the collision shapes were not finished, right?).
Lo! Even without Debug Drawing, with a single actor (and only 3 behaviours: "Camera Follow", " Reload on Exit", and "4-way Movement"), the FPS plummets to 4-5!!!! I cannot sensibly add all the other actors I planned until I've solved this issue.
Would you have any idea to investigate what could cause this massive lag?
I'll test replacing parts of my layers (the ones with non-collidable non-animated tiles) with plain images as back/foregrounds, but this means I must change these images each time I modify a single item in the scene. Switching one tile would have been so much more convenient!
Thanks in advance for any hint or insights you could give me!