Buildings

During the last few days, I have been working on the buildings logic. I decided the best approach for it would be to define a building as a set of structures that belong together. Buildings can later have an owner (or multiple ones) and can be expanded with small "modules" like extra rooms or small workshops. But that's for the future.

Right now, Buildings are created using patterns. A pattern is nothing more than a small text file within a specific folder and with readable characters written on it. These characters (X for wall, . for floor, O for door) are simply converted to structures within the game and combined into a building. It's really that simple, which means adding more variation in building layouts will be really, really easy.

2 Options

The building section isn't done though, and I have to work it up some more so I can continue on my way to world generation. Remember that I want to simulate villages growing during world generation? I also need the generator to build buildings. But how can I control the way villages are laid out? I definitely want a main building in the center of a village, but how to continue from there?

Radius development

One way is to make a check each time a new building is built, so it is within a certain range from another (but not too close) inside the same village. I imagine this system to create a more pseudo-circular layout. However, rotation of the patterns is not yet planned and would be a pain in the a** in later development and for usability purpose.

Land lots

Another way would be to divide the village into parcels or land lots. Each lot may contain exactly one building. This way, villages have a more linear and planned look. It would simplify creation of a road network and might give some opportunities to simplify path finding. By extending parcels with special types, such as farming lot, workshop lot, domestic lot, I could give a larger village the possibility to have districts and thus to control the amount of building types. Wouldn't it be awesome to see a technologically advanced city look different in layout than a primitive family settlement? This would be a nice goal for the development package "Stone after Stone" for sure!

I guess when it comes to really make a complex city planning system, I need to do lots and lots of research.

Update from 17.02.2015:


Finally did it! Going with the first option, a main building is created in the center of the village when the village is created. After that, adding a new building needs only as much as calling BuildingPlanner.addBuildingInVillage and a new building is placed. I even can keep variable distance between Buildings. I guess during the big Building update I will define different building types and define different padding between buildings, like 6 tiles Padding for the main Building(which is the most probable to be expand with modules), 4 tiles for workshops or big houses, only 1 tile for huts. The list is really getting big, so I will have to restrain myself a bit there.

Leave a Reply

Your email address will not be published. Required fields are marked *