Viewport for dummies?

Bethins

Villager
Member
Joined
Nov 4, 2012
Messages
69
Reaction score
0
First Language
English
Primarily Uses
What exactly does viewport do? I've only encountered it with the default help window so far. I understand that it has something to do with layers, but why would you need multiple layers in the help window? I'm still a noob, so be gentle please :)
 

Venka

Veteran
Veteran
Joined
Jun 20, 2012
Messages
945
Reaction score
365
First Language
English
Primarily Uses
think of the screen has sheets of paper stacked on top of each other. So one sheet will have all the information about the map. In that sheet you can have stuff drawn above or below elements in that sheet.. like your character could walk behind a tree or in front of a bookshelf.

I'm not well versed on all the layers.. but I believe one does weather effects. So no matter what you do to your map layer, the weather layer will always be on top of the map layer. This prevents stuff like ran drops falling behind tall trees and looking all wierd.

Windows are usually (but not always) put into their own layer so they don't get layer glitches. Like maybe your map has a picture called when you open a text message. Well if the viewport are set wrong.. then perhaps your picture prevents your message window from being seen.

That's the purpose of viewports.. they just hold visual sets of information that you can do things with. Like screen shaking uses the map viewport and moves everything in it all at once instead of you having to go and determine everything that you want to shake and then moving them all individually.

This could probably be explained better, but that's the basics.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
Yeah, that's pretty much it.


In the RTP, all the menus have only a single viewport - they don't "layer" stuff like the maps do, though you can still put things in front of or behind other things by changing the individual sprites' z-values.


On the map and in battles, there are three viewports. Viewports also have z-values. Viewport 1 has a z-value of 0, 2 has a z-value of 50 and 3 a z-value of 100. Then things are layered inside these viewports by the sprites' z-values, just as they are in the menus. If you have something in viewport 1 with a z-value of 500, anything in viewport 3 will still appear in front, even if those sprites have lower z-values.


Viewport 1 on the map contains the map itself, the background parallax, the character/event/vehicle sprites. When you set the screen tone or make the screen shake, only things on this viewport are affected.


Viewport 2 holds the weather and timer sprites and pictures. When you make the screen flash, this viewport is affected (which also has the appearance of affecting Viewport 1 as well, as this one is in front).


Viewport 3 takes care of the screen brightness, when you do a fade in or fade out or transfer.


The arrangement of the battle scene follows the same order, though I don't see an allowance for weather effects in the battle spriteset (which is strange, because I thought you COULD have weather in battles ...)
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Today's patch of Eternal Dreamers is for all the gamblers out there! https://bit.ly/327mu83
i deleted anime only family guy from now on
I've discovered Stardew Valley and now I'm an addict. To think that one person designed this...
There a thread out there that tells us the best way to open an RPG that isn't 'the protag gets out of bed'?
Updated my state Stacker Script on itch.io, github is down for some reason (probs just me).

Forum statistics

Threads
94,335
Messages
920,036
Members
124,093
Latest member
JosephTucker
Top