I want to share with you my first website - World generator. I’ve been making this site for a very long time, and in my opinion it turned out well for a beginner in web development.
You can also see my website at this link until the beginning of 2024: https://world-generator-site--kalexk.repl.co/
How to use it?
Using my website is very simple. First you have to choose the size of the generated image (3 sizes are available: 256px, 512px, 1024px). Next, you must specify whether the site needs to add additional elements to the image (mountains, rivers, deserts and glaciers). After that, you can click on the Generate button and after a while see the generated image (I can’t speed it up, since I don’t have money to speed up the repl).
How does it work?
Image generation is based on Perlin noise (I won’t go into the details of perlin noise generation, it’s already obvious to everyone ).
The image consists of 3 perlin noises: 2 ordinary ones (for height, for rivers and mountains) and 1, which has darker pixels in the upper and lower edges than in the center (for temperature).
I wrote the entire perlin noise generation algorithm myself.
I know that there are python modules for generating perlin noise, but despite this, I wrote the entire generation algorithm myself, and there are 3 reasons for this:
- When I wrote the generation algorithm, I didn’t know about the existence of such libraries.
- When the algorithm is written by you, you can control the entire generation process.
- The initial goal of my project was not to create a website, but a generation algorithm (more on this below).
History of creation
Somewhere in late January - early February, I watched a video of a Russian-speaking youtuber about how he does the generation of a landscape on Unity. After I regretted a little that I don’t have Unity and I don’t know C#, I decided to repeat such a project but on Scratch.
I did this project and I was very happy with the result.
A little information about the project:
- there are 330 blocks in the project
- generating a 256px 256px image took an average of 98 seconds
- the generated images were dockable, that is, if you put two identical generated images side by side, they will perfectly dock
But 98 seconds to create such a small image seemed too much to me, and I transferred the project to Python. After several major updates, I abandoned the project.
When I signed up for Replit, I immediately wanted to share my projects. And I decided to upload my project with a landscape generator to Replit. But I ran into a problem - I didn’t know how to combine input using the console and webview. Then I looked for similar replays and found one, but in it the image output occurred via the console. I didn’t want to do the same, and I resigned myself to having to make a website (I didn’t know how to make websites at all). An example of a site for me was a site from TimMcCool with a subscriber counter.
And now, the site can be called completely ready.
I plan to add seed generation and image docking (as it was in the first version of the project). Also offer your ideas for this project!
Is it allowed to take code from the project?
Yes, you can take the code from the file
WorldGenerator.py, since it has two classes for generating images (I tried to write something like documentation for each function).
Leave me a thank you for creating this file, if you use it in your projects, it’s already a matter of your conscience.