- 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 !
Plans
Plans:- I hope I'll be able to make it build neighborhoods or maybe even cities.
I think building the roads first is the smartest way to approach it.It is not ! - Whenever I feel fancy, I'll try and make it create rooms inside of the buildings. Maybe even with some furnitures.
I'll introduce different shapes of buildings later on.Done !- Introduce a zombie apocalypse ?
Make the buildings pretty ?Done !
Update n°5
[media]http://www.youtube.com/watch?v=MV_GOv9nIM0[/media]
Youtube Videos
Playlist: https://www.youtube....SvQ6Zog4sVudvsWUpdate n°1: The basics (That thread wasn't even made back then)
[media]http://www.youtube.com/watch?v=t6kXCcjsvyY[/media]
Update n°2: The random buildings
[media]http://www.youtube.com/watch?v=pHSuypOkPjA[/media]
Update n°3: Making amazing roads
[media]http://www.youtube.com/watch?v=zjen5EzDTAM[/media]
Update n°4: Creating a path (Day 2)
It was actually a pretty bad idea to make this. It really isn't the simplest way to make a city. How do I know where to place my buildings after that ? I scrapped this idea and saved this code as a fun example for the API mode.
[media]http://www.youtube.com/watch?v=P3GSaEJgUIw[/media]
Update n°5: Prettier buildings
[media]http://www.youtube.com/watch?v=MV_GOv9nIM0[/media]
Update n°6: Almost there with the city generation
[media]http://www.youtube.com/watch?v=t22AOA-Zg4Y[/media]
Spoiler
If you are a madman, you can check out the latest of the latest version here:http://wyvern67.free...citybuilder.lua
It's updated in real time and that's what I use to transfer my code from my computer to the game quickly.