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 d-ostapa · Jun 26, 2016 at 06:03 AM · c#2dterrainterrain generation

Random 2D Terrain Generating

Hi. I am fairly new to unity and I have only created about 2 games. I would want my next project to be a game where you "Mine" the ground and there are randomly generated dirt stone and for example iron being generated as you "Mine" down lower. I am sure I am able to get the mining bit by myself. The only thing I need help with is making the terrain generate randomly as the player "Mines" deeper and the camera to follow the player. If I posted this in the wrong place sorry. Any help is appreciated.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by jdean300 · Jun 26, 2016 at 06:21 AM

Might be able to look into perlin/simplex noise generation. 2D Perlin/simplex noise generates a 2d grid of values, usually between -1 and 1, that rise and fall smoothly. Here is an example of it's output:

alt text

You could then use that and the vertical depth to assign different ore types to the terrain. For example, the blue in the picture represents values close to -1 - you could say any point in the game world with a depth greater than 40, with a noise value from -1 to -.8 is iron.

I haven't tried using perlin/simplex noise generation like this before, but it seems like it may work.

https://github.com/deanljohnson/EnviroGen This is a link to a generator I created to give me that image. It's far from finished and is a big project, but all the code is there. Note this is not done in Unity, but the code to actually generate the noise values is not specific to anything.


perlinexample.png (345.3 kB)
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 d-ostapa · Jun 26, 2016 at 05:56 PM 0
Share

Do you know anyway I could input it into unity?

avatar image
0

Answer by Nick4 · Jun 26, 2016 at 01:11 PM

What you're exactly looking for is here, the tutorial series Unity itself offers for procedural cave generation.

Comment
Add comment · Show 2 · 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 d-ostapa · Jun 26, 2016 at 05:57 PM 0
Share

I am not looking for a Cave to be generated. I am looking for just random dirt, stone, and some select ores to be generated as you go down.

avatar image Nick4 d-ostapa · Jun 26, 2016 at 09:36 PM 0
Share

That'll still give you the idea.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

SetAlphaMaps Opacity Gradient 0 Answers

Procedural 2D Tilemap Terrain - Mesh or Unity Tilemaps? 0 Answers

Multiple Cars not working 1 Answer

[C#] Wondering what is amiss with my 1D Perlin Noise Terrain Generator? 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