Resolution Option

Shirakami

Villager
Member
Joined
Oct 25, 2015
Messages
6
Reaction score
9
First Language
German
Resolution Options v1.1
by Shirakami

About this script

It will add a simple resolution selection on the options menu. You can set a list of available resolutions via parameters. There is also an option to automatically resizes the window to the new resolution as well as an option to force the window's size. The settings are also properly saved and loaded into/from config.rpgsave.

However, this script will only provide you with an option to change the resolution. It doesn't touch the way things are scaled. There are also some option for rescaling backgrounds, but they are still WIP.

Features

 * Adds resolution selection to the option menu

 * Resolution are automatically sorted in size ingame.

 * Automatically resizes the game's window at resolution change

 * Force the game's window size to resolution

 * Rescales Title Screen Background

 * Rescales Battler placement during Battles

 * Rescales Battle Background during Battles

Upcoming Features

 * Adds more rescaling options for Battler placement as well as Battle Backgrounds

 * Adds rescaling options for "Show Picture" event command.

 * Adds an option to force selection of predefined resolution-sets (I.E. 800x600 or 1200x900, but no 1200x600)

Changelog

v1.1
 * Added different resizing options for Title Screen, Battler Placement and Battle Background. Not all optiones are implemented yet.
 * Changed the name of some parameter.
v1.0
 * initial release

Bugs

If you increases the resolution via the main menu on the map, the map won't properly rendered until you the map will be "active" again, thus there will be a black border filling up the new space. I couldn't find a way to fix this, so if anyone figured out how to do it, drop me a message on Steam (link is above and on my profile) or here on the forums.


The game's window won't resize to the actually resolution if there isn't enough space and thus will be smaller. The internal render resolution will be set properly, so it will be downscaled to the window size. It shouldn't pose any problem thought. You can press F3 in order to turn of downscaling, but you will get scrollbars instead and won't be able to see the whole screen at once.

How to use

Just download the file and put it into the plugins folder like any other script. After loading the script into your project and setting up the parameters you are good to go.

Thought if you aren't happy with how the game/menus behaves at different/higher resolutions, you will need to write your own scripts. I can't "fix" all the menus in the game that are behaving a bit "strange".

The script will automatically sort the array of the available resolution in size, so you don't need to keep the order when setting up the parameters.

The Script

Download v1.1

Download v1.0

or copy:

