generating random maps

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
anthropomorph
Engineer
Engineer
Posts: 9
Joined: 12 May 2005 21:34

generating random maps

Post by anthropomorph »

I couldn't find any threads about this, but it's definitely my biggest TT pet peeve, especially now that the developers have done such a wonderful job implementing bigmaps: the larger the map is, the less the the map looks like a real map. What I mean by that is that they don't look like they've been formed by geographical events; they look like they've been generated by a computer program that is trying to achieve a roughly even distribution of land and water, or highland and lowland. I would love it if the options consisted of you could choose between having a patagonia, or continents, or archipelegos (as in civilization 3), as well as mountainousness and the amount of lakes and seas. I find that when I'm playing on bigmaps, I just get lost in the sameness of the land; it would be nice to have recognisable coastlines, mountain ranges, bays, and penninsulas that give shape to the land-masses. Right now you can tell right away whether a map is a scenario or a random game, because of the shapes of the land. A good map-generator would generate landforms that look like scenarios.

I know that there's a planned rewrite of the way that map data is stored or something, and so these changes I'm suggesting would probably best wait until after such rewrites have taken place. This is definitely a change I'd like to see, though. Anyway, just my two cents.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

This would mean a rewrite of the landscape generation algorithm. Maprewrite or no maprewrite, the underlying algorithm fundamentals will be the same. So if you would like to code it, you don't have to wait for the maprewrite :)
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1795
Joined: 30 Mar 2005 09:43

Post by peter1138 »

Hmm, depends if a rewrite would allow things like cliffs and different water levels...
User avatar
jvassie
Tycoon
Tycoon
Posts: 3421
Joined: 18 Dec 2002 18:00
Location: High Wycombe, England
Contact:

Post by jvassie »

Thos features would be absolutely awesome, you'd have to build around them instead of bulldozing your way through.

James
(British) Modular Stations Set - Thread: | Website:
Swiss Set - Thread: | Website:
Route Map Creator
My Screenshot Thread
anthropomorph
Engineer
Engineer
Posts: 9
Joined: 12 May 2005 21:34

Post by anthropomorph »

Darkvater wrote:This would mean a rewrite of the landscape generation algorithm. Maprewrite or no maprewrite, the underlying algorithm fundamentals will be the same. So if you would like to code it, you don't have to wait for the maprewrite :)
Thanks, I'll get right on that... :wink:

I've actually done some map-generation scripts for Flash projects, but I've got very little experience coding anything in C. Still, I'll have a look and see what I can do...
Asterix
Engineer
Engineer
Posts: 121
Joined: 04 Apr 2005 18:17
Location: Germany

Post by Asterix »

