YesNoOk
avatar

Stage Zoomer & Scaler (Read 12481 times)

Started by Pixel Grass, May 11, 2021, 01:25:59 am
Share this topic:
Stage Zoomer & Scaler
#1  May 11, 2021, 01:25:59 am
  • *
I made two little tools:
  • the first tool, Zoomer, tries to automatically convert a 4:3 stage to a widescreen (e.g. 16:9) stage, by adding zoom to a stage (or alternatively it can generally add zoom support to a stage); other parameters (such as deltas) are also automatically adjusted to avoid artifacts,
  • the second tool, Scaler, allows to resize the whole stage by using the xscale and yscale parameters; the horizontal deltas, vertical offsets of backgrounds and the left, right and upper camera bounds are also adjusted accordingly.

These tools are Python scripts, so you need to have Python installed to use it. It also most probably requires at least Python 3.10 (as this is what I have installed).

If you are on Windows, look at this: https://www.wikihow.com/Use-Windows-Command-Prompt-to-Run-a-Python-File.  A crutial part from the article above is: Part 2 Point 5. At this point you can provide additional command line arguments (like the path to the DEF file).


The script is currently only hosted on ideone.com:
You can just download them and save e.g. as files named stage-zoomer.py and stage-scaler.py. I have not put it on Github, because I am not sure that I currently have the time and motivation to deal with MRs and what not. Anyways, enjoy if you find it useful.

A detailed Zoomer description/usage:
Spoiler, click to toggle visibilty

A detailed Scaler description/usage:
Spoiler, click to toggle visibilty


Updated: 2024-01-31

Changelog 1.0.0 (Scaler):
- Initial version.

Changelog 1.1.0 (Zoomer):
- Added support for the conversion of old-style parallax background layers that use the xscale parameter.
- Removed the legacy Ikemen bounds mode, as well as the separate horizontal/vertical bound modes (the -x, -y options).
- More tweaks in vertical bounds calculation formulas.
- Added the -o / --output-path option that can be used to avoid modifying the stage files in-place.
- Some minor bufixes.
- Some tweaks in the errors handling.
- Some tweaks in the documentation.

Changelog 1.0.2 (Zoomer):
- Updated formulas for the newest Ikemen GO version.
- Added optional `debugbg` setting for follow-up manual edits.
- Excluded parallax backgrounds from delta adjustments.
- Other minor tweaks and fixes.
Last Edit: January 31, 2024, 06:04:36 pm by Pixel Grass
Re: Stage Zoomer
#2  May 11, 2021, 01:10:47 pm
  • **
  • Rabbit + Fantasy Blob = Blobbit with very high DEF
    • USA
= RESTART: C:\Users\Classified\Classified\Classified\M.U.G.E.N\Ikemen\Ikemen_GO_Win_x86-1\stages\stage-zoomer.py
usage: stage-zoomer.py [-h] [-r RATIO] [-z ZOOM] [-n ZOOM_IN] [-t ZOOM_OUT]
                       [-m CB_MODE] [-x XB_MODE] [-y YB_MODE] [--no-backup]
                       [--version]
                       DEF_FILE [DEF_FILE ...]
stage-zoomer.py: error: the following arguments are required: DEF_FILE

Umm...how...do I run this?
Re: Stage Zoomer
#3  May 11, 2021, 04:23:45 pm
  • *
It is a command line / console / shell tool.

You at least have to give it a path to a stage's DEF file as a command line argument.


Also if running it on Windows you may need to call the script by explicitly running the Python executable:

  python.exe stage-zoomer DEF_FILE

or something similar.


Here are some examples of running it (without explicitly calling Python):

  stage-zoomer DEF_FILE
                        modify the given zoom-less stage DEF file to support a 16:9 aspect ratio
                        (this is the default behavior when no additional options are given)
  stage-zoomer -z 0.85 DEF_FILE
                        modify the given zoom-less stage DEF file to support a zoom of 0.85
                        the stage will be set to always display in this exact zoom
  stage-zoomer -z 0.8 -n 1.0 DEF_FILE
                        modify the given zoom-less stage DEF file to support a zoom-out of 0.8
                        set the zoom-in value to 1.0, making the effective zoom range [0.8, 1.0]
  stage-zoomer -r 64x27 DEF_FILE
                        modify the given zoom-less stage DEF file to support the ultra-wide 64:27 aspect ratio
                        (this implies a large zoom-out value, therefore some artifacts may not be avoided)


