- An algorithm that scans the city's empty spaces, separates them into rectangles of varying sizes, so that all of the available land is used and with a minimum amount of 1chunk by 1chunk buildings (here a chunk is 13x13 blocks wide)
- A function that "paints" the city. Divides it into neighborhoods. Maybe by creating some dots over the city and for each building, calculating which point is the closest to it. Associate each of those points to a particular colour and you have painted your city.
If anyone wants to finish it, go ahead please
pastebin get dj7hsjKU citybuilder
EDIT: If you want to use it as an API, be sure to set "activateTheExamples" to false at the beginning.
I'm looking for a distraction and I also want to be a little productive during the vacations. So I'm doing this thing and I intend to update it regularly.
If you guys are interested in helping me with it, I made a github since some friends of mine already came forward to tinker the city's generation code.
I just received my optical fiber connection from my french ISP so since it takes me only a couple of minutes to record and upload videos to Youtube, I will probably take advantage of that and upload a video of every big change.
It's not very useful per se but i'm self taught and the time lost will be compensated by the great motivation it gives me to me to be able to show my stuff to my friends and the world. :P
It's just not as fun if nobody sees my stuff.
So for those who enjoy watching progress videos, enjoy ! There's going to be quite a lot of them.
Current features:
- Push the button and it'll spawn a different building everytime
- Can work as an API to build structures quickly if cropped a little at the bottom of the code
- It can build: cubes, floors, walls, rooms, rooms with windows, buildings
- Smart placement and sizing of windows. It'll most likely make something nice.
- Randomization of the materials that are used to build stuff
- Sorting materials with categories ("brown", "gray"...) to make coherent buildings and allow for thematic neighborhoods
- It will build ghost floors, ghost walls or ghost windows at will if any of the blocks in my list aren't there (aka not having the right mods installed)
- Road making
- Almost able to make a full city generation !
Update n°5
Edited by Yarillo, 16 October 2015 - 03:46 PM.