//=============================================================================// Resolution Option v1.1.js//=============================================================================/*: * CHANGELOG: * v1.1 * [] Added different resizing options for Title Screen, Battler Placement and Battle Background. Not all optiones are implemented yet. * [] Changed the name of some parameter. * v1.0 * [] initial release * * @plugindesc v1.1 * Adds options to change the resolution. * @author http://steamcommunity.com/id/Yoshi72 * * @param Resolutions Width * @desc Array of supported resolutions (Width). Default: 800,1600,1920 * @default 800,1200,1920 * * @param Resolutions Height * @desc Array of supported resolutions (Height). Default: 600,900,1080 * @default 600,900,1080 * * @param Cycle Through Selection * @desc Selection will start back at the lowest resolution if you exceed the array (and vise versa). Default: 0 * @default 0 * * @param Force Window Size * @desc Forces the window size to the spezified resolution. You won't be able to resize it anymore. Default: 1 * @default 1 * * @param Auto Window Resize * @desc Automatically sets window size at leaving the options. Only used if "Force Window Size" is set to 0. Default: 1 * @default 1 * * @param Stretch Title Screen * @desc Stretches the Title Screen. See Notes for further details. * @default 1 * * @param Stretch Battlefield * @desc Stretches the Battlefield/Battler placement during battles. See Notes for further details. * @default 1 * * @param Stretch Battle Background * @desc Stretches the Battle Background. See notes for further details. * @default 1 * * @help You can change the resolution in the options menu (both ingame and at the title screen). There is no command you have to execute during the game whatsoever, all you need to do is set the parameters and you are good to go. * Some more details about the parameters: * There are different resize options for different cases. I'll explain the options for each case down below. Also note: Any value that isn't explained there (like 0) will simply turn off my resizing code and will fall back to vanilla code. I recommend to use a value of 0 in order to turn it off in order to maintain readability. * * Stretch Title Screen * 1 = Keep aspect ratio; It will resizes the Title Screen Background to fit the whole screen, but will maintain it's aspect ratio. This means it will cut out a bit either vertically or horizontally if the resolution isn't the same aspect ratio than the background image. * 2 = Stretch to fit; It will stretch the Title Screen Background in order to fit the selected resolution. This way there will be no part of the background cut out, but it will look cramped if the aspect ratio does differ too much. * * Stretch Battlefield * 1 = Scales the position of all Battlers during fights to fill out the whole screen instead of just in the top left corner. * 2 = TODO; I plan to add an option to center the Battler placement into the middle without rescaling the field (so it will simply move to the center). THIS OPTION IS NOT IMPLEMENTED YET! * * Stretch Battle Background * 1 = TODO; Vanilla keep aspect ratio; It will behave similiar to vanilla rendering, but with the ability to resize to different resolutions while maintaining the aspect ratio. THIS OPTION IS NOT IMPLEMENTED YET! * 2 = TODO; Same as above, but without keeping the aspect ratio but instead being stretch to fit. * 3 = Keep aspect ratio; Same as option 1 of Title Screen Resizing. Tries to fit the screen while maintaining the aspect ratio. Battler placement might be off on different resolutions thought. * 4 = Stretch to fit; Same as option 2 of Title Screen Resizing. The image will fit onto the screen and being stretched on different aspect ratios. Like with option 3 Battler placement might be off on different resolutions. * * * * Upcoming features: * [] Despite the options mentioned at the "Stretch Battle Background"-option I will add a feature to lock resolution selection to width and height, so you can't choose them independently anymore (I.E. you can only choose between 800x600, 1200x900 and the like). This will help developers to add different resolutions while maintaining aspect ratios (which might fix some possible bugs and/or makes it easier to create assets). * [] A resizing option for the "Show Picture"-command used in events. You will be able to define a "Base Resolution" so the picture will scale accordingly to the difference of base and current resolution. This way you need to configure the picture showing only for the base resolution during event creation and it will behave the same way on different resolutions. */(function(){    //////////////////////////////////////////////////    //                    Parameters    //////////////////////////////////////////////////        var parameters        = PluginManager.parameters('Resolution Option v1.1');    var val_width        = parameters['Resolutions Width'].split(',').map(function(value) { return parseInt(value); }, this).sort(function(a, {return a-b}) || [800, 1200, 1920];    var val_height        = parameters['Resolutions Height'].split(',').map(function(value) { return parseInt(value); }, this).sort(function(a, {return a-b}) || [600, 900, 1080];    var cycleSelect        = Number(parameters['Cycle Through Selection']) || false;    var forceResize        = Number(parameters['Force Window Size']) || true;    var autoResize        = Number(parameters['Auto Window Resize']) || true;    var stretch_title    = Number(parameters['Stretch Title Screen']) || 0;    var stretch_bField    = Number(parameters['Stretch Battlefield']) || 0;    var stretch_bBack    = Number(parameters['Stretch Battle Background']) || 0;                    //////////////////////////////////////////////////    //                Config Manager    //////////////////////////////////////////////////        //We need to add new variables to the ConfigManager.    ConfigManager.resolutionWidth = val_width[0];    ConfigManager.resolutionHeight = val_height[0];        _ConfigManager_makeData = ConfigManager.makeData;    ConfigManager.makeData = function()    {        var config = _ConfigManager_makeData.call(this);        config.resolutionWidth = this.resolutionWidth;        config.resolutionHeight = this.resolutionHeight;        return config;            };        _ConfigManager_applyData = ConfigManager.applyData;    ConfigManager.applyData = function(config)    {        _ConfigManager_applyData.call(this, config);        this.resolutionWidth = this.readRes(config, 'resolutionWidth');        this.resolutionHeight = this.readRes(config, 'resolutionHeight');    };        //New function in order to read the values. If none are set, it will take the smallest value of the array.    ConfigManager.readRes = function(config, name)    {        var min;        var max;        if (name === 'resolutionWidth')        {            min = val_width[0];            max = val_width[val_width.length-1];        }        else if (name === 'resolutionHeight')        {            min = val_height[0];            max = val_height[val_height.length-1];        } else        {            return 0;        }        var value = config[name];        if (value !== undefined)        {            return Number(value).clamp(min, max);        } else        {            return min;        }    };                //////////////////////////////////////////////////    //                Options Screen    //////////////////////////////////////////////////        //Add new commands to change the resolution.    _Window_Options_prototype_makeCommandList = Window_Options.prototype.makeCommandList;    Window_Options.prototype.makeCommandList = function()    {        this.addCommand("Resolution X", 'resolutionWidth');        this.addCommand("Resolution Y", 'resolutionHeight');        _Window_Options_prototype_makeCommandList.call(this);    };        //Check if selected option is a resolution.    Window_Options.prototype.isResolutionSymbol = function(symbol)    {        return symbol.contains('resolution');    };        //Changes the display of options.    _Window_Options_prototype_statusText = Window_Options.prototype.statusText;    Window_Options.prototype.statusText = function(index)    {        var symbol = this.commandSymbol(index);        if (this.isResolutionSymbol(symbol))        {            return this.getConfigValue(symbol);        } else        {            return _Window_Options_prototype_statusText.call(this, index);        }    };        //Changes how it handles option when pressing enter    _Window_Options_prototype_processOk = Window_Options.prototype.processOk;    Window_Options.prototype.processOk = function()    {        var index = this.index();        var symbol = this.commandSymbol(index);        var value = this.getConfigValue(symbol);        if (this.isResolutionSymbol(symbol))        {            this.changeRes(symbol, true);        } else        {            _Window_Options_prototype_processOk.call(this);        }    };        //Changes how it handles option when pressing right    _Window_Options_prototype_cursorRight = Window_Options.prototype.cursorRight;    Window_Options.prototype.cursorRight = function(wrap)    {        var index = this.index();        var symbol = this.commandSymbol(index);        var value = this.getConfigValue(symbol);        if (this.isResolutionSymbol(symbol))        {            this.changeRes(symbol, true);        } else        {            _Window_Options_prototype_cursorRight.call(this, wrap);        }    };        //Changes how it handles option when pressing left    _Window_Options_prototype_cursorLeft = Window_Options.prototype.cursorLeft;    Window_Options.prototype.cursorLeft = function(wrap)    {        var index = this.index();        var symbol = this.commandSymbol(index);        var value = this.getConfigValue(symbol);        if (this.isResolutionSymbol(symbol))        {            this.changeRes(symbol, false);        } else        {            _Window_Options_prototype_cursorLeft.call(this, wrap);        }    };        //Changes the resolution selection. However resolution will be changed only at closing the options menu.    Window_Options.prototype.changeRes = function(symbol, direction)    {        var last_value = this.getConfigValue(symbol);        var resolution;        if (symbol === 'resolutionWidth')        {            resolution = val_width;        } else if (symbol === 'resolutionHeight')        {            resolution = val_height;        } else        {            return;        }        var index = resolution.indexOf(this.getConfigValue(symbol));        index += direction ? 1 : - 1;        if (index < 0)        {            index = cycleSelect ? resolution.length-1 : 0;        } else if (index >= resolution.length)        {            index = cycleSelect ? 0 : resolution.length-1;        }        if (last_value !== resolution[index])        {            this.setConfigValue(symbol, resolution[index]);            this.redrawItem(this.findSymbol(symbol));            SoundManager.playCursor();        }    }        //Changes resolution at closing the option screen. Also changes window size if "Auto Resize" is set to true.    _Scene_Options_prototype_terminate = Scene_Options.prototype.terminate;    Scene_Options.prototype.terminate = function()    {        if (forceResize || autoResize)        {            window.resizeTo(ConfigManager['resolutionWidth'] + window.outerWidth-window.innerWidth, ConfigManager['resolutionHeight'] + window.outerHeight-window.innerHeight);        }        Graphics.boxWidth = Graphics._width = ConfigManager['resolutionWidth'];        Graphics.boxHeight = Graphics._height = ConfigManager['resolutionHeight'];        //If a map is loaded, center the screen onto the player.        if (SceneManager._stack.indexOf(Scene_Map) !== -1)        {            $gamePlayer.center($gamePlayer._realX, $gamePlayer._realY);        }        Graphics._updateAllElements();        _Scene_Options_prototype_terminate.call(this);    };                //////////////////////////////////////////////////    //                Window Resizing    //////////////////////////////////////////////////        //Force automatic window resize if "Force Window Size" is set to true.    if (forceResize)    {        _Graphics__onWindowResize = Graphics._onWindowResize;        Graphics._onWindowResize = function()        {            window.resizeTo(ConfigManager['resolutionWidth'] + window.outerWidth-window.innerWidth, ConfigManager['resolutionHeight'] + window.outerHeight-window.innerHeight);            _Graphics__onWindowResize.call(this);        };    }        //Resizes window and render resolution at startup if "Auto Resize" is set to true.    if (forceResize || autoResize)    {        _Scene_Boot_prototype_create = Scene_Boot.prototype.create;        Scene_Boot.prototype.create = function()        {            _Scene_Boot_prototype_create.call(this);            window.resizeTo(ConfigManager['resolutionWidth'] + window.outerWidth-window.innerWidth, ConfigManager['resolutionHeight'] + window.outerHeight-window.innerHeight);            Graphics.boxWidth = Graphics._width = ConfigManager['resolutionWidth'];            Graphics.boxHeight = Graphics._height = ConfigManager['resolutionHeight'];            Graphics._updateAllElements();        };    }                //////////////////////////////////////////////////    //                    Resizing    //////////////////////////////////////////////////        //Check which Title Screen resize option is set to execute.    switch(stretch_title)    {        //Keep aspect ratio.        case 1:            _Scene_Title_prototype_centerSprite = Scene_Title.prototype.centerSprite;            Scene_Title.prototype.centerSprite = function(sprite)            {                _Scene_Title_prototype_centerSprite.call(this, sprite);                scale1 = Graphics._width / sprite.width;                scale2 = Graphics._height / sprite.height;                sprite.scale.x = sprite.scale.y = scale1 > scale2 ? scale1 : scale2;            };            break;        //Stretch to fit.        case 2:            _Scene_Title_prototype_centerSprite = Scene_Title.prototype.centerSprite;            Scene_Title.prototype.centerSprite = function(sprite)            {                _Scene_Title_prototype_centerSprite.call(this, sprite);                sprite.scale.x = Graphics._width / sprite.width;                sprite.scale.y = Graphics._height / sprite.height;            };            break;    }        //Check which battlebackground resize option is on.    if(stretch_bField == 1)    {        //Scales the position of the actors on the battlefield depending on the resolution.        Sprite_Actor.prototype.setActorHome = function(index)        {            var x = 600 * (Graphics._width / 800) + (index * 32) * (Graphics._width / 800);            var y = 280 * (Graphics._height / 600) + (index * 48) * (Graphics._height / 600);            this.setHome(x, y);        };                _Sprite_Enemy_prototype_setBattler = Sprite_Enemy.prototype.setBattler;        Sprite_Enemy.prototype.setBattler = function(battler)        {            _Sprite_Enemy_prototype_setBattler.call(this, battler);            this.setHome(battler.screenX() * (Graphics._width / 800), battler.screenY() * (Graphics._height / 600));        };    }        //Check which battlebackground resize option is set to execute.    switch(stretch_bBack)    {        //Stretched vanilla.        case 1:            //TODO            break;        //Vanilla keep aspect ratio.        case 2:            //TODO            break;        //Keep aspect ratio.        case 3:            Spriteset_Battle.prototype.locateBattleback = function()            {                var width    = Graphics._width;                var height    = Graphics._height;                                var width1    = this._back1Sprite._bitmap._baseTexture.width;                var height1    = this._back1Sprite._bitmap._baseTexture.height;                var width2    = this._back2Sprite._bitmap._baseTexture.width;                var height2    = this._back2Sprite._bitmap._baseTexture.height;                                var scale1    = (width / width1) > (height / height1) ? (width / width1) : (height / height1);                var scale2    = (width / width2) > (height / height2) ? (width / width2) : (height / height2);                                this._back1Sprite.scale.x = this._back1Sprite.scale.y = scale1;                this._back2Sprite.scale.x = this._back2Sprite.scale.y = scale2;                                var x1 = 0;                var y1 = 0;                var x2 = 0;                var y2 = 0;                                x1 -= (width1 * scale1 - width) / 2;                y1 -= (height1 * scale1 - height) / 2;                x2 -= (width2 * scale2 - width) / 2;                y2 -= (height2 * scale2 - height) / 2;                                this._back1Sprite.move(x1, y1, width1, height1);                this._back2Sprite.move(x2, y2, width2, height2);            };            break;        //Stretch to fit.        case 4:            Spriteset_Battle.prototype.locateBattleback = function()            {                                this._back1Sprite.scale.x = Graphics._width / this._back1Sprite._bitmap._baseTexture.width;                this._back1Sprite.scale.y = Graphics._height / this._back1Sprite._bitmap._baseTexture.height;                this._back2Sprite.scale.x = Graphics._width / this._back2Sprite._bitmap._baseTexture.width;                this._back2Sprite.scale.y = Graphics._height / this._back2Sprite._bitmap._baseTexture.height;                this._back1Sprite.move(0, 0, this._back1Sprite._bitmap._baseTexture.width, this._back1Sprite._bitmap._baseTexture.height);                this._back2Sprite.move(0, 0, this._back2Sprite._bitmap._baseTexture.width, this._back2Sprite._bitmap._baseTexture.height);            };            break;    }})();



