How to draw&update 2500(50x50) tiles

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
tornsoul
Regular
Posts: 29
Joined: Sat Jun 19, 2021 7:32 pm
Contact:

How to draw&update 2500(50x50) tiles

#1 Post 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?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

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

#2 Post 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.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Ocelot