You can also run:

  stage-zoomer --help

and this will display a detailed help.

Please read the help if you use it for Ikemen - there is a special mode that gives better results for stages to be used in Ikemen as opposed to Mugen.
Last Edit: May 11, 2021, 04:40:48 pm by Pixel Grass
Re: Stage Zoomer
#4  May 11, 2021, 07:14:09 pm
  • **
  • Rabbit + Fantasy Blob = Blobbit with very high DEF
    • USA
Yeah it's the same help you posted here. I just don't know how python specifically works. When I launch the python executable the CMD closes before I can blink. I go to stage-zoomer.py, right click to use "Edit with IDLE" and I use "Run Module" or this case "Run Customized" and I don't know what to put in the textbox to make it do it's job. Is there like a an image or video example of how this works?
Re: Stage Zoomer
#5  May 11, 2021, 09:12:47 pm
  • *
OK. I don't have Windows currently, so I can't provide a step-by-step tutorial myself.

However, I found something like this: https://www.wikihow.com/Use-Windows-Command-Prompt-to-Run-a-Python-File.

  • Essensially, you have to run cmd separately and then run Python inside an already open CMD window.
  • Another crutial part from the article above is: Part 2 Point 5. At this point you can provide additional command line arguments (like the path to the DEF file).
Last Edit: May 11, 2021, 09:27:15 pm by Pixel Grass
Re: Stage Zoomer
#6  May 12, 2021, 12:08:08 am
  • **
  • Rabbit + Fantasy Blob = Blobbit with very high DEF
    • USA
I think I got it! So this would mean any stage that has zoom settings, hires and/or xy scales has to be disabled, run the script and reenable them again right?
Re: Stage Zoomer
#7  May 12, 2021, 10:13:02 am
  • *
You can try it like that, but the script almost certainly won't make a good job in this case, that's why these cases are explicitly disabled/unsupported - the mathematical formulas in the script simply do take these parameters into account and they are important to what the script is trying to do.

If you can make a sensible manual conversion from hires and/or xy scales to localcoord instead and then run the script, then it has a chance of working correctly, however I have not tested such cases. I tested mostly lowres and zoom-less 4:3 stages.



Last Edit: May 12, 2021, 10:25:33 am by Pixel Grass
Re: Stage Zoomer
#8  March 15, 2023, 09:57:54 pm
  • *
I updated the tool, if someone is interested.

The main highlight is probably the support for the newest Ikemen Go version.
Re: Stage Zoomer
#9  March 23, 2023, 08:44:28 pm
  • ****
    • Argentina
    • matrerog@yahoo.com.ar
It seems a simple method and an interesting tool.
I understand much of the code of the stages but it can be something useful to do a quick edit. I'll check it out, thanks for share.
Re: Stage Zoomer
#10  March 28, 2023, 02:09:57 am
  • ******
  • 90's Kawaii
  • :thinking:
    • Guatemala
This is a great tool, and makes me want to build a new 16:9 install.

One thing: as of the most recent nightly, Ikemen's camera works more like mugen 1.1, so you actually get better values for boundhigh and cutlow from using "-x mugen -y mugen" than "-x ikemen-y ikemen". May wanna sunset the feature once stable 0.99 comes out since it could be misleading.
Re: Stage Zoomer & Scaler
#11  January 31, 2024, 06:11:05 pm
  • *
I updated the tools againt, for those interested.

The main highlights include:
  • a new Scaler tool, as the name suggest, for scaling the whole stage,
  • the added support for conversion of parallax backgrounds that use the xscale parameter.

Links and description at the top of the thread.

PS: The files are now hosted on ideone.com, instead of Pastebin, as Pastebin is currently having problems.