Help with Perlin Noise Procedural Generation

So I have a Perlin Noise map but I want it to be able to convert to tilemap help

1 Like

I’ve never used the perlin noise extension, but all of the “maps” are numbers, or in other words, arrays of arrays of numbers. Try to do some research and figure out how to turn those numbers into a tileMap

Here is an example I made using my extension, WoofWoofCodes/pxt-tilemapgen

3 Likes

Here’s my fix! :sparkles:
I just looped over the 2D array and set each tile of the tilemap to the value in the array as a tile:


LMK if this works with your size of tilemap / any bugs come up!

2 Likes
1 Like

I just guessed that the maximum number was 8 when I wrote the code. You’ll have to make a tile 9. Make sure to add it to the tilemap or it won’t end up in the list. Maybe make a tile 10 just in case? It might be super rare, but better to have it then to not have it.


@YuHayate please create a new release of the noise extension to get rid of the code in main.ts. It’s correct on GitHub, but is still there when you import the extension.

Yeah, the background is sometimes set to that for me too! Any clue on what causes it?

It’s the noise generation extension. @YuHayate forgot to create a new release after removing that code from main.ts.

1 Like

uhhh
woups

um, so basicaly, youre trying to generate an image that is already complex to create, but also making it 13 larger then the screen, thats 3 062 500 pixels to generate perlin noise for, let alone, youre doing it 3 times, the reason why youre not getting an output is because its taking forever to generate the noise maps, ill see if i can optimize the program but for now i think a 200 by 200 noise map is big enough, and only has 76.5 times less pixels and is plenty of tiles large for any map, good luck

1 Like

The values in the arrays range from 0 to 1. After passing them through the convert noise to image function, the output produces numbers from 0 to 15. The reason you rarely see values above 8 or 9 is that the code was using a product operation, which multiplies the corresponding values of the two arrays element-by-element. If you understand distribution curves, you’ll know that multiplying two numbers in the 0–1 range pushes most results toward the center of both ends, which explains why higher and lower values appear less frequently

1 Like

also, try playing with the values in the functions

1 Like