If you need help programming try asking on IRC (#openttd on freenode), most of the time you will find someone who could help you... :)

and if you provide the general logics for a new generation system, maybe someone else is willing to do the programming, too
Kong Basse
Traffic Manager
Traffic Manager
Posts: 130
Joined: 08 May 2005 08:45
Location: Bergen, Scandinavia

Post by Kong Basse »

I'd like to see oceans on the big maps, so that aircrafts and ships would become more necessary.
User avatar
Bob Smith
Engineer
Engineer
Posts: 111
Joined: 17 May 2005 23:25

Post by Bob Smith »

I agree, I was thinking the other day I would like to see more varied landscapes. If I choose "hilly", for example, everything is hilly, there isn't flat land, with hills here and there, which would be more realisitic.

Water too, is either everywhere or nowhere, the odd lake, more smaller ones, maybe one or two bigs ones, would be nice. Maybe it would be simplest if we could have say an adjustable percentage of the land at one setting, and the rest at another. 50% flat, 50% hilly would be very nice. The same for water.
anthropomorph
Engineer
Engineer
Posts: 9
Joined: 12 May 2005 21:34

Post by anthropomorph »

I had free time in the last couple days to mock-up the sort of map generation tool I'd like to see.

This is a java-based app (Linux/Mac/Windows included) for generating maps using Perlin Noise. Use the sliders to adjust things like complexity, erosion, water level, etc. My goal for the time-being is to make the sliders more intuitive, make the landscapes more realistic, and to make this compatible with the png import patch. Currently, you can press 'Enter' to capture a png (automatically saved in the app directory), but it may not import correctly.

I don't think it's worthwhile to try to integrate these functions in OpenTTD until the map rewrite is done, but if there's interest, I'll continue developing this as a standalone app.
Attachments
perland.png
perland.png (49.9 KiB) Viewed 5311 times
perland.zip
(525.36 KiB) Downloaded 205 times
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

anthropomorph wrote:This is a java-based app (Linux/Mac/Windows included) for generating maps using Perlin Noise.
If I was incharge that would never get in because it's java LOL :lol: (stupid, bug-prone, slow-as-hell, time-waster among others thing...)

But luckly for you I'm not! Still it would never get it because it's java and not C... :roll:

EDIT: just remembered that the AI will most likely be able to get stuff written in java... Yet I hope I won't ave to use it cause java is SLOOOOWWWWWW...
Uncle Dex Says: Follow the KISS Principle!
anthropomorph
Engineer
Engineer
Posts: 9
Joined: 12 May 2005 21:34

Post by anthropomorph »

Dextro wrote:
anthropomorph wrote:This is a java-based app (Linux/Mac/Windows included) for generating maps using Perlin Noise.
If I was incharge that would never get in because it's java LOL :lol: (stupid, bug-prone, slow-as-hell, time-waster among others thing...)

But luckly for you I'm not! Still it would never get it because it's java and not C... :roll:

EDIT: just remembered that the AI will most likely be able to get stuff written in java... Yet I hope I won't ave to use it cause java is SLOOOOWWWWWW...
Yeah, I agree fully, but I'm not a C programmer (or a programmer of any sort, really). I'm just developing this as a concept for how a random map generator should work (hence the fact that it's under suggestions, not development). If anyone wants to try coding this in C, I'm sure they could do a much better job than me!
User avatar
Graphite
Engineer
Engineer
Posts: 84
Joined: 17 Nov 2005 20:56
Location: Netherlands
Contact:

Post by Graphite »

Dextro wrote:If I was incharge that would never get in because it's java LOL :lol: (stupid, bug-prone, slow-as-hell, time-waster among others thing...)
Do a google search for Jake II sometime. It's a java-version of Quake 2. It's just like all the other languages. In capable hands, it can be a very useful tool, just like all the other programming languages.
A computer scientist is someone who, when told to "Go to Hell," sees the "go to," rather than the destination, as harmful.
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Post by Korenn »

Dextro wrote:
anthropomorph wrote:This is a java-based app (Linux/Mac/Windows included) for generating maps using Perlin Noise.
If I was incharge that would never get in because it's java LOL :lol: (stupid, bug-prone, slow-as-hell, time-waster among others thing...)

But luckly for you I'm not! Still it would never get it because it's java and not C... :roll:

EDIT: just remembered that the AI will most likely be able to get stuff written in java... Yet I hope I won't ave to use it cause java is SLOOOOWWWWWW...
that's absolute nonsense. Java is way less bug-prone than C because of it's inherent exception handling, and compiled Java code is actually faster than C, it's the JVM that kills performance. It sure isn't stupid or time-wasting, or else 50% of all new business research in software wouldn't be done in Java.

Please, don't spew nonsense like that as if it's fact.

I do agree that Java is totally not suited to ttd. it's simply the wrong tool.
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

Oh come on let me hate java like many hate windows :lol:
Uncle Dex Says: Follow the KISS Principle!
User avatar
LordOfThePigs
Route Supervisor
Route Supervisor
Posts: 435
Joined: 01 Jul 2004 10:28
Location: Jura/Switzerland

Post by LordOfThePigs »

Yet another java VS c argument...

/me sides with Java (I hate buffer overflows :) )
Sometimes I'm told "Brilliant"...
Sometimes I'm told "Charming"...
And Often I'm told "Shut Up"!
egladil
OpenTTD Developer
OpenTTD Developer
Posts: 188
Joined: 07 Nov 2005 17:10
Location: Sweden

Post by egladil »

Java is a very good tool for prototyping. However, the things that make it so good for prototyping is also what limits it functionality in some other cases, like when you need function pointers or other obscure c constructs.
What makes C so good is that it allows the programmer to do anything he wants. The problem is, it also allows him to do things he doesn't want or even thought of.
Archonix
Chief Executive
Chief Executive
Posts: 733
Joined: 01 May 2003 17:29
Location: Manchester, UK
Contact:

Post by Archonix »

PHP all the way baby!

Seriously, there's a PHP-OGL library out there now. Mad or what?

Anyway... I seem to recall that this has been requested before but never acted on. Shame really, because it's a really cool idea. And, as far as I know from a very cursory read of the code, etc, it doesn't actually need to wait for the map array re-write. Once that comes along I assume it would be a fairly simple task to tweak it for the new map array. Why not write it up as a patch?
Brignell’s law of consensus: At times of high scientific controversy, the consensus is always wrong.
anthropomorph
Engineer
Engineer
Posts: 9
Joined: 12 May 2005 21:34

Post by anthropomorph »

Archonix wrote:PHP all the way baby!

Seriously, there's a PHP-OGL library out there now. Mad or what?

Anyway... I seem to recall that this has been requested before but never acted on. Shame really, because it's a really cool idea. And, as far as I know from a very cursory read of the code, etc, it doesn't actually need to wait for the map array re-write. Once that comes along I assume it would be a fairly simple task to tweak it for the new map array. Why not write it up as a patch?
I'd love it if someone made a patch for this. Again, I think the best approach to creating good random maps is using the Perlin Noise method. The method basically uses layers (or octaves) of waves to allow for infinite layers of complexity. Basically, you can modify the frequency (scale) of the original noise (I recommend having scale linked to the map size, so that settings that tend to produce a single continent at 256 will produce a similar continent at 2048, but with more complexity), persistance, the number of octaves. I also put in a sea-level adjuster and a simple multiplier to make mountainous terrain easier to generate.

This page has a great tutorial on it:
http://freespace.virgin.net/hugo.elias/ ... perlin.htm

I got about three-quarters of the way through generating my own code for it, before I realized the environment I was developing on (the Processing API for Java--processing.org) has perlin noise features built in.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

I don't see what C has to do with keeping people from shooting themselves in the foot. C will happily load the gun, offer you a drink to steady your nerves, and help you aim. -- Peter da Silva

Yes, Java is so bulletproofed that to a C programmer it feels like being in a straightjacket, but it's a really comfy and warm straightjacket, and the world would be a safer place if everyone was straightjacketed most of the time. -- Mark 'Kamikaze' Hughes
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

anthropomorph wrote:I had free time in the last couple days to mock-up the sort of map generation tool I'd like to see.

I don't think it's worthwhile to try to integrate these functions in OpenTTD until the map rewrite is done, but if there's interest, I'll continue developing this as a standalone app.
Thanks for the inspiration on this one. I went and researched, and the easiest algorithm to implement was a recursive subdivision method. Although its normally used for clouds, it produces OK terrain.

See the TerraGenesis thread for the patch, and the Integrated Nightly will have this once Ive got the rest of the patches working.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 3 guests