I did some tests
if you use multiple tilemap objects (single tilemap for each) and multiple viewports you get 1000fps
also app properties > machine independent speed makes a huge difference
Interesting. I tried some of your suggestions. I'm writing this as I test things. Here's what I got:
---
I checked Machine Independent Speed ON, and that alone seemed to increase frame rate. But in a sort of odd way. Fusion's debugger reports a pretty consistent 60 fps, but visually the screen looks like its dropping frames (the game appears stuttery). So I don't think that's a real solution. So it seems the underlying game engine is running at a smooth 60 fps, but the screen refresh rate is stuttering around maybe 40 fps (my best guess).
If I bump up the FPS on my game to 1000, I get around 100 fps on my frames with the Tile objects in it. I have one level in my game where the FPS drops down to 40 (when its set to 1000). This only seems to happen when I move the player to a particular underground section of my map (so the slow down must have something to do with scrolling + multiple tilesets overlapping)
---
UPDATE: If I turn "VSync" on, it seems to lock the game at a maximum 60 fps, even if the Framerate is set to 1000. It also appears very smooth and consistent. But if I change the Framerate back down to 60, I get stutters and drops down into the 40s again.
---
I can't test the "multiple tilemap objects (single tilemap for each)" right now, because that would require completely redesigning how I setup my game. But even if that does work, it feels like a sad work-around -- one of the main benefits of the TileMap object is the ability to store multiple layers, tilesets, and basically all your level's map data in one object. Having to use multiple objects feels hacky, and probably increases RAM usage too.
But I'll try to test this out later if I can.
---
ANOTHER UPDATE:
I tried testing out a "mixed installation" of the TileMap.mfx and TileMapView.mfx files. What I mean by this is:
- I installed the old version of TileMapView.mfx, which has a "Date Modified" value of "11/19/2016 5:48 PM"
- This date matches up exactly with the last commit Looki made on 11/19/2016: Please login to see this link.
- I installed the newer version of TileMap.mfx, which has a modified date of "4/6/2019 11:51 PM"
Interestingly, when I run my game now (with the new TileMap.mfx, and old TileMapView.mfx) the frame rate is perfect, smooth, and stable... BUT... The Tilemap viewport won't render any other tilesets except the first one it finds. The parts of my level that used a second tileset are now just blank.
This confirms what I originally suspected: There's nothing wrong with the TileMap.mfx extension, it is the TileMap Viewport extension that is bugged. This makes sense since if you consider that the TileMap object is basically just a specialized data array -- it doesn't have any built-in graphical components.
The TileMap Viewport object is the one that is rendering the graphics to the screen (and thus is the extension interacting with your GPU).
Now the odd thing is, that the GitHub for the TileMap object has a last commit of 4/7/2019 (which lines up with the file date on the mfx extension):
- Please login to see this link.
But the TileMap Viewport's GitHub page says the last commit was by Looki in 2016... but the newer MFX file does have a modified date of "4/6/2019"
Conclusion:
If Yves was the one to update the TileMap and TileMap Viewport extensions, it appears that he forgot to commit/push the source code to the GitHub page (but only forgot for the TileMap Viewport extension). So we (as a community) have no clue what was changed in that extension that is causing this bug, therefore we can't really fix it.
On top of that, the bug causing frame drops, lag, and issues with more than 1 tileset seems to be related to this TileMap Viewport object specifically. My guess is that it may be some small inefficiency when the object tries to load/access a second image texture.
Yves Could you please push the TileMap Viewport changes you made to the public GitHub, so maybe someone can spot the bug and fix it? Without being able to see that source, we're in the dark.