Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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
    Thank you for the clarifications! I'll have to be a lot more careful with these things from now on.

    Honestly, I think it is partially my fault for failing to communicate the purpose and features of this asset clearly enough. The screenshots can give the impression that this is a Minecraft-like game engine, many people don't bother reading the documentation, and the description could be worded better. But then again, it is very hard to write a good description that communicates everything clearly, and I don't really know how to word it better aside from putting a huge "DISCLAIMER: This is NOT a game engine" in bold font at the top. Actually, maybe I should just do that...
     
  2. theultimatepwn

    theultimatepwn

    Joined:
    Dec 14, 2012
    Posts:
    6
    I think that the description is about as good as it will ever get, but what do I know.
    A quick question. I keep trying to think of a good way to add rotation for some blocks. For example I made a security camera and monitor (It is a custom mesh) and I need to have it rotated to different orientations. Any suggestions for the cleanest method of doing this?
     
  3. Roachie

    Roachie

    Joined:
    Aug 2, 2009
    Posts:
    67
    Does this engine only generate the surface level cubes , or can it also do deep caves e.t.c underneath the terrain. If not , how hard is it to adjust it to do caves and also work well with saving?
     
  4. eabykov

    eabykov

    Joined:
    Jan 12, 2015
    Posts:
    11

    is it possible to check for the presence of blocks from all sides? and how to write a script that checks?
     
  5. theultimatepwn

    theultimatepwn

    Joined:
    Dec 14, 2012
    Posts:
    6
    This should answer your first question: http://i.gyazo.com/27bdf3d450bedc991a31b6bb835da38f.png
    Caves are possible but you just have to write the code to make them, I suggest perlin worms.
    It will save anything generated or built from my experience.
    Also, it does not ship with that terrain generator, my water, or my textures. :p (But the terrain will have depth and a minecraft like appearance regardless)
     
    Last edited: Jan 22, 2015
  6. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    The simplest method would be to create four different voxels and have them use four different meshes, though that's slightly inefficient in terms of memory, because you'll have to store the same mesh four times, once for each rotation. But it wouldn't require any modifications to the code, and you could have some voxel naming convention to keep track of the rotations (for example, if voxel id 45 is the default "north" rotation, id 450 would be "south", 451 "west", and 452 "east").

    The more efficient but also more difficult thing would be to add a mesh rotation property to the voxels, which could be set for each voxel with a custom mesh and applied when building the mesh. You would still have four different voxels for each rotation, but all four would use the same mesh, except each would rotate it differently while building the chunk mesh (in ChunkMeshCreator's CreateCustomMesh function). The problem would be to actually rotate the vertices of the mesh - since I wasn't able to find a solution for this in 5 minutes of googling, I'm guessing it's not that simple, but I'm sure it could be done.

    The answer in the post above is pretty much spot on. Terrain is stored in 3 dimensions, so not just surface, but generating caves will require some coding.
     
  7. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Sure. To check if a block next to the current one is empty, you can do

    Code (CShar0p):
    1. // currentVoxel is a VoxelInfo of the current voxel
    2. if (currentVoxel.chunk.GetVoxel (currentVoxel.index.x+1, currentVoxel.index.y, currentVoxel.index.z) == 0)
    then you can repeat this for different offsets (x+1, x-1, y+1, y-1, z+1, z-1). Though this is still not very useful for finding floating blocks. It will find single, isolated floating blocks, but two connected floating blocks will have a block next to them so they will fail this check.
     
    eabykov likes this.
  8. eabykov

    eabykov

    Joined:
    Jan 12, 2015
    Posts:
    11
    Sanks, I have a problem why my dude cant destroy blocs near him, on the ↓↓↓ screenshot ↓↓↓
     

    Attached Files:

  9. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Um, I don't know, but it must be something on your end. I can only guess, but it seems like maybe the player model blocks raycasts? Try putting the player on the Ignore Raycast layer and see if that helps.
     
    eabykov likes this.
  10. eabykov

    eabykov

    Joined:
    Jan 12, 2015
    Posts:
    11
    Thank you for your previous answers, but I have a problem I can not solve, is that when you put a block under you falls to the map, it's not my error it was from the start
    Please help me to solve this problem
     
  11. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
  12. eabykov

    eabykov

    Joined:
    Jan 12, 2015
    Posts:
    11
    In a script where to write it?
     
    Last edited: Feb 3, 2015
  13. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    One possible way to do it would be like this:

    In DefaultVoxelEvents, right below the line commented // place block with RMB:
    Code (CSharp):
    1. // player collision
    2.   Transform player = GameObject.FindWithTag("Player").transform;
    3.   Index playerPosition = new Index (Mathf.RoundToInt(player.position.x), Mathf.RoundToInt(player.position.y), Mathf.RoundToInt(player.position.z));
    4.   Index voxelPosition = new Index (Engine.VoxelInfoToPosition(new VoxelInfo(voxelInfo.adjacentIndex, voxelInfo.chunk)));
    5.  
    6.   if (Index.Compare (playerPosition, voxelPosition)) { // if player position and voxel position are the same
    7.     return;
    8.   }
    9.  
    10.   playerPosition.y += 1; // player is 2 block tall, so we need to check the upper block collision too
    11.   if (Index.Compare (playerPosition, voxelPosition)) {
    12.     return;
    13.   }
    Keep in mind it's just an example and won't always work in every situation, like for example if your player's collider is a different size, or for blocks placed in some other way than the default right-click, so you might need to adjust it depending on the needs of your project.
     
    eabykov likes this.
  14. eabykov

    eabykov

    Joined:
    Jan 12, 2015
    Posts:
    11
    1) Does it check by position of other players?
    2) How to make blocks without support from the bottom fell down under the map and then disappeared?
    3) On what basis is the removal of the block in the script CameraEventsSender? Because I want to add the ability to break the weapon units and wish that it broke the blocks are not the first time (assignment unit = 100 health damage caused by such weapons damage = 50 and with every shot takes health, then check if health is 0 or less then the destruction of block) how to make the destruction of the block?
     
    Last edited: Feb 5, 2015
  15. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    1 - No, this only works for the default single player demo scene. If you have any extra players, NPCs, etc, you'll need to adapt the script to include them.

    2 - I answered this in this post
    http://forum.unity3d.com/threads/un...xel-terrain-engine.226014/page-4#post-1925266

    Basically, every time you destroy a block, check if there is a block above. If there is, destroy it, then create an object that looks like a block and have that object fall down. Blocks that are part of the terrain cannot be moved, so that's why you need to create a dummy block to make it look like the block is falling.

    3 - The voxels do not store any damage/health information, so if you want to add health values to the blocks, you'll need to do that on your own, outside of Uniblocks. You could track the current block damage somewhere and only call Voxel.DestroyBlock when health reaches 0.
     
  16. eabykov

    eabykov

    Joined:
    Jan 12, 2015
    Posts:
    11
    1) Yes, I write Voxel.DestroyBlock (0); in the code of fire, but an error it can not find such a function Voxel.DestroyBlokk what to do? how to write in the shooting that would block destroyed?
    2) can explain the function set and break the blocks and how to insert them in my code?
     
    Last edited: Feb 11, 2015
  17. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    I'd really recommend you to read the user manual and scripting reference carefully, they explain everything you need to know. I'm doing my best to help, but all the information you need is available in the documentation, or the previous posts.

    Anyway, I'll answer your questions but again, all this stuff is explained better in the scripting reference.

    Blocks are destroyed simply by changing the voxel to an empty one (id 0). You can do that either by directly accessing a chunk and changing a specific voxel in that chunk (in that case, you'd use the Chunk.SetVoxel function), or you can use the Voxel.DestroyBlock function. Voxel.DestroyBlock needs a VoxelInfo as an argument, which points to a specific voxel in the world.
    Also, judging by the error you're getting, you're probably missing the Uniblocks namespace in your script - try Uniblocks.Voxel.DestroyBlock() instead.
     
  18. HumanSquid

    HumanSquid

    Joined:
    Feb 9, 2015
    Posts:
    15
    Is there a standalone that will work on a mac or maybe a way to test it in Unity?
     
  19. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
  20. HumanSquid

    HumanSquid

    Joined:
    Feb 9, 2015
    Posts:
    15
  21. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Well, that's annoying... I might have done something wrong, but since I can't do any testing on a Mac myself, I don't think I'll be able to fix that.
    I'm really sorry, but I'm afraid that means there's no Mac demo for now :(
     
  22. HumanSquid

    HumanSquid

    Joined:
    Feb 9, 2015
    Posts:
    15
    No prob! Thanks for the effort. I just wanted to see how fast it was in a stand alone!

     
  23. HumanSquid

    HumanSquid

    Joined:
    Feb 9, 2015
    Posts:
    15
    Hey! I figured out it was a permission issue ( I had a similar problem with a windows / mac app I downloaded today) A chmod ugo+rwx on the app in the console fixed it!

    Thanks the demo runs well. It's fast!

     
  24. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Hey there!

    I'm just wondering about support and updates. Is this going to remain supported (and updated?), or end up discontinued soon?

    I am interested in purchasing it, if it will remain supported.

    Thanks,
    Jason
     
  25. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    I have no plans to discontinue supporting Uniblocks for the foreseeable future. An update adding support for Unity 5 should be coming out very soon, and I'm also working on some performance improvements.
    And of course if you have any questions, I'll always be happy to help.
     
    zkwentz and JasonBricco like this.
  26. kun_at_tribes

    kun_at_tribes

    Joined:
    Mar 11, 2015
    Posts:
    2
    Hi there!

    I take a quick look at the documentation and have some questions for you.

    1. How many blocks can uniengine supports?
    2. Is it possible to swap the texture of a block on the fly?
    3. How many textures can the Chunk prefab take? We potentially may have many (>100+ !!) type of blocks
    4. Have there been attempts to optimize it for mobile?
    5. I was trying out the android build and it seem to hang or isn't responsive at all. May I try a more recent mobile build?
     
    Last edited: Mar 11, 2015
  27. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    1. Depending on what exactly you're asking about:
    - Different types of blocks: practically unlimited
    - Blocks on the screen at one time: depends on the hardware, but on an average gaming machine a view radius of 128 blocks or more with stable 60 FPS.
    - The amount of blocks that can exist in the game world: infinite. Technically there's a limit on chunk index sizes, but you'll almost certainly never reach these numbers.

    2. Yes, you can swap textures just like you can on regular GameObjects.

    3. Uniblocks supports texture sheets so you could easily fit 100 blocks on one texture. You're not limited to just one texture sheet though, you can use as many separate materials (with their own textures, shaders etc) as you want.

    4. Mobile isn't really the target platform for this asset, but it does run okay. Just expect the performance to be quite a bit worse than on a desktop.

    5. I'll release a new android build in a few days, when I'm done working on the upcoming update. Should be up in a few days. The current build should work fine though, it could be a problem with your device.
     
  28. Basbo

    Basbo

    Joined:
    Oct 3, 2013
    Posts:
    11
    Hey there,
    I'm just working with Uniblocks for a few days now and project, codebase and documentation seems quite good!

    Two questions:
    1. Is there a date for the announced Unity5 version of Uniblocks? Most of my currently used project modules are now U5ready, so it would be nice to switch to U5 in near future.

    2. I'm looking for a possibility to import some voxel data in a Uniblocks chunk. It would be very efficient to import some small structures in .vox or .qbicle format instead of building them ingame voxel after voxel. This could be a quick and dirty import without textures etc., just the voxel structure itself in a appropriate chunk - is there any chance for this workflow?
     
  29. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    1. The Unity 5 update is already finished. It's currently pending approval, so it should be available for download in a few days.


    2. I'm not familiar with .vox or .qbicle formats, but it would be pretty easy to import voxel data as long as you can get direct access to the voxels in the file and determine the coordinates of each voxel (x,y,z). If you have these, all you need to do is simply Chunk.SetVoxel (x,y,z, voxelData) for each of the voxels in the file. You might also want to apply a constant offset to the x,y,z values to set the imported object's position within the chunk.

    Probably the tricky part here is parsing those file formats to extract the voxel data from them, though unfortunately I can't find any information on them anywhere so I can only guess here.

    If you were able to point me to some sort of documentation for these formats, I could perhaps try writing an importer script. Googling doesn't seem to give any meaningful results...
     
  30. Basbo

    Basbo

    Joined:
    Oct 3, 2013
    Posts:
    11
    Thanks a lot, that are good news!
    Would you mind to send me a dropboxlink with the U5-Version, if I send you my order number via pm or email?

    Regarding the voxel formats, I found an importer script in C# for MagicaVoxel .vox-files and a description of the format itself - this could be a good starting point for a Uniblocks import.
    http://www.giawa.com/magicavoxel-c-importer/
    https://voxel.codeplex.com/wikipage?title=VOX Format

    There exist some slightly different .vox-formats (..voxlap .vox-format...), but the described MagicaVoxel .vox-format seems to be the most common and recent variant.
    The Qubicle Editor is the actual choice of the professionals, imports nearly all formats, but exports mainly qubicle binary QB and voxlap .vox files. A documentation of Qubicle Binary can be found here:
    http://minddesk.com/wiki/index.php?title=Qubicle_Constructor_1:Data_Exchange_With_Qubicle_Binary

    Alright that are the first results of my quick enquiry. I think it makes sense to support both most used voxel editors MagicaVoxel and Qubicle, but since MagicaVoxel is open source and can import .qb-files, the mv .vox-files should do the job for most cases.
    https://voxel.codeplex.com/wikipage?title=Import Export&referringTitle=MagicaVoxel Editor
     
  31. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Thanks for the links. I wrote a quick and dirty .vox importer script based on the one from the first link. Seems to work fine, but consider this an unofficial release. I'd like to add a cleaner version of this in a proper update sometime in the future, and possibly one for Qubicle as well.

    I tested this one with the MagicaVoxel editor. It converts the colors from the palette into voxel id directly, so for example color index 1 in the MagicaVoxel's palette converts to voxel id 1 in Uniblocks.

    To import voxels, use the static function VoxelImporter.ImportVoxels ( string filePath, VoxelInfo originVoxel )
    filePath is the full path to the .vox file (including extension)
    originVoxel is the location in the world where the file will be imported (starting at the 0,0,0 corner)

    Let me know if you run into any problems.

    https://www.dropbox.com/s/d1ic8sn5zffwn55/VoxelImporter.cs?dl=0

    Sure, just send me the invoice number, preferably by email.
     
    Basbo likes this.
  32. Basbo

    Basbo

    Joined:
    Oct 3, 2013
    Posts:
    11
    That's awesome, I will test the new importer script the next hours!
    Have send you an email with the invoice data. Thanks again :)
     
  33. MasterAcer90

    MasterAcer90

    Joined:
    Feb 24, 2015
    Posts:
    4
    Hi Maap,

    First, great engine, but i have a problem with add a Block from a mesh. He load the texture not :-(.
    I have upload to Pic´s to see my problem, please help me :-D.

    My 3D Object was created with blender3D.
     

    Attached Files:

  34. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    By default, custom meshes use the same texture sheet as the blocks, because the custom mesh becomes a part of the chunk mesh when it's placed.

    There are two ways to set a texture for a custom mesh:
    - add your texture to the main texture sheet, and unwrap your model's UVs onto the whole sheet
    or
    - add another material (with your texture) to the Chunk prefab's renderer, and set the voxel with the custom mesh to use that material instead (in Block Editor -> Material index. 0 is the first material attached to the Chunk prefab, 1 is the second, etc)
     
  35. MasterAcer90

    MasterAcer90

    Joined:
    Feb 24, 2015
    Posts:
    4
    Thx Maap, thats help. :-D
     
  36. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,473
    Playing the demo, I fell through the ground when building a tower underneath me. Do collider get added after mesh build?
     
  37. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Colliders are updated instantly. Falling through terrain can happen if you place a block on top of the player, because then the player is suddenly inside the terrain collider, without a collision actually occurring. It's just the way colliders work.

    This can easily be avoided by checking if there are any colliders occupying the space where a block is being placed.
     
  38. MasterAcer90

    MasterAcer90

    Joined:
    Feb 24, 2015
    Posts:
    4
    Hi Maap, :-D

    I am sorry to bother you again, and indeed how can I get for a single Voxelcube Light Effects, Particle Effects and TonEffects? With scripting, or must the Game Objects directly into the block Prefab?

    Thank you in advance for your help.

    yours sincerely: Acer
     
  39. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    You want to attach some effects to one type of block, right? Adding them to the block prefab won't do anything, because the prefabs don't actually get instantiated. You'd need to do this through scripting. For example, whenever a chunk is updated, iterate through all it's voxels to find the specific voxel id, and instantiate your effects at the position of each voxel with that id.

    The script for that would be something like this:
    Code (CSharp):
    1. for (int x=0; x < Engine.ChunkSideLength; x++) {
    2.   for (int y=0; y < Engine.ChunkSideLength; y++) {
    3.     for (int z=0; z < Engine.ChunkSideLength; z++) {
    4.       if (GetVoxel (x,y,z) == 5)    { // target voxel id here
    5.         Instantiate (particlesPrefab, new Vector3 (transform.position.x + x, transform.position.y + y, transform.position.z + z), transform.rotation);
    6.       }
    7.     }
    8.   }
    9. }
    10.  
    You'll need to delete all previously spawned particles to avoid duplicates before spawning new ones. You could also keep track of existing particles somewhere in your script to avoid deleting and recreating the same particles, but that would be slightly more complicated. This method should work well enough in most cases.
     
  40. Ellandar

    Ellandar

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

    I'm attempting to integrate my water asset into Uniblocks again, but I'm having a little trouble (history HERE).

    Basically there's two problems:
    1. Mesh/Collider generation is a bottleneck.
    2. Retrieving a voxel is a bottleneck.

    First, a big disclaimer: I'm using the word bottleneck instead of slow, because I know that 1 is a unity limitation in most cases, and 2 is something you identified in the documentation as a more heavy query. In normal situations both of these items perform fine, it's just in this situation my water simulator is rather mean to those two operations.

    I'd like to tackle number 2 first and then later on come back to 1. My problem is I query your simulator 1000's (often 20,000+) of times per tick of the water simulator. Ticks are a variable option in Liquid Voxels but it defaults to 10 times a second.

    My question is, what is the fastest possible method I could use to locate a voxel in uniblocks given a world co-ordinate? I don't mind if it means I need to keep a cached array of chunks, or whatever hoops need to be jumped through as in this case the absolute fastest method is key.

    - Ell
     
  41. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    Glad to see you're still working on the project! I haven't heard from you for a while so I was worried it was abandoned.


    For looking up voxels, there are definitely ways to do it much faster. The main bottleneck here is finding the reference to a specific chunk. Since the world is infinite, it's not really possible to store the chunks in a static array for easy access. Currently they're stored in a list, so the lookup takes a long time (and it happens every time you call PositionToVoxelInfo). Changing the list to a dictionary will make this several times faster. This is really something I should've done in the first place, but for some reason I went with a list instead - will be changing that in a future update.

    You can fix this easily enough just by changing ChunkManager.Chunks to a Dictionary<string,chunk> (using Index converted to string as keys - using an int might be risky because you could potentially have more chunks than an int's max size).


    However, this by itself is probably not going to be enough, as dictionary lookups are still pretty expensive. What you should be focusing on mainly is reducing the number of GetChunk calls, which means you need to have the reference to the chunk you're looking for readily accessible.

    I don't know how your engine interacts with chunks, but perhaps you have some way of limiting the voxel lookup to the local chunk? For example, in Uniblocks the MeshCreator doesn't need to find any chunks, it just stores the reference to it's own chunk and looks up voxels directly through Chunk.GetVoxel, which is just a basic 1d array lookup, which is as fast as it gets.
    If you can somehow do the same from your engine - simulate the water locally, within the scope of a chunk - that would eliminate the need for GetChunk calls.


    If you can't do that, there are still ways to drastically reduce GetChunk calls. One thing I can think of is to store the most recently accessed chunk in a temporary variable, and only refresh it when you actually need a new chunk reference. If your voxels are updated sequentially rather than randomly, most of the time you'd be accessing the same chunk many times in a row. So you could just check whether the currently stored chunk is the one you need for the current voxel, and only look up another chunk if it's not the one. You can use Engine.PositionToChunkIndex to check which chunk index contains the voxel, and this should be a lot faster than a dictionary lookup to search for the chunk again every time.


    Another thing to consider is that each chunk contains a reference to it's neighbor chunks. So once you look up one chunk, you can access all other conencted chunks directly just by a simple index offset system. You would need a little bit of math to convert between the positions, indexes and offsets of voxels and chunks, but it should still be a lot faster than the dictionary lookup.

    So for example, you pick some origin chunk, and you want to look up a voxel that is in some other chunk - you find out how many chunks away the voxel's chunk is from the origin chunk (an x,y,z offset), and you traverse the neighbor chunk references starting at the origin chunk to find the one you're looking for.

    The neighbor chunks are stored in the Chunk.NeighborChunks array, with the index corresponding to the Direction enum. This array is sometimes not fully up-to-date, so it might be necessary to force it to update it if it returns a null value.


    There are probably some other things you could do that I can't think of right now, and I'm not really sure how well these methods would work in practice, but you get the idea - the important thing here is to reduce GetChunk calls and use chunk references directly as much as possible.
     
  42. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    Thanks Maap, that's really good info!

    The chunk info is really golden, as I expect I could write a chunk cache in my voxel interface that was world position aware. Then store the chunk info there. The chunks could eventually fall out of the cache if not accessed for a long period of time (just in case the array gets massive).

    I have a few good ideas already, I'll give the interface another shot now.

    Cheers!
     
  43. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    That worked wonders, it's gone from 3-4 fps with 1 update per second (300 blocks) to 15-20 fps with 10 updates per second and 1000 blocks. Thats a MASSIVE difference.

    I implemented a "currentChunk" reference which is looked up on index number.
    Also implemented a chunk cache, as the flowing water in these terrains would only be a small percentage of the total number of chunks.

    Works well enough now for me to believe that this is a supportable voxel engine for my go live. Thanks again for your help Maap, I'll probably be back with some further questions in a month when I begin optimising for release.

    - Ell
     
  44. Endzone

    Endzone

    Joined:
    Dec 18, 2014
    Posts:
    119
    Hey , just a quick question i kinda need a little help ...

    im just wondering how i would go about adding my own blocks and then apply my own textures to them from the texture sheet? im a little lost i have put my textures onto the texture sheet but from their i have no idea what to do ......
     
  45. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    There is a section on textures in the user manual, you'll find detailed explanation there, so please check it out.
    But basically, you need to set the X and Y coordinates of the texture in the block editor for your block. The X and Y coordinates correspond to the location of your texture in the texture sheet (so for example X: 2, Y: 1 is two right, one up, starting from the bottom left corner of the sheet)
     
  46. Endzone

    Endzone

    Joined:
    Dec 18, 2014
    Posts:
    119
    ohh ok i see now, wow ..... Sorry for wasting your time i thought i had checked the users manual .... Aparently not .. Thank you :)
     
  47. Endzone

    Endzone

    Joined:
    Dec 18, 2014
    Posts:
    119
    Hey mapp sorry to bother you Again ..... but i got a quick question.. i was wondering if you would have any ideas on how to go about implementing a simple Voxel water system so that it will randomly spawn around the world in small lakes.. ive attempted this myself but it didnt go so well... would you have any idea on how i could do this ?
    and also for some reason when i was trying this my self i was applying a script to the block i was useing in the block editor and the script dosent seem to work at all when the block is spawned in the world but for some reason it does work on the block that gets put into the scene when your useing the block editor ? .. was wondering if you knew why ? - thank you so much in advance u have been a great help so far :)
     
    Last edited: Apr 12, 2015
  48. RawLionWorkshop

    RawLionWorkshop

    Joined:
    Jan 29, 2014
    Posts:
    206
    I'm afraid there is no such thing as a simple voxel water system. Any water system, even a relatively simple one, would be way too complex to explain here, and it would probably take weeks if not months to actually develop.
    However, there is actually a voxel water system being developed by someone which you might be able to use, check out this thread:
    http://forum.unity3d.com/threads/liquid-voxels.242821/page-3#post-2053552

    The block objects are not spawned in the scene (that would mean instantiating hundreds of thousands of GameObjects, and Unity wouldn't handle that very well). So basically scripts attached to the block prefabs don't do anything, except when used for voxel events. Check the section on interacting with the blocks & scripting in the manual for more information on this.
     
  49. Endzone

    Endzone

    Joined:
    Dec 18, 2014
    Posts:
    119
    yea i figured out how complex it would actually be to get "simple" water in my game about 2 hours after posting my question ... and i actually did check out Ellandars voxel water system and its pretty impressive, ive been playing around with it now for quiet a while and i think its the way to go :p

    and thanks for answering my question about the scripts attached to the blocks i have been trying to figure out why for quiet sometime now and now i know why haha :) - Thanks Again for your help
     
  50. Nyother

    Nyother

    Joined:
    Mar 20, 2015
    Posts:
    4
    Hey Maap,

    i play around with your engine for some time now, all works fine and i added a few things to it to get a better understanding. I want to add now a "Wobbly Effect" i guess its called so. I cant find a good reference to do something like that, so i wanted to ask if you can point me in the right direction? But since it is not a question directly related to the Engine itself its no problem if you dont got a answer :)

    Example what i mean

     
    Last edited: Apr 15, 2015