Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Uniblocks: cube-based infinite voxel terrain engine

Discussion in 'Assets and Asset Store' started by RawLionWorkshop, Feb 2, 2014.

  1. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Uniblocks Voxel Terrain, a cube-based infinite voxel terrain engine.

    Asset store link | Video demonstration

    Screenshots:
    $ss1.jpg
    $ss2.jpg
    $ss3.jpg

    Features:
    - Infinite procedurally generated terrain
    - Fast realtime loading and saving of terrain, efficient terrain storage on disk
    - Multiplayer features: streaming terrain data from server, synchronizing voxel changes
    - Support for custom non-cube voxel meshes
    - Fully compatible with Unity's built-in physics engine, including standard colliders, raycasting, etc.
    - Fully compatible with Unity's built in lighting, including dynamic shadows and custom shaders
    - Easy scripting using the event system (OnMouseDown, OnBlockPlace, etc)
    - Clean, simple and well-documented code (all C#)
    - A Block Editor window for easily adding and editing blocks
    - Example code demonstrating some common gameplay implementations and terrain generation

    Infinite, procedurally generated terrain
    The terrain is generated procedurally at runtime. The engine comes with a simple perlin noise based terrain generator algorithm, which you can expand/modify or swap out for a custom one. Multiple worlds can be stored on disk.

    Fast performance
    Uniblocks supports modifying blocks at runtime with no lag, as well as fast streaming of terrain data from disk at runtime.

    Multiplayer
    Built-in multiplayer functionality allows you to stream voxel data from a master server and synchronize voxel changes between players. The multiplayer solution uses the standard Unity networking and comes with in-depth documentation, making it easy to modify or port to a third-party networking solution as needed.

    Custom meshes
    Up to 65535 block types are supported. A block can use either the standard cube shape, or a custom mesh of any shape and
    size, as well as different collider types (cube/custom mesh/trigger).

    Easy scripting
    The engine comes with a game-ready block scripting system. Simply attach a custom script component to a block type, override an event function (exactly as you would with the standard Unity functions such as OnTriggerEnter, OnMouseDown, etc), and execute custom code within that function. Uniblocks comes with events capturing camera look, mouse clicks, mouseovers, collisions, as well as placing and destroying blocks, and you can add your own events easily.
    Various basic functions for converting between voxels and world position, voxel raycasts, etc, are also provided.

    Clean, simple code
    The source code is fully accessible and easy to modify. All code is heavily commented, and the individual parts of the engine are neatly organized into separate modules. An in-depth user manual and scripting reference are also provided.

    Universal
    Uniblocks is designed to be compatible with many different types of games. The events scripting system allows you to easily implement different gameplay features, and some example gameplay features are provided. Lots of performance options allow you to accommodate a wide range of systems.


    Demo
    Web Demo (note: WebPlayer performance can be significantly slower than a standalone build)
    Standalone Demo (better performance, save/load enabled)

    (controls: wasd+space = move, left click = destroy block, right click = place block, 1-9 = switch active block)

    Android Demo
    (controls: drag bottom left of the screen to move, drag bottom right to look around, tap the screen to break blocks, double tap to jump)

    Documentation
    https://www.dropbox.com/s/p9nfjw4dalq8v66/Uniblocks 1.4 Documentation.zip?dl=0

    Warning
    Anti-aliasing not supported with forward rendering path. Water not included.


    Please feel free to post any questions here, or contact me at rawlionworkshop@mail.com
     
    Last edited: Aug 4, 2015
    Steelshot and eabykov like this.
  2. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Whats the performance like on mobile? If it work well, this is a huge plus and up near the top of my to purchase list.
     
  3. Wrekk

    Wrekk

    Joined:
    Jul 16, 2012
    Posts:
    51
  4. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    With the settings turned way down you can probably expect about 10-20 FPS, which might be playable depending on the type of game you're making, although really this asset is meant for desktop use, and I can't guarantee satisfactory results on mobile. Unfortunately, voxels are just very performance-intensive.

    Edit: I've put together a quick Android demo, so you can check mobile performance for yourself.
    https://www.dropbox.com/s/t0p623ykawbc2wx/Uniblocks Android Demo.apk

    Looks like the top of the hill got cut off due to the chunk height limit in the webplayer version. I guess I forgot to configure the terrain generator properly to match the height limit. You shouldn't see anything like this in the standalone demo.
     
    Last edited: Feb 11, 2014
    eabykov likes this.
  5. vincentellis

    vincentellis

    Joined:
    Oct 21, 2013
    Posts:
    100
    Do you intend to add multiplayer functionality? Maybe just a demo with Photon Cloud or Photon Server, allowing players to alter the world together?
     
  6. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Yep, I am indeed planning on adding multiplayer some time in the future, though probably not very soon, I want to make sure the single player version doesn't have any major issues first.

    By the way, Uniblocks is now available on the asset store. Check the link in the first post!
     
  7. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    1. Does it need to use unity's lighting system? Does it use minecraft-like lighting calculations?
    2. Is there any documentation or support website?
     
  8. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    Suggestions:

    * Put a link on uniblocks asset store's page to this thread
    * I saw there are two PDF files inside your asset store's package. Why not post them here? I would be a great to clarify its features and if we would have trouble changing from another solution (Minepackage in my case)...
     
  9. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Thank you for the suggestions, I added a download link for the documentation to the first post, and the asset store description should be updated soon.

    Nope, there are no per-voxel light calculations.

    A support website might be coming in the future depending on the demand. In any case, I'll be expanding the documentation as new questions and issues come up.
     
  10. joelfivat

    joelfivat

    Joined:
    Aug 14, 2013
    Posts:
    45
    Hello,

    There don't seem to be any water, am I right ?

    Do you plan to add water at some point ?

    Do you plan to add more features ? In that case, what is your road map, what are your priorities ?

    I have to say, I am very excited to finally see a Minecraft-like voxel terrain generator on the asset store :)

    Thanks a lot !
     
  11. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    That's correct, there is no native water system.

    The problem with water is that there are many ways of doing it, and it will depend largely on what kind of game you're making. For example, there's the Minecraft system, which, let's be honest, sucks, because it's not very realistic, but a proper Dwarf Fortress style finite water system is very resource-intensive. I don't necessarily want to force any particular implementation of water on the users. Uniblocks is meant to be a universal engine, not just a Minecraft clone.

    I might implement some water system in the future, but I think it would be in the form of a plugin rather than a core part of the engine, for reasons stated above.

    By the way, it should be perfectly possible to implement a water system in the current version just using the basic functions provided, without modifying any engine code. The code gives you easy access to things like checking adjacent voxels, including seamless checks between different chunks. And you can use custom voxel meshes to render the water.

    Multiplayer is the big one that I definitely want to add. Before that though I want to focus on polishing and bugfixing in the single player version, expanding documentation, etc.
     
  12. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    I saw there is a block editor.
    Our game have dynamic blocks, defined in a file and created at runtime. Is there a way to create the prefabs and link them to uniblocks before it runs? I.e. is there a way to create a block pallete dynamically?
     
  13. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Yes, in order to that you would need a custom script which reads your file and creates the block prefabs, then replicate the ApplyBlocks function of the block editor and call it right before Engine.Awake.

    To create the prefabs, one easy way would be to instantiate a template prefab (for example, block_0), then modify it's attributes based on your file data, and save it as a new prefab (using PrefabUtility.CreatePrefab). The prefabs must have the Voxel component, and must be named "block_x" where x is their ID number.
     
  14. CallHimX

    CallHimX

    Joined:
    Jun 16, 2013
    Posts:
    7
    Hey that looks really impressive.
    So I tested the standalone version and it looks pretty good.
    But one small thing is there what I've found, in case you change the settings from the standalone version to fantastic, this
    will happen over the complete world:
    $whitestrokes.jpg
     
  15. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Thanks for pointing that out. I've found that it's caused by certain anti-aliasing settings. I think Minecraft has similar issues with this as well.
    Enabling adaptive anti-aliasing in my AMD driver settings seems to have fixed the problem for me, while still allowing anti-aliasing.
     
  16. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    And another Voxel creation "engine" with no fluid.. Seriously.. Do you now know how to do, or really just not interested? Because honestly, voxel terrain with no water, really is useless
     
  17. CallHimX

    CallHimX

    Joined:
    Jun 16, 2013
    Posts:
    7
    Yeah fixed it for me, too. ;)
    I really like your system, it could be something that I'm searching for.
    I'm really looking forward for auto-foliage generation and for sure, biomes.
    Generation of caves and stuff like that would be a nice big plus, but not necessary.

    But at the moment the system is a little overpriced for me, please don't get me wrong, I know
    whats a hard work that is in the background. I think a good idea is, to start with a smaller price
    to get more "day one supporter" and with upcoming updates you increase the price.
    Just my two cents. :)

    EDIT: Another little thing that I figured out, everything that I'm created in the standalone
    demo its not saved out. At the next start of the demo, nothing is left from my testbuildings.


    Some posts above yours, he pointed out, why he doesn't implemented this for now.


    Greetz the X
     
    Last edited: Feb 8, 2014
  18. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    I have heard that exact line from every single "Voxel" developer out there. I don't believe it!
     
  19. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    My original intention was to provide an engine that's universal, low-level and not specific to any type of game, basically handle the saving and loading of infinite worlds, rendering blocks, chunk communication, etc, and leave the higher level gameplay stuff for the user to implement, according to their needs.

    I can see now that there might be some demand for some specific game features, so that's something that I'll probably be moving towards in the future. I definitely want to expand Uniblocks to match the users' needs, so I really appreciate all your feedback.

    Yep, I hear you, I'm not really sure of the current price myself, it's quite possible I'll be trying out different pricing in the future.

    Press V on your keyboard to save the world (and wait a few seconds for the saving to complete). I forgot to mention that in the first post.
    Chunks will also save when they are unloaded from memory, so if you walk away far enough from your buildings, they should save too.
     
  20. CallHimX

    CallHimX

    Joined:
    Jun 16, 2013
    Posts:
    7
    Mmmh, yeah, the original idea is good.
    I think the really best way to keep the "core" clean is to make extensions for your system, as you said.
    Lower price for the core, for all devs out there they need a basic cube voxel system.
    And extensions for people they need more, like water, dungeons, biomes and so on.
    So anyone have the chance to pick up the right personal package for her project start.
    Just some ideas.

    Nice to hear, I definitely keep an eye on it in the future.

    Thanks, works perfect and thanks for your great response. :)

    Greetz the X
     
  21. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    Great idea. What we need is a great core engine that allows us to extend it.
    Never mind bargainers and naysayers, your engine doesn't need 1 billion features to be useful.
    The price is also interesting, there is a lot of effort in your code. But if you think lowering it you will sell more, do a test, but don't say it here, or people will hold back waiting for a price drop.

    R.
     
  22. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    LOL. Water is a 1 billion features? That's called a KEY feature. Please show me one single voxel based game that doesn't have water in it. Then show me the list of assets I have purchased, and call me a bargainer or naysayer again. please.. O wait, you have no idea, so please shut your mouth with the names huh?
    I am called a potential customer. If the OP doesn't want to hear it, then I don't want to be his customer at all. Personally, I will not spend more than the other three on the asset store, with less to offer. They way he speaks of water in general terms, and it should be "simple enough", makes me think he doesn't know how, so once again, I will not spend $95 on an asset that the Dev. doesn't know how to implement a simple KEY feature of voxel based games; WATER!!

    (Before you reply, know that the term "simple enough" isn't my saying, and obviously if I knew how, I wouldn't need any of the Voxel assets would I?)
     
  23. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Hey, I totally understand your frustration, and yes, I know water is a very difficult problem, which is one of the reasons I haven't included it as a core feature. But, as I've already said, I do plan to add a water system in the future. Obviously it's going to take some time, and I'm very sorry about that, but the asset wouldn't have even been published yet in the first place if I actually tried to include a water system from the start.

    And by the way, I DO want to hear what you have to say, and I definitely appreciate your feedback. I just wish you weren't so angry :(
     
  24. midorina

    midorina

    Joined:
    Jun 1, 2012
    Posts:
    131
    Or you could download MrWishmaster35 "Minecraft" engine for free.

    http://www.youtube.com/watch?v=qOeaG2Q686Y (download link is in the video description)

    Features water, trees, texture atlases, caves, custom lighting and is very easy to edit if understand C#.

    There is also a massive 115 page thread on how to make your own voxel based engine with some very useful information in.

    Link: http://forum.unity3d.com/threads/63149-After-playing-minecraft

    Either way, great effort with the asset but your price is way too high for something that isn't finished.
     
  25. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    Only "angry" at the people that try to tell you, you don't have a right to give your opinion... Same as the ones, that say, if you don't like, go make your own. It ridiculous. I appreciate what you have created, and read through your API stuff, and it does seem like you have thought of just about everything. If the price point was lower for what you currently have, I would be a customer already too. (the more the merrier in terms of voxel assets)..
    I also appreciate your repsonse, and finally can agree. Obviously water isn't easy, otherwise it would be included in all of them. Its also an industry secret, and found in google (no one will share code that deals with voxel and fluids).. Once you have fluid, even as a plugin, whichever one you do, even both, I will be a customer.
     
  26. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Maybe I'm missing something, but this doesn't seem to actually have a dynamic water. The water you see in the demo is just a block like any other, with a custom shader, but it doesn't flow or spread. Unfortunately I couldn't really test it very well because Unity kept throwing loads of compile errors at me as soon as I imported the asset.
    I guess that's one of the advantages of buying stuff on the asset store - you know it will actually work.

    Of course you can always create your own solutions for free, but the whole point of the asset store is to spare you that time and effort.

    I think perhaps I haven't communicated the purpose of this asset clearly enough, so let me state this right now: this is NOT a "Minecraft Starter Kit". It's a terrain engine that uses cubic voxels and a scripting system for easily integrating your own gameplay features. Uniblocks is priced very similarly to other voxel terrain systems currently available on the asset store, and to my best knowledge none of them feature dynamic voxel water, so the feature set of this asset is at least comparable, if not larger, than the other available terrain systems.

    I'm always open to feedback regarding the price or features you'd like to have, but I think you're being unfair by calling this asset unfinished.

    (By the way, there is actually one comercially available voxel engine for Unity with dynamic water - and it costs €2500.)
     
  27. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    I'm glad we can agree. I'll do my best to implement a fluid system in some reasonable timeframe, so stay tuned!
     
  28. midorina

    midorina

    Joined:
    Jun 1, 2012
    Posts:
    131
    MrWishmaster's Voxel Engine works perfectly fine here. There are no compile errors or nothing. You are probably using an old version of unity. Simply unpackage and hit play, works straight off the bat.

    The feature set on the €2500 asset far exceeds yours and is not bound to just blocks.

    I don't want to offend you but I really don't see why people should pay $90 for this asset when they can easily download MrWishmasters free asset (that also has a bigger feature set). Just my 2 cents.
     
    Last edited: Feb 11, 2014
  29. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    Support and expansion predictability.

    I saw plenty of softwares from asset store where some developer publishes a solution, people start belittling and bargaining, the developer drops the price, doesn't make money and then abandons his/her project.

    So the point here is professionalism. Good solutions are hard to find, but more important, SUPPORT and EXPANSION are even harder. I'm using a free solution right now and I can tell you I would gladly pay the free solution's developer for him to expand his engine, but he abandoned it a long time ago.

    So maap, please find a sweet spot where you can avoid feature creep and make lots of money, so I can make it too. ;)

    R.
     
    Last edited: Feb 18, 2014
    twobob likes this.
  30. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Those are all good points. If you buy Uniblocks, you get a professional, well-tested and supported package aimed at serious developers, whereas free engines tend to be more on an amateur level, usually personal projects that are not necessarily intended for use by other people and often lack documentation, support or clean code. And of course the developer might not be very motivated to keep updating and supporting his engine if he's not getting any money from it, so abandoned projects are very common.

    I actually wrote Uniblocks precisely because I was frustrated with the lack of good cubic voxel solutions available (both free and commercial). All the solutions I've tried had various problems which made them unsuitable for me, and my goal with Uniblocks was to solve all these problems. I'd like to think I came pretty close to fulfilling that goal.

    Feature creep is definitely something I'm concerned about, which is why I'm cautious of announcing new features. I know how easy it is to promise stuff, and how hard it is to actually deliver all of it. Even AAA game studios often fall into this trap.


    In other news, a minor update is on the way (currently pending review). It's mostly just fixing a few issues I missed in the initial release, but also the price will be slightly lower, so if you're looking to buy the asset, you might want to wait a day or two.
     
  31. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    Hi maap,

    Great solution! Congratulations!

    I'm experiencing some glitches. When running the game I get results similar to the ones from "CallHimX":

    $Screen Shot 2014-02-18 at 10.42.47 AM.png

    But when seeing the same perspective from the editor window the glitches don't appear:

    $Screen Shot 2014-02-18 at 10.45.27 AM.png

    When changing the chunk's shader the number of glitches changes. So I don't think its related to the graphic card only. :(
     
  32. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    Oh, sorry for what I said. The glitches are still there on the editor window. The difference is they are very subtle.

    $Screen Shot 2014-02-18 at 11.13.56 AM.png

    BTW, using Mac Mini here (Intel HD Graphics 4000).
     
  33. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    I'm 99% certain that this is caused by anti-aliasing, and yes, changing the shaders can lessen the effect but it should be gone completely if you disable anti-aliasing.

    Can you make sure you have anti-aliasing completely disabled, both in Unity and in your graphics card settings?

    Also, does this glitch happen in the public demo, or only in your own builds? If it's only in your builds then it's likely that you have anti-aliasing enabled in the Quality settings in Unity, but if you get it in the public demo as well then you probably have forced anti-aliasing enabled in your graphics driver settings.
     
  34. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    It looks more like interpolation/mipmapping artefacts to me... probably you're using linear interpolation on a texture atlas? Switching to point samping and/or disabling mipmaps should fix it. Proper linear interpolation of a texture atlas is quite a tricky problem to solve.
     
  35. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    The default texture already uses point sampling and has mipmaps disabled, though if you import a new texture these settings might need to be fixed. (Which reminds me - I should add this information to the manual. For now, the correct texture import settings are in the picture attached.)

    $importsettings.PNG


    Anyway, enabling mipmaps causes a similar, but slightly different looking glitch. I'm pretty sure what's happening here is due to the fact that the individual cube faces aren't actually connected to each other, they're just floating in space independently, so anti-aliasing treats them as if they were separate objects, creating these "gaps" between them. Unfortunately it's not something I can readily fix, but disabling anti-aliasing, or forcing adaptive anti-aliasing, _should_ fix the issue.
     
  36. joelfivat

    joelfivat

    Joined:
    Aug 14, 2013
    Posts:
    45
    I'm not sure it is the same problem as in this thread, but the solution should work as well.

    For my voxels, I use an very small offset of 0.0001 when building voxel faces. It is invisible to the eye and removes artefacts.
     
  37. DavidWilliams

    DavidWilliams

    Joined:
    Apr 28, 2013
    Posts:
    522
    It looks to me like that is what is happening in Rod Galvao's case, whereas CallHimX's case is visually distinct and looks more like cracks between the quads (as you describe).

    Anyway, I just wanted to make sure you were aware of the texture filtering possibility but it seems that you are.
     
  38. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    Solved. Issue related to AA indeed.

    For others with the same problem go to Edit->Project Settings->Quality, select a quality level without anti-aliasing or set it off.

    Both editor view and game view will show the world correctly now.

    Thanks guys,
    R.
     
  39. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Ah, this does seem like it would solve the problem completely, and it's clean and simple. Thank you! I'll try to do this in the next update.
     
  40. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    This looks really interestesting. For me, as others mentioned before, the clean multiplayer-support would be crucial and I'd buy it right away if there was one integrated. Any timeplan/roadmap for that maybe? :) Thanks!
     
  41. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    +1 vote for multiplayer. The difference is I already bought it and it's great stuff the way it is right now.

    BTW, I'm replacing MinePackage (aka MineFoundations) with Uniblocks in my project. There are very few things I found in MinePackage that are (as of feb/2014) better, like calculated lighting and some optimizations. But, and that is a big but, Uniblocks is way better organised, documented and flexible. So those who are using MinePackage, don't think twice switching to Uniblocks.

    BTW2, I'm not related to Uniblock's maap. :D I'm just excited now that there is a good solution on asset store.
     
    Last edited: Feb 23, 2014
  42. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Multiplayer support is definitely planned, though I can't give you a specific timeline. I really don't want to overpromise or rush things, but don't worry, it is coming.
     
  43. CallHimX

    CallHimX

    Joined:
    Jun 16, 2013
    Posts:
    7
    I purchased it too, cuz I can't wait anymore to play around with. :)
    Currently I try to understand the world generation.

    I have one question, whats the best way to add things on top of the world?
    Like grass or something else. Each thing that I've tried failed in something strange. :D
     
  44. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    The basic idea behind world generation is that you take every individual voxel, and determine what type of block it is based on the voxel's position and some procedural algorithm - Perlin noise is a common one here. It can be quite tricky to get the scale right though, only a very narrow range of scale values will give you good results. I think it just takes a lot of trial and error.

    If you want to generate grass on top, one way of doing that would be to check if the voxel above is empty. So you'd have to do two checks per voxel - one to check if this block is dirt, and another to check if there is empty space above, and set the block to grass instead if there is.
    I think the way I'm doing it in the example generator is that I first set everything to grass, and then overwrite all the grass one level below with dirt. Either way, the idea is to offset the voxel position by 1 vertically. There are probably better ways of doing it, but these are just some ideas you can explore.

    To be honest, I don't really have all that much experience with world generation myself, but I'll do my best if you need some more help or clarification.
     
  45. Drommedhar

    Drommedhar

    Joined:
    Sep 24, 2013
    Posts:
    78
    Hey maap,
    as I saw that you are also working on adding multiplayer support to Uniblocks, I thought I post this here.

    For our project we want to use Uniblocks for the terrain generation (obviously) and as the project needs to have a sever which handles terrain generation (all done through the unity headless mode), I tried to split the Uniblocks system into 2 parts. One for the whole terrain generation and one which simply displays this information.

    Let's say I got as far as like 50%. The server generates the data, where the player currently is and is able to transmit this data via RPC calls to the client, if they request chunks. The problems are:

    - The client only receives around 70% of the chunks available (could be a problem on the network side)
    - But more improtantly, the server currently does not generate new chunks if it doesn't have them already and it does not send chunks which are outside it's view distance. Even if these chunks were generated before and loaded from disk, they do either not exist or are plain flat.

    I hope you know a way which will enable us to simply put the whole generation on the server side and have a client just show the data. Even block placement would be completly done on the server, which would later receive a block place/delete request and will update everyone accordingly.

    If you want to have a look at my code, I would kindly give you access to it by email, so we might get somewhere together.
    The asset itself is very promissing and is really good documented, but unfortunately it's still hard to split it up into 2 different systems.

    Thanks in advance.

    EDIT:
    I might add that the server will later not display and graphics, so he does not need any mesh data.
     
    Last edited: Mar 4, 2014
  46. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    You can send me the code and I'll try looking into it tomorrow, but for now just a few quick notes:

    I think you don't need to split stuff too much, perhaps it's possible to keep most of the original code intact and only make a few modifications in very specific places:

    - On the client side, change Chunk's GenerateVoxelData to request the data from server instead of generating it's own data (which I'm guessing you've already done)

    - On the server side, whenever a client requests chunk data, load the chunk normally on the server (which would either load the data from the server's hard drive or generate new data) and then send the data to the client's chunk.
    The only tricky part here is that there is currently no easy way of loading only one specific chunk. You could either write a custom chunk loading script, or just load the chunk normally using SpawnChunks with a range of 1, but that might cause some inefficiencies because you'll be unloading previously spawned chunks, which is probably not a good thing in this case.
    For a custom chunk loading script, I think all you'd need to do is just instantiate the chunk prefab and set it's ChunkIndex to whichever one you need, and then the chunk should take care of itself (automatically load/generate data).

    Since the chunk will be loaded normally, exactly as it would be in single player, it should always have the correct data to send, which should eliminate all of the problems you described.

    - You can also disable mesh generation on the server side just by commenting out the RebuildMesh function of Chunk.


    So basically: Client requests chunk -> Server loads chunk locally -> Server sends chunk data to client -> Client's chunk processes the data, displays the mesh, etc.

    Obviously in addition to that you would also need some way of synchronizing block changes made by players, but that should be simple enough.

    Anyway, I'm not entirely sure if this actually makes sense, I'm in the process of working this out myself, so let me know if there's something I missed.
     
  47. Drommedhar

    Drommedhar

    Joined:
    Sep 24, 2013
    Posts:
    78
    Hey,
    first thanks for the great answer. This solved a lot of problems and my code is now working properly.
    I now have to make sure that the transmission between both sides is as fast as possible, but that's something I have to consider.

    Interestingly enough I now got the old bug where on highest quality settings the transparent lines appear between blocks. Need to check why this came up. Also a lot of the chunks below the current terrain are rendered as they don't get updated. Maybe I need to update the terrain from top to bottom. Have to check this.

    Other than that, you really helped us out here. Thanks again for the great support.
     
  48. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Ah, that's one thing I missed in the previous post. It would make a lot more sense to transfer the data compressed, the same way it's stored on the hard drive, instead of the raw data in memory. You can copy the SaveData function from ChunkDataFiles to do simpe RLE compression and then send the compressed data as a string, which would probably be the simplest solution.

    The lines should go away if you disable anti-aliasing in the quality settings. Not sure what's going on in the second problem though, if you could explain in more detail, that'd be great.
     
  49. BlueSin

    BlueSin

    Joined:
    Apr 26, 2013
    Posts:
    137
    We were thinking about buying Uniblocks for our project. Is it possible to use Uniblocks to create 2D maps more like Terraria and Starbound? I should think it would not be too hard to manage if all the code is available, to just cut out the Z axis. How easy or hard would it be for us to modify the code to allow for this?
     
  50. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    It's very easy, you just need to always leave blocks empty if their z position is different than 0, for example.

    Here's an example with just one extra line in the terrain generator script:
    if (chunk.VoxelIndexToPosition(x,y,z).z == 0)
    This basically makes sure that only blocks with absolute z position 0 get generated, and the others remain empty.
    $2d.JPG

    You might also need to add similar checks in places where blocks are changed (placing blocks by players, etc), depending on your gameplay mechanics.