H
Heropants
Guest
So I'm making a game where you basically create your own sprites for many of the objects in game (it's a tycoon game where the player is building different objects to sell. Every object they create to sell gets it's own custom sprite). I do this by transferring the sprite the player makes to a surface then use the function: sprite_create_from_surface function. This allows the player to create their own custom sprites that can be used in-game.
The problem is that each of these new sprites creates their own sprite page (or texture page or whatever it's called). So if the player creates more than a handful of sprites, the game has to do a bunch of texture swaps and it really starts to slow the game down.
Does anyone have any idea of how I could save custom sprites to a single page rather than having it create a new page every time.
Here's some of the ideas I've tried that failed:
- Instead of actually creating and saving a new sprite, I just have the object draw a bunch of different sprites together to make up the sprite. The probably with this is that the sprites the player creates can be made up of 1024 different sprites. So it turned out that even with the texture swaps, it's still takes a lot less power to create a single custom sprite than have the object draw 1024 different sprites together.
- I also tried making it so every time a new sprite was created, it took all the custom sprites and redrew them on one surface and then created a single sprite from that. This worked because it saved all the custom sprites into 1 sprite that was 1 texture page. However, I then had to use the draw_sprite_part function to split up the sprite back into the individual sprites for each object. The problem is that the draw_sprite_part function takes up more power (if there's more than like 10 objects) then it does to swap between texture pages.
Any help guys would be massively helpful. Thanks in advance!
The problem is that each of these new sprites creates their own sprite page (or texture page or whatever it's called). So if the player creates more than a handful of sprites, the game has to do a bunch of texture swaps and it really starts to slow the game down.
Does anyone have any idea of how I could save custom sprites to a single page rather than having it create a new page every time.
Here's some of the ideas I've tried that failed:
- Instead of actually creating and saving a new sprite, I just have the object draw a bunch of different sprites together to make up the sprite. The probably with this is that the sprites the player creates can be made up of 1024 different sprites. So it turned out that even with the texture swaps, it's still takes a lot less power to create a single custom sprite than have the object draw 1024 different sprites together.
- I also tried making it so every time a new sprite was created, it took all the custom sprites and redrew them on one surface and then created a single sprite from that. This worked because it saved all the custom sprites into 1 sprite that was 1 texture page. However, I then had to use the draw_sprite_part function to split up the sprite back into the individual sprites for each object. The problem is that the draw_sprite_part function takes up more power (if there's more than like 10 objects) then it does to swap between texture pages.
Any help guys would be massively helpful. Thanks in advance!