Author [EN] [PL] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [ID] Topic: Pixel-Perfect Up-scaling in Game Maker (sans surfaces)  (Read 9096 times)

0 Members and 1 Guest are viewing this topic.

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Pixel-Perfect Up-scaling in Game Maker (sans surfaces)
« on: June 24, 2013, 06:20:16 PM »
+2
I've been seeing this topic cropping up a bit at GMC. The solution has often been to render the game onto a surface and draw the surface up-scaled or something. This is hardware-dependent -- if your video card doesn't support it, you're screwed. I stumbled upon another feature in GM's video processing that is also hardware dependent, but may work with all video cards. I would appreciate any feedback on this.


First, this is intended for full-screen resolution up-scaling. This does apply to windowed games, however. Still, these days nobody cares about windowed games, especially in low-resolution games. You need to go into the Global Game Settings and enable Full-Screen with Fixed Aspect Ratio. This is important. Also make sure interpolation is disabled while you're there. Now go into every room in your game make sure all view ports are twice the width and height of the view; then reduce the size of the ports by 1 each way. In other words, if you use a view 256 pixels wide and 224 pixels high, the view port should be 511 by 447 (256*2-1 and 224*2-1). Now when the game is run, it should take up the full height (or width if the monitor is portrait-oriented) of the monitor with pixel-perfect scaling, meaning no tearing between tiles and no interpolation.

In windowed mode, there should never be any issue with odd-factored scaling. A 1:1 or 3:1 port-to-view ratio should always yield pixel-perfect scaling. With even-factored scaling, you need to reduce the port by 1 (or increase by 1, but I prefer a smaller port). I don't know why this is; I have my hypothesis, but I'm sure it's way off base. Determining the port size can be handled arithmetically if you choose. The following code would be able to handle it for you:

Code: [Select]
var scale;
//Set scale to the desired factor
view_wport    =    view_wview * 2 - !(scale & 1);
view_hport    =    view_hview * 2 - !(scale & 1);


Once again, feedback would be appreciated. This needs to be tested on more than just my computers to see if it works.

Update: Unless my eyes deceive me, it seems any integral scaling factor should work as long as it is greater than 1. I tried with a 3:1 factor and it seemed to scale pixel-perfect. Thus, it seems 3:1 is the ideal ratio.

Personal Response to Previous Update: Scaling beyond the resolution of the monitor will cause distortion. So while 3:1 could be deemed the ideal ratio (I have always encouraged 3:1 scaling, something I picked up on while viewing screenshots from my alpha engine), it is more likely to overextend the port/window beyond the resolution of the OS if one were to factor in mobile apps. Thus, on a PC 3:1 scaling is the best I think, but for a mobile app the 2:1-=1 scaling is better.
« Last Edit: June 25, 2013, 08:24:35 PM by TheouAegis »
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Pixel-Perfect Up-scaling in Game Maker (sans surfaces)
« Reply #1 on: June 26, 2013, 05:48:33 PM »
+2
Update: I tried changing my monitor's resolution from widescreen to... um... whatever the old resolution was called. Went from 1600x900 native to 800x600. In my case, 3:1 scaling did NOT work. Only 2:1-=1 scaling up-scaled properly in my program. So I'm stick with 2:1-=1 for now.Since I only have two monitors, I can't tell beyond these two.  :-\
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3265
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: Pixel-Perfect Up-scaling in Game Maker (sans surfaces)
« Reply #2 on: June 27, 2013, 11:34:46 AM »
0
I remember having to deal with this in the passed. But for me this stopped being an issue when I stared designing my projects with 4x size graphics in mind to allow for hi-res graphics sets. When not using hi-res graphics I just make the low-res graphics bigger.
"Stuff and things."

Tags:
 

anything