Hey, I do not really know how you can do it in game maker, and it would be nice to know how did you manage to make the pixels look good on all screen resolutions.
And also, I want to say that I keep lurking your thread (but not IndieDB) so, perhaps you can crosspost. It takes time to write down the stuff you are doing, so, why not let it read to as much people as posible? I like TIG, because I can easily check new posts on threads I've written.
This game looks cool!
Hey mate, thanks for asking. Before I address the second part of the post, I'm happy to share!
-----------------------------------------------
So, before I go any farther into explaining, I'd like to point out that this isn't an absolute solution in my opinion. While I believe this is the best that Game Maker can handle, it is not absolutely perfect. When I say it scales correctly, I mean there are no artefacts and the pixels are rendered evenly. Black borders may still result on certain screens.
I start out by creating my room. In rooms that are designated as menus, I make the view encompass the entire room and set the port to exactly half of each measurement (example: 800x600 view, 400x300 port). In some cases views can be disabled all together for these sorts of rooms. In actual "gameplay" rooms, the view is set to an appropriate setting, and the port is set to equal the view. I use 320x240 in all gameplay rooms, due to the size of my tiles and sprites being very small.
Moving on, I use a global constant to define the base resolution and height of the game, or the base resolution which will be scaled up or down. I generally place this in the creation code for all rooms, although it is important to note that if you plan on having the player control the resolution, you will have to make a few changes by setting a global switch which lets the room know on creation to re-render the application surface or not. If this is not done, the game may not retain user settings.
basewidth = RESW;
baseheight = RESH;
resolutionaspect = basewidth / baseheight.
My base resolution is 1280 x 768, this being a direct multiple of the tile size used. The resolution aspect variable is the most important variable here. Without a defined aspect which is the same as the base resolution aspect, odd artefacts will appear on the screen in resolutions that are not direct multiples of the original tile size. After this, you must access whether the user's display is vertical or horizontal.
if (display_get_width() < display_get_height())
{
var truew = min(basewidth, display_get_width());
var trueh = truew / aspect;
}
else
{
var trueh = min(baseheight, display_get_height());
var truew = trueh * aspect;
}
This was something I was not 100% familiar with in Game Maker, as I am more acquainted with working with OpenGL and Java. Therefore, some of this code is modified off of tutorials I found on the GMC forums and I cannot take 100% "ownership" as the original writer of this part of the code shown above. What this does is first detect if the monitor is set to portrait or landscape. If it is portrait, it finds whether the base width or the display's width is smaller, which it must know in order for it to scale up or down. It does the same if it is portrait, but measures this with height instead of width.
surface_resize(application_surface, truew, trueh);
This is by far the most helpful thing implemented in the newest versions of GMS. This allows for the actual surface the application is drawn on to be resized. As you can see, it is resized to the truewxtrueh resolution.
EDIT: DISREGARD THIS READ COMMENT BELOWPlease note this is assuming the aspect ratio is selected as "Keep Aspect Ratio" and not "Fixed". While there will be some black bars (althought not huge), the quality will be better.However, let's say you want to the player to control the resolution. Here's two things you need to know. The first is that you have to initialize the player's choice when the game is started. The second is that the window size CANNOT carry over into fullscreen. This can cause artefacts. In order to make this work, you must make it so the window size is only selectable when fullscreen is off. Therefore the fullscreen scale will be solely based off the application_surface being upscaled/downscaled.
It is also important to notice that much older graphics cards may not fully support surfaces, or lag may result. I have included an option for players to turn off surfaces, which also warns players that this may mess up scaling and graphical fidelity.
application_surface_enable(TRUE/FALSE)
While I am sure this isn't the absolute best way to do it, I have tested this on roughly four computers all with different resolutions, and I can say that this is an efficient solution. However, as I am not satisfied with anything, I am still looking for other ways to get this to work. I am currently experimenting with fixed ratios which will take away the black borders. I will keep you updated.
EDIT: Alright apparently I'm an idiot who didn't do enough testing. Changing the aspect ratio from "Keep Aspect Ratio" to "Fixed" WILL eliminate the black borders and will keep the quality. Even on Windowed mode. However, on odd resolutions which are not divisible by the original base multiple, you may notice that things that are one pixel now take up two pixels. This is apparently unavoidable, however as far as I can tell it doesn't act as a detriment to the game's quality, although it might appear a bit odd at first. This only appears to happen on Fixed for some reason.If this still does not work and you are really looking for a solution, I would be happy to help you out with your project on this one specific topic.
-----------------------------------------------
In response for your second part, first of all thanks for following man! I appreciate it a lot. I will make an attempt to cross-post from now on, I guess it just hasn't crossed my mind. Thanks for the advice.
Hopefully this was helpful. PM me if you need any additional help or whatever. It's possible that I'm overlooking a simple detail.
-Bonesy