generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Terrain Generation

Previous Thread :: Next Thread 
Fluffmiceter is not online. Fluffmiceter
Joined: 28 Jan 2012
Total Posts: 6931
03 Nov 2013 06:45 AM
What function should I use for my terrain generator? I'm currently using y = z - x .


v = 0
space = 0
t = 0
function terrain(height,depth,fragment,change)
for i = 1, fragment^2 do
depth = depth + 1
v = v + 1
t = t + 1
x = game.Workspace.Baseplate.Size.X / fragment
y = 1
z = game.Workspace.Baseplate.Size.Z / fragment
if v == fragment + 1 then
space = space + 10
v = 1
depth = -t/100 + 1
wait()
end
game.Workspace.Baseplate.CanCollide = true
game.Workspace.Baseplate.Transparency = 0.4
game.Workspace.Baseplate.BrickColor = BrickColor.new("Bright blue")
plate = game.Workspace.Baseplate:Clone()
plate.Transparency = 0
plate.Parent = game.Workspace
if depth > change then
plate.BrickColor = BrickColor.new("Bright green")
elseif depth < change then
plate.BrickColor = BrickColor.new("Bright yellow")
end
plate.Name = "part"
plate.Size = Vector3.new(x, y, z)
Py = game.Workspace.Baseplate.Position.Y + depth
Px = game.Workspace.Baseplate.Position.X - (game.Workspace.Baseplate.Size.X/2 - x/2 - (v * x - x))
Pz = game.Workspace.Baseplate.Position.Z - (game.Workspace.Baseplate.Size.Z/2 - x/2 - space)
plate.CFrame = CFrame.new(Px, Py, Pz)
end
end

terrain(100,0,100,20)
Report Abuse
Fluffmiceter is not online. Fluffmiceter
Joined: 28 Jan 2012
Total Posts: 6931
03 Nov 2013 06:46 AM
The result looks like this:
http://www.roblox.com/Scaled-Terrain-Generation-place?id=132523390
Report Abuse
As8D is not online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
03 Nov 2013 06:52 AM
Hm...

I'd expect some random terrain instead of just a tilted plate made of 5x5 or whatever the size was-parts.

So yerh, come again with something amazing ):

- As, that means you need 65k x 65k grid n' streamin' parts n' physic effektz^2.
Report Abuse
TheColorMan is not online. TheColorMan
Joined: 30 Jan 2010
Total Posts: 11228
03 Nov 2013 08:24 AM
One thing that makes terrain generation look really fancy is using trig functions!

So you can make a nested for loop for the X and Z axis and make the height equal to sin(z) + cos(x) or something like that.

You might need to multiply stuff around so the trig functions are bigger or smaller though.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image