Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Bartosz · Sep 12, 2015 at 07:17 PM · algorithm

Detecting need of generating terrain (Minecraft-like) [Perlin Noise]

Hey! I've got a problem and only unsatisfactory solutions come to my mind. Ok, let me explain this.

I am using Perlin Noise to generate the terrain. I want to spawn the terrain blocks piece by piece (just like Minecraft does). I don't want to instantiate big terrain at once, because on each piece I will make calculations to make it more differential. How can I detect, if I need to generate particular part of terrain at given moment?

Imagine yourselfs the terrain divided into squares. How can I check if I need to instantiate each of squares?

Here's my not-exactly-solutions: a) Four variables (north, east, south, west) for keeping informations, how far player went in given direction and if it is less that current position (+ draw distance) I am spawning chunk. Defect of this method is, I can generate terrain only in four directions, I cannot detect anything between that (it looks like +).

b) Triggers on the terrain borders detecting player collider. When the trigger is fired, I am generating terrain part behind it. It is hard to explain with my english skills... Defect is, each square part of the terrain can be generated by touching four surrounding borders, so it might generate terrain even four times.

Have you got any sugestions or ideas?

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
0

Answer by Cherno · Sep 13, 2015 at 12:01 AM

Your first suggestion is the right way. I see no reason why your terrain generation should be limited to a cross shape. All you need is some simple code that tells you which chunks are to be generated and which are to be destroyed depending on the player's new chunk position.

X = existing chunks P = Player walking northward N = new chunks D = destroyed chunks

 XXX
 XXX
 XXX
 
 NNN
 XPX
 XXX
 DDD
 
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 Bartosz · Sep 21, 2015 at 04:09 PM 0
Share

Corrent me, if I am wrong.

So I have to keep all the instantiated chunks in the two-dimensional array (or any other container) of game objects. When the player will reach the Draw Distance, I must Destroy chunks behind him and Instantiate chunks in front of him.

I am not sure if searching the array is good and fast solution. I may be wrong of course.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity 3.5: What is the definition of PLE algorithm? 1 Answer

Check for closed circuit of pickups 2 Answers

Beat detection algorithm 4 Answers

Two camera rendering an object differents textures 2 Answers

How to make a Maze with multiple paths and no dead ends? 0 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