Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

It doesn't really need to swap the whole texture page, it does get all the sprites from the same page. It only swaps for the goddesses which I put on a separate page because the sprites are very large and they wouldn't fit on the main page. 

The reason it was doing a lot of swaps before v9.8 was because I was using the built in draw_rectangle function which swaps textures to a built in page that contains only a white pixel which it uses to draw the rectangles (I wasn't aware of this). Rectangles were used for progress bars on structures, so it had to swap a few times for every structure that had a progress bar. The way I fixed it was using a white pixel I had on the main page, and just making my own rectangle function.

Deleted post
(+1)

The progress bar is already not a part of the structure sprite, and the game does draw the rectangle above the structure. I don't know if calculating and rendering vertices is faster in this engine, maybe it is, but it's fine now. The rectangle function that I made uses a white pixel on the texture page that is already loaded, and stretches and recolours it to make a rectangle for things like the progress bar, so there are no swaps (basically works the same as the built in rectangle function, but without swapping pages). Drawing more sprites doesn't impact performance that much, so it's fine.

If I should optimize, it would be other parts of the code at this point. The crafters for instance start at the top of an array containing the recipes in the form of arrays of items, and check every one of those arrays against their inventory until they find an array whose items the inventory contains (and then they start the crafting countdown). This is really inefficient, and is probably having a much larger performance impact than the same structure drawing an additional sprite as a progress bar.

Conveyors do already use a shader to swap colours.

I hope I'm understanding your points properly, and not speaking past you. If you want you can add me on discord, it could be easier to talk there.

Deleted post
Deleted post