-
JustasJ
- Posts: 205
- Joined: Wed Feb 03, 2010 1:48 pm
Map generator - how does it work?
Is the code of map generator made public? How does it work? How does it's mechanics work?
Throughout the centuries there were men who took first steps, down new roads, armed with nothing but their own vision.
- Ayn Rand
- Ayn Rand
-
FritzPL
- Posts: 100
- Joined: Thu Aug 19, 2010 8:25 am
- Location: Teknillan
Re: Map generator - how does it work?
Maps are generated totally randomly I guess. But it may be also made by hand of loftar because we had only 3 worlds before,and each world there is one,new and big map.
-
JustasJ
- Posts: 205
- Joined: Wed Feb 03, 2010 1:48 pm
Re: Map generator - how does it work?
"Generated randomly" is not an answer. I'm interested in the algorithms they use.
Throughout the centuries there were men who took first steps, down new roads, armed with nothing but their own vision.
- Ayn Rand
- Ayn Rand
-
DatOneGuy
- Posts: 5553
- Joined: Sun Apr 18, 2010 7:50 am
- Location: I'm in Miami, trick.
Re: Map generator - how does it work?
iirc there's no such thing as truly 'random' in computers.
Don't think it's public, I'm also interested though.
Don't think it's public, I'm also interested though.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .Hi. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .Hi. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
spectacle
- Posts: 950
- Joined: Wed Nov 11, 2009 11:16 am
- Location: Planet
Re: Map generator - how does it work?
True, but the difference between true randomness and a well coded pseudorandom generator is purely academic, you'll never notice any difference in real-life applications.DatOneGuy wrote:iirc there's no such thing as truly 'random' in computers.
Once a man has changed the relationship between himself and his environment, he cannot return to the blissful ignorance he left. Motion, of necessity, involves a change in perspective.
-Commissioner Pravin Lal, "A Social History of Planet"
-Commissioner Pravin Lal, "A Social History of Planet"
-
brohammed
- Posts: 526
- Joined: Sun Jun 20, 2010 2:41 pm
Re: Map generator - how does it work?
Guys, I hacked the game code and found the terrain generator.
Code: Select all
10 {spawn [$coniferous_forest] "everywhere"}
20 {spawn [$deciduous_forest] "in blobs"}
30 {spawn [$heath,$grassland,$moor,$swamp,$marsh,$overgrown] "in smaller blobs"}
40 {spawn [$lakes] "in penis shapes"}
50 {spawn [$rivers] "connect rivers"}
60 Supergrid Complete
70 goto 10, repeat till all supergrids are done-
DigDog
- Posts: 711
- Joined: Mon Jul 19, 2010 1:52 am
- Location: Germany
Re: Map generator - how does it work?
I lol'd.brohammed wrote:Guys, I hacked the game code and found the terrain generator.
Code: Select all
10 {spawn [$coniferous_forest] "everywhere"} 20 {spawn [$deciduous_forest] "in blobs"} 30 {spawn [$heath,$grassland,$moor,$swamp,$marsh,$overgrown] "in smaller blobs"} 40 {spawn [$lakes] "in penis shapes"} 50 {spawn [$rivers] "connect rivers"} 60 Supergrid Complete 70 goto 10, repeat till all supergrids are done
burgingham wrote:You call that beer?
-
Lothaudus
- Posts: 641
- Joined: Fri Oct 23, 2009 12:32 pm
- Location: Adelaide, Australia
Re: Map generator - how does it work?
I lol'd too but I don't think loftar would defile himself by actually using "goto".
Then again, there was that divide by zero error with the beehives...
Then again, there was that divide by zero error with the beehives...
Barry Fletcher Norwin
Lawspeaker of Crossroads - Leader of Codexia - Keeper of the Cheese
http://www.rpgcodex.net
Lawspeaker of Crossroads - Leader of Codexia - Keeper of the Cheese
http://www.rpgcodex.net
-
PLEP
- Posts: 13
- Joined: Mon Aug 16, 2010 7:18 am
Re: Map generator - how does it work?
ROFLbrohammed wrote: 40 {spawn [$lakes] "in penis shapes"}
I thought I'm the only perverted one that noticed lakes looking like penises
-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Map generator - how does it work?
It would potentially be a bit boring to publicize the code, since it might potentially reveal some secrets that can currently only be found by exploring. I wouldn't mind doing it after it's been replaced with a new map generator, though. Except the potential exploration issues, the current map generator is nothing I feel particularly secretive (or proud) about. :)
I can tell you that it's written in Python, at least. I also wouldn't mind handing out the code that generates the "patch" shapes (it uses libgd for drawing), if that's what you're interested in.
By the way;
I can tell you that it's written in Python, at least. I also wouldn't mind handing out the code that generates the "patch" shapes (it uses libgd for drawing), if that's what you're interested in.
By the way;
While goto's reputation is understandably bad, the reaction against it is often exaggerated, too. The flow control in C is quite limited, and doesn't lend itself well to a lot of things, such as multi-level break or continue, or other non-local exits of structured blocks -- see the Linux kernel source for constant goto usage to emulate unwind-protection, for example.Lothaudus wrote:[...]I don't think loftar would defile himself by actually using "goto".
You do not have the required permissions to view the files attached to this post.
"Object-oriented design is the roman numerals of computing." -- Rob Pike