Week 4-5 – Generating a world
This has taken me quite a lot of work to get right. It is still not quite how I would like it as the world is generated from tiles with perlin noise added to give some variation to make it look more organic. But the tile selection is still random, as i would like it to work from a seed so that maps can be reproduced.
This is true size of the maps they are 16×16 pixels using grayscale to store the information.
This is them with 900% zoom.
Black represents 0, this being the floor height. White represents 1, this being the wall height. And grey represents the ability to sway, between wall and floor, this allows the perlin noise to take advantage of this to change the design how the noise sees fit.
How it works:
Because the maps are 16×16 the world is only able to generate square multiples of 16. The map generator takes these 16×16 images, selecting from them and putting them into an image that is 1×1 pixel per position for the final map. Once it has generated this new larger X*16² pixel image. It then uses the pixel information to generate the world, as it reads the pixel data for each position it takes into account the perlin information base on that pixels position. The result is a 0-1 scalar value that is than simply using a bias for wall placement where any value below the bias is floor, and any value equal to or above becomes a wall. I am also using the perlin information with a different bias to place resources, that is why they all clump together. This is hopefully temporary.
I have taken this and the pathing from the weeks before to create drones capable of navigating the world, this still needs quite a lot of work, as they have a lot of issues, that I hope to address in the coming week.
This week we learned how to set up a simple physics interaction, in the form of rope simulation. And how to use Verlet Integration, to make it more performant. The last class of this week we will be looking over spatial partitioning and how it can be used to improve performance.