Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drawing canvas 'fixed' resolution misalignment #8017

Open
Ldwebster111 opened this issue May 15, 2024 · 2 comments
Open

drawing canvas 'fixed' resolution misalignment #8017

Ldwebster111 opened this issue May 15, 2024 · 2 comments
Assignees

Comments

@Ldwebster111
Copy link

Ldwebster111 commented May 15, 2024

Problem description

When using the drawing canvas to capture graphics using the fixed resolution, it is offset by a pixel on both the horizontal and vertical.

Attach a .c3p

drawing canvas pixel error.zip

Steps to reproduce

  1. launch program. Press any mouse click to toggle drawing canvas visibility in comparison to the tiles that it has captured.

Observed result

The drawing canvas is offset by a pixel to the left and top.

Expected result

The canvas snapshot should match the pixel placements of the tiles beneath it.

More details

I first noticed an issue with drawing canvas glitches on a large scale floor canvas that was capturing decals for better perf management. On capture, there was an evident pop in the objects being saved, and at a large scale (3000x3000 layout) it wasn't always predictable that the shift would happen in the same direction despite all decals being positioned to int numbers. (edit, see post below. I believe the unpredictability of this was related to the sprites being randomly assigned mirrored/not mirrored on spawn)

More recently, I've begun using small tiles, like the sprites in the example file, to generate random levels and then capturing the composed tiles using drawing canvas and converting that pixel data into array values to build a level later on. However, I noticed that the array was not filling correctly on the first x/y axis, and after some investigation discovered this quirk with the drawing canvas.

Note, this doesn't happen in 'automatic' mode, but a minimised screen breaks level generation using this system completely and so it's important to have an accurate canvas in 'fixed' mode for this system.

Can clarify other users on C3 Discord have also experienced this. I also went through and tested it in a stable build from a year ago and it also happened in that build too.

Affected browsers/platforms:

@Ldwebster111
Copy link
Author

The misalignment is even worse (or more noticeable) when tiles are randomly rotated at right angles:

drawing canvas pixel error

Build with rotatable tiles:

drawing canvas pixel error.zip

@AshleyScirra AshleyScirra self-assigned this May 21, 2024
@Ldwebster111
Copy link
Author

Any update on this issue? fixed resolution canvas is essentially broken for pixel games because of this.

Here's a simple project that compares fixed and automatic canvas. Not only is the last pixel stretched in fixed, the entire texture is incorrectly sized.

canvas bug

fixed canvas paste bug.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants