After a (not so) brief respite I've picked up where I left off and
made some progress.
I've gone back to the drawing board in terms of project layout, it was
getting to be too much code to handle with some kind of structure.
I've even implemented a few tests, though not as many as should be
there.
I've managed to fix my speed issue! I can now load a level with
40,000+ tiles and get about 60 fps.
I managed this in two phases:
1. I found the smallest Rect that surrounds the iso_screen, where
iso_screen is the screen rectangle transformed into "model"
coordinates. This allows me to use colliderect to decide which tiles
to update which sped things up alot. There was still some slow done
with large number of tiles though, as each tile needed to be tested.
2. I fixed this problem by implementing a 2D linked grid collection.
This allows me to start at any tile and iterate outwards in all
directions, stopping in a direction when a tile fails the test.
Effectively, this mean that a constant number of tiles is tested no
matter how many tiles are loaded in the grid. A downside of this is
that it can take a while for the level to load (the grid is expensive
to create, fast to use). I tried to load a level with 1,000,000+ tiles
but gave up waiting :-)
I've also made update to the physics which I think work quite well and
implemented a level loader with some walls that I made in Blender.
Let me know what you think, I'm wondering what to concentrate on next
and I'd appreciate any ideas.
p.s. The controls are:
Click: Move
x: Fire
Space: Jump
p: Switch panning on/off
ESC: Quit