Sunday 3 February 2008

Mapping The World



My petty rulers now require petty states, more than just names, to rule. With a computer to hand, and with a background in programming, the obvious route was to write a program to create the map, so I have written a terrain editor. The image shows a simple, random map created by my program. Graphics are crude at the moment: its all 'programmer art' which is notoriously ugly, but the basic functionally is all there, and the symbols used can be improved any time I feel particularly artistic. For fun, I'm hoping to add the option of an 'antique' mode where the map is drawn in sepia colours just like an 18th Century map.


There are currently two ways to create a map. There's a random number generator that will create a terrain map from scratch using a few basic parameters - whether or not you want a coast, and how hilly or wet you want things, etc.. Alternatively, you can manually set down each hill or mountain or wood whereever you want. And, perhaps most practically if you choose to create a large map, you can create it randomly and then modify it by hand. You can zoom in and out, and the map can contain a large number of hexes without the program slowing down significantly. The map can be printed or saved as a bitmap file. The map (and all associated data) can also be saved in the program's own format. If there's any programmers out there: its saved in xml format: changing the extension on a file to .xml will enable it to be examined in Explorer or Firefox, so it would be possible for anyone to import it into their own program if they can code.


In my career as a tools programmer one golden rule is that the more functionality you provide in software, the more scope users see for expanding that functionality to cover ever more activities. Its like a builder putting up a wooden shed, and five years later coming back to add crenelations to the large country mansion that now occupies the spot. So I've written the terrain editor as one function within a framework that could happily contain much more - economics, recruitment, unit positions and movement etc - without any difficulty.. Thats the reason for its fancy title (Council Of War) - it may well end up managing every aspect of my imaginary campaign. Whether or when I get much further is, however, uncertain as there seems so much else to do these days.


I'll get the program tidied up (a job known to all programmers as 'the boring bit') and then add it to the files in the Old School Wargaming group - a process that should take a week or two. So anyone who wants to take a look at it can get a copy from there.

8 comments:

Bluebear Jeff said...

Andy,

Will your program run on a Linux machine? Or will it require Windows?

As for me, I'm no computer nerd . . . if it isn't super easy, it is too tough for me.

How simple will it be for someone like me to use?


-- Jeff

Andy Mitchell said...

It will be Windows only. I'm programming/testing on a Windows XP machine, but it should be able to run on any 32bit version of Windows. I'll not be able to test on Vista, but I'm not aware of any potential problems there.

Usability is a key quality factor for any tool, so it must be simple to use. Essentially you select 'edit map' from the top menu, select the terrain type you want, and click on the map where you want it. I'll zip the program up with help files providing context sensitive help, and write a post on the blog that will be a 'how to'.

Andy Mitchell said...

I think there are Windows emulators for Linux that could run my program on that platform. I can draw 2D graphics quickly enough without having to use hardware acceleration, so I don't need to use DirectX, so that won't be an issue.

WSTKS-FM Worldwide said...

Happy Sunday Andy,

Well, your current map looks pretty nice to me! Eager to see what else you might do with it over time, the names you cook up for your petty states, etc. Its almost as much fun watching someone else create a campaign as it is doing it oneself. Enjoy!

Best Regards,

Stokes

Snickering Corpses said...

As the fellow programmer, I'm curious as to language used. :) I seriously need to learn more about the graphic creation side. I've never had a need to learn how to draw graphics programatically before, but it'd be useful in some projects I have in mind.

Andy Mitchell said...

The language is C++, using MFC to give me the windows framework, using my own class libraries for everything else.

For graphics I use my own 3D renderer, although here I'm just using 2D elements of it. The renderer has two versions - DirectX (which I'm not using in this case) and Software.

My Software renderer uses a block of memory into which I draw everything I need using my own graphics API calls (which again is all C++). When all drawing is done, the block of memory is blitted to the screen by the one and only GDI call I use.

Steve-the-Wargamer said...

...nice program! I'll definitely be interested... you could then use it with the Online Population Generator program(http://welshpiper.com/lowfantasy) to fill your map with people... :o))

Andy Mitchell said...

I'll be working on towns next, all things are being considered for them atm.