• Register

A roguelike game inspired by the literature of Jorge Borges, Umberto Eco & Neal Stephenson, and the games Europa Universalis and Dark Souls. URR aims to explore several philosophical and sociological issues that both arose during the sixteenth and seventeenth century (when the game is approximately set), and in the present day, whilst almost being a deep, complex and highly challenging roguelike. It explores questions of philosophical idealism, cryptography, linguistics and the writing and formation of the historical record, and will challenge players to hopefully think in ways and about themes that are rarely touched upon by games.

Post news Report RSS Cities, towns, and roads!

The early stages of adding civilizations to the URR world map.

Posted by on

I've been working on adding cities, roads and towns to the world map. They're generated in that order - each feudal civilization is given a capital city, and then everything goes from there. Cities start off as a small 2×2 structure. As time goes by, cities can expand in any direction, up to a maximum of a 5×5 size. A city reaching that full size is very rare - most cities don't end up being twenty-five tiles in size and generally end up between fifteen and twenty. I tried a lot of different character sets for depicting cities, but in general I ended up showing them in the way displayed below. In the future each tile will be a distinct district, such as "administrative", "market", "military", "medical" and so forth, but those aspects are still in the planning stages. The bigger the city, therefore, the more districts and the more services. Some district types might be particularly rare compared to others.

Meanwhile, once the cities have been placed on the map the game then adds a series of roads. I expected this to be quite simple, but as it turned out making a network of roads which wasn't too dense, wasn't too sparse, looked organic and found their own way around the map in an intelligent way was surprisingly tricky. Firstly, I didn't want diagonal roads. Roads had to move orthogonally - the logic behind this was simply that I couldn't find any ANSI/extended character that could accurately depict the shift from horizontal or vertical roads to diagonal ones. So, that meant that the pathfinding algorithm had to work only by moving in orthogonal directions. However, this was not without problem. For those who know how A* works, if you disable any diagonal directions it will still basically split the path into "diagonal" bits - even if those are just done by going up-left-up-left-up-left, rather than diagonally - and then long stretches of horizontal or vertical bits. What this meant was that any time roads were trying to path to a distant point, all the roads would line up (as we see below) and funnel themselves towards their target. Needless to say, this looks like crap.

User Posted Image

My initial solution was to try having the path sometimes divert from the optimal route. Say, each four "steps" there is a possibility for the path to divert one tile in a direction perpendicular to the route of travel. However, having tried this, it rapidly produced its own set of problems. What if the road decides to divert at a crucial point, and then cannot actually rejoin the initial route? Say, if it diverts on the tile before a coastline, and then cannot path back to where it needs to be, what would happen to that road? The solution to this would be to have the game check every time it wants to divert and make sure it can safely get back onto the right route, but then you'd just have roads which basically bounced up and down on a straight line, which - having tested it - also looked like crap. In the end the solution was pretty obvious, but I think reasonably elegant and simple. Once the world map is created, the game goes through the map and picks a certain selection of tiles - very few, and in a regular (though hard to spot if you don't know it) pattern - that prevents any horizontal or vertical line from continuing for more than nine tiles at the max. A trivial solution, and once it tried to pathfind on this new, hidden map - also excluding mountains and deserts, which will in the future have their own methods of travelling across - you get something like this. The routes are still fairly optimal, but look organic and realistic:

User Posted Image
User Posted Image
User Posted Image

Once the road system is added to the map, the game then starts to work on placing towns. Whilst roads are being placed the game makes a note of each road - once they're done, it then goes through each road in turn and measures how long it is. The longer it is, the more towns will be placed. In general each road will only have a single town, but roads above 50 or 60 tiles have a good shot of generating with two towns. This is obviously subject to change - I have on idea yet whether this will be too many towns, too few, or roughly enough. I should add towns and roads will not generate on the human scale for the next release; they will only be shown on the world map for now. However, if you check the development plan, 0.6 will see some of these areas actually starting to generate for you to walk around. As for mountains and deserts, the current intention is for "mountain passes" to generate which require navigation in a special way (still working on the specifics) whilst deserts have no roads or obvious means of travel. I currently plan for the player to be able to either navigate across them on their own - whilst taking the risk of running into a travelling nomadic civilization - or to make contact with a nomadic caravan who may take you safely across the desert. Again, this is for now squarely in the "future mechanics" category, but those are my initial thoughts. I'm also currently working on having the game add in other appropriate settlements (e.g. towns which aren't on main roads, mines atop resources, farms, etc) and connecting them intelligently to the main road system, and we'll have some more 0.5 world maps in a few weeks. Next time I'll talk about generating the names for cities for all types of civilizations (hunter-gatherer settlements, feudal cities and nomadic encampments have very different names) and for the various religions the game is generating.

Until next time you can keep up to date on my devblog, Facebook page, or Twitter feed. The devblog is updated weekly or fortnightly generally on Saturdays, Facebook a few times a week, and the Twitter roughly daily. Any thoughts, please leave them in the comments! Stay tuned...

Post comment Comments
B.R.V
B.R.V - - 96 comments

I think you can do it that way so first game kinda finds good spots for placing towns, based on landscape and biomes configuration, then similarry draw roads between them, bypassing mountains and lakes, taking it through the part of the forest that is less dense and so on...
This is lot complex, of course, and may affect the variety of town locations, but will be much consistent and real.
Also, are those T's towns? And what are those edgy things? Are they like bigger towns or are they hills?.. Wasnt paying much attention to recent updates so i may miss that one.

Reply Good karma Bad karma+3 votes
UltimaRatioRegum Author
UltimaRatioRegum - - 307 comments

That would be as you say be a lot more complex, but in some ways, I actually think it would be less realistic - towns do crop up in some strange places, and I think a varied gameplay experience where towns are spread out is much more important than absolute "realism". Also, assigning different values for pathfinding through forests/plains, for example, hugely ups the CPU load. Ts are indeed towns, the large structures are cities!

Reply Good karma+3 votes
stalnz
stalnz - - 6 comments

If you're using A* for roadbuilding than the obvious thing to make them more interesting is change the node cost depending on whether its plains/forest/hills etc. That would make the roads less optimal but probably more realistic and interesting. Does the actual game have different player movement cost?

Reply Good karma Bad karma+1 vote
UltimaRatioRegum Author
UltimaRatioRegum - - 307 comments

I considered this, but the A* implementation I use is part of a library - I just use the inputs/outputs, and to be frank, I wasn't sure how to go about weighting them, and I wasn't even sure I wanted to for fear of roads always swerving to avoid certain situations/locations. It doesn't have differential movement costs on the world map, but it will in the future.

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: