11/05/2012

Classifying & Labeling!

As I mentioned in the last post, much of what is going on right now is adding more information and context to the maps. With this information I can label the different entities on the map. I just started doing that, and although there are some challenges to overcome still, it looks like it can work satisfactory. I've taken continents, oceans, lakes, and islands so far, and given them "names". (It's all dummy-data so far, but that's beside the point at this stage). Finding the location to put the labels is not necessarily as trivial as one would expect though. Finding the "middle" of any kind of shape is not difficult in itself, but most algorithms are very time-consuming when working on such large amounts of cells. So I ended up scaling the algorithm itself, offering higher precision for smaller entities, and lower precision for the larger ones (like large oceans).

Challenges include labels that overlap each other. For instance, cities might be located on small islands, and then the label for the city name will crash with the label for the island name. These are things I'm going solve going forward. Also, all the labels are pretty plain and horizontal at the moment. When I start to label rivers for instance, the label could/should curve, and be angled adjacent to the river angle. Again, things that will be solved eventually.

Labels and identification of map entities might seem like a small thing when looking at the map below. But for the underlying system it's huge, and opens all kinds of doors. So, yay!

Islands & Lakes!


10/15/2012

Pixel details, and a first version of smarter Cities.


Pixel details


Up until now, land has been land, and water has been water. To create more believable maps, with further customization possibilities, that sadly does not suffice. The filters that are being applied need more details about the geography to make smart decisions. I've added a few "Scanning" filters that basically tags each pixel in the map with additional information. Now each pixel knows the following:

  • What is my altitude? Am I above or below sealevel?
  • Am I in a river?
  • Am I on land, but next to a river? (A riverbank)
  • Am I along a coastline?
  • Am I in a lake?
  • Am I in an ocean?
I plan to add more information at later stages, - as this is fundamental to tailoring content.

Smarter Cities


Previously, when I generated city names, I had no way of making sure that the city names were fitting for their location. Now I can make sure that City 1 should be along the coast. Since I know this, the city name generator can now delegate its work to the specialized coastal-city name generator. No longer will the super-secret city of the pirates "Skullport" be located way up in the mountains :)


Refactoring, cleaning code, and battling high memory usage!

A little history...

This project started as nothing more than testing some noise-generation algorithms. In fact, even the Visual Studio project was called "TestProject". From there on as new ideas manifested, code began to take form. But my mental image of the code was still that it was just something that I wanted to try out, because it could be cool. So alot of code sprang forth as proof of concepts, with many try & fail iterations on most features. After a while, things settled and I started building further on what I had. The problem was that I never really took the time to clean everything up, refactor, and improve. I'm a huge fan of clean code, and  at some point I tried to reduce cyclic complexities and statements per method. However, about halfway through the code I  realized that when dealing with such computation-heavy code, cleaning up the code created a huge performance overhead. In most everyday projects it's still worth it, but not here. Performance is a key success factor, and it's still too slow for my liking. But alas, further performance optimization has been put on the backburner.

Anyway, without focusing on "clean code" specifically, I've refactored and beautified the code significantly over some time now. The next problem was trying to cope with huge memory usage. It has never been a goal in itself to use as little memory as possible, but I felt at some point the usage was ... Well, a little extreme. I've taken steps to reduce memory usage somewhat, replacing huge array copies with pointers and unsafe code where it seems reasonable. Memory usage is down, but it still chews through quite a bit.

All in all, today I am happier. Not completely content, but happier.

9/03/2012

Deciding how to distribute the software.

I've spent a few hours contemplating on whether a first version of the software should be distributed through thick desktop clients, or on the web. I concluded that there was no obvious winner, and that there are several pros and cons to both alternatives.


  • Desktop client
    • Pros
      1. Functionality available everywhere.
      2. Rapid production of maps, - dedicated cpu and no waiting on others.
      3. Less personal bandwidth usage.
    • Cons
      1. Personally I'm less experienced in creating desktop clients (Especially UI).
      2. Software is bound to be updated rapidly in its first incarnations. Extra work to implement auto-update functionality.
      3. Not platform-independent.
      4. Software is cpu and memoryintensive. Old hardware might have trouble handling the requirements.
  • Website
    • Pros
      1. Pretty experienced with technology.
      2. Platform-independent.
      3. Very easy deployment. Updated website is immediately available for everyone.
      4. Software runs on a server with enough juice to run the software.
      5. Easier to detect errors in the software.
      6. Better general overview of the userbase (How many maps are created daily, for instance).
      7. Can easily apply trending to the software usage, to analyze where future effort should be focused.
      8. A community around the software can be embedded into the website seamlessly.
    • Cons
      1. Possibly longer map-generation time, if many users generate concurrently.
      2. More bandwith usage, as end-users have to download mapfiles.
      3. You have to be online to use it!
      4. I'll have to pay for hosting :)

In the end I decided that to start with, I'll be going with the website. Further down the road, I also want a feature-rich desktop client where you can turn and tweak all possible settings though. But the website alternative offers me the most at early stages. At least that's my opinion. (Yes, you're entitled to your own!)


8/23/2012

Out of hibernation

So, this blog has been in hibernation for quite some time. So has work on the project, unfortunately. It came to a point where it took a little too much of my time, and some parts of it was quite frustrating. Other excuses include a few addictive games, moving the family to a new house, and a new job.

But, to the point. It's out of hibernation. I've decided that what I have now has potential, and already it might be worth something to someone. So I've shifted my focus slightly. I've started creating a web page so that everyone can try out what's already there, and pitch in their ideas for future stuff. I'm convinced that this will fuel motivation to keep going.

I've also been tidying up some of the map generation code. Parts of it was a bit messy, due to the pure nature of "try and fail" with different algorithms and functionality.

Can anyone recommend a web host that supports ASP.NET MVC 4, and has no shortage of CPU power and RAM? Creating these huge maps is a pretty taxing process ;-)

I promise to stay in touch while creating the website, and of course I'll inform everyone the very minute it's up and running!

Cheers.


4/10/2012

A multi-flavoured mountain kingdom of dwarves

Name generation is underway, and it's time to show off some of the results so far. In addition to generating city names, I'm also dabbling into fantasy "languages". The languages are so far very basic, and not all words roll naturally off the tongue. As with everything, it's a work in progress.

The images shown below depict a region of a mountain kingdom. I asked in an earlier post what would constitute good city locations. These images are not generated with the default city placement rules, - but rather it's a test to weigh inland high-altitude higher. (Dwarves, anyone!?).

Kingdom with Language 1

Kingdom with Language 2

Kingdom with Language 3

Kingdom with Language 4

4/05/2012

Easter update!

So, it's easter!

I have been rather busy at work lately, so progress has been rather slow. This update comes from my tablet, in a cabin far from the city. Technology is amazing. Anyway, what's going on in these fictional worlds? City placement has seen significant improvement. They now appear in locations that seem very reasonable. I am also looking into city name generation, as well as road connections between the cities. Once the name generation framework is complete, rivers, coastlines, forests and mountains will start getting names as well.

Once that is done, I want to track down some better textures for mountains and deserts, as well as some better city icons. Perhaps some of you readers want to contribute with something here? Would be appciated.

And once THAT is done, I am going to start preparing for an alpha release! Excited? Yes, me too.


But for the next days I will be busy relaxing and eating well!