I've found it's generally good practice to stick to powers of two for the sizes of art assets however when implementing 2D art Game Maker doesn't restrict you to this. Upon discovering this I admittedly went a bit, well, mental with it- I immediately chose a resolution of 1920 x 1080 for the game and created some pretty massive assets as a result.
So, not wanting to sacrifice any quality I finally got round to optimising my assets in game last night thanks to this very handy blog post by Yo Yo Games.
Game Maker stores all the graphics for the game in texture pages - images with several sprites stored on them that sprites will be pulled from whenever they appear on screen. The first step to optimising my art was to create a texture group for each room (scene) in my game.
I then went through all of the sprites in the game and selected the appropriate texture group for them. After doing this all the texture sheets were more or less ordered with all the sprites for each room/scene in chronological order. This already sped the loading speed up quite a bit as it shortens the amount of texture sheets the game has to look through.
Finally for each room I created a "create event" for an object there and added the code:
draw_texture_flush();
Which clears the texture memory. This was followed by the line(s) "draw_sprite([sprite name], 0, 0, 0);" for one sprite on each texture sheet for that scene (the forest scene in the above example has A LOT of sprites). As I understand it, this way the game now instantly knows which sheets to load up for that scene, rather than searching through all of them for each individual sprite.
I've also had to scale down the scope of my game due to time restraints, so the current map looks like this:
However quality over quantity, and the game is running a lot faster now!
No comments:
Post a Comment