Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

How to make your GameMaker game be TRUE 64x64

A topic by Baku created Apr 03, 2016 Views: 1,645 Replies: 9
Viewing posts 1 to 7
Submitted (2 edits) (+8)

I've seen some posts about how to set up GameMaker to be 64x64, but I don't think I've seen anyone post this important bit of code that makes the game ACTUALLY run at 64x64:

surface_resize(application_surface, 64, 64);

EDIT: Also do this to resize the GUI (thanks, Jack!)

display_set_gui_size( 64, 64 );

Put that in the Create event of your controller object or whatever you have in your project that runs at the beginning. It resizes the application surface to be 64x64.

If you don't do this, the game will look like 64x64 sure, but when you increase the window size, it'll allow objects to be placed between pixels, and rotating objects will look smooth, thus breaking the rules. So make sure to use this code!


Here's a comparison showing rotation + "smooth" camera (both 64x64 view, 320x320 port on screen):

1) App. surface has not been resized. You can see how camera movement and rotation is smooth. It's pretty, but breaks the rules:

2) App. surface has been resized. The game now correctly conforms to a 64x64 grid. It's jerky, but follows the rules:

Deleted post
Submitted(+2)

Draw GUI will still draw things scaled to real-size pixels even when using this trick. It doesn't care about application surface size or view size etc. That's just how Draw GUI works, and I have no idea if that can be changed or not.

Instead, when you want to draw your HUD and so on, use the normal Draw event, and place stuff in relation to view_xview and view_yview. This'll will give the same result, but use the same scaling as the rest of your game.

Deleted post
Submitted(+4)

You can resize the GUI using display_set_gui_size( 64, 64 );

Although you may have to run that code each time you go to a new room, GM can be very tempermental. :P

Deleted post

I tried this and placed the display_set_gui_size(250,240); in many places, never worked. Are you able to draw pixelated rectangles and circles on the GUI? I think it works for coordinates but not for draw events.

Submitted (1 edit)

Resizing the GUI works differently than resizing surfaces in GM, for whatever reason. The difference is that, as you describe, even after resizing it will still display subpixels (e.g. when you draw a rotated sprite, a primitive such as a circle, x/y positions that are fractions of pixels, etc.). To absolutely force the GUI to adhere to the pixel grid, you could instead draw all of your GUI stuff to a surface that's the desired size, then draw that surface on the GUI layer.

(+2)

And this whole time I'd just been trying to work around using image_angle! Thanks for this!

Thank you for this!

Submitted

Thank you so much :,)

Well, this just made my life a lot easier. Thanks for the tip!

Submitted

HUMMMM
well, although nothing spins on my game i'll do this to avoid any rule breaking =DD