Villages Concept and stuff

Perdemot

Member
Contributor
Art
World
So at the moment there are Skaldarnar, Ten'son' and me working on this. (Hopefully I'm right with this one)
Any feedback is appreciated :)
Skaldarnar and Ten'son' will focus on the generation of a village. I will work on the AI in the meantime.

Generation:
(Part that needs to be written by the other two.


Building Generation
I am working on a procedural architecture generation approach similar to the one described in this paper. My aim is to develop a solid grammar based system for easy building generation. New building types could be added via new grammar files consisting the specific new grammar.

So, how does this corporate with the city generation? As mentioned by @Ten'son', the village or city will be divided into several parcels which have a functionality assigned. The proper building type is then determined by the functionality, the biome the city is located in and the overall style of the city (style could be something like modern, medieval, ancient rome/greek, ... and is defined only once for one city. However, its not necessary for the generation itself, only an esthetic thing).
The concrete building instance is then generated by choosing and applying the grammar rules width the additional information of the parcel size (length x width x height). The generated structure could be stored as a Blueprint in a Metablock or something to "rebuild" the building if the player comes back to the city.

With this approach the cities would differ in the final building instances for the same word seed (as the generation is a quite random process). Although, the generated cities would look very similar (as the same grammar is used).

Finally I would like to give a hint on how the grammars could look like:
A simple rule has the following structure
Code:
predecessor : condition ::- successor : probality;
where condition[\i] is a guard for the rule that has to evaluate to true in order for the rule to be applied, e.g. splitting a building into 4 floors makes only sense if the building height is greater than, let's say, 16, so the associated rule would look like
Code:
building : (height >= 16) ::- floor(height/4) floor(height/4) floor(height/4) floor(height/4)


AI:
The AI will be based on a POI(Point of Interest) System, which defines certain areas and buildings in a city as worth visiting for an NPC.
Let’s take a quick example of this: A fisher would go to the lake to fish. A normal citizen wouldn’t go there . So the POI is not in the POI-list of the villager.
Another one here: A guard would walk on the walls of the city, but normal villagers don’t go there.
This allows us to have a city full of life. Since some villagers will walk to places where others don’t . But there are also certain times where most of the villagers go to a place . Like meeting in a church every morning.
There will be also different ways for the villagers to go to some other place. They can run/hurry or just wander around and even get distracted and stop at some point.
The AI will react on the Players behavior too. If he kills villagers or destroys buildings the villagers will get hostile and attack the player.


AI in theory:
Oh well that sounded neat didn’t it? So here are some information what methods I’m planning to use.
The decision which point a NPC visits will be by chance for the beginning, later this will get a more fine tuning. The navigation from one point to another will be via a graph, in which all crossroads and buildings are added as nodes in the graph. The weight of the edges would be the block distance. Then we run a dijekstra over the graph to get the shortest way to our target.
A A* algorithm will then find the real way of the NPC to walk. So to say the dijekstra gives the NPC a certain direction and the A* the exact path.
This is the basic of NPC walking around in a village. Now let’s had over to the city development.
The speed of the development of the city is mainly based on the amount of visits by the player, if he visits the city often it would grow faster then a city he passed through once.

More information will come later.
 

Ten'son'

Member
Contributor
World
Generating a city :
- Choose emplacement, size (the city will be a circle at first but if big city, then multiple circles (like here))
- Generate parcels
- Generate streets
- Give every parcel a function
- Give life to the city by placing NPCs and calculating their ways
- Wait for the player to load a chunk that touches the city circle, then proceed to generate the buildings in the loaded chunks
- Spawn NPCs when player is close enough to see them

That's how I'll do that. Any other idea ?
 

Nym Traveel

Active Member
Contributor
Art
World
Perdemot I don't fully understand why you need dijkstra in the first place. You have a lower boundary for the value given by the air distance. So A* (which is nothing other than a evolved dijkstra) will give you the shortest path. Or did I miss something?

Ten'son' What will be interesting is the creation process of the city. Theoretically the whole city has to be created when the player first comes in sight of the city boarder (or if the far distance rendering, issue 319 https://github.com/MovingBlocks/Terasology/issues/319 is implemented even earlier) we need to know that this is in fact a city.
Sounds weired, I know: When a city spawns I imagined a city center chosen by worldgen and around this the city gets created in whatever manner. But then already visited areas will get transformed...
Also a possible issue: what happens if parts of the AI's territory get unloaded? What happens to this npc's (they may disappear if they're nameless background actors but can get a problem when they are important)

Ok, it's late night, enough thinking, you surely will care about all this :)
so long,
Nym
 

Ten'son'

Member
Contributor
World
Haha
If a part of the city is unloaded, it means that the player is very far from the city, so the NPCs has been unloaded from a while ! I mean, "physicaly" unloaded. 'Cause as Cervator is saying : the city and NPCs are still "living" but as abstracts objecs. ;)
 

Perdemot

Member
Contributor
Art
World
Nym Traveel I need it to decrease the time calculating. Since if there isn't anything in the way the NPC would just follow the path from node to node given by the dijekstra. If there is somethin in the way (a block on the roads or maybe even a group of NPCs/Players it would let the A* calculate a new path. The dijekstra basically doesn't give a s*** about if the road is occupied. But that's how the idea is now it's likely a first idea.
 

glasz

Active Member
Contributor
Art
You could have 2 kind of computation : a pathfinding one for when a npc is in sight, and another one to calculate where the NPC should be at whatever time of the day it is, so as to make it appear at this place.
 

Perdemot

Member
Contributor
Art
World
yeah something like this must be there I'm working now a bit through the internet to learn what a good AI needs
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
All world generation should be fully deterministic off of the world seed (ultimately). So you shouldn't actually need to create the whole city and store it, as you can just regenerate it and apply it to each chunk as needed. That's ignoring the desire to cache the generated city for performance though.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Nine companions. So be it. You shall be the fellowship of the World team!

lordofthering-1.jpg


Er, okay, so you're three to start with. You get to pick which one you are! About time we get the World team restarted some, has potential beyond procedural villages, of course. Nym Traveel - mkalb - dacresni (still around?) - glasz (if you're not too busy as it is!) - if any of you want the World badge too, let me know :D

I might be missing somebody, I'm terrible at that. Incidentally, while I hope to see great things out of all of you, if any of you is willing to step up above and beyond to take an official lead role for world generation / content population at some point then I think we could use one of those. Mainly looking for initiative and good collaboration skills, which I'm seeing plenty of already. Lead just takes some longer-term commitment to apply that continuously and encourage others along :)

Can't wait to see more stuff in this field! Village eggs ftw.
 

Ten'son'

Member
Contributor
World
Immortius I agree with you. But how I fully see it :
- Player starts Terasology, creates new world
- Terasology generate a huge 2d noise to represent the map
- Then find the best places on the map for the cities
- Choose emplacement, size (the city will be a circle at first but if big city, then multiple circles)
- Generate parcels
- Generate streets
- Give every parcel a function

STOP GENERATING CITY

Now the player is exploring his new world, then he is near of the circle of a city (I mean that the loaded chunks are near of the city). So :
- Give life to the city by placing NPCs and calculating their ways

STOP GENERATING CITY

Now we wait that the player loads a chunk that is part of the circle of the city. Then, we start placing the buildings (and generate their structure).
By being nearer, the player has fully generated the city and is near enough to see NPCs so we spawn them (but they were already living as abstract entities!)

If the player leaves the city, we delete the NPCs models but they still continue to live as abstract objects, as the buildings.
 

Skaldarnar

Development Lead
Contributor
Art
World
SpecOps
Ok, last but not least:

Incubator
Wiki

Building Generation
I am working on a procedural architecture generation approach similar to the one described in this paper. My aim is to develop a solid grammar based system for easy building generation. New building types could be added via new grammar files consisting the specific new grammar.

So, how does this corporate with the city generation? As mentioned by Ten'son', the village or city will be divided into several parcels which have a functionality assigned. The proper building type is then determined by the functionality, the biome the city is located in and the overall style of the city (style could be something like modern, medieval, ancient rome/greek, ... and is defined only once for one city. However, its not necessary for the generation itself, only an esthetic thing).
The concrete building instance is then generated by choosing and applying the grammar rules width the additional information of the parcel size (length x width x height). The generated structure could be stored as a Blueprint in a Metablock or something to "rebuild" the building if the player comes back to the city.

With this approach the cities would differ in the final building instances for the same word seed (as the generation is a quite random process). Although, the generated cities would look very similar (as the same grammar is used).

Finally I would like to give a hint on how the grammars could look like:
A simple rule has the following structure
Code:
predecessor : condition ::- successor : probality;
where condition is a guard for the rule that has to evaluate to true in order for the rule to be applied, e.g. splitting a building into 4 floors makes only sense if the building height is greater than, let's say, 16, so the associated rule would look like[/I]
Code:
 building : (height >= 16) ::- floor(height/4) floor(height/4) floor(height/4) floor(height/4)
So, that's the idea for procedural building generation. Every comment/idea/suggestion/critique is appreciated ;)
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Cool stuff :)

