Page 1 of 1

How to draw&update 2500(50x50) tiles

Posted: Wed Jul 28, 2021 3:28 pm
by tornsoul
Usecase:
- a board game with 50x50 tiles (or more)
- tiles will change as the game progress, so they need to be updated (on click - and automatically)
- the board has row and column headers that needs to update (highlight/change color) as the mouse moves around over the board

I've tried with image buttons for each tile (knew it would be too slow - but had to test)
I've tried with a CDD (full code here viewtopic.php?f=8&t=62635) - which is factors better, but still sluggish.
- it appears that the 2500 items somehow still hang around even if it's rendered by the CDD

The next attempt would (perhaps?) be to somehow generate a single "texture" (a tiling of all the tiles) that only would need to be updated when a tile changes (as opposed to being re-rendered all the time when the mouse moves around as with the CDD)
I in fact thought the CDD would accomplish this - But evidently not (the number of tiles impacts performance when moving the mouse - which would not be the case if it was simply a single texture)

So - Is there a way to generate "a texture" (or image or bitmap or...) dynamically from multiple source images (the different tiles) with renpy to achieve this - I haven't been able to find anything..

OR: Is there a different and better way to go about this?

Re: How to draw&update 2500(50x50) tiles

Posted: Mon Aug 02, 2021 8:26 pm
by PyTom
What does your screen look like? If it's being cached right, and the tiles are mostly the same images, that should be fine.