:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::
Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Tue Oct 23, 2018 12:51 am
All times are UTC + 0
 Forum index » Other Projects » Inactive Projects » Open Tiberian Sun
Auto Terrain Map Generator
Moderators: Judeau
Post new topic   Reply to topic Page 1 of 1 [26 Posts] View previous topic :: View next topic
Author Message
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: 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
Reply with quote

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:
------------------------------------------------------

An optimised version of 1.0B is available at http://www.ppmsite.com/forum/viewtopic.php?p=178193#178193
which runs ~50 times faster then the standard 1.0B (produces heightmap in seconds rather then minutes)



preview.PNG
 Description:
sample output - sized down and converted to png
 Filesize:  92.34 KB
 Viewed:  12254 Time(s)

preview.PNG



test release.rar
 Description:
source + executable, with descriptions fixed

Download
 Filename:  test release.rar
 Filesize:  15.46 KB
 Downloaded:  472 Time(s)


Last edited by Equiredox on Mon Aug 06, 2007 2:03 pm; edited 1 time in total

Back to top
View user's profile Send private message Skype Account
Pepzi
Plasma Trooper


Joined: 26 Nov 2004
Location: Sweden

PostPosted: Fri Jun 29, 2007 1:30 pm    Post subject: Reply with quote

Hey what's this!?

I received a trojan upon downloading this!

Edit: I didn't download it, but it warned me before I could.

Back to top
View user's profile Send private message
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Fri Jun 29, 2007 1:41 pm    Post subject: Reply with quote

Hey what's this!?

I received a trojan upon downloading this!

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:

------------------------------------------------------
EDIT:
------------------------------------------------------

An optimised version of 1.0B is available at http://www.ppmsite.com/forum/viewtopic.php?p=178193#178193
which runs ~50 times faster then the standard 1.0B (produces heightmap in seconds rather then minutes)



otsmapgen.c
 Description:

Download
 Filename:  otsmapgen.c
 Filesize:  8.43 KB
 Downloaded:  253 Time(s)


bmpStream.h
 Description:

Download
 Filename:  bmpStream.h
 Filesize:  4.37 KB
 Downloaded:  291 Time(s)


Last edited by Equiredox on Mon Aug 06, 2007 2:11 pm; edited 2 times in total

Back to top
View user's profile Send private message Skype Account
DeathRay2K
Commander


Joined: 01 Sep 2002
Location: Canada

PostPosted: Fri Jun 29, 2007 6:31 pm    Post subject: Reply with quote

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...
_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
DragonFly
Cyborg Soldier


Joined: 02 Jun 2007
Location: England

PostPosted: Fri Jun 29, 2007 8:28 pm    Post subject: Reply with quote

Quote:

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

Back to top
View user's profile Send private message Skype Account
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Fri Jun 29, 2007 10:15 pm    Post subject: Reply with quote

DeathRay2K wrote:
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.

Back to top
View user's profile Send private message Skype Account
DeathRay2K
Commander


Joined: 01 Sep 2002
Location: Canada

PostPosted: Sat Jun 30, 2007 4:25 am    Post subject: Reply with quote

Alrighty. Smile
_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Kiith-Sa
Rocket Cyborg


Joined: 26 Oct 2004

PostPosted: Tue Jul 03, 2007 6:36 pm    Post subject: Reply with quote

Are you even plannning for little/big endian compatibility? (that endianness test) You seem to take it really serious #Tongue.
_________________
Time will tell...
Sooner or later...
Time will tell...

Back to top
View user's profile Send private message
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Fri Jul 13, 2007 1:17 pm    Post subject: Reply with quote

Just some snapshots of the progress. Custom Flattening Algorithm. Before and After.


yes_flat.PNG
 Description:
After
 Filesize:  77.82 KB
 Viewed:  11995 Time(s)

yes_flat.PNG



no_flat.png
 Description:
Before
 Filesize:  92.34 KB
 Viewed:  11996 Time(s)

no_flat.png



Back to top
View user's profile Send private message Skype Account
Judeau
Commander


Joined: 28 Feb 2004

PostPosted: Fri Jul 13, 2007 1:33 pm    Post subject: Reply with quote

Equiredox wrote:
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.

