Pixel Polygon Creator 2000

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
Bobble68
Party member
Posts: 160
Joined: Wed Nov 30, 2022 9:16 pm
Contact:

Pixel Polygon Creator 2000

Post by Bobble68 »

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Ok now I got that out of my system, welcome to what I've been obessing and stressing over for the last week or so. Some of you might remember a little while back I asked for help with optimising my game, specifically about rendering the islands that had a pixellated style to them. The main suggestion was to use meshes with a repeating texture rather than canvases, which made sense to me but it would be hard to make these meshes in the right style.

While there were some suggestions about how to create this mesh, I eventually realised that there was only really one method that made sense - Bresenham's line algorithm, but like, harder. I won't get into the details on how this works, but just know that drawing pixels is way easier than placing points on the outside of those pixels.

So I present to you, the Pixel Polygon Creator 2000!
pix.png
pix.png (44.06 KiB) Viewed 3743 times
Probably horribly inefficient, but it was the best I could do, and will hopefully improve performance on my game (which I have been longing to work on for the last week or so). Feel free to use it yourself, lord knows I spent enough time working on it.

polpixel.love
(3.87 KiB) Downloaded 160 times

Bobblesoft - inefficiently making the wrong things since 2022.
Dragon
User avatar
GVovkiv
Party member
Posts: 670
Joined: Fri Jan 15, 2021 7:29 am

Re: Pixel Polygon Creator 2000

Post by GVovkiv »

I use this every day! It's great!
- Gadget Gabe (2023)
User avatar
UnixRoot
Citizen
Posts: 80
Joined: Mon Nov 08, 2021 8:10 am

Re: Pixel Polygon Creator 2000

Post by UnixRoot »

Bobble68 wrote: Sat Jun 17, 2023 12:30 pm The main suggestion was to use meshes with a repeating texture rather than canvases, which made sense to me but it would be hard to make these meshes in the right style.
Why not use both together? You can draw multiple meshes to a scaled up canvas.

poly.love
(1.56 KiB) Downloaded 118 times

I would do something like this. For more vertices and more complex polygons, you could easily calculate a vertexMap to get them in the right order
User avatar
Bobble68
Party member
Posts: 160
Joined: Wed Nov 30, 2022 9:16 pm
Contact:

Re: Pixel Polygon Creator 2000

Post by Bobble68 »

UnixRoot wrote: Sat Jun 17, 2023 4:44 pm
Bobble68 wrote: Sat Jun 17, 2023 12:30 pm The main suggestion was to use meshes with a repeating texture rather than canvases, which made sense to me but it would be hard to make these meshes in the right style.
Why not use both together? You can draw multiple meshes to a scaled up canvas.


poly.love


I would do something like this. For more vertices and more complex polygons, you could easily calculate a vertexMap to get them in the right order
The main reason I avoided using canvases was so that I could have multiple grids at different angles and scales. I'm just happy I got something that works™
Dragon
User avatar
UnixRoot
Citizen
Posts: 80
Joined: Mon Nov 08, 2021 8:10 am

Re: Pixel Polygon Creator 2000

Post by UnixRoot »

Bobble68 wrote: Sat Jun 17, 2023 6:28 pm The main reason I avoided using canvases was so that I could have multiple grids at different angles and scales.
You can use multiple canvases, and you can scale and rotate each one differently
User avatar
Bobble68
Party member
Posts: 160
Joined: Wed Nov 30, 2022 9:16 pm
Contact:

Re: Pixel Polygon Creator 2000

Post by Bobble68 »

UnixRoot wrote: Sat Jun 17, 2023 6:33 pm
Bobble68 wrote: Sat Jun 17, 2023 6:28 pm The main reason I avoided using canvases was so that I could have multiple grids at different angles and scales.
You can use multiple canvases, and you can scale and rotate each one differently
Sorry, not sure why I said that yesterday, I was already using canvases before to do exactly that. The actual main reason I was avoiding canvases was because people said they were getting poor performance, which I think was because some of the canvases had to be massive, hence why I'm trying this approach.
Dragon
User avatar
UnixRoot
Citizen
Posts: 80
Joined: Mon Nov 08, 2021 8:10 am

Re: Pixel Polygon Creator 2000

Post by UnixRoot »

You don't need to use massive canvases. They only have to have the size of the screen. You can do the scrolling by streaming new vertex coordinates to your meshes.
Post Reply

Who is online

Users browsing this forum: No registered users and 58 guests