Computer Science Canada Random Map Generator |
Author: | Raknarg [ Thu Jan 02, 2014 8:35 pm ] | ||
Post subject: | Random Map Generator | ||
I decided this deserved a new post on its own. It results in the same thing as my previous program, however now it performs the task iterively rather than recursively. On small depths, there's no noticeable difference. At depth 9, the new version is about a second faster or so. At depth 10, it is twice as fast. With the new version it finds each point mathematically without having to generate a new array each time and do a lot of value swapping within the array. As before, uses pygame. Also as before, neat results. Does anyone have ideas on making a map witha custom size? I could make a huge map and basically crop it, but that seems unnecessary.
|
Author: | smool [ Sat Jan 04, 2014 10:43 am ] |
Post subject: | RE:Random Map Generator |
Very nice. I can imagine all the math and logic was annoying to debug |
Author: | Insectoid [ Sat Jan 04, 2014 11:49 am ] |
Post subject: | RE:Random Map Generator |
I've been meaning to implement diamond-square myself for a while, but as usual I never get around to it. Closest I've come so far is a 2d fractal mountain silhouette. |
Author: | Raknarg [ Sat Jan 04, 2014 8:41 pm ] |
Post subject: | RE:Random Map Generator |
@Instectoid I've been trying to figure out how to do this for a long time, the other night I just pulled out a piece of paper and figured it out by a fluke. Do you mean midpoint displacement? @smool yeah it was a bit annoying cause there were some exceptions and such I had to handle that I didn't know about, but the majority of the math kindof just came to me all at once |
Author: | Insectoid [ Sat Jan 04, 2014 9:15 pm ] |
Post subject: | RE:Random Map Generator |
http://en.wikipedia.org/wiki/Diamond-square_algorithm "It is a slightly better algorithm than the three-dimensional implementation of the midpoint displacement algorithm" I saw your functions named diamond and square and assumed, given that this is a map/terrain generator, that this is an implementation of this algorithm. I can't be bothered to go through your code to find out how similar it is, but even coming up with diamond and square function names in this context is an impressive coincidence. |
Author: | Raknarg [ Sat Jan 04, 2014 9:27 pm ] |
Post subject: | RE:Random Map Generator |
No it is the diamond square algorithm, but you mentioned "2d fractal mountain silhouette" so I assumed you meant a midpoint displacement rendering of a mountain |
Author: | Insectoid [ Sat Jan 04, 2014 10:54 pm ] |
Post subject: | RE:Random Map Generator |
Oh, yeah, I did one of those. Midpoint displacement. Yeah. I keep meaning to add more procedural stuff to it to create a complete scene, but I'm far too lazy to actually finish it. |