GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2010-01-12 01:02:38

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Fractal like Terrain generator

Download TerrainGen.gmk


from the topic

http://gmc.yoyogames.com/index.php?s=&s … &p=3381308


I implemented 2 methods for generating coast lines, 2d mountains and 3d terrain following <somewhat> the method explained here

http://www.gameprogrammer.com/fractal.html

I lost interest in it but if you dont mind taking a look at it and discuss better methods...

They all (the scripts) depend on the initial data... the 3d terrain has initial random data to make the terrain.

F1 for info!!!

3d, wasd + arrows to move.

Offline

#2 2010-01-12 22:08:19

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Fractal like Terrain generator

Hey neat! I haven't really looker very far into it yet but I did notice something I didn't understand. Your cross product function takes three vectors as arguments. It looks like the first vector is subtracted from the the other two and then the last two are crossed. What is the purpose of the first vector?

If Colossal Cave has taught me anything, it's that this is the standard form for cross product.
[tex]\\ A_x = B_y C_z - B_z C_y \\ A_y = B_z C_x - B_x C_z \\ A_z = B_x C_y - B_y C_x[/tex]

Is the first vector a mutual origin for the two other vectors, vectors which aren't being passed in standard form?

Tiny bug: When you go to the "next" room after the last, the demo starts over, but d3d mode is still running so the screen is inverted in relation to the mouse. Makes clicking a bit trickier the second time through.


Abusing forum power since 1986.

Offline

#3 2010-01-13 00:38:26

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Re: Fractal like Terrain generator

I don't know I got the cross product from the gmc. I always used it as is.

It's for calculating the plane vector, from 3 point... aka the facing direction of a facet.  Maybe that is why I always have the negate the results when used for vns... Odd, no one ever noticed. I know tepi and yourself have glipsed at it a few times from all the times I posted it for people wanting to calculate vns...

...

I know, weird bug hey!!??

I do a game restart instead of a room go first because I was too lazy to reset the projection to ortho and I found this bug. It's truely another GM bug.

...

The 3d terrain is not really doing what I expected though, though staying withing the confines of the original shapes, I expected it to generate height that would merge more with the neighbours. Instead there is a drift and there is too little difference/littel generation.  I dont calculate the inbetween points properly...

..
I updated to have lighted facets (F1)

Last edited by icuurd12b42 (2010-01-13 01:35:01)

Offline

#4 2010-01-13 15:36:34

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: Fractal like Terrain generator

It's for calculating the plane vector, from 3 point... aka the facing direction of a facet.

O! Thy explainest, forsooth, 'tis the very answer. Shouldst had I only thought, like less an ass I look.

Sorry, I've been reading Two Gentelmen of Lebowski.

Feeding that function three relative points in space would return the surface normal of the plane they define. Makes perfect sense, I'm sure its form was immediately obvious to Yourself and Tepi.

As for the bug, and after actually looking at what you've done, it does look like a GM problem. I doubt it will be fixed in GM, but it's easy enough to handle by one's self. The problem should certainly be documented.


Abusing forum power since 1986.

Offline

Board footer

Powered by FluxBB