Map generator - how does it work?

General discussion and socializing.

Re: Map generator - how does it work?

Postby Mqrius » Tue Sep 21, 2010 8:47 pm

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
This would be true in every other language, but in python it's actually:
Code: Select all
import mapgen
mapgen.setlaketype(mapgen.PENIS)
for sg in sgs:
  mapgen.gen(sg)

Python ftw.
User avatar
Mqrius
 
Posts: 367
Joined: Sun Aug 29, 2010 8:58 pm

Re: Map generator - how does it work?

Postby Jotun » Tue Sep 21, 2010 10:16 pm

Pure mothafuckin' magic.
User avatar
Jotun
 
Posts: 233
Joined: Thu Aug 05, 2010 7:26 pm
Location: Dah Wastelands

Re: Map generator - how does it work?

Postby Jackard » Tue Sep 21, 2010 11:20 pm

mspaint
“A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.”
User avatar
Jackard
 
Posts: 8849
Joined: Sun Jul 12, 2009 6:07 am
Location: fucking curios how do they work

Re: Map generator - how does it work?

Postby JustasJ » Wed Sep 22, 2010 10:43 am

loftar wrote: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. :)


Do you mean that your generator makes the same result if not tweaked every time before it's use?

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


I am more familiar with Ruby than with Python, but I'll try to copy the algorithms you use. That's some nice trigonometry there, by the way ;)

I was always interested in how to make natural-looking landscapes with a computer. Thanks for getting me one step closer to how to.
Throughout the centuries there were men who took first steps, down new roads, armed with nothing but their own vision.
- Ayn Rand
User avatar
JustasJ
 
Posts: 205
Joined: Wed Feb 03, 2010 1:48 pm

Re: Map generator - how does it work?

Postby DatOneGuy » Wed Sep 22, 2010 2:20 pm

I think Amit Patel had some interesting stuff on making realistic terrain since he did it for RotMG(Realm of the Mad God). :P
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .Hi. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
User avatar
DatOneGuy
 
Posts: 5553
Joined: Sun Apr 18, 2010 7:50 am
Location: I'm in Miami, trick.

Re: Map generator - how does it work?

Postby Xelen » Thu Oct 07, 2010 4:28 am

Just out of random curiosity. What are you using for your rendering of the scenes, if you don't mind me asking while we're talking about programming. I'm sure it's been asked before, but I never dug deep enough to find it, I suppose.

LWJGL or JOGL, perhaps? Something else even?

As for the map generator, Python? Ewwww... Jk, jk :P
Xelen
 
Posts: 3
Joined: Sat May 29, 2010 7:17 am

Re: Map generator - how does it work?

Postby Mqrius » Thu Oct 07, 2010 11:51 am

Xelen wrote:As for the map generator, Python? Ewwww...
Python ftw man! Or are you just afraid of executable pseudocode?
User avatar
Mqrius
 
Posts: 367
Joined: Sun Aug 29, 2010 8:58 pm

Re: Map generator - how does it work?

Postby Xelen » Thu Oct 07, 2010 7:16 pm

^ Haha, I don't have a problem with Python, really. I was just kidding :) It's just that I am so used to C-styled/family syntax, that I just cringe inside for a few seconds when I see Python, as I haven't really worked with it very much. Though, it does what it does well and is a nice language. I just hate looking at it, initially, because of the lack of braces gets to me for those first few moments, so I couldn't help but tease ;)

If I had ever made a cross platform capable game like H&H, I might have even considered using Python as the main language. Maybe. Anyhow, later on when I drop back from C#/XNA back to C++, I am quite probably going to end up using Python as my scripting language for my programs/games.
Xelen
 
Posts: 3
Joined: Sat May 29, 2010 7:17 am

Re: Map generator - how does it work?

Postby Mqrius » Thu Oct 07, 2010 7:30 pm

It's too bad python is too slow for big projects. In some cases, C is 400 times as fast as python. Of course, this difference can be reduced a bit by using psyco (JIT compiler-ish, just import it and it makes your program faster) and numpy (numeric and mathematical array calculations module), but it's nearly always slower :(

Awesome for scripts, non-time-dependent things, and small programs though :)
User avatar
Mqrius
 
Posts: 367
Joined: Sun Aug 29, 2010 8:58 pm

Previous

Return to The Inn of Brodgar

Who is online

Users browsing this forum: Claude [Bot] and 2 guests