As for generating / re-generating a village vs world seed - how about using the "village egg" idea to assign/calculate a seed attached to a central block in the village (based on the world seed) then also keep a "time of creation" counter on the same object. Then you have a static seed specific to the village and something to simulate growth over time with.

... not sure that actually helps anything, I'm just trying to think of a nice way to encapsulate village info that's compatible with the village developing / growing / moving slightly over time within the world.
 

Perdemot

Member
Contributor
Art
World
I would agree to have all those things in the village egg.
Also Player visits over time etc.
 

glasz

Active Member
Contributor
Art
So, we need themes for the villages. One Biome = one Theme?
House will be made of blocks of course : how to make each theme specific? Can we have some kind of Biome specific blocks(and texture of course)? Otherwise : find ways to make specific architecture using geometry...and also : different building organisation for different themes (new york straight lines vs paris rays comin from the center)

Ideally a village could be like a plant : given enough ressources they will grow indefinitely (and eat all ressources around, and fight whoever steals their ressources).
 

Skaldarnar

Development Lead
Contributor
Art
World
SpecOps
Cervator: I already thought about using the place in the world, the time of city creation and the world seed in combination for generating a "random" choice for the grammar...

glasz: One thought of mine was to determine the style of a building by the used resources/blocks (e.g. usage of wood/planks or stone/bricks). I am not sure what you mean with:
Otherwise : find ways to make specific architecture using geometry
Can you explain it to me a little bit further, please? :)

