How to render a lot of small images without lag
Posted: Tue Mar 13, 2018 3:49 pm
Okay, so I'm trying to render a map composed of small tiles. My character is fixed on the center and the map moves smoothly below it. The problem is every time the render method is called it checks if an animation is happening and call a 'change_pos' method, that updates the position of all my tiles. With a 10x10 grid I have no performance problems, but as the number of tiles grow, my game starts to be laggy - which is, honestly, expected.
I'm using the same image object for the same type of tile, so it's not a RAM problem, since it loads just 5 or 6 different small images. I tried to check if the image should or shouldn't be rendered by checking its position with a xmax, xmin, ymax, ymin (my print zone is 3 times width and height of the screen) in the case the problem was the rendering itself, not the checking method, but it's still laggy.
I would like to know if there is a better way to calculate positions and/or render all those images without lag. Maybe using a well optimized renpy function, or even threads (haven't found much about this on the doc).
I'm using the same image object for the same type of tile, so it's not a RAM problem, since it loads just 5 or 6 different small images. I tried to check if the image should or shouldn't be rendered by checking its position with a xmax, xmin, ymax, ymin (my print zone is 3 times width and height of the screen) in the case the problem was the rendering itself, not the checking method, but it's still laggy.
I would like to know if there is a better way to calculate positions and/or render all those images without lag. Maybe using a well optimized renpy function, or even threads (haven't found much about this on the doc).