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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
1
Question by Entrio · Dec 15, 2013 at 02:29 PM · proceduralminecraftmesh-deformation

Advice on lavaflow (minecraft like)

alt text

Hey people, I am currently working on minecraft like game. (Before you go sigh, not another one, been done before etc.) I am doing this just for my personal learning and wanting to get a hang of unity. I am a seasoned programmer, have been making games in XNA until recently when the support for it totally collapsed. So I decided to try Unity.

TL;DR I have procedural generated chunks that consist of a mesh, I am able to modify this mesh on the fly by "digging" and placing blocks. The mesh recalculates and adjust accordingly. Everything fine and dandy...

Now my question is I want to implement liquids into this. I half understand the concept of needing every X number of ticks (be they seconds / frames) I need to expand the flow in a specified direction. I can do that no problem as seen in the screenshot (green blocks are slime). I know how to propagate them, the only question I have is how to implement the said "ticks" i have tried several things but they all just instantly create the creep. I want the fluid to creep only each "tick".

How would I go about doing that? Throw me a bone.

PS: The creep is done in a co-routine.

Any help or advice would be much appreciated!

Thanks in advance

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
1
Best Answer

Answer by Bunny83 · Dec 15, 2013 at 02:56 PM

There are many ways to do something like that. How YOU implement it is of course up to you and your requirements :)

Minecraft has quite a few different type of ticks. In the case of water / lava they use scheduled ticks. So there's a scheduler which has a list of objects and for each object a corresponding time value. If the List is sorted by expiration time the scheduler just has to check if the first element in the list has expired and "tick" the object / block. You shouldn't use "relative" delays (like WaitForSeconds in coroutines) since at low performance the whole game runs slower. Such things are best bound to the game time.

To implement such a scheduler you can use a normal generic List of a "TickTask" class and implement an comparer function / interface so the items can be sorted by their "timestamp".

The TickTask class would only have two members:

  • timestamp

  • reference to a "tickable" object (an interface would make sense here)

If you want to schedule a tick you just add a new TickTask item to the list (with the desired timestamp) and sort the list. Since the list is always sorted the sorting shouldn't take much time (O(n)).

The scheduler now just checks each update if the first item's timestamp has expired. Then it removes the first item, ticks the object and checks the next one.

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 Entrio · Dec 15, 2013 at 04:35 PM 0
Share

Thanks mate, just the heads up I needed!

avatar image
0

Answer by Toggy11 · Jan 09, 2014 at 08:13 PM

Maybe I'm a bit late but, you could make a timer that when activated runs a function then that function checks at one block above, below, left and right. Then if a place is free create a water block at that posistion.

Comment
Add comment · 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

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

18 People are following this question.

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

Related Questions

Mushy Rigidbody 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Pathfinding & Navigation in 3-dimensional space (proced. generated) 2 Answers

Mesh manipulation at runtime - existing tools / libraries? 0 Answers

Procedural array of meshes problem / solved 1 Answer


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