The growing and growing and growing city is a nice idea, and if the resources are considered for the growth the might be border for the expansion (which is not bad). Maybe the player can drive the progress further by bringing resources to the city.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Another factor to keep in mind is who built the city. Different races would have different architecture and different preferences for where to build (resource availability) :)

Maybe late in the World Map stage you could have a civ placer process that would consider available races vs available land features then place racial cities appropriately.

But for now that's probably premature, make any city work then biome / block availability would be a first good way to diversify :coffee:
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Oh, now that I think of it, this might be a good time to link to an older thread about growth simulation featuring some impressive work by woodspeople in particular an organic plant simulator that works! And it does advanced stuff like base off available resources and what not :omg:

Admittedly, it does so outside of Terasology - but that's a minor obstacle with geeks around! :trollestia:

We'd love to see that code ported to Java and working inside Terasology. The visual look is less important this early so it doesn't matter if it creates 200 meter tall trees originally meant to be maybe 20 meters tall using smaller blocks. Just spawn them via acorns the player plants rather than hook them into the natural generator

And looking at it might yield some inspiration for how to "grow" villages as well :fluttersquee:
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps

Ten'son'

Member
Contributor
World
Okay, after reading all of this I think that the city won't be placed by the game, but placed by a biome : City Biome.
So we have a full flat space for our city generator without holes, trees, etc.
Then we can generate the city AND the fields ! We forgot them ! All cities are surrounded by fields.
Thus, when we will want to grow the city, the parcels will already exist.
 

Skaldarnar

Development Lead
Contributor
Art
World
SpecOps
Ok, but how is the city style picked? Should it be based on the surrounding biomes (but what if it is located between a desert and a jungle or something?)
I don't know much about the current biome generation, but is it possible to generate a biome (without the trees, but still a "normal" biome) and declare it as a city space? If its no city space, trees could be set and such...if so, a small village will be generated (if the player comes near).
 
Top