Certain zoom values create pixels above character sprites?

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
526
First Language
Javascript
Primarily Uses
RMMZ
Can someone please help me out?

Problem:
Can't seem to figure out why certain zoom values such as 2.25 create pixels above the character sprites (events/player).
Code:
$gameScreen.startZoom($gamePlayer.screenX(), $gamePlayer.screenY(), 2.25, 1)
zoom issue.png

Meanwhile zoom 2.4 & 2.6 work nicely:
1576728568349.png

Is there a solution to this besides simply avoiding such zoom values?
Any insight is much appreciated.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,858
Reaction score
14,046
First Language
English
Primarily Uses
RMMV
It looks like it's taking a row of pixels from the image above. This might be something to do with the height of each individual cell in your character sheet.

Does it do this in a brand new project with NO plugins active? What if you use sprites in the $spritesheet format (only one character per image, 3 columns, 4 rows)?

What if you try 1.26 rather than 1.25?
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
526
First Language
Javascript
Primarily Uses
RMMZ
@Shaz Thanks for reply. Any help is much appreciated :)

Does it do this in a brand new project with NO plugins active? What if you use sprites in the $spritesheet format (only one character per image, 3 columns, 4 rows)?
Yup yup just tried a blank project and tried the $spritesheet format still happens.


What if you try 1.26 rather than 1.25?
1.24 & 1.26 both good no extra pixels
1576739961467.png
1576738860296.png
1576739536213.png
1576740138274.png

Demo of the issue (clean project, no plugins, freshly created): Click Here to View
 

Attachments

  • Zoom Issue.zip
    1.5 MB · Views: 1

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,858
Reaction score
14,046
First Language
English
Primarily Uses
RMMV
So I didn't download your demo, but I tried the same thing on a new map in a project with no plugins, and was able to reproduce the issue.

I also created a $single version of the one character, and it also had the issue, but only in one direction.

I haven't looked very much at the scripts, but I had a feeling it might have had something to do with the number of pixels in height for each individual sprite. So I copied the Actor1 and my $single version, enlarged the canvas by 8 (and 4) pixels, and moved each row down accordingly (row 8 I moved down 8 pixels, row 7 I moved down 7 pixels, etc). After this change, it all worked fine.

I suspect there's something in the scripts that's recalculating the frame size and having a rounding issue - either because of the odd number on the end, or something to do with not being divisible - haven't looked any further at it.

If nobody else gets a solution for you, I'll look a little further over the weekend. I can't concentrate well enough right now to figure it out, and tomorrow I have other things happening.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,586
Reaction score
8,647
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Support. Please be sure to post your threads in the correct forum next time. Thank you.

 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
526
First Language
Javascript
Primarily Uses
RMMZ
@mlogan Thanks for moving it. :cutesmile::thumbsup-right:

I suspect there's something in the scripts that's recalculating the frame size and having a rounding issue - either because of the odd number on the end, or something to do with not being divisible - haven't looked any further at it.
Same thoughts just not really sure where to begin with this one...
If nobody else gets a solution for you, I'll look a little further over the weekend. I can't concentrate well enough right now to figure it out, and tomorrow I have other things happening.
No worries I totally know how that one is. I'll take any help with this. I'm quite stumped... perhaps something helpful can be found in rpg_core.js or maybe pixi.js
 
Last edited:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
526
First Language
Javascript
Primarily Uses
RMMZ
Hmm... I'm really leaning towards something in pixi.js or pixi-tilemap.js being an issue...
1576772253797.png

1576772361339.png
...no clue what I'm looking for really though.
 
Last edited:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,858
Reaction score
14,046
First Language
English
Primarily Uses
RMMV
So the following change in pixi.js (starting line 10649) stops the extra lines, but messes with the focus point.

Code:
    TransformStatic.prototype.updateTransform = function updateTransform(parentTransform) {
        var lt = this.localTransform;

        if (this._localID !== this._currentLocalID) {
            // get the matrix values of the displayobject based on its transform properties..
            lt.a = Math.floor(this._cx * this.scale._x);
            lt.b = Math.floor(this._sx * this.scale._x);
            lt.c = Math.floor(this._cy * this.scale._y);
            lt.d = Math.floor(this._sy * this.scale._y);

However, before I made that change, I noticed when zoomed in, the mouse destination became faulty, and the camera didn't follow the player correctly. So I'm not sure if you want to continue along those lines, as there are multiple other issues that would also need to be addressed.

Did you take a look at some of the other camera zoom plugins to see how they handle it, and if they have the same issue?
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
526
First Language
Javascript
Primarily Uses
RMMZ
So the following change in pixi.js (starting line 10649) stops the extra lines, but messes with the focus point.
Hmm.. interesting... thanks for the info.
Did you take a look at some of the other camera zoom plugins to see how they handle it, and if they have the same issue?

Yup I looked over a few others and it seems all the other ones I came across had the issue still.
I did however come up with a fix for this now also. Mind testing? Maybe there are other issues this causes?

Fix:
Changing this.x & this.y in function Spriteset_Base.prototype.updatePosition
Code:
Spriteset_Base.prototype.updatePosition = function() {
    var screen = $gameScreen;
    var scale = screen.zoomScale();
    this.scale.x = scale;
    this.scale.y = scale;
    this.x = -screen.zoomX() * (scale - 1); // Default:   this.x = Math.round(-screen.zoomX() * (scale - 1));
    this.y = -screen.zoomY() * (scale - 1); // Default:   this.y = Math.round(-screen.zoomY() * (scale - 1));
    this.x += Math.round(screen.shake());
};
More specifically removing the rounding of the values.
ExtraPixelFix: Plugin - Click Here to Download/View
However, before I made that change, I noticed when zoomed in, the mouse destination became faulty, and the camera didn't follow the player correctly.
That feature and many more incorporated into an upcoming plugin. ;):thumbsup-right:
PS. Sorry for the delayed reply, somehow missed the notification.

*** EDIT ***@Shaz
The fix I posted seems to fix some values but not all... and may have other issues...
...still need help with this. :dizzy:
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts


When you thought you'd be finished with the grid, and spend ~8-9 hours on an arrow. How is this more difficult to than player movement?

Still some bugs hiding in there, but it's nearly complete.

I'm having it strictly follow the path a user draws, because there will be booby trap and other similar mechanics where you want to avoid specific cells.
I feel like banging my head against a wall every time I want to find that post that shows all the plugin header codes. Then I think "next time I find it, I'm going to bookmark it". Then I think "wait a minute ... maybe I bookmarked it last time because it took me so long to find it". Check bookmarks, and there it is :)
... a few of my main characters standing around doing nothing lol. I mostly wanted to see them together on screen.

Forum statistics

Threads
107,820
Messages
1,032,430
Members
139,970
Latest member
ThatOneMans
Top