Search Unity

Laircraft: Voxel Engine

Discussion in 'Assets and Asset Store' started by LaireonGames, Feb 15, 2017.

  1. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    @LaireonGames - The discord invite link on the asset store has expired. May want to fix that :)
     
  2. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Hey HeadClot,

    I have a feeling I have already replied to your email so figure I will repeat myself publicly :)

    I took down the Discord since I got sick of unreasonable requests turning into 1 star reviews, thought I had updated the store page to show this but seems not so gonna do that now
     
    HeadClot88 likes this.
  3. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    Can you tell on which script i will put the break point in monobehaviour so that i can understand the work flow of generating the world as well as blocks interactions?
     
  4. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    The world itself is in two places: TerrainGenerator and BiomeMap. This will populate the worlds shape but has nothing to do with mesh creation (guessing that is currently your interest). Terrain generator should be pretty self explanitory, from the comments, but the biome map is a bit trickier, its better to get used to the editor first with that one before diving into the code

    Block interaction is all through block events. They are called and driven mainly from CameraEventsSender which raycasts into your world and applys the correct events depending on the block hit
     
  5. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    On empty scene from where i should start if i want to add two functionalities. One is generating world and other is blocks interaction.
     
  6. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Don't start from an empty scene :p There are too many settings and scripts interacting with each other to easily explain how to start from scratch, this sort of methodology is what keeps the engine running quickly rather than having to constantly check if certain components are around or not.
     
  7. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    Can you elaborate it properly?
     
  8. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    Im trying to do the following:

    1>Introduce a custom FBX mesh into the scene so that when when I add it in, it works like any other cube mesh
    i.e when I click my custom FBX mesh adds onto the terrain.So im trying to create an animated switch for example.

    2>When I create a new class in Custom Block Events called Switch , and Im trying to put my custom FBX in that.

    3>Im trying to add that custom block into Terrain Generator however it throws a null exception

    4>Which script should I modify ,so I can introduce a custom FBX?
     
  9. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Bottom line, no. This is not how complete projects work, its not designed to be easily broken apart since doing so will require a LOT of extra engineering and at the expense of speed and stability.

    If you want to break apart any complete project you just gotta dig through the code.

    Take Facebook messenger as an example. Imagine asking them to just give you the chat code so you can host it on Amazon. It doesn't work like that... They will have hooks everywhere for things like profile and analytics that are specific to them. So to take chat you need to take profile which is probably the majority of their code but profile probably doesn't work without timeline since your profile has timeline built in and you unravel this HUGE thread.
     
  10. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    1) that can be done in the block editor, there is a section for custom meshes. However for animating you probably want a prefab which is what the existing chest objects do, they spawn an empty block in the world, then a Unity prefab on top which passes events into the system

    2) Events are linked to blocks, not a specific mesh/prefab. Take a look at the custom events video on my vimeo. So you make an event, register it in CameraEventsSender and then in the block editor you select that event so it can apply to multiple blocks. This way, there is no garbage and 1 event can effect any number of blocks.

    3 and 4) no need to edit any scripts for a custom mesh :) Just drag it into the custom mesh section of the block editor
     
  11. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    Atleast you can tell on which script i put breakpoint in monobehaviour, so that i can check the flow in your demo scene?
     
  12. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705

    I told you this before :/ The files are heavily commented to explain what each method does. E.G I think TerrainGenerators first method is called GenerateTerrain and thus generates terrain :p As I said, BiomeMap is trickier and I would recommend getting familiar with its editor before going through its code. There are 2 videos on how to do that on my vimeo
     
  13. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    Hi,

    1>I am trying to add a custom mesh , for instance an animated lever that will spawn like
    other blocks in the world like Stone etc.

    2>Can you tell me how to add it?Ive tried Wooden Chest , but its a Game Object.

    3>Ive tried searching Structure Editor for Wooden Chest and Block Editor but have found no reference to the Wooden Chest

    4>Im trying to add Wooden Chest into the game scene so I can see how its animation setup is and will try to duplicate its behaviour to add my own custom mesh with animation

    5>After adding custom mesh ,can I add/remove that inside world just like normal blocks and also interact with chest?

    6>How can I get rid of water because right now in demo scene ,water is everywhere and I get infinite null reference errors when I run the base package?Im using Unity 2017.
    Enclosing the console debug here:

    ck(Int32, BlockType, Int32, Int32, Int32, Boolean) (at Assets/Laireon Games/Laircraft/Scripts/Meshes/ChunkMeshCreator.cs:284)
    Laircraft.ChunkMeshCreator:CalculateMesh() (at Assets/Laireon Games/Laircraft/Scripts/Meshes/ChunkMeshCreator.cs:161)
    Laircraft.ChunkMeshManager:CalculateMesh() (at Assets/Laireon Games/Laircraft/Scripts/Meshes/ChunkMeshManager.cs:115)
    Laircraft.Chunk:CalculateMesh(Boolean&) (at Assets/Laireon Games/Laircraft/Scripts/Chunk.cs:938)
    Laircraft.ChunkManager:CalculateMesh(Chunk, Int32, Boolean&) (at Assets/Laireon Games/Laircraft/Scripts/ChunkManager.cs:1250)
    Laircraft.ChunkManager:RunThreadedTasks(Int32[], CachedList`1[], ThreadTask, ThreadTaskCheck) (at Assets/Laireon Games/Laircraft/Scripts/ChunkManager.cs:781)
    Laircraft.<StartThreadWork>c__AnonStorey1:<>m__0() (at Assets/Laireon Games/Laircraft/Scripts/ChunkManager.cs:721)
     
    Last edited: Aug 9, 2018
  14. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Dude, slow down and watch some of the videos!

    For the block editor, its not the code its the editor window. So press Ctrl+E (whilst the game is not running) or use the top menu Laircraft/Editors. Then go to the blocks tab and search for Oak Chest. It will show you a setup where an empty block is spawned along side the chest prefab.

    If your making a new block what you need is:
    Ensure empty mesh is checked (this means the usual cube doesn't spawn)
    Ensure the collider is set to cube (if your prefab is cube shaped, if not set it to mesh and drag in a mesh for its collisions)
    Drag your prefab into the spawn on create section

    At this point you can spawn your prefab into the world and interact with it as a normal block, but it wont animate. To check your block works go to the inventory tab at the top (So Ctrl + E again, then inventory) and within that go to starting inventory. Then change one of the starting block types to your new block (or to Oak Chest to test that). Make sure the first setting is block, not item, since you can have items that are not blocks, e.g a pickaxe.

    To get it animating, you need a custom block event which means making a new script. Everything up until now has been in the editor and has involved 0 code. For your event I suggest checking out Chest.cs and copying what you need which is the OnMouseDown method, I use TriggerTransition (my custom animations class) to animate opening of the chest.

    Once you have the class made, you need to register it in the CameraEventsSender. If you stuck here, watch the video on custom events/blocks, it explains all this in detail.

    Water issues sound like you have changed something in the engine, I would suggest starting from a fresh copy of the engine from the store and seeing if it still happens there.
     
  15. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    Ok thanks.
    Is it possible to loop through opening and closing oak chest again and again (opening and closing animation goes into infinite loop) OR it will work only by player interaction?
     
  16. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    That is entirely up to your code/object/prefab, there is nothing in the engine that wouldn't allow that.

    E.g if your prefab animates itself to open and close again in a loop, then it will do the same thing when its spawned into the world using this system
     
  17. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    but there are transitional object scripts and i saw looping drop down and looping variables there. I thought that will help to solve my problem but nothing happened. What exactly does those variables used for?
     
  18. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    If you hold your cursor over the variables your confused about in the transitional object (whilst Unity is Not playing) then it will give you more information about what it does.

    These can certainly be used to loop something opening and closing constantly as you described if you turn TriggerInstantly: on, Stay Forever: off, Looping: on
     
  19. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    Ok thanks man. Really appreciate your work and giving time to reply.
     
    LaireonGames likes this.
  20. Legend458

    Legend458

    Joined:
    Mar 13, 2016
    Posts:
    190
    Just got the kit and it looks really awesome, good job! Quick question, how do I change the HUD position? I changed it manually and set the anchor but it stays in the same position. I also changed it via the set to position script in the inspector but it still doesn't want to move?
     
  21. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Glad your liking it :)

    The position is controlled by the animations, so even if you it the animation is restoring it to the original as it runs. Take a look at it TransitionalObject component (on the HUD) then within that expand, Position, then Data and change its end position (or move it to the end position you want and hit Update in the end position ssection)
     
  22. Legend458

    Legend458

    Joined:
    Mar 13, 2016
    Posts:
    190
    Wow, that was a quick response. Just did what you said and it worked perfectly! I have just published a review for this superb kit.
     
  23. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Sweet really appreciate it! :D
     
  24. nb05

    nb05

    Joined:
    Nov 13, 2015
    Posts:
    8
    Dear,

    I have the following questions really need your support!

    1. In fly mode, the player goes in between the blocks can you check on this.
    2. Once game start how I can add more blocks what is the parameters controlling this. as the default start maximum 3 or 4 blocks.

    Thanks.
     
  25. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Hey nb05,

    1: This is currently intentional :) Fly mode is intended to make development easier rather than being a fly mode for players. If your wanting that it should be pretty easy to disable gravity in the player controller and rigidbody.

    2: Not really sure what your asking here sorry! If you mean starting inventory so you have more blocks hit Ctrl+E then go to the invetory tab, then starting inventory so you can add more starting blocks

    hope that helps!
     
  26. nb05

    nb05

    Joined:
    Nov 13, 2015
    Posts:
    8
    Thanks really helped me and I found it.

    Last point from where you controlling the player movement as trying to use CrossPlatformInputManager and I modified InputController but no impact. As I am changing the game to Andriod Versio
     
  27. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Ah sorry I was not very specific. What you are looking for is FPSInputController, which sends input to the motor, and CharacterMotor which handles the movement itself. These are just modified versions of the Unity standard assets: https://assetstore.unity.com/packages/essentials/asset-packs/standard-assets-32351

    I've not followed this tutorial but from a quick google something like this should apply to those scripts and listen to android input: https://unity3d.com/learn/tutorials/projects/2d-roguelike-tutorial/adding-mobile-controls

    Your aim is to have an on screen UI (I imagine) and feed input from it to the motor, just as the FPSInputController does. If you want to take it in simpler steps, then try adding 4 UI buttons to start with, rather than an actual on screen joystick, and get them to feed into the motor. Should make it easier to figure out the joystick stuff from there
     
    nb05 likes this.
  28. nb05

    nb05

    Joined:
    Nov 13, 2015
    Posts:
    8

    All are ok I am able to control the player and UI from Mobile now.
    Flying, moving..etc

    only the problem for changing the mouse click 0,1,2 to mobile touch I did search and found you are using block events for mouse click but I am facing a challenge to convert to touch input.

    let me know if I am correct or no please, also need your help in converting mouse click to mobile touch input if you can.
     
  29. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    awesome glad you you got it :)

    Yup your in the right place, BlockEvents is indeed where I listen for mouse clicks although I'm not really sure how I can help from there since it depends on your game! E.G there is of course no right click on a mobile so you will need to decide what you want to replace that.

    If you just mean touches instead of clicks overal then this might help: https://docs.unity3d.com/ScriptReference/Input.GetTouch.html
     
    nb05 likes this.
  30. nb05

    nb05

    Joined:
    Nov 13, 2015
    Posts:
    8
    All working fine complete touch platform and customized for Andriod.

    Only small suggestion if the player can walk from block to another no need to jump.
    also building block once I am on top of the block is not allowed can you advise how to enable it.


    Thanks for your support and really amazing asset saved a lot a lot of work.
     
  31. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Glad your up and running!

    Oh yeah hm... I will have to take a look at the code tonight to see where I disable building at your feet. I think its in block events somewhere but not got the code in front of me to check (in my 9-5 job)
     
  32. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Ah ok this is the line:

    Code (CSharp):
    1. if(Vector3.SqrMagnitude(adjacentPosition - Player.Instance.transform.position) > 0.5f || //if not trying to place where the player is standing
    BlockEvents:line 92.

    So this is giving a sensible distance before placing a block which is pretty important! So if you jump, you should be able to place below you. I would advice against removing this check since once you place a block below where you are standing, you drastically increase the chance of instead shooting miles up into the air!

    If you really want to do this, I would suggest having a specific check (can probably be done by using an else to the if statement above) when trying to place a block very close to the player and the moving the player away from the block to make sure Unity physics don't kick in and launch the player into the sky
     
  33. nb05

    nb05

    Joined:
    Nov 13, 2015
    Posts:
    8
    For the network part? any plan or is it implemented as so many codes related to the network.
     
  34. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    I am afraid not. Originally I was considering multiplayer very hesitantly since I still want to actively avoid asset flippers (people who just buy packs like this, invest minimal work and upload to steam etc. Close to a scam as it gets!) and gives people willing to look after their project a clear advantage.

    However currently its looking much less likely that it wont happen. Last week I started negotiating with 2 publishers to publish a game I am making using this engine, if it goes ahead I don't think I will have any spare time to add new features since my version has been tailored from this engine specifically towards the project I have in mind.

    I will still provide support by answering questions, but probably wont add new features if I get a good deal from one of them. Come to think I'll make sure the store page is updated as well to reflect this
     
  35. japanmomiji

    japanmomiji

    Joined:
    Sep 24, 2018
    Posts:
    7
    no demo scene for noob?
     
  36. japanmomiji

    japanmomiji

    Joined:
    Sep 24, 2018
    Posts:
    7
    sorry I was boiled. Here are my questions.

    I could press Main Scene(other were empty and stopping) then I could play in flooded map. but I could not find the path to reach what I want to see.

    How can I modify map like diorama by mouse.

    Do I have any other press-able scene like quick spawn start on visible map data without through main menu.

    sorry for my bad english
     
  37. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Hey Japanmomiji,

    You probably got unlucky with your see to start over an ocean. If you head to your ChunkManager in the scene and look for the GameData component, it will have a variable World Seed. When its set to 0 it will randomly select a new seed each time you hit play. Once you find one you like, copy it and then when the scene is Not running paste that seed to replace 0 and you will always start in the world. I find this helps a lot for development.

    You can also press R to enter flying mode and quickly look over the terrain.

    Its a little more complex, but the biome editor gives you a preview as you mention, there is a video on the store page talking about the biome editor at length and showing how to use its preview functionality
     
  38. japanmomiji

    japanmomiji

    Joined:
    Sep 24, 2018
    Posts:
    7
    thank you for reply, I understand a little bit about auto generating system.
    I am satisfied with your maps, also what I wanted to create were flooded ocean and tunnel map.

    but my question was like what do I have to do if I want to put 3D realistic submarine to this game.

    https://imgur.com/a/dNDG3IH

    I want this to my working scene tab,
    I copied all gaming hierarchy, but It was not working.


    I am sorry I am idiot.
    if you mentioned me save in 0, fly, take photo, remember XY then place new on terrain. Ill try that too.

    If you have simple solution, please teach me.
     
  39. japanmomiji

    japanmomiji

    Joined:
    Sep 24, 2018
    Posts:
    7
    SOLVED

    I did it in this way.

    https://imgur.com/a/VGeMFm5
    https://imgur.com/a/pzL2Ftu

    ......................................................................................................
    New problems

    I cannot pick up blocks, after I played few hour.
    I need to delete saves and rebuild to fix it.
    my block stack was 999. Inventory row were 20,
    I did not touch anything, it was happen during built game demo.

    https://imgur.com/a/Dm0bZ8S





    sorry for that I did not read what they wrote on previous thread.
     
    Last edited: Oct 3, 2018
  40. Angiel

    Angiel

    Joined:
    Jan 6, 2015
    Posts:
    15
    Hi
    Sorry but is there any written documentation or tutorial?
     
  41. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
  42. Angiel

    Angiel

    Joined:
    Jan 6, 2015
    Posts:
    15
    thanks 1000 :)
     
    LaireonGames likes this.
  43. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Hello before I buy I wanted to ask a few questions:
    1. Is this asset still being updated?(Still gonna buy if it isnt)
    2. Is the UI a child of the player prefab or is it, its own parent prefab?(I want to know for multiplayer implementation)
    3. Is there full body awareness?(Just floating arms or a full figure)
     
  44. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Hey Bioman,

    1: Honestly, not really. I keep meaning to get back to it but I've been too busy with the game I am building with the engine (if you're curious: https://twitter.com/laireon) to go back to the engine itself.

    2: No the UI has its own camera

    3: It moves around as a full body character controller that is either 1.5m or 2m high. There is a placeholder character in there but its not rigged or animated.

    As a note there is an issue with garbage in the core of the engine I recommend fixing. Chunks are not properly pooled, if you add a pooling system to them then you should be good to go (its not too difficult to do).
     
    Bioman75 likes this.
  45. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Ah, well it's fine I'm liking what I see so I can work with it, also thanks for the heads up on Chunks and Garbage.
     
  46. Flitch_

    Flitch_

    Joined:
    Mar 2, 2015
    Posts:
    4
    Its filled with bugs.
    I cant even click in the inventory menu when it closes the menu again, any solution?
     
  47. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Does anyone know how this works on Unity 2019.3?
     
  48. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    It probably has got a few bugs in there although this one might be due to something else you've changed since no one else has mentioned it. Try downloading a fresh copy and see if its in there and if so it will be easier to reproduce.

    Also not sure how I missed that message :/
     
  49. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    From the top of my head I can't think of/remember anything in there that wouldn't play nicely with 2019.3
     
    Bioman75 likes this.
  50. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    92
    Oh that's great! Last time I asked about future updates you said you were focusing on your game. Since its been awhile since then are all future planned updates of Laircraft axed or are you still gonna update it?