Similar lines are different thickness

I’m drawing a grid and the lines (although all set to the same thickness (1px)) appear to be different thicknesses… See attached example.

How do I avoid this? (1.5 KB)

It is a known problem with rendering and not only that.
If scale the screen up and down, lines also disappear:

I have reported this problem long ago, not sure if there is a fix…
Most reliable option is to create the grid using sprites.

Could you elaborate on this please?

Just create a square in a paint tool and then use it in a tiled sprite to create grid of tiles.
Take a look at the level editor example.

Or place individual instances of the square next to each other to create the grid in case you wan to interact with individual tiles.
Take a look at the Inventory example.

Great, thanks for that!

Can you point me to your bug report about the rendering issue? I tried searching Github but couldn’t find anything there…

It was only mentioned in a topic on GitHub can’t remember which one.
It received no comment from the devs in case you wondering what the devs had to say about it.
Feel free to post it on GitHub again and see if you get any response this time :slight_smile:


I can see the code to draw lines in the GDevelop sources is a bit weird, instead of using the lineTo PIXI method it uses polygons and rectangles if the initial and final Y positions are the same.
For now, you can use a thickness = 0.5 to make the 2 pixels width line 1 pixel width only. Or change the Y position just a bit in one of the sides, in your case change the final point Y position from “Variable(y)*50” to “Variable(y)*50 + 0.001”.

About the lines turning non-visible when changing the zoom, think that you want to draw 1 pixel width line in the normal window size, if the window size is 1/10 the original size you can’t draw 0.1 width lines, physically impossible, maybe draw 1 pixel line with very low opacity, but in the end it’s normal the lines turn invisible.

Super busy, but will add it to my TODO list :slight_smile:

I disagree:

  1. In ddabrahim’s screenshot, only one line has disappeared, so its possible for lines to be shown at that size (since all the others are fine).
  2. When scaling the window, I think lines should be shown at a minimum of 1px width rather than disappearing. Just my personal opinion though.

1 - I guess it depends on the lines position, rounding pixels and so.

2 - So if you have just 10 tin lines and reduce the screen size a lot you’ll end with a black screen… not corresponding to the original view at all. While if you have 10 tin lines in a large view and make this view smaller, the behavior that shows better the original state is taking out the lines indeed.

But I get your point, you want a zoom-independent draw maybe scaling the lines thickness in function of the screen size?

Hmm, good point. Not sure what the answer is then…

If all lines disappear at the same time when the screen size is too small to accomodate them, I guess that’s expected and OK. But definitely having some disappear while others are still shown is a weird bug.

Yeah, would be nice if GD would handle this internally. I can’t really think of any scenario where you draw something on the screen and it would be ok to disappear (even if there is a rational explanation) :cry:

I was thinking once to make a game by using nothing but the drawing commands, so it would be important to keep everything visible on the screen or add a toggle button and let people choose :nerd: