Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Vederant · Nov 08, 2014 at 08:23 PM · randomoptimizationminecraftcubes

Some questions about random world generation

Hi!

I want to make randomly generated world entirely made of cubes(minecraft-ish). And I have a few questions: 1.Giveing every block a random coordinate is really great but it doesn't look uniform (I can't make smooth hills and things like that). Every block is just there without any "interaction" with others.![alt text][1]

So I came up with creation of chunks (32x32 for example) based on random height and a mathematical function. ![alt text][2] But it won't let me build more complex forms that will go across few chunks. And I still don't know how to handle transition between chunks. If someone could help with that it would be great.

  1. My script really slows down when it makes bigger chunks. Some tips for optimization? I have a script that disables rendering of cubes if they are not in the bounding box of main camera (second picture) but this seems to slow down even more.

Thanks for your time. Any help highly appreciated. Greg [1]: /storage/temp/34861-randomness.png [2]: /storage/temp/34862-less+random.png

randomness.png (44.1 kB)
less random.png (42.8 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by gribbly · Nov 08, 2014 at 09:02 PM

Take a look at Mathf.PerlinNoise. It's designed for this kind of thing. See also this thread.

A common approach to things like this:

  1. Generate your terrain based on a heightmap - i.e., a greyscale bitmap image where a black pixel is your lowest terrain value, and a white pixel is your highest terrain value. 50% grey is 50% height, etc.

  2. Now instead of generating your terrain directly, generate heightmap images. This will make it much easier to experiment with various 2D noise functions and get interesting/smooth features, etc.

You could do a similar thing without using a heightmap image, but having the image is nice because you can generate offline, use known images, etc. It also gives you a nice way to save your terrains.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Vederant · Nov 09, 2014 at 04:35 PM 0
Share

Thank you good sir. I'll try to learn this technique. Any tips for optimization?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Serious Drawcall Issues 1 Answer

Random Terrain Generation (Trees, Details, Textures) by passing a Seed? 0 Answers

Minecraft strater package in JS 0 Answers

Is minecraft made of cubes? 4 Answers

Random Terrain Generation 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges