What are views, ports & application surface actually?

Z

zenoboy

Guest
Hey guys, I want to know what these terms mean. Currently I'm trying to design the size of my game but I'm kinda confused with the documentation. I understand about Aspect Ratio and based on what I read, to make your game suitable for many devices you'd need to use the Full Scale option in the Global Settings & also use Views.

But then terms such as Application Surface and View Port appear, thus making me confused because I'm not really familiar with these terms. I thought that maybe, asking here would enlighten me & clarify these terms.
A simple explanation with pictures would be a great help.

Thanks in advance, hope you guys can help me with this matter. o_O
 
S

seanm

Guest
view_w/hview: How much of the game is captured in the view

view_w/hport: The size that your view will be rendered to in the game window.

window_size: The size of the game window.
You must set the window size to the size of the view port if you want to scale the view using surfaces.

application surface: Where everything gets drawn by default
You must resize the app surface to the size of the view port if you want to scale the game using views.

so if you want to scale by 2x
Code:
view_wview[0]=640
view_hview[0]=480

view_wport[0]=view_wview[0]*2
view_hport[0]=view_hview[0]*2

window_set_size(view_wport[0],view_hport[0])
surface_resize(application_surface,view_wport[0],view_hport[0])
should look something like that, might have messed up the function names though so look through the manual
 
Z

zenoboy

Guest

Nocturne

Friendly Tyrant
Forum Staff
Admin
Lol! Okay, well I tried...!

Let's take it to it's most basic...

For scaling you have 4 elements to take into consideration:

the window size
the view size
the view port size
the app surface
(and the GUI layer too but we'll leave that for now...)

The view port is the area of what is drawn on the screen. SO if your view port is set to 640x480, an area of 640x480 ON THE SCREEN will be used to display the game.

The view is what get's drawn to the view port. The view can be any size you want and will be stretched or squashed to fit the view port. So, if your view is 120x160 and make your view port 640x480, the game will be streteched up to fit the whole port area, but will be distorted as it is in portrait and not landscape like the port

The window is what we call the game window where all the drawing occurs, and is only really valid on desktop OS. The window size is calculated as being the same size as the view port (or combined view ports), but you can also make it larger or smaller in which case what is drawn will be distorted. In general, you never want a window that is a different size to the port.

The application surface is (as the name implies) a surface that everything in your game is drawn to. If you imagine in a graphics editor where you have different layers... everything you have on a layer is drawn over what goes under it on the layers below. This is like the way depth works in GM, where everything is drawn at a specific depth. Now, when you are finished with your image in your graphics program, you can merge all the layers and print it out on paper or save it as a JPG file... that's what happens with the app surface in GameMaker. Everything you draw is drawn onto the app surface and then the app surface is rendered to the view, which in turn is rendered to the view port, which in turn is shown in the game window.

:)

I'm not sure I can explain things any better or simpler than that... I hope it helps!!!!
 
Z

zenoboy

Guest
Lol! Okay, well I tried...!

Let's take it to it's most basic...

For scaling you have 4 elements to take into consideration:

the window size
the view size
the view port size
the app surface
(and the GUI layer too but we'll leave that for now...)

The view port is the area of what is drawn on the screen. SO if your view port is set to 640x480, an area of 640x480 ON THE SCREEN will be used to display the game.

The view is what get's drawn to the view port. The view can be any size you want and will be stretched or squashed to fit the view port. So, if your view is 120x160 and make your view port 640x480, the game will be streteched up to fit the whole port area, but will be distorted as it is in portrait and not landscape like the port

The window is what we call the game window where all the drawing occurs, and is only really valid on desktop OS. The window size is calculated as being the same size as the view port (or combined view ports), but you can also make it larger or smaller in which case what is drawn will be distorted. In general, you never want a window that is a different size to the port.

The application surface is (as the name implies) a surface that everything in your game is drawn to. If you imagine in a graphics editor where you have different layers... everything you have on a layer is drawn over what goes under it on the layers below. This is like the way depth works in GM, where everything is drawn at a specific depth. Now, when you are finished with your image in your graphics program, you can merge all the layers and print it out on paper or save it as a JPG file... that's what happens with the app surface in GameMaker. Everything you draw is drawn onto the app surface and then the app surface is rendered to the view, which in turn is rendered to the view port, which in turn is shown in the game window.

:)

I'm not sure I can explain things any better or simpler than that... I hope it helps!!!!

This actually helped me a lot. Thanks a bunch for your time & explanation especially with those examples given. I kinda get the rough idea of the whole thing now.
I'm sorry that I couldn't understand your blog post earlier, those terms confused me & I just needed to know the meaning of those terms.

Right now, your blog can already be useful for me. Thanks again for this explanation.
Cheers! :D
 
Top