Infinite Terrain Generation with Perlin Noise in Java + Processing

preview_player
Показать описание
Procedural terrain generation can help any game more replayable. In this coding challenge I create a 2D terrain generator that uses Perlin Noise to determine the tile type at each location.

Perlin Noise is a type of noise that can take in numerous inputs to create an output, in this case we feed it the coordinates of each tile and it returns a value between 0 and 1. This value is then mapped to a tile type.
The really cool thing about Perlin Noise is that coordinates close to each other are given similar values which creates pretty organic looking terrain!

Hope you enjoy the episode! If you have any questions be sure to ask in the comments down below :)

0:00 - Intro
0:25 - Perlin noise
5:10 - Using noise for terrain
12:02 - Tile sprites
16:20 - Generation parameters
17:40 - Infinite terrain
20:01 - Fixing the camera
32:06 - Final product

Make sure to check out the links below, they've got everything you need to get started!

Download Processing so that you can get started right away:

Check out the rest of the Coding Challenges here:

Follow me:

#proceduralgeneration #processing #java
Рекомендации по теме
Комментарии
Автор

The most incredible thing about this video is the guy's sincerity. He looks at the code and says "oh, wow. I don't know how I'm going to fix this"

Cookieukw
Автор

Haha “I made a few game but they aren’t finished, I don’t think they’ll ever be finished”

Words I can relate to

reyariass
Автор

Dude thanks a lot. I'm working on a game and this video was so helpful!

reaper
Автор

Barney is a dinosaur from our imagination
And when he's tall
He's what we call a dinosaur sensation
Barney's friends are big and small
They come from lots of places
After school they meet to play
And sing with happy faces
Barney shows us lots of things
Like how to play pretend
ABC's, and 123's
And how to be a friend
Barney comes to play with us
Whenever we may need him
Barney can be your friend too
If you just make-believe him!

danielhuang
Автор

I did not know this was possible in processing. Big thanks :)

Currychicken
Автор

Amazing and really helpful. Thanks for sharing this video! You saved me a lot of time trying to do this...

boblight
Автор

This was incredibly helpful and I plan on implementing something like this in a dungeon crawler I am working on.

Gratenateful
Автор

Thanks for the interesting video!


I think you could pass floor(i + offset) into the noise function, and then draw it at i * tileSize + (offset % tileSize), and avoid keeping track of previous values.

aboutscript
Автор

Maybe I come here too late, but it doesn't matter, that's an amazing example. You have one more sub. Greetings from Mexico <3

jhonatanvictorio
Автор

Thank you! Great video, you speak very well and that perfect!

Aymeri
Автор

Thanks a lot, this was quite helpful!

omaratieh
Автор

Have you considered adding 2 more noise maps one for heat and one for moisture to determine biomes. Done properly you could also get smooth transitions between biomes.

sir_slimestone
Автор

This video est useful for me! But I have a question, how do you create the sprites? And with what file extension? Because he don’t understand how the image can decrease to suit « scale »

baptistegogolewski
Автор

for fun you should also try QuadTree, to render pixels tiles

ajinkyax
Автор

hi, how can i use your code in godot game engine cuz i want this to randomly generate world in my game .by the way this is the best tut i found on youtube about procedural world generation

vaibhavpandey
Автор

Ik I’m really late but I’m trying to implement this in my own game (not using this engine or language) but I don’t understand how you implemented the seed I saw you set the seed to the milliseconds but where in your code did you make that affect the Perrin noise sample?

AryanShahGamingMusic
Автор

this video was helpful but what could I use instead of noise I'm using java in eclipse and there is no noise function.

Mr.Dum_
Автор

Are you using a framework like monoGame or is this all do e in console, I'm new to this stuff so...

jaymhlurbaloyi
Автор

i know this is a big ask but would you be able to try do this in c++, and if not, do you know where i can find someone that can show me how to do it in c++

RealTrueBeast
Автор

Bruh, why they got your channel buried like this? Looked up your name and got pages and pages of Barney the dinosaur. You might want to change your name, this is like the most helpful channel I've come across.

themusicguy