Back to top
View user's profile Send private message Send e-mail Skype Account
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Fri Jul 13, 2007 11:51 pm    Post subject: Reply with quote

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.

Back to top
View user's profile Send private message Skype Account
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Mon Jul 16, 2007 7:47 am    Post subject: Reply with quote

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".
 Filesize:  100.01 KB
 Viewed:  11926 Time(s)

canyon_small.PNG



Back to top
View user's profile Send private message Skype Account
Judeau
Commander


Joined: 28 Feb 2004

PostPosted: Mon Jul 16, 2007 7:53 am    Post subject: Reply with quote

Equiredox wrote:
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.

Back to top
View user's profile Send private message Send e-mail Skype Account
Audiopulse
Railgun Soldier


Joined: 08 Jul 2006
Location: in your closet... Post = true

PostPosted: Mon Jul 16, 2007 6:50 pm    Post subject: Reply with quote

Wow - I already cant wait to get my hands on the leveleditor. What a pity Ill have to wait for it #Tongue Smile
_________________
audiopulse sagt:
your raging arse is creating storms?
Luke | CCHyper sagt:
yup, neptune size!

Back to top
View user's profile Send private message
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Wed Jul 18, 2007 3:54 am    Post subject: Reply with quote

Judeau wrote:

looking very nice, you probably won't have to go beyond 1000x1000 btw


Cool - I will take note of that. Sorry I haven't been on msn - been sort of too busy this week to have any decent conversations.

Back to top
View user's profile Send private message Skype Account
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Fri Jul 20, 2007 2:53 am    Post subject: Reply with quote

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.

Back to top
View user's profile Send private message Skype Account
Anderwin
General


Joined: 16 May 2005

PostPosted: Fri Jul 20, 2007 10:18 am    Post subject: Reply with quote

This pictures look like the program DeathRay2K come with.

Anyways, is will be kickass to got a Auto Terrain Map Generator.
_________________
Please, read the signature rules of the forum.

Back to top
View user's profile Send private message Visit poster's website Skype Account
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Fri Jul 20, 2007 10:31 am    Post subject: Reply with quote

Anderwin wrote:
This pictures look like the program DeathRay2K come with.

Anyways, is will be kickass to got a Auto Terrain Map Generator.


Confused So would DeathRay2k dissing my work be, *pause*, hypocritical?

Back to top
View user's profile Send private message Skype Account
Kiith-Sa
Rocket Cyborg


Joined: 26 Oct 2004

PostPosted: Fri Jul 20, 2007 5:17 pm    Post subject: Reply with quote

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...

Back to top
View user's profile Send private message
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Sat Jul 21, 2007 12:27 am    Post subject: Reply with quote

Equiredox wrote:
Anderwin wrote:
This pictures look like the program DeathRay2K come with.

Anyways, is will be kickass to got a Auto Terrain Map Generator.


Confused 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).

see http://www.ppmsite.com/forum/viewtopic.php?t=9780

Back to top
View user's profile Send private message Skype Account
DeathRay2K
Commander


Joined: 01 Sep 2002
Location: Canada

PostPosted: Mon Jul 30, 2007 2:44 am    Post subject: Reply with quote

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. Smile
I really didn't mean any offence to your program with that comment, I was just feeling rather blunt that day. Wink
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.
_________________

Back to top
View user's profile Send private message Visit poster's website Skype Account
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Wed Aug 01, 2007 3:27 pm    Post subject: Reply with quote

Okay OTSMapGen is now in BETA

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.

------------------------------------------------------
EDIT:
------------------------------------------------------

An optimised version of 1.0B is available at http://www.ppmsite.com/forum/viewtopic.php?p=178193#178193
which runs ~50 times faster then the standard 1.0B (produces heightmap in seconds rather then minutes)



flat_smooth.PNG
 Description:
otsmapgen.exe flat_smooth.bmp 2 -f 0.1 0.01 500 -b 0.8 100 -s 70 50
 Filesize:  113.18 KB
 Viewed:  11621 Time(s)

flat_smooth.PNG



rough.PNG
 Description:
otsmapgen.exe rough.bmp 2 -f 0.1 0.01 500 -s 30 20
 Filesize:  139.23 KB
 Viewed:  11621 Time(s)

