Search Unity

Liquid Voxels

Discussion in 'Works In Progress - Archive' started by Ellandar, Apr 26, 2014.

  1. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Very cool stuff! Regardless of whether there's a leak, I'm pretty sure that the memory usage of Cubiquity can be significantly reduced in future version. This will be one of the focus points for the coming months so I hope you get to test it on some bigger volumes in the future :)
     
  2. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Well I'm back from the week away, including being stranded in Adelaide due to volcanic ash over my home city!

    Just looking through the threads....WTF HAPPENED?!
    Forum update destroyed my thread! Time for a new format I think. AND a unity update (which I might pass on for a while).

    I'm back into the code again (as of 10 minutes ago). It's a bit of a hard slog to page in all that memory, but I should be up to speed soon. Once I get rid of a bug I introduced before leaving I can get it packaged for you all. The bug is going to take a bit of squashing, it snuck in during re-factoring so it's a bit of an annoying one.

    - Ell
     
  3. someunityguy

    someunityguy

    Joined:
    Jun 28, 2011
    Posts:
    35
    Looking seriously awesome..................
     
  4. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    It's been a brutal couple of weeks at work, 70 hours a week so far, leaving very little time for family let alone LiquidVoxels :(

    I've had a couple of hours today on it and I've managed to squash the annoying bug, there's still some entrials left around the place so cleanup is happening now. I'll spend a bit of time cleaning the code, adding some notes and stuff and I'll get an alpha release sorted. I'll also post on the front page what my definition of an Alpha release is just so people don't get caught out if I make structural changes.

    Today's video is to show that the water engine is still there and performing fairly well (it's a little fat at the moment again; keeping it from slowing down is quite tricky!) and also to show off a new shader David released in cubiquity that I really like.

    Seriously, if you haven't yet checked out Cubiquity, go ahead; it's has a free for private use version that is not cut down from the pro version at all.

    Oh, I also think I have evaporation set nearly just right now. It no longer deletes water voxels too quickly I don't think; it's also tune-able. It can even be removed due to the plugin setup i've got going.



    - Ell
     
  5. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Great stuff as always, and it looks like it's performing well. How does it scale in this regard? Is the performance dependent on the number of water voxels, active water voxels, or the size of the volume?
     
  6. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Cheers David,

    All of those things:
    • Number of Voxels: slower physics calcs + slower render (due to more updates), and slower retrieval of things like "Give me all water blocks".
    • Active water voxels: All of them are active, I have some very big wins here around performance if I make blocks inactive.
    • Size of volume: slower start-up. The size doesn't really affect the running of the physics.

    Other factors that effect the water is if there's a lot of upwards pressure in the simulation. That's the last calculation to do so it does all the others + that one, thus it's worst case scenario if every block is pushing up.

    At the moment, there's some problems in there that are causing annoying cycle consumption to occur even when there's no water on the screen. There's also a memory leak that needs squashing; this is a problem I need to tackle before I'll release a beta version.


    I've put in some things that make it faster too:
    • Post-Processing: if a water voxel doesn't change volume enough to break a threshold then it won't be marked with a flag; this means plugins such as evaporators and renderers can choose not to update those voxels.
    • Early out: If a voxel has already acted upon all of it's contents then it will drop out of calculations early (ie, falling voxels won't calculate sideways or up if the whole voxel falls into the block below it).
    • Prefetch interfaces: Early on a 3d array performed faster than Cubiquities and Voxwells internal data storages (Octree in Cubiquity and ...uh, I didn't check in Voxwell), so I took a copy of the terrain on start-up in a 3d array and only updated voxels in and around areas that contained active water. Recently though I've turned this off gone back to the non-pre-fetch version for cuqiuity as it's faster than my data set, you must be working on performance lately :)

    I'm going to release this as an alpha and it will remain as an alpha whilst I make sizeable changes that affect the way the simulation will interact with voxel worlds and visa versa. Once I get down to speed/polishing then it'll become beta, then I'll release once I can get it performant and easy enough to use.

    -Ell
     
  7. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    You got me interested in what the performance is (at a simulation level as opposed to always being down in the threads and trying to improve nanosecond level stuff).

    I created a counter that told me the number of times the simulation ran per second, then set the simulator to try to run 100 times per second. I also set some aggressive evaporation so there were a lot of updates. The results weren't bad:



    - Ell
     
  8. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Was messing with rain to keep creative juices flowing. It seemed to perform ok.




    -Ell
     
  9. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Private Pre-Alpha release going out.

    Hi All,

    I'm releasing a Pre-Alpha copy to a small group of people, mainly those that provided support and sent me copies of their engines to assist in the development of LiquidVoxels.

    I'll spend this next week creating some limited documentation and doing some small amount of polish; as well as fixing any bugs the initial group bring up.

    Hoping to release next week. I just don't want to put it out too pre-maturely, as without basic documentation it will be difficult to understand how to use the tool and people may not give it the time to try. Then I doubt they will give it a second shot when the documentation is available.

    Those that received a copy, feel free to post screenshots or thoughts/bugs here.

    - Ell
     
  10. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Alpha is out!

    I released it a little earlier than I was going to but to be honest, there's not a lot I can do to it in the next day; so why not get it out there.

    Please tell me what you think. I know there are bugs and it's probably going to run very slow on some of your computers right now. There's some good optimisations I can do, but I wanted to get it out there to get people's feedback early. I'll try to iterate often!

    - Ell
     
  11. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    I found a little time to play around with this yesterday and it's pretty cool! I was able to run the example scenes and also managed to set up a scene from scratch. I did have some difficulty with this, but it was interesting because it reminded me that things which are obvious to the author are not always obvious to users! This is something I really need to keep in mind with Cubiquity.

    Setting up a scene does require quite some work. There are several components that you have to add and some configuration to perform. I wonder whether some of this could be simplified. For example, does the auto-start really need to be its own component, or could it just be a check box on the water example? Or perhaps it's only useful for debugging. Also, it seems the IVoxComms is usually going to point to its parent game object, so perhaps it should check this if the user doesn't set it to something specific? It also wasn't obvious how to add the 'render' plugin but I figured it out in the end :)

    Anyway, I think a useful feature might be a menu item to convert the current game object to a water object, or to create a new water object with sensible defaults. I realise it might not be trivial as you have to interact with other systems, but it would make it easier for the user to see results with the minimum of effort.
     
  12. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Good to hear you found it cool :)

    I have been quite worried about the number of components required, you are right, it's something that I should automate or simplify. Autostart probably should be integrated, I added it because I was lazy and didn't want to click "start" all the time.

    IVoxComms is a challenge. Right now there's only support for a single IVoxComm, but I'm thinking I may have to extend that depending on how I'm going to attack infinite terrains. If i'm going to load an IVoxComm for each chunk, or a single one and allow the users to define chunked data that the simulator can ignore whilst it's off the screen. Still working on that one at a design level.
    I know integration with Voxwell would benefit from multiple IVoxComm's, or some other type of object that gets attached to the voxwel gameobjects, and relays information back to IVoxComms.

    A menu item to create a water object is a good idea; I'll add that to my ideas forum.

    The plugins concept in it's existing state is still something that may disappear. It still might be better to make plugins a monobehaviour that people just attach to the gameobject. That way they can have settings that can be tuned by the user in the inspector as opposed to in code right now being scriptableobjects.

    Thanks for your feedback David!
     
  13. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    How did you find the performance was on your system?
     
  14. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    My personal view is that chunks are an implementation detail which users should not need to deal with, which is why Cubiquity does not expose them (of course it does use chunking internally). I expect this will continue to hold when we move to very large or infinite terrain. I don't like that Cubiquity currently requires a 'Region' for each volume, and think that ideally a user should be able to read/write from any voxel at any time, with the required chunks being created internally on the fly.

    But I think most voxel engines don't work like this and, having looked at API docs for other ones on the asset store, it seems you often have to work out which chunk a voxel is in before you can set it. Perhaps you can wrap this process to make it transparent to the user, so it appears to be a single large volume? Or maybe it doesn't even matter to your users - just those who write the integration layer between the voxel engines and Liquid Voxels?

    It seemed to run as well as your videos, though I didn't do any proper profiling. I was going to test it on a large volume (one of the 'Build and Shoot' maps) but I couldn't get it to work. I set up a simple scene with an almost empty volume and that worked ok, but when I replaced the volume data with 512x512x64 build and shoot map I didn't see any water being spawned when the thrown water cubes hit the ground. Maybe there is a size limitation at the moment? Or just a config problem on my side perhaps?
     
  15. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Ideally i'd like it to be transparent, and the water simulator works out the back-end stuff for us. I think that might be a very lofty goal though. Some designs offer a clean single window into the voxel world and others are quite fragmented and will require a bit of work.

    I think I'll focus on ironing out the bugs and getting a nice clean implementation first and then start working on infinite terrains and loading/unloading chunks. I do appreciate your view on the chunking though; I wish everyone thought like that as it would make my life very easy :)

    In my case, I'm thinking that those people are my users. The people that play with the water are the users of my users; and my clients are the ones writing or implementing someone else's voxel engine.
    I could also be suffering from not really knowing who my users are :)

    I'll setup a terrain now and try. It very well could be a size issue.
     
  16. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Ok, I know what the problem is.
    It's a performance issue when querying the terrain.

    I move the entire terrain into a single 3d array on load and then update it every frame to capture changes.
    This works OK on smaller terrains, but the 16+ million data points in the 512x512x64 is a bit much for it.

    If you see the entry "Scanning Terrain" (which I will change to LiquidVoxels - Scanning Terrain) it means that the simulator is loading the terrain into the array. It took 62 seconds to load the entire terrain on my run through, then the simulator got 2 or 3 updates in before crashing unity.

    I'll look at that problem this weekend.

    Thanks for finding it.

    Rob
     
  17. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Dont feel you need to solve it just for me, I was just curious how it would look on a more interesting map (and Build and Shoot has some really nice ones). But is it also possible to define the extents of the simulation? It seems to me that in many cases the similation might be quite local (e.g. a waterfall) and that keeping a copy of the whole terrain would be overkill (or impossible if the terrain is infinite).

    Perhaps the simulation needs a visual representation in the editor, in the form of a wireframe cube which the user can position to set the extents of where water simulation can occur?

    Just ideas for the future of course - I'm sure you want to focus on getting something on the asset store.
     
  18. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    wow.

    I never thought of doing it that way. That's a seriously good idea. It removes my infinite terrain problem, it also will give users more control on how much the water simulator affects their engine (just define small water areas).

    That idea may get this release a lot sooner as there's less problems to solve!
    I'll add that to the list and probably work on it before most other things.

    - Ell
     
  19. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Today's update:

    I'll hopefully release a new alpha version in the next few days, currently the new features are:

    Features:
    • Add AutoStart to main engine.
    • Water can flow faster now
    • Ability to ctrl-click a voxel and get it's data.
    • Regions (reason for this update)
    • New Map, floating islands (it's still in development but it's an early preview).

    Methods/Engine updates:
    • CheckValidLocation to no longer throw an exception; it now returns false, and allows the callers to determine what they want to do about it.
    • Added some minimum density code to catch blocks that were below minimum density properly.
    • New classes: LiquidVoxels, LVRegion, LVEngine. To support the new regions and a restructure to begin centralising external calls (that you guys make) to a single interface in an effort to make things easier.
    • Auto-Build water object.

    Here's a quick video of an early Regions build in action:



    - Ell
     
  20. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Greetings all,

    A further update to regions. Previously only a single region would work. Now I have multiple regions working on a single terrain.
    Also, as an added bonus; if two terrains join, then liquid will flow between them!
    I've also stopped using scriptable objects as plugin modules due to the fact that we can have multiple renderers in a scene now.

    This one is taking quite a lot of bedding down due to the sheer number of cases that it needs to deal with. Getting there!

    I have stopped scanning the terrain and pulling voxels out of it that were marked as liquid (in cubiquity a specific color indicated liquid). It was a good feature for troubleshooting and initial setup but it requires slow terrain scans every frame. I may re-implement this feature as a plugin at some point if it's really something people want.



    - Ell
     
  21. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    That's really cool. But of course I have to ask - what would have happened if there was a gap between the volumes? Or more generally if there was some transforation applied to one of them? Actually on that note, does water flow downwards in volume space or in world space? i.e. if you tilt a volume then does that cause the water to move? Could be tricky of course but I'm just curious :)
     
  22. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Welcome back David, hope the holiday was good.

    If there is a gap between the two then the simulation will currently fail at that point. I have a few use cases that I'm going currently working through to try to make the simulator resilient. At the moment i'll just crash :)

    If a volume moves or a transform is applied during simulation that will also cause some problems. Although I am going to be implementing the ability for water regions to move and allowing water to expand/contract/move it's own region.

    Water flows in volume space. Regions currently don't rotate or scale, but they will soon. If your world is tilted on a 45degree angle, then the water will still fall towards the local "down" and basically not work as if it was on a 45 degree hill.

    I've been profiling all weekend trying to get the simulation back up to scratch, I've fixed most of the bugs that cropped up with regions, so I'm hoping to release again soon.
     
  23. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    That's what I expected of course - handling arbitrary transformations between volumes would be complex and probably unnecessary (though perhaps it could be used for an interesting puzzle game?). I think the tilting could be fun but I can imagine that an arbitrary 'down' vector would really complicate the cellular automata code :)
     
  24. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    I was thinking about the problem last week actually; as my daughter was messing with the simulator on a tablet and was tilting it... I thought of a way to implement it fairly easily by replacing all of my direction code (and there's really only 6 lines) with "Up, Left, Right, Forward, Back, Down". We could then substitute Vector normals of 0,1,0 instead of 0,-1,0 for down, which would effectively invert gravity.

    It would mean directions are only available in cardinal points but that's not such a bad thing in a simulator where diagonal flows aren't available.
     
  25. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    I've spent a week with the engine and the unity profiler, wow, what a week it's been!

    I've gone from 2k voxels on screen @ single digit FPS to 10k voxels being updated @ around 15FPS.
    I think the engine is finally performing at a level that will allow games to utilise it without sacrificing large amounts of CPU time.

    I have some cleanup to do around the regions and also Add/Delete voxels via a single LiquidVoxels interface and then I'll fire off a release.

    I'm also going to start aiming for weekly releases with notes indicating known issues instead of being delicate about it and trying to squash them all before release :)

    I'll post a video tonight and a release on Sunday.

    - Ell
     
  26. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    It's been a big weekend of coding with quite a few ups and downs.

    So I've been working on a couple of things:

    Regions
    I've mentioned and demo'ed this before so I won't bore you with details. There has been tonnes of work to get this feature in and it cost me a some performance so the next few releases will be restructures to smarten up how data structures are accessed to get performance back.

    LiquidVoxels
    I finally have a controller type object that allows you to do things like "LiquidVoxels.Instance.AddMetadata(Locaiton, LVType.WaterBlock) to add water to the engine.


    Menu items - Create Region/Controller
    These two menu items create a region object (which will add a controller if one isn't found). Basically this is enough to get started with the tool.


    WaterSpawner
    this is a gameobject that can be placed in the world that will spawn water constantly; similar to the way minecraft spawner's work.


    Namespace
    Self explanatory, I've wrapped the whole thing in a namespace to prevent collisions.

    There's been a lot of other things done; I've profiled the app and fixed a few inefficiencies in the locks.
    Spending the rest of the afternoon fixing sleeping liquid(I broke that with regions), and writing some doco on how to install and use the product. Then i'll package it up and do another alpha release.

    Once this one is out I'll be trialling regular incremental releases to see if I can manage that :)

    - Ell
     
  27. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Couple of screenshots to tide you over:

    Liquid Voxels Status:




    And me dragging a waterspawner around the scene.
    LiquidVoxelsWaterpawner.png
     
  28. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    LiquidVoxels Alpha version 15 has been released.

    Download on front page.
     
  29. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Congrats! I'll look forward to having a play with this later in the week. Should be easier now that Cubiquity has moved to Unity version 4.3

    I like the look of this. It seems it could provide a handy checklist for getting everything set up correctly :)
     
  30. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hey David,

    I hope so :) It's in it's infancy, it only came into existence on Friday so there is a long list of things to do to that component, a couple being:
    • Use seralisedProperties
    • Make it runnable in the editor so it helps with scene setup.
    • Have it provide more meaningful control, eg pausing and unloading regions etc.
    I just wanted to get it out there and iterate a bit. I think I'm doing too big of chunks before releasing, thus potentially going too far down paths that people may not even want.

    There's also a long list of bugs in the existing system that need squashing. Too, I think I almost need to feature lock for a little and bed down :)

    - Ell
     
  31. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Tonight I thought I'd do a rewrite of the interface to voxwell to get it working with this new region based engine. It took about an hour and came with it's own set of awesome bugs, and is running at a super slow rate because I'm not doing any of the tricks I did a month ago to make it super fast (will add them, at this stage I really just wanted to know if it worked).

    This is water flowing between completely separate Voxwell regions.


    I'm currently uploading the video that shows the setup of this scene from scratch, to show how to configure a LiquidVoxels scene. It's identical to how we do it in cubiquity, just the communiations module in this case is called VoxwellPrefetchComms - technically it's not pre-fetch or caching yet...i'll get there!

    I'll add the scene setup video once it hits youtube.

    Edit: And here it is.

    - Ell
     
    Last edited: Jul 14, 2014
  32. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Had a eurika moment and worked out how to make voxwell FAST without worrying about caching or any other heavy tricks.

    8 lines of code later:



    - Ell
     
  33. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi All,

    It's been 12 days since I last wrote here; it's been rather hectic during that time.

    I've rewritten the main simulator component of the engine to parse the region that it's in via a single pass instead of the multiple hits that I was doing earlier. It has increased the simulation speed substantially!

    The other major change has been to switch from using floats to using ints as the unit of measurement, this has simplified some of the math required, and has given some gains in speed as well.

    I have to say that I did lose the pressure system in the process, which is very unfortunate as I really did like that system. I'm going to come up with a new pressure system in the next couple of weeks but till then, no pressure :(

    I'll work on getting a release out to everyone; and apart from pressure, I'm going to be just working on stability, squashing bugs and usability for the foreseeable future. I'd really like to get this to the point that it can be tested/used easily by people.

    - Ell
     
  34. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi All,

    With the release of Apha 17, I now feel the core simulator engine is now fast enough and stable(ish) enough to begin ironing out bugs and working on presentation and usability.
    I'll be creating a roadmap over on my Userecho page soon, please pop over there and report bugs, make suggestions or ask for help.

    Also if people are using this plugin at all, please sound out on the forums or at userecho, i'd love to hear from you.

    - Ell
     
  35. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Congrats on the new release - sorry I didn't test it for a while but I've been busy trying to beat the next Cubiquity release into shape. The amount of work which goes into 'the last 10%' is crazy - I'm sure you're finding the same!
     
  36. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Absolutely!

    I think I rebuilt this release 6-7 times, just due to small annoying things that weren't right when testing.
    Getting the polish in is like starting the whole project again with a whole new set of problems. Interfaces, buttons, menus, removing complexity etc!

    It's very tempting to just go back to adding functionality :)
     
  37. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    I've been squashing some bugs, and making the interfaces a little nicer.
    I've also been considering adding the ability to for the water engine to dynamically create it's own regions when new water is requested where there is no region. Basically that should make regions an optional accessory for people to mess with if they want to.

    To make this work properly I think I'll need to also allow regions resize themselves and then liquid to flow between regions.

    Also, during some of my down time i've been dabbling in another simulator engine for LiquidVoxels, this one will allow momentum/flow/pressure and mixing of liquids/airs etc similar to how some of the Falling Sand Games work.
    Here's an amusing first glimpse at the very first rendered run of the engine...liquid is not quite flowing how I planned!



    Ell
     
  38. Corentin

    Corentin

    Joined:
    Dec 1, 2013
    Posts:
    16
    I discovered Liquid Voxels today, and wanted to give it a go even though I only had 30 mins spare...
    It looks very nice and Cubiquity demos look very nice. I wanted to show it to a friend and tried to build him an executable version, and it seems that LiquidVoxels is trying to import UnityEditor all over the place. I don't know if this is mentionned somewhere, I only read the readme (nicely written thanks) to the point where I could run the scenes (i was all "whooohoo" at that moment and couldn't keep reading further)

    If you already know about this, ignore previous message and jump to next lign :
    This all looks excellent ! thanks for your hard work !
     
  39. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Corentin,

    Thanks for the kinds words and thanks for the report on the UnityEditor, I hadn't actually run a build before, which now strikes me as a little dumb. Yes, that problem is totally my fault, moving some scripts into the editor directory and a little re-factoring will fix that. I'll get that sorted for the next release.

    Ell
     
  40. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Hi Everyone,

    First up, I'd like to apologise for going 2 weeks with no communications. Between work stress and a couple of doctor visits I've found it challenging to spend time on anything other than sleep, work and family.

    This will probably continue for the coming 4-5 weeks due to big project crunches at work; but I use LiquidVoxels as a means to escape reality a bit so I'll continue working on it.

    At the moment, the current focus is:
    Bugfixes for game builds (editor problem above).
    Useability, making the LiquidVoxels object track things a little cleaner.
    Documentation within the interface: I want to make it so others can add this system by following the steps in a template IVoxelCom script, hopefully making it a little easier to get started.

    I have a few hours this weekend put aside for LiquidVoxels so hopefully a video and an outside chance of a alpha 18 release.


    Having said all that, I still get notified if people chat here; so please feel free to ask questions, make comments etc. There's been 40 downloads of Alpha 17, so hopefully some of you are getting good use of the product.

    - Ell
     
    Last edited: Aug 23, 2014
  41. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Since my Unity pro trial expired I've been trying to pre-emptively optimise my code whilst writing LiquidVoxels this past few weeks. I know it goes against good programming methodologies but without a good profiler I'd have little hope of ensuring this product stayed reasonably fast.

    So it was my birthday not long ago and after much explaining as to how important I felt it was, my wife allowed me to purchase unity pro! I purchased it last night then ran the profiler for the first time in quite a few weeks, and as usual the app was slow in areas that I was totally not expecting.

    This post is to cover two things:
    1. My wife is awesome; I was absolutely not expecting an eventual yes to a $1500 spend on a hobby _ever_.
    2. Adding my voice to the normal chorus of "Do not pre-optimise code".

    Yes you should write code with performance in mind, but even when writing code that runs in very tight loops like this one, it's a complete waste of your time to optimise stuff without measuring (profiling), changing, then measuring again.

    - Ell
     
  42. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Well happy belated birthday, and a copy of Unity Pro is indeed a nice gift :)

    I'm also in optimization mode at the moment and am making some improvements to the core of Cubiquity. These should benefit you over the next couple of months, and you shold see an increase in performance and a decrease in memory usage. Not sure how far it will go yet - like you I'm trying to follow the profiler and fix the hotspots.

    I'm lucky enough to have a copy of VS 2013 Ultimate (academic license) which is great for profiling, but I don't have Unity Pro. So when I come to optimize the Unity part of the system I might ask for tips ;-) Actually, UnityVS was recently released for free so I wonder whether that exposes any profiling functionality? Something to look in to...
     
  43. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Cheers David,

    I've used UnityVS for the past year and Microsoft purchasing it was wonderful! They sped it up and it's a lot more stable now; it's really good for debug but there's nothing that I could see there for profiling. Although I've never used visual studio profiling so there's possibly some hooks there.

    Happy to chat about optimising Cubiquity; can even send you some profile screenshots when rendering mesh updates (including collides) to show you how the performance breakdown is in Unity. I'll see if I can get a chance to grab some tonight for you.

    - Ell
     
  44. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Features added and Bugs killed today:

    Ability to remove water blocks in code. COMPLETED
    NullReference error when creating a second region using the menu item. FIXED
    Multiple water spawner's seem to not allow more than 10 units of water per second to spawn. FIXED
    Use of UnityEditor functions will cause classes that get included in the final built to break unless handled. FIXED

    Post on my userecho site if you have requests or if you have bugs you want squashed.
    I'll attempt to get a few more things done, and then i'll download the latest version of cubiquity and do some profiling.

    - Ell
     
  45. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Alpha 18 has been released.

    The last 2 things I want to do before a proper beta is:
    Serialisation (runtime save & restore) regions.
    Re-Optimise the engine to run in large (greater than 256x256) regions.

    Please let me know what you think of the engine and if you are getting any use of it.

    - Ell
     
  46. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    I got home from work today and thought "wouldn't it be cool if I could use Cubiquity's block terrain to show landscape, and the smooth terrain to render water".



    Turns out it was very simple and for those that want to reproduce the screenshot, you'll need to do the following non destructive stuff (won't break your existing liquid voxels if you use alternative point 3):
    1. Add CubiquityComboStdComms.cs to your project (Under the VoxelEngineInterfaces/Cubiquity folder)
    2. Add RenderInSmoothTerrain.cs to your project (it's a plugin, put it in the plugin directory in LiquidVoxelsSim)
    3. Replace your current LVRegion.cs with the attached.
    3. (Alternative) Or, just add the following method to your current LVRegion.cs:
    Code (CSharp):
    1. public void SetVoxelType(int x, int y, int z, VoxelType voxelTypeToSet, int amountToSet)
    2.     {
    3.         if (!CheckIfInRegion(x, y, z)) Debug.Log("Asked to create a voxel that isn't in my region.");
    4.         myVoxelComms.SetVoxelType(ConvertLocalVectorToWorldVector(x, y, z), voxelTypeToSet, amountToSet, GetVoxelIndex(x, y, z));
    5.     }
    4. Place the Water fallback.jpg in your project (or import it from Water(Basic), it's a standard unity asset)

    Here you can just import the: StairsSceneWithSmoothTerrain.unitypackage into your project, making sure to put both files in your scene directory. Then open the scene, select the Terrain Volume and double click the material in the Terrain Volume Renderer. On texture number 3 (first empty texture slot), add the "Water fallback" jpg we added to the scene earlier. Or just change it to sand or something if you want to see liquid sand :)
    Click play, you are done!

    If you wish to do it manually then:
    1. Go to a normal example scene that is already working with liquid voxels.
    2. Replace the CubiquityCubesStdComms component (on the liquid Voxels object) with the CubiquityComboStdComms
    3. Click on your region gameobject and remove the "RenderInTerrain" component. Add the "RenderInSmoothTerrain" component.

    Last steps is to add the smooth terrain to your scene.
    1. Assets -> Create -> Terrain Volume Data -> Empty Volume data
    2. Select the same dimensions as your existing scene (25x25x25 if it's stairs)
    3. Unselect "create Floor".
    4. Click Create.
    5. GameObject -> Create Other -> Terrain Volume.
    6. Select the Terrain Volume game object, then select the Settings button in the selector.
    7. Drag your volume data object you created in step 1 - 4 into the Volume Data field.
    8. Double click on the Material in the Terrain Volume Renderer
    9. On texture number 3, add the "Water fallback" jpg we added to the scene earlier.

    click Play, we are done.


    ps. Nearly there with the simulator, I'm creating a basic tower defence game like Creeper World 3 to show the liquid engine in use, and to give some demonstrations on how to interact with the water in a game setting.
    Will be simple stuff, nothing fancy.
    - Ell
     

    Attached Files:

    Last edited: Sep 15, 2014
  47. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    Very cool stuff! If you want to try making the liquid smoother you could average each voxel's density with it's neighbours. Probably this is too slow though, and you'd have to do it C# side to avoid too many calls across the native code boundary. Or if you have your own representation of the data anyway, then perhaps you could simply perform the averaging as you copied across to Cubiquity?
     
  48. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Heyas David,
    averaging is probably something that could be done but at a fairly hefty cost to the update rates. I do have a copy of the data and am just using the voxel engine as a visual representation, so on draw we could do the average. Although I don't update every block in the scene each update, just ones that have changed so there would still be a little bit of stepping I think.

    I'll give it a try sometime and see how it affects performance, good idea!

    - Ell
     
  49. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Activity over the past week has been quite low, I'm putting a couple of hours a week into LiquidVoxels, so it's still being worked on. That's about all I can spare at the moment; but it'll get better :)

    The demo tower defence game got some of my free time tonight.
    I have the basic mechanics in, so now I need to get a couple of scenes happening and implement a little game-play and it's ready to package with LiquidVoxels as a demo scene (or a separate download). I'm thinking of using 4.6 and it's sexy UI so it's more likely going to be a separate download for a while.

    Below is a sneak preview of the turret shooting water. Turret projectile damage and explosion radius is modifiable so I'm sure there's opportunity for upgrades there :)



    - Ell
     
  50. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Greetings all,

    I've neglected the simulator for the past month, and I've been very remiss in communicating why. I'm currently involved in a long running project at work that is consuming a large amount of my work and personal time. We don't like crunches at work so we've been pushing the work level for quite a few months now to prevent a big crunch at the end. This has lead to me not wanting to go near computers when I get home. The project will be over early next year, at which point I can dial back the personal time effort and begin working more on my personal likes instead :)

    Excuses out of the way, I'd like to share a few things and also hopefully get some feedback from others.
    I have 4 weeks leave coming up and I'm keen to hear from those that have downloaded the plugin to indicate what they would like to see added/removed or improved.

    As a bit of a different type of update today, I thought some might find it interesting to see how the last release was received and downloaded. It was released August 31st, just over 2 months ago and downloaded 88 times. Below is the break down of the traffic per day.

    Alpha18 Downloads.png


    Not exactly viral material, but I thought others may find this information interesting.

    - Ell