Terms of use

You are free to do whatever you want with this script. Use it for any kind of games, change it burn it or use it to conquer the world.

But I would be happy to get a spot in your credits if you use my script in your games, but then again, it's not necessary. And maybe drop me a message about your finished game.
 
Last edited by a moderator:

Rito

Veteran
Veteran
Joined
Jun 29, 2015
Messages
107
Reaction score
50
First Language
French
The ideal would be to create a 4k resolution image and then resize the image depending on the selected resolution.

But it is a very good start.
 
Last edited by a moderator:

Shirakami

Villager
Member
Joined
Oct 25, 2015
Messages
6
Reaction score
9
First Language
German
I am currently working on resizing features for the backgrounds. I plan to add different resize options you can then choose from.

Unfortunately the battlescreen background placement is kinda awkward (i.e. it shifts up/down depending on SV view), so I need some more time. it should be out tomorrow or the day after thought.
 

Prescott

argggghhh
Veteran
Joined
Aug 28, 2014
Messages
498
Reaction score
392
First Language
English
Primarily Uses
RMMV
This is very nice! I look forward to the resizing option :) this will be very, very helpful in many, many projects.
 

Shirakami

Villager
Member
Joined
Oct 25, 2015
Messages
6
Reaction score
9
First Language
German
I've updated to script to v1.1. I've added some resizing options for Title Screen, Battler placement as well as Battle Background, but it's still WIP. So some resizing options are still missing. I might also change some of the resizing options at a later point (I didn't really test the script much yet, so if there are any bugs or oddities I might have to rewrite some of the resizing options).

