A few days ago when I was trying to figure the best way to draw text. The problem was this: the resolution of the game was very low, and in order to accommodate different screen sizes I was scaling the game up. For example, the game’s view for a 16:9 device was 568×320, and say the device had a resolution of 1920×1080, it would have to scale the game up 3.3X in size to fit the display.
This is a big problem for drawing text. If you’re drawing text relative to a small view (568×320), scaling the game up is going to stretch out the pixels, making the text have jagged edges. This isn’t a problem if you’re dealing entirely with pixel art or drawing a blocky font. Pixel art can scale up and still look the same as it does on the smaller view; same with a blocky font, such as those found in 8-bit games. However, I did not want to be limited to only using an 8-bit font, so I needed to change the way my game handled scaling.
The only solution for this is to scale down instead of scaling up. When you scale the game down it allows all of the images in your game to remain looking crisp, including any text. For GameMaker, drawing text requires an additional step which is to turn on “texture_set_interpolation”. Then it’s necessary to turn it off again after you’ve finished drawing the text. This essentially smooths out any remaining jagged edges due to the scaling of the game.
Now that I’m scaling down, I’ll have to create all of my artwork at a higher resolution. The target resolution that I’m going for is 1920×1080, the standard for HD, and depending on the device being used, the game will either scale up or down to fit the resolution. If scaling up from 1920×1080, the text that is using “texture_set_interpolation” will likely appear blurry, which is something I don’t have a solution for.
The only downside to scaling down is that it takes up more memory and is more taxing on the system. My target frames per second for my game was originally 60 fps, but now that I’m scaling down it will likely be 30 instead. This is an issue with GameMaker, but may not be a problem with more powerful platforms such as Unity.
Disabling Surfaces for Android
In the previous week’s dev blog, I posted a video of a quick prototype for the level editor. The game was running slowly and was very laggy on Android, but I had assumed this was because I was testing with a USB cable from my computer. The game was running perfectly on Windows, so I didn’t see any reason why it would be running slower on Android. I figured the game would run faster once it was exported as an Android App.
However, I read this post from someone on the GameMaker forums claiming that disabling the application surface would improve the frames per second. I started debugging my game to see how many frames I was achieving on Android, (I had the application_surface enabled and I was using other surfaces for scaling on top of that), and I was getting around 17 fps. Once I deactivated the application surface and figured out a method to scale without using surfaces, I was able to achieve 60 frames per second. This of course was when I was still scaling up, so now I’m achieving 30-40 frames per second on Android.
A New Dilemma
I’m faced with a tough choice going forward, but one that won’t really affect anything until I start the final artwork for the game. Do I scale the game down? Or do I scale the game up? If I scale down, I’m going to be able to have “HD” visuals within the game, but I’m sacrificing frame rate if the game can only run at 30 fps. If I scale up, I will be limited to having only pixel graphics and block fonts, but I will be able to run the game at 60 fps.
After some testing on Android, moving objects around at 30 fps doesn’t seem fast enough. With the level editor, it definitely has a better feel when moving objects around at 60 fps. So the question is: Do I sacrifice visuals in favor of functionality? Or vice versa?
In a few days I will post another dev blog to shed some light on recent design changes I’ve made to the game, as well as any updates on whether I’ll be scaling up or down going forward.