rough.PNG



bmpstream.h
 Description:
source file 2 of 2

Download
 Filename:  bmpstream.h
 Filesize:  12.8 KB
 Downloaded:  218 Time(s)


otsmapgen.c
 Description:
source file 1 of 2

Download
 Filename:  otsmapgen.c
 Filesize:  35.79 KB
 Downloaded:  226 Time(s)


otsmapgen_v1beta.rar
 Description:
OTSMapGen 1.0 Beta
Includes source files / sample output / test scripts / readme etc.

Download
 Filename:  otsmapgen_v1beta.rar
 Filesize:  1.13 MB
 Downloaded:  402 Time(s)


Last edited by Equiredox on Mon Aug 06, 2007 2:00 pm; edited 5 times in total

Back to top
View user's profile Send private message Skype Account
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Thu Aug 02, 2007 1:28 am    Post subject: Reply with quote

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:


custom_stamps_2.PNG
 Description:
otsmapgen.exe custom_stamps.bmp 2 -f 0.1 0.01 200 -s 10 10 -a testCraterUseScript.txt -s 5 5
 Filesize:  129.7 KB
 Viewed:  11615 Time(s)

custom_stamps_2.PNG



canyon_rough2.PNG
 Description:
otsmapgen.exe canyon_rough2.bmp 2 -f 0.1 0.01 500 -s 20 20 -c 8 10 5 1.0 -s 20 20
 Filesize:  121.61 KB
 Viewed:  11615 Time(s)

canyon_rough2.PNG



canyon_rough.PNG
 Description:
otsmapgen.exe canyon_rough.bmp 2 -f 0.1 0.01 500 -s 20 20 -c 8 10 5 1.0 -s 20 20
 Filesize:  127.43 KB
 Viewed:  11615 Time(s)

canyon_rough.PNG



canyon_smooth.PNG
 Description:
otsmapgen.exe canyon_smooth.bmp 2 -f 0.1 0.01 500 -s 40 40 -c 10 20 5 2 -s 20 20
 Filesize:  141.25 KB
 Viewed:  11615 Time(s)

canyon_smooth.PNG



interpreter.h
 Description:
unfinished interpreter code

Download
 Filename:  interpreter.h
 Filesize:  30.16 KB
 Downloaded:  281 Time(s)


Back to top
View user's profile Send private message Skype Account
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Thu Aug 02, 2007 1:05 pm    Post subject: Reply with quote

Heres how the canyon heightmaps look in 3D, but as you can tell, some more work needs to be done - but we are getting there.


canyon_smooth_3D.png
 Description:
 Filesize:  330.16 KB
 Viewed:  11558 Time(s)

canyon_smooth_3D.png



canyon_rough2_3D.png
 Description:
 Filesize:  187.69 KB
 Viewed:  11558 Time(s)

canyon_rough2_3D.png



Back to top
View user's profile Send private message Skype Account
Audiopulse
Railgun Soldier


Joined: 08 Jul 2006
Location: in your closet... Post = true

PostPosted: Thu Aug 02, 2007 7:55 pm    Post subject: Reply with quote

Looks promising, really...
_________________
audiopulse sagt:
your raging arse is creating storms?
Luke | CCHyper sagt:
yup, neptune size!

Back to top
View user's profile Send private message
Equiredox
Rocket Infantry


Joined: 29 Jun 2005

PostPosted: Fri Aug 03, 2007 12:32 am    Post subject: Reply with quote

Audiopulse wrote:
Looks promising, really...


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.

------------------------------------------------------
EDIT:
------------------------------------------------------

An optimised version of 1.0B is available at http://www.ppmsite.com/forum/viewtopic.php?p=178193#178193
which runs ~50 times faster then the standard 1.0B (produces heightmap in seconds rather then minutes)

Back to top
View user's profile Send private message Skype Account
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [26 Posts] View previous topic :: View next topic
 Forum index » Other Projects » Inactive Projects » Open Tiberian Sun
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
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


Powered by phpBB © phpBB Group

Wildcard SSL Certificates
[ Time: 0.2582s ][ Queries: 26 (0.0105s) ][ Debug on ]