So keep that in mind if you are creating your own background images and/or redesigning menus. They might not be in sync with future releases.

I've also added an upcoming features list.

So if you find any bugs with the current release, just let me now.
 

Rito

Veteran
Veteran
Joined
Jun 29, 2015
Messages
107
Reaction score
50
First Language
French
I think I found your worries battleback.

Found in the Core Engine script from Yanfly :

if (eval(Yanfly.Param.ScaleBattleback)) {Yanfly.Core.Spriteset_Battle_locateBattleback = Spriteset_Battle.prototype.locateBattleback;Spriteset_Battle.prototype.locateBattleback = function() { var sprite1 = this._back1Sprite; var sprite2 = this._back2Sprite; if (sprite1.bitmap.width <= 0) return; if (sprite2.bitmap.width <= 0) return; if (this._rescaledBattlebackSprite) return; this._rescaledBattlebackSprite = true; Yanfly.Core.Spriteset_Battle_locateBattleback.call(this); this.rescaleBattlebacks();};Spriteset_Battle.prototype.rescaleBattlebacks = function() { this.rescaleBattlebackSprite(this._back1Sprite); this.rescaleBattlebackSprite(this._back2Sprite);};Spriteset_Battle.prototype.rescaleBattlebackSprite = function(sprite) { if (sprite.bitmap.width <= 0 || sprite.bitmap <= 0) return; var width = Graphics.boxWidth; var height = Graphics.boxHeight; var ratioX = width / sprite.bitmap.width; var ratioY = height / sprite.bitmap.height; if (ratioX > 1.0) { sprite.scale.x = ratioX; sprite.anchor.x = 0.5; sprite.x = width / 2; } if (ratioY > 1.0) { sprite.scale.y = ratioY; sprite.origin.y = 0; sprite.y = 0; }};}; // Yanfly.Param.ScaleBattlebackGood luck.

