Project Sword: A beginning “dotted” with hope

 Originally titled “Project You’re a Nation”.

Download: Landscape prototype -231 kb

So, as you can see, I’ve begun work on a new project.  Affectionately referred to as “Project Sword”, pending a real name.   Currently, it’s just a graphical display of a procedurally generated height map.

That's a million dots of pure awesome.

I have included a download (see above); I will be making more posts and maybe youtube videos in the future.  I’m not sure how long I will include an executable of my current progress as I would like for the completed project to be commercial.  Perhaps I will just provide limited features in a demo version.

Instructions:
Currently the project is pretty simple.  All there is to do at the moment is to explore the generated map. Movement is WASD and directional keys. Q and Z controls elevation.  N for new map.

Geek stuff:
As linked above, I use a “diamond square” algorithm in which the generated area height is averaged then randomly modified within a range, then again, and so on.  It’s currently fractal, or self similar on smaller scales.  However, this will change in the future.  I have a lot of processes I want to run to refine my current output into something more usable.  After all these procedures are ran I will then find a map I like (or keep it open, I’m not sure) then use this map to seed a similar, though implicit,  algorithm.  Which will finally be rendered into the game world.  While I like the idea of a infinite game world like Minecraft’s and it certainly wouldn’t be difficult to pull off, I have specific reasons why I want to use a finite map.  An infinite map uses a purely implicit algorithm.  This means that only a nearby area can be used to figure out what your current area will be like.  You could generate a continent at a time or something like that but it would get really weird.  With an explicit algorithm you can determine, for example, your current area should be a desert because the rain is carried in from the west and there are large mountains 500 miles in that direction blocking any storm clouds from getting to you.  Typically in an infinite world you would only generate everything a chunk at a time, with some very simple larger areas being generated.  In Minecraft, these are called biomes.  But as far as I can tell there is really no strict rules on any sort of placement.  I’m not really sure how big the game world will be yet, I think it’s going to hinge on river creation. As I believe this to be the smallest aspect that will need to be explicitly generated.  A map of ideal size, would require the distance between each point to be approximately 300 yards/meters (the current height is exaggerated).  The problem with this is that if I wanted to designate a a river to be at a certain point, I would need a pretty clever algorithm to determine where, in that distance, it is actually located.  Now the obvious solution would be to increase the density of the points by increasing the number of points.  However, I’m being mindful of memory and generation time. Currently there are 1025×1025 points (yes, I know, weird size, due to the generation algorithm it’s easiest with 2^n+1) this means slightly more than 1 meg per byte pixel. Currently the height map is stored in an unsigned short, 2 bytes. This means 2 megs to have this in RAM. That might not seem like much but every time I halve the distance between the points I double the RAM necessary and it will likely require at least another 2 bytes for the rest of the information needed, dryness, material, vegetation, temperature modifier, river etc.  The whole game should probably take around 1GB of RAM and I wouldn’t really want this aspect to hold more than about 5% of the total RAM (about 50 megs).  The second part is with every algorithm I run the data through, the time increases, and exponentially so with increased points.  If this increases up to more than a few minutes it would make it unreasonable to allow the user to generate a new map, and would also require the user to download the 50megs along with the rest of the data. I may increase the density some more still but it’s not necessary to make the decision yet, so we’ll see.

Todo: (next)
-Refine algorithms
-Probably add some triangle strips and textures and basic lighting to help visualize.
-???
-PROFIT!

Advertisements