texture and rigib body combiner [solved]

Hello everyone,

My game is a modified version of the go board game. It displays a matrix of 32*32 tiles on which units move. Among others, there is a type of unit that mark the tiles it runs on.

The problem is that displaying 1024 independant tiles is not that easy. To display the matrix, I use a big quad with a grid texture (this was the first attempt at keeping a good frame rate), but now that my units are moving on it, I need to display the ‘marking’ they place on tiles. For that I use a 150*150 texture, but the frame rate drops too much, too quickly (from 17ms a frame to 50ms after ~320 tiles have been marked).

here is a screen of a run with pstats, frame time and graphic memory used.

Drwr suggested me to put the tile nodes into a quadtree-like structure. I tried that without success fps-wise, since every tiles are displayed anyway.

I also tried flattenStrong-ing the tile nodes’s parent, but even if the frame rate is indeed better, tile nodes coordinates are set to their parents, and I can’t use them to move my units along the matrix.
the fix, would be to keep another matrix of node for unit moves.

Last possible solution I tried was to use a rigid body combiner, but it seems tiles are not able to update their texture anymore: at first they are all hidden as expected, then as soon as one of them is assigned a new texture and called show(), every nodes get visible and show the default texture (not even the one asked for).

my questions are:
1- are rbc designed to handle texture change ?
2- is there another way to possibly solve my problem (other than zooming in so that only n tiles are displayed at once)
3- any other advice in mind ?

No, sorry.

There are still other things to try. One possibility, for instance, is to draw your marking updates directly into a texture that overlays the entire big quad (or even directly into the original texture), by updating the pixels in the texture image. That way you don’t need to display more textures as more tiles are placed.

David

ok, too bad. I prefer not to draw into a texture, as the simple texturing scheme I am using was meant to replace structure models, and texture painting is too far from model instanciation (I would like to be able to include models there, without having to recode the whole thing).

So I switched back to the flattenStrong method so that the units can still use tile nodes coordinates easily, with for each tile:
-a node contained by the node matrix (I may switch back to the quadtree if needed here), at the proper location.
-a textured quad positioned at the tile node location, but then reparented to a specific later-flattened node.

this way I can reach 400+ textured tiles at 60 fps, which will have to do (this was supposed to be a medium sized map haha :unamused:)

thanks for the prompt answer, and the help on irc :slight_smile:

val