Edit :

It's possible to resize the image  script "MOG_TitlePictureCom" (Title)

Here's script (a part) :

  var Imported = Imported || {};  Imported.MOG_Picture_Command = true;  var Moghunter = Moghunter || {}; if (Moghunter.title_sprite == "true") {//==============================// * Create Foreground//==============================Scene_Title.prototype.createForeground = function() { this._gameTitleSprite = new Sprite(ImageManager.loadTitleScene("Title")); this.addChild(this._gameTitleSprite); this._gameTitleSprite.x = Moghunter.title_x; this._gameTitleSprite.y = Moghunter.title_y;};};

After resolution change, why not simply close the menu and re-open it ?

For example, if pressing cancel button, close window menu, wait 2 frames (refresh), open window menu.
 
Last edited by a moderator:

Shirakami

Villager
Member
Joined
Oct 25, 2015
Messages
6
Reaction score
9
First Language
German
First, sorry for the late response. Was kinda busy the last days.

Secondly. I do appreciate your help, but that doesn't really help with my worries. T he current version of my script already has different kind of rescaling options (for both, Title Screen as well as Battle Background). What it does not support yet is vanilla like rescaling option.

You see, the game's native rendering is in 800x600. The battle background images are 1000x740. Since vanilla doesn't has any resizing for the background image it will only use a certain part of the image. And this is based on side view on/off.

Some pictures for better understanding:

Vanilla 800x600 SV on:


Vanilla 800x600 SV off


For comparison:

My custom stretch to fit (keep aspect ratio) on 800x600:




Here is a snippet of the vanilla code (no changes made):

Spriteset_Battle.prototype.createBattleback = function() { var margin = 32; var x = -this._battleField.x - margin; var y = -this._battleField.y - margin; var width = Graphics.width + margin * 2; var height = Graphics.height + margin * 2; this._back1Sprite = new TilingSprite(); this._back2Sprite = new TilingSprite(); this._back1Sprite.bitmap = this.battleback1Bitmap(); this._back2Sprite.bitmap = this.battleback2Bitmap(); this._back1Sprite.move(x, y, width, height); this._back2Sprite.move(x, y, width, height); this._battleField.addChild(this._back1Sprite); this._battleField.addChild(this._back2Sprite);};Spriteset_Battle.prototype.locateBattleback = function() { var width = this._battleField.width; var height = this._battleField.height; var sprite1 = this._back1Sprite; var sprite2 = this._back2Sprite; sprite1.origin.x = sprite1.x + (sprite1.bitmap.width - width) / 2; sprite2.origin.x = sprite1.y + (sprite2.bitmap.width - width) / 2; if ($gameSystem.isSideView()) { sprite1.origin.y = sprite1.x + sprite1.bitmap.height - height; sprite2.origin.y = sprite1.y + sprite2.bitmap.height - height; }};

Basicly it's not really hard to write a new scaling algorithm. It's only a matter of using the right formula. Unfortunately I am not very good at this so I'll need to try out different approaches, which will take some time. I have difficulties to imagine how it will react to different resolution options (for both, render resolution as well as image resolutions).
 
Last edited by a moderator:

Fox536

Veteran
Veteran
Joined
Nov 5, 2015
Messages
173
Reaction score
60
Primarily Uses
Is there any possibility of you adding an option to resizing the $gameMap too? I'd love to use a higher resolution for menus, but keep the viewable map area the same.
 

Shirakami

Villager
Member
Joined
Oct 25, 2015
Messages
6
Reaction score
9
First Language
German
Sorry for being dead for so long.

@Fox536: I will look into this. Thought no promises. But first I have to finish the scaling options. I'll try to work on them during the weekend.
 

Sakif X9

Level 99 Persona User
Veteran
Joined
Jan 4, 2015
Messages
87
Reaction score
12
First Language
English
Primarily Uses
/C:/Users/$akif%20X9/Documents/RPG%20Maker%20MV/Project1/js/plugins/Resolution%20Option%20v1.js:39 Uncaught TypeError: Cannot read property 'split' of undefined
I get this error
 

yuyu!

The Hero of Rhyme
Member
Joined
Feb 19, 2014
Messages
25
Reaction score
11
Sorry for the necro!

The links for this plugin are no longer working, so I copied the plugin text in the OP and cleaned it up (fixed a few bugs mentioned above and fixed the formatting)... and it works for me now. :)

For anyone who stumbles on this, here's the working plugin:
*NOTE: If you use this plugin, saved it as "Resolution Option.js".

