r/proceduralgeneration • • 2h ago

My browser game uses procedural generation to create an endless alien ecosystem - Microgenesis

6 Upvotes

r/proceduralgeneration • • 10h ago

Pixel outlines generated from a sampled curve get an extra pixel at every bend. The 3-pixel rule that removes them (61 to 43 px)

Post image
3 Upvotes

If you generate sprites by sampling a parametric curve and flooring each sample to a cell (blobs, slimes, rocks, planets), the outline comes out lumpy: thick on the curves, clean on the straight parts.

The cause: on a slope, a sample almost never crosses a cell exactly at its corner. The path steps one cell sideways, then one cell down, and both cells get set. That's an L: three pixels where two touching at a corner would do.

On the 32x32 slime in the picture (x = 15.5 - 12.6 cos t, y = 24.4 - 17.2 sin(t)^0.92, 2,001 samples over the top half), the raw path had 61 pixels, and 18 of them were L elbows. After the rule below: 43, one pixel wide all the way round.

The rule is the one pixel-art editors call "pixel-perfect": walk the path, and whenever the last three pixels a, b, c have a and c touching diagonally while b is a side neighbour of both, delete b.

def is_corner(a, b, c):  
 return abs(a[0]-c[0]) == 1 and abs(a[1]-c[1]) == 1 and ((b[0] == a[0] and b[1] == c[1]) or (b[1] == a[1] and b[0] == c[0]))

def pixel_perfect(pts):  
 out = []  
 for p in pts:  
 if out and out[-1] == p: continue  
 out.append(p)  
 if len(out) \>= 3 and is_corner(out[-3], out[-2], p): del out[-2]  
 return out  

It only ever deletes the elbow of an L, so straight runs and diagonal steps survive, and it costs O(1) per point.

One more check for generated curves: the run lengths. Along a curve they should only shrink or only grow (4, 3, 2, 2, 1, 1). If they jump around (4, 2, 1, 3, 1, 2), the curve reads as dented even at one pixel wide (bottom of the picture).

(I make pixel-art tools at Gridwright; our browser pixel editor runs this rule on every pencil stroke. Linked below.)

The browser pixel editor that applies this rule as you draw: https://gridwright.dev/tools/pixel-art-editor/?ref=reddit-proceduralgeneration


r/proceduralgeneration • • 12h ago

Preview screenshots of Brickadia's upcoming procedural terrain

Thumbnail
gallery
22 Upvotes

r/proceduralgeneration • • 18h ago

A generated mountain for a base-defence game: the same seed gives the same world in every browser

Post image
0 Upvotes

Each run of my browser game Rock & Hold is a new mountain: a 60 × 60 grid of rock with caverns, passages between them and mineral deposits. A few things I had to solve, in case they help someone:

- The same seed must give the same world everywhere. JavaScript engines round Math.sin, cos and exp differently, so the game uses its own versions of them and never sorts with a random comparator.

- Nobody may start trapped. Generation checks that no open cell is closed in by deposits and bedrock alone; a deposit on such an edge turns back into rock, so the miner can always walk or dig out.

- New content must not move old worlds. Indestructible "Old walls" were added later: they are rolled last, from their own stream of the seed, so a seed's caverns and deposits stay where they were. A wall is kept only if every floor cell is still as short a dig from the start as before.

- Hidden things leave a hint. Rock near a hidden cavern's deposit shows flecks of that deposit's colour, on about one cell in four, so a few catch your eye.

The picture is a generated world open in the game's map editor. You can type any seed there and look at its world: https://rockandhold.com/?ref=reddit-proceduralgeneration

How do you keep old seeds stable when you add a new generation step?

Made with AI: I design the game and tune it by playing it; the code, art and sound are written with AI tools.


r/proceduralgeneration • • 21h ago

Procedural pixel-art ocean

201 Upvotes

r/proceduralgeneration • • 6m ago

Did some work on near-surface rendering of my procedural planet. Took the opportunity to add walking as well

5 Upvotes

I'm targeting 60fps on RTX 3070 at 1440p native. Grass and Water are the big budget breakers right now and will need some optimization.


r/proceduralgeneration • • 24m ago

been working on this medieval house generator for about a year, you draw a street and it builds the houses

22 Upvotes

hey, first time posting my stuff on reddit

started this about a year ago with a professor of mine and kept building it since. it's medieval paris around 1500: you draw a street and it fills it with houses, each one is generated (storeys, roofs, timber framing, shop fronts, little props on the street etc). the core is written in rust and runs in the browser with three.js

still struggling a lot with the 3d side honestly, making the houses look less blocky and more like real old buildings. if anyone has tips on that, especially on modelling or procedural architecture, it'd help a lot


r/proceduralgeneration • • 19h ago

Spherical polyhedron with prisms

14 Upvotes