Posted: Fri Jun 29, 2007 10:56 am Post subject:
Auto Terrain Map Generator
Subject description: All info, suggestions and questions / answers here in regards to auto-map generation
Okay, I have finally come to a point where I have a demo of the basic terrain generation functionality, such that it is portable. This 'test release' does not represent the final product (not nearly), and it is just to demonstrate to the community our progress. Please be aware that the supplied source is uncommented and is only supplied at this moment in time so you can check for yourself that it does not contain any malicious code.
BASIC GOALS (demonstrated in test demo):
1.) Be able to create and save a bitmap via no API
2.) Be able to generate a good base terrain heightmap via no API
3.) To be done using portable code
GOALS IN NEAR FUTURE ITERATIONS:
1.) Be able to purposely create canyons for strategic purposes
2.) To generate roads for units to move (flatten terrain at points for base development and unit movement)
3.) Performance enhancement (create terrain faster)
4.) Mix in some other methods / algorithms to get different behaviors / feels
Why is it slow?
It uses the fault algorithm and is computing a 2048x2048 bitmap. Although good for creating terrain, it is quite slow in comparision to say, fractal methods. However to me, it generally produces quite a good mix of terrain patterns.
What did you use to create it?
LCC (WIN32) - C
It keeps generating the same heightmap, why?
Pseudorandom numbers, I will add a seed later.
Please note: I havn't 'refactored' my code - so there may be unnecessary break statements, weird prototypes etc.
UPLOADED new version:
Fixed some grammatical errors: 8-bit (256 colour), 1024x1024 bmp outputted for test 1
Edit: I didn't download it, but it warned me before I could.
You must a really good virus detection software, for it to detect virus patterns within files without even having the files present or downloading them. I am not aware of having an virus - have TMIS all updated.
Anyway, here is the source code without the executable:
Uh, how come the output is so ugly?
It doesn't look like real terrain, and it would never work as game terrain (No flat parts).
I really think you could get better results with fractals... _________________
GOALS IN NEAR FUTURE ITERATIONS:
1.) Be able to purposely create canyons for strategic purposes
2.) To generate roads for units to move (flatten terrain at points for base development and unit movement)
3.) Performance enhancement (create terrain faster)
4.) Mix in some other methods / algorithms to get different behaviors / feels
Uh, how come the output is so ugly?
It doesn't look like real terrain, and it would never work as game terrain (No flat parts).
I really think you could get better results with fractals...
lol, as long as the heightmap looks like cloud / smoke the algorithm is working.
The next release will include the use of several algorithms (including fractal) for different types of terrain and will probably flatten 50-70% of the map anyway.
This just serves as a base heightmap - something to start out with. QUICK_EDIT
Are you even plannning for little/big endian compatibility? (that endianness test) You seem to take it really serious . _________________ Time will tell...
Sooner or later...
Time will tell... QUICK_EDIT
Just some snapshots of the progress. Custom Flattening Algorithm. Before and After.
nice, what's the calc time atm ? _________________ Micro TS
Portable, no campaign, movies or music, just the engine and needed resources for skirmish and lan. QUICK_EDIT
Instead of forcing it to write to a 2048 x 2048 surface (no matter the heighmap res selected) - I programmed it to suit the heightmap res. This made making a 1024 x 1024 heightmap take a quarter the time, and a 512 x 512 a sixteenth the time it use to.
So currently (for a 3300+ AMD) the times taken are:
512 x 512 -> 10 - 25 secs
1024 x 1024 -> 40secs - 1min
2048 x 2028 -> 3 - 4min
Also, I am working on some shortcuts to help it speed up more. QUICK_EDIT
Currently working on getting canyons / cliffs working - this is the progress so far. I decided to implement them since they have always played a large role in strategy games. Finally, I believe, I am able to generate adequate heightmaps for gameplay.
canyon_small.PNG
Description:
Canyon / cliff algorithm implemented to restrict access to locations on the map and to form "bottlenecks".
Currently working on getting canyons / cliffs working - this is the progress so far. I decided to implement them since they have always played a large role in strategy games. Finally, I believe, I am able to generate adequate heightmaps for gameplay.
looking very nice, you probably won't have to go beyond 1000x1000 btw _________________ Micro TS
Portable, no campaign, movies or music, just the engine and needed resources for skirmish and lan. QUICK_EDIT
Joined: 08 Jul 2006 Location: in your closet... Post = true
Posted: Mon Jul 16, 2007 6:50 pm Post subject:
Wow - I already cant wait to get my hands on the leveleditor. What a pity Ill have to wait for it _________________ audiopulse sagt:
your raging arse is creating storms?
Luke | CCHyper sagt:
yup, neptune size! QUICK_EDIT
Ok guys, just need to inform you want is going on.
You won't see any test releases in the near future (next couple of weeks) for the terrain generator because I am trying to complete some of the major functionality focused at helping "maintain" the map-gen. Basically, trying to allow the user to alter the terrain gen process to suit their needs.
2 major features are being worked on atm:
STAMPS FEATURE:
Allows the user to include a range of bitmaps ('stamps') to include in the making of the map. So a user could have bitmaps of craters, the mars head etc. and include them in his / her heightmap. Allows the user to either extrude or press the terrain with the stamp according to the pixels' byte values, and allows the user to toggle how many times it should use a stamp and its displacement per use (relative to the max height of the terrain being created).
SCRIPT FEATURE:
Map-Gen is going to include an interpreter to parse basic script. This script will allow users to write (and share across platform) plugins. It will include the ability to declare temp variables, basic math functions, function declaration, iteration and recursion (so people can implement their own fractal algorithms for example). Going to take a lot of time, but will make users have nearly total control over the terrain gen process by overriding and altering the order of the terrain-gen process. QUICK_EDIT
The scripting language sounds excellent. If you can pull this off for map gen, could you do something similar for AI scripting? I think it would be much better than WW type AI scripts (which just have a goto and no conditionals). _________________ Time will tell...
Sooner or later...
Time will tell... QUICK_EDIT
This pictures look like the program DeathRay2K come with.
Anyways, is will be kickass to got a Auto Terrain Map Generator.
So would DeathRay2k dissing my work be, *pause*, hypocritical?
Oh, sorry, did you get mixed up with OpenSun?
Has Deathray2K produced a terrain generator? Because if he did and it is open-source I don't mind trying to integrate both projects. I just didn't appreciate his "negative" comments if he produced a terrain generator that outputted the same result - otherwise I don't mind.
After some thought, it occured to me that you may of been referring to OpenSun (where Deathray2k and I tried to reproduce tiberian sun a while ago) - I wrote a pre-mature terrain generator for that, which sort of outputted the same looking heightmaps (but used VB.NET instead of C).
Heh, actually I wrote that before I started work on a terrain generator. After I wrote it, I realised that I really had no idea how much work went into one, and so I decided to find out.
I really didn't mean any offence to your program with that comment, I was just feeling rather blunt that day.
If you want, you can download what I released, or just see the screenshots here.
Right now its really slowed down by my fake gaussian blur. _________________
You can use the lcc compiler to compile OTSMapGen V1.0B for win32 (just google "lcc compiler download")
I have also attached some sample output. Note that it runs much faster then the first iteration test release. Also since it is all written using standard C libraries (all from first principles so to speak...) it is easily portable for use on any platform.
A GUI can be easily constructed - for example if you are using VB the "shell" command can be used to call otsmapgen with specific parameters and you can just pipe/divert the output to a textbox or your own parser for update status.
Some more pictures of sample output of the BETA version:
Note that the BETA version has the 'stamps' feature available (as discussed), however the 'script' feature was excluded. The script feature is partially complete, however, it became apparent that it was a pretty useless feature (for only terrain generation purposes) given the amount of work that is required to produce it - and due to the parsing process, how slow it would have been to process moderatly complex terrain. Most people would prefer to code it up themselves I would assume.
Anyway I have included a link to the unfinished script feature source code:
The major problem with the current heightmaps, is that they are bland. They have a good "overall" behaviour - but if applied to a large map it will be boring. The objective now is to pay attention to finer detail - make the edges of slopes look interesting and less smooth, and maybe try to apply algorithms to certain parts of a map instead of applying it to the whole map. However the program itself is around 70% complete - just needs some tweaks to get it looking right and some acceptance testing / evaluation, but all the major features have been implemented.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum