View Full Version : Mapping with Pascal

11-25-2009, 05:33 PM
Or this can be titled "One World, One Random number sequence".

The world of Metaphaze II: Avalon began as a MapMaker map that grew and grew and grew, but wasn't able to generate the detail maps I needed for my world.

The first rendition of a programmed world came about through using Javascript and a 1/0 bitmap of the country maps. The JavaScript generated all the terrain, the rivers and regions. It worked very well for each country, but failed in blending the edges of each country into the adjacent ones. Moving to a world map, JavaScript just plain bogged down taking really long times to do basic things like loading the 1/0 bitmap. The first two attached maps show what this looked like.

So, along came Pascal, something I learned back in college and that I could find a cool compiler online. So, recoding all my routines into Pascal, I generated an entire world's rivers, counties, districts, regions in a fraction of the time it takes JavaScript to load.

The maps that come out are quite detailed... I've attached some samples for one of the countries. The last three attached maps show the green country map overlaid with the rivers generated, a county map and a district map.

One of the interesting facets of creating maps this way is you don't realize the detail that comes about when you show how every cell drains via its rivers. I added a sliding scale to eliminate some of these tributaries to clear up the map.

The second thing you realize is that when people create a rudimentary RPG world, it is highly generalized. My first run of my program creating rivers resulted in over 1 million river names. Likewise, with 75 countries, there were over 90,000 counties, almost 10,000 districts and 3,000 regions. The original 1/0 map was exploded from a 180x600 map where each cell was 25x25 kms to a map 1,800x6,000 containing 10 million cells, each 2.5x2.5 kms in size.

The goal of this project is to generate via code everything from the world, all the way down to the different details in each location....

-- Regions
--- Districts
---- Counties
----- Cities, towns, villages, castles, temples, churches, ruins, and dungeons.

When completed, the estimate is a web-site with more than 250,000 maps and more than 1 million pages.


11-25-2009, 07:18 PM
Good luck and more power to you.


11-25-2009, 07:59 PM
You have a good start on your project there. It will be fascinating to see how it progresses. Theres a few of us here who make procedural terrain and its great to see how other people tackle the problems of it.

Theres some sample name generators on here if you dig about tho they were in Python and Perl if I remember correctly. Never known anyone do Pascal - bit before my time I think ! But it can be a faster language than Java.

How are you planning to make it realistic in terms of modeling the world physics above the rivers and the names being random. Is there some phonetic stuff going on ? Theres lots to think about - such a big and ambitious project. Keep posting as you make progress.

11-25-2009, 09:20 PM
This is a highly complex project. It is hard to describe it entirely in a few paragraphs that people will tend to glaze over reading. It evolved from the concept that to "zoom" into a higher detailed map for any region you've created in your world map. Taking a world map and zooming to 75 countries, you've now got to create 75 more maps... If you then go to regional maps, in my world, that's another 3,000 maps... I'm tired already and all I've gotten done is the world map. I'm certainly not going to do the 95,000 county maps or the 3,000 city maps.

My gazette database has more than 35,000 world names. I have a prefix file with 199 entries and a suffix file with 319 entries that add items to the gazette entries to make other versions of these names. Just these three files can generate almost 2 million unique names. In addition, I have 10 translation modules that regionalize the names into other unique and quite interesting names. These are keyed to the country indexes and I can select which translator is used for which countries.

The current challenges I'm working on resolving now are:

1) What to generate for a region page (other than a map)...
2) What to generate for a district page (ditto)
3) What to generate for a county page (ditto)

For these pages, I'm considering a subtle map difference at each level to differentiate each level from the others. So, at the country and region level, the maps will be like those I posted above... as you zoom into the district and county levels, they take on a more parchment/drawn look to them. In all of these instances, I have to use my pascal program to generate the map graphics. In addition, I'll have to figure out what layers I want to be able to combine to create information zooms. (See #5 below)

4) What to generate for a city page... currently, I've been examining the Medieval Demographics document by Ross and found it only generated "jobs" for 7% of the cities population. I've now got a table of jobs and percentage allocations for 100% of the humanoids in the city. I've come up with conditionals for things like sailors who can be found in large numbers in a port city, but not so many in an inland city.

5) The main engine for the world is wikimedia, with openlayers and several other products that build functionality. The challenge is what to import into the wiki and what to link to as dynamic pages. Where each of these transitions and how it looks in the wiki are challenges as well. A good example is the heraldry javascript that is used in the wiki now. I can call the routine with any key and generate the heraldic device to be displayed on the page as well as what size to display it as.

See: http://www.metaphaze.com/AvalonWikia/index.php5?title=Blazon/Heraldry

6) Openlayers is a wonderful API for displaying maps on the web. You can use it natively in your own web pages or as I do in the wiki. It manages your layers and all of the zoom and navigation of the map. You do not have to code anything for these features. This allows you to concentrate on generating the map images. When combined with the wiki and semantic layers, you can display data from other pages in pop-up windows on your maps...

See: http://www.metaphaze.com/AvalonWikia/index.php5?title=AvalonMap

The displayed icons actually pull the data that is displayed on them from the associated page for that country.

In addition, the semantic layers allows queries to be built on pages so that you can do things like display regions on a country page, or districts on the region page... or anything you'd like to pull and display.

The unique mix of graphical maps with automated information retrieval creates a very interesting level of cartography that can be explored in different ways than static maps allow.

Steel General
11-26-2009, 06:25 AM
Interesting and ambitious project (and I thought PASCAL was dead), good luck and looking forward to see how things go.

11-26-2009, 08:04 AM
Cool. Yes very ambitious.

I would recommend having a look at our CWBP community world building project as well as the links in my sig tho.

The CWBP being a tile based world with maps from world to battlemap and being hosted via a wiki sounds similar.

This line:

The unique mix of graphical maps with automated information retrieval creates a very interesting level of cartography that can be explored in different ways than static maps allow.I agree with very much though, surprisingly, it has not been something that many people have bought into very strongly.