Code:
//=============================================================================
// Resolution Option v1.1.js
//=============================================================================
/*:
* CHANGELOG:
* v1.1
* [] Added different resizing options for Title Screen, Battler Placement and Battle Background. Not all optiones are implemented yet.
* [] Changed the name of some parameter.
* v1.0
* [] initial release
*
* @plugindesc v1.1
* Adds options to change the resolution.
* @author http://steamcommunity.com/id/Yoshi72
*
* @param Resolutions Width
* @desc Array of supported resolutions (Width). Default: 800,1600,1920
* @default 800,1200,1920
*
* @param Resolutions Height
* @desc Array of supported resolutions (Height). Default: 600,900,1080
* @default 600,900,1080
*
* @param Cycle Through Selection
* @desc Selection will start back at the lowest resolution if you exceed the array (and vise versa). Default: 0
* @default 0
*
* @param Force Window Size
* @desc Forces the window size to the spezified resolution. You won't be able to resize it anymore. Default: 1
* @default 1
*
* @param Auto Window Resize
* @desc Automatically sets window size at leaving the options. Only used if "Force Window Size" is set to 0. Default: 1
* @default 1
*
* @param Stretch Title Screen
* @desc Stretches the Title Screen. See Notes for further details.
* @default 1
*
* @param Stretch Battlefield
* @desc Stretches the Battlefield/Battler placement during battles. See Notes for further details.
* @default 1
*
* @param Stretch Battle Background
* @desc Stretches the Battle Background. See notes for further details.
* @default 1
*
* @help You can change the resolution in the options menu (both ingame and at the title screen).
* There is no command you have to execute during the game whatsoever, all you need to do is set the parameters and you are good to go.
* Some more details about the parameters:
* There are different resize options for different cases. I'll explain the options for each case down below.
* Also note: Any value that isn't explained there (like 0) will simply turn off my resizing code and will fall back to vanilla code.
* I recommend to use a value of 0 in order to turn it off in order to maintain readability.
*
* Stretch Title Screen
* 1 = Keep aspect ratio; It will resizes the Title Screen Background to fit the whole screen, but will maintain it's aspect ratio.
* This means it will cut out a bit either vertically or horizontally if the resolution isn't the same aspect ratio than the background image.
* 2 = Stretch to fit; It will stretch the Title Screen Background in order to fit the selected resolution. This way there will be no part
* of the background cut out, but it will look cramped if the aspect ratio does differ too much.
*
* Stretch Battlefield
* 1 = Scales the position of all Battlers during fights to fill out the whole screen instead of just in the top left corner.
* 2 = TODO; I plan to add an option to center the Battler placement into the middle without rescaling the field (so it will simply move to the center).
* THIS OPTION IS NOT IMPLEMENTED YET!
*
* Stretch Battle Background
* 1 = TODO; Vanilla keep aspect ratio;
* It will behave similiar to vanilla rendering, but with the ability to resize to different resolutions while maintaining the aspect ratio.
* THIS OPTION IS NOT IMPLEMENTED YET!
* 2 = TODO; Same as above, but without keeping the aspect ratio but instead being stretch to fit.
* 3 = Keep aspect ratio; Same as option 1 of Title Screen Resizing. Tries to fit the screen while maintaining the aspect ratio.
* Battler placement might be off on different resolutions thought.
* 4 = Stretch to fit; Same as option 2 of Title Screen Resizing. The image will fit onto the screen and being stretched on
* different aspect ratios. Like with option 3 Battler placement might be off on different resolutions.
*
*
*
* Upcoming features:
* [] Despite the options mentioned at the "Stretch Battle Background"-option I will add a feature to lock resolution selection
* to width and height, so you can't choose them independently anymore (I.E. you can only choose between 800x600, 1200x900 and the like).
* This will help developers to add different resolutions while maintaining aspect ratios (which might fix some possible bugs and/or makes
* it easier to create assets). * [] A resizing option for the "Show Picture"-command used in events. You will be able to define a
* "Base Resolution" so the picture will scale accordingly to the difference of base and current resolution. This way you need to
* configure the picture showing only for the base resolution during event creation and it will behave the same way on different resolutions.
*/

(function(){

  //////////////////////////////////////////////////
  //                    Parameters
  //////////////////////////////////////////////////

  var parameters = PluginManager.parameters('Resolution Option');
  var val_width = parameters['Resolutions Width'].split(',').map(function(value) {
    return parseInt(value);
  }, this).sort(function(a,b) { return a-b }) || [800, 1200, 1920];
  var val_height = parameters['Resolutions Height'].split(',').map(function(value) {
    return parseInt(value);
  }, this).sort(function(a,b) {return a-b}) || [600, 900, 1080];
  var cycleSelect = Number(parameters['Cycle Through Selection']) || false;
  var forceResize = Number(parameters['Force Window Size']) || true;
  var autoResize = Number(parameters['Auto Window Resize']) || true;
  var stretch_title = Number(parameters['Stretch Title Screen']) || 0;
  var stretch_bField = Number(parameters['Stretch Battlefield']) || 0;
  var stretch_bBack = Number(parameters['Stretch Battle Background']) || 0;

  //////////////////////////////////////////////////
  //                Config Manager
  //////////////////////////////////////////////////
  //We need to add new variables to the ConfigManager.

    ConfigManager.resolutionWidth = val_width[0];
    ConfigManager.resolutionHeight = val_height[0];
    _ConfigManager_makeData = ConfigManager.makeData;
    ConfigManager.makeData = function() {
    var config = _ConfigManager_makeData.call(this);
    config.resolutionWidth = this.resolutionWidth;
    config.resolutionHeight = this.resolutionHeight;
    return config;
  };

  _ConfigManager_applyData = ConfigManager.applyData;
  ConfigManager.applyData = function(config) {
     _ConfigManager_applyData.call(this, config);
    this.resolutionWidth = this.readRes(config, 'resolutionWidth');
    this.resolutionHeight = this.readRes(config, 'resolutionHeight');
  };

  //New function in order to read the values. If none are set, it will take the smallest value of the array.
  ConfigManager.readRes = function(config, name) {
    var min;
    var max;
    if (name === 'resolutionWidth') {
      min = val_width[0];
      max = val_width[val_width.length-1];
    } else if (name === 'resolutionHeight') {
      min = val_height[0];
      max = val_height[val_height.length-1];
    } else {
      return 0;
    }
    var value = config[name];
    if (value !== undefined) {
      return Number(value).clamp(min, max);
    } else {
      return min;
    }
  };

  //////////////////////////////////////////////////
  //                Options Screen
  //////////////////////////////////////////////////
  //Add new commands to change the resolution.

  _Window_Options_prototype_makeCommandList = Window_Options.prototype.makeCommandList;
  Window_Options.prototype.makeCommandList = function() {
    this.addCommand("Resolution X", 'resolutionWidth');
    this.addCommand("Resolution Y", 'resolutionHeight');
    _Window_Options_prototype_makeCommandList.call(this);
  };

  //Check if selected option is a resolution.
  Window_Options.prototype.isResolutionSymbol = function(symbol) {
    return symbol.contains('resolution');
  };

  //Changes the display of options.
  _Window_Options_prototype_statusText = Window_Options.prototype.statusText;
  Window_Options.prototype.statusText = function(index) {
    var symbol = this.commandSymbol(index);
    if (this.isResolutionSymbol(symbol)) {
      return this.getConfigValue(symbol);
    } else {
      return _Window_Options_prototype_statusText.call(this, index);
    }
  };

  //Changes how it handles option when pressing enter
  _Window_Options_prototype_processOk = Window_Options.prototype.processOk;
  Window_Options.prototype.processOk = function() {
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol);
    if (this.isResolutionSymbol(symbol)) {
      this.changeRes(symbol, true);
    } else {
      _Window_Options_prototype_processOk.call(this);
    }
  };

  //Changes how it handles option when pressing right
  _Window_Options_prototype_cursorRight = Window_Options.prototype.cursorRight;
  Window_Options.prototype.cursorRight = function(wrap) {
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol);
    if (this.isResolutionSymbol(symbol)) {
      this.changeRes(symbol, true);
    } else {
      _Window_Options_prototype_cursorRight.call(this, wrap);
    }
  };

  //Changes how it handles option when pressing left
  _Window_Options_prototype_cursorLeft = Window_Options.prototype.cursorLeft;
  Window_Options.prototype.cursorLeft = function(wrap) {
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol);
    if (this.isResolutionSymbol(symbol)) {
      this.changeRes(symbol, false);
    } else {
      _Window_Options_prototype_cursorLeft.call(this, wrap);
    }
  };

  //Changes the resolution selection. However resolution will be changed only at closing the options menu.
  Window_Options.prototype.changeRes = function(symbol, direction) {
    var last_value = this.getConfigValue(symbol);
    var resolution;
    if (symbol === 'resolutionWidth') {
      resolution = val_width;
    } else if (symbol === 'resolutionHeight') {
      resolution = val_height;
    } else {
      return;
    }

     var index = resolution.indexOf(this.getConfigValue(symbol));
     index += direction ? 1 : - 1;
     if (index < 0) {
       index = cycleSelect ? resolution.length-1 : 0;
     } else if (index >= resolution.length) {
       index = cycleSelect ? 0 : resolution.length-1;
     }

     if (last_value !== resolution[index]) {
       this.setConfigValue(symbol, resolution[index]);
       this.redrawItem(this.findSymbol(symbol));
       SoundManager.playCursor();
     }
   };

   //Changes resolution at closing the option screen. Also changes window size if "Auto Resize" is set to true.
   _Scene_Options_prototype_terminate = Scene_Options.prototype.terminate;
   Scene_Options.prototype.terminate = function() {
     if (forceResize || autoResize) {
       window.resizeTo(ConfigManager['resolutionWidth'] + window.outerWidth-window.innerWidth,
       ConfigManager['resolutionHeight'] + window.outerHeight-window.innerHeight);
     }

     Graphics.boxWidth = Graphics._width = ConfigManager['resolutionWidth'];
     Graphics.boxHeight = Graphics._height = ConfigManager['resolutionHeight'];

    //If a map is loaded, center the screen onto the player.
    if (SceneManager._stack.indexOf(Scene_Map) !== -1) {
      $gamePlayer.center($gamePlayer._realX, $gamePlayer._realY);
    }
    Graphics._updateAllElements();
    _Scene_Options_prototype_terminate.call(this);
  };

  //////////////////////////////////////////////////
  //                Window Resizing
  //////////////////////////////////////////////////
  //Force automatic window resize if "Force Window Size" is set to true.

  if (forceResize) {
    _Graphics__onWindowResize = Graphics._onWindowResize;
    Graphics._onWindowResize = function() {
      window.resizeTo(ConfigManager['resolutionWidth'] + window.outerWidth-window.innerWidth,
      ConfigManager['resolutionHeight'] + window.outerHeight-window.innerHeight);
      _Graphics__onWindowResize.call(this);
    };
  }

  //Resizes window and render resolution at startup if "Auto Resize" is set to true.
  if (forceResize || autoResize) {
    _Scene_Boot_prototype_create = Scene_Boot.prototype.create;
    Scene_Boot.prototype.create = function() {
      _Scene_Boot_prototype_create.call(this);
      window.resizeTo(ConfigManager['resolutionWidth'] + window.outerWidth-window.innerWidth,
      ConfigManager['resolutionHeight'] + window.outerHeight-window.innerHeight);
      Graphics.boxWidth = Graphics._width = ConfigManager['resolutionWidth'];
      Graphics.boxHeight = Graphics._height = ConfigManager['resolutionHeight'];
      Graphics._updateAllElements();
    };
  }

   //////////////////////////////////////////////////
   //                    Resizing
   //////////////////////////////////////////////////
   //Check which Title Screen resize option is set to execute.

   switch(stretch_title) {
     //Keep aspect ratio.
     case 1:
       _Scene_Title_prototype_centerSprite = Scene_Title.prototype.centerSprite;
       Scene_Title.prototype.centerSprite = function(sprite) {
         _Scene_Title_prototype_centerSprite.call(this, sprite);
         scale1 = Graphics._width / sprite.width;
         scale2 = Graphics._height / sprite.height;
         sprite.scale.x = sprite.scale.y = scale1 > scale2 ? scale1 : scale2;
       };
       break;

     //Stretch to fit.
     case 2:
       _Scene_Title_prototype_centerSprite = Scene_Title.prototype.centerSprite;
       Scene_Title.prototype.centerSprite = function(sprite) {
         _Scene_Title_prototype_centerSprite.call(this, sprite);
         sprite.scale.x = Graphics._width / sprite.width;
         sprite.scale.y = Graphics._height / sprite.height;
       };
       break;
   }

   //Check which battlebackground resize option is on.
   if(stretch_bField == 1) {
     //Scales the position of the actors on the battlefield depending on the resolution.
     Sprite_Actor.prototype.setActorHome = function(index) {
       var x = 600 * (Graphics._width / 800) + (index * 32) * (Graphics._width / 800);
       var y = 280 * (Graphics._height / 600) + (index * 48) * (Graphics._height / 600);
       this.setHome(x, y);
     };
     _Sprite_Enemy_prototype_setBattler = Sprite_Enemy.prototype.setBattler;
     Sprite_Enemy.prototype.setBattler = function(battler) {
       _Sprite_Enemy_prototype_setBattler.call(this, battler);
       this.setHome(battler.screenX() * (Graphics._width / 800), battler.screenY() * (Graphics._height / 600));
     };
   }

   //Check which battlebackground resize option is set to execute.
   switch(stretch_bBack) {
     //Stretched vanilla.
     case 1:
      //TODO
      break;

     //Vanilla keep aspect ratio.
     case 2:
      //TODO
      break;

    //Keep aspect ratio.
    case 3:
      Spriteset_Battle.prototype.locateBattleback = function() {
        var width = Graphics._width;
        var height = Graphics._height;
        var width1 = this._back1Sprite._bitmap._baseTexture.width;
        var height1 = this._back1Sprite._bitmap._baseTexture.height;
        var width2 = this._back2Sprite._bitmap._baseTexture.width;
        var height2 = this._back2Sprite._bitmap._baseTexture.height;
        var scale1 = (width / width1) > (height / height1) ? (width / width1) : (height / height1);
        var scale2 = (width / width2) > (height / height2) ? (width / width2) : (height / height2);
        this._back1Sprite.scale.x = this._back1Sprite.scale.y = scale1;
        this._back2Sprite.scale.x = this._back2Sprite.scale.y = scale2;
        var x1 = 0;
        var y1 = 0;
        var x2 = 0;
        var y2 = 0;
        x1 -= (width1 * scale1 - width) / 2;
        y1 -= (height1 * scale1 - height) / 2;
        x2 -= (width2 * scale2 - width) / 2;
        y2 -= (height2 * scale2 - height) / 2;
        this._back1Sprite.move(x1, y1, width1, height1);
        this._back2Sprite.move(x2, y2, width2, height2);
      };
      break;

    //Stretch to fit.
    case 4:
      Spriteset_Battle.prototype.locateBattleback = function() {
        this._back1Sprite.scale.x = Graphics._width / this._back1Sprite._bitmap._baseTexture.width;
        this._back1Sprite.scale.y = Graphics._height / this._back1Sprite._bitmap._baseTexture.height;
        this._back2Sprite.scale.x = Graphics._width / this._back2Sprite._bitmap._baseTexture.width;
        this._back2Sprite.scale.y = Graphics._height / this._back2Sprite._bitmap._baseTexture.height;
        this._back1Sprite.move(0, 0, this._back1Sprite._bitmap._baseTexture.width, this._back1Sprite._bitmap._baseTexture.height);
        this._back2Sprite.move(0, 0, this._back2Sprite._bitmap._baseTexture.width, this._back2Sprite._bitmap._baseTexture.height);
      };
      break;
  }

})();
 

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

Latest Threads

Latest Posts

Latest Profile Posts

It seems like this is going to be another remote semester. RIP.
I don't like linear gear progression in games. I'd like to see more gear be useful from start to finish. This is also true for skills. I also like finding overpowered gear, and don't enjoy games that are too balanced.
Framework is getting closer to completion. Adding more QoL changes for users.
I'm very excited with DE:VOID! And FYI Darkness of Hope - The Pocket Watch in development, so please be excited!
The more I look at the QPlugins... The more I am amazed at what they can do. Which I'm not going to lie is pretty awkward, because I already consider them far and away the best plugins MV has to offer. :kaoback:

Forum statistics

Threads
99,505
Messages
966,167
Members
131,137
Latest member
CondeNikolai
Top