Search Unity

[RELEASED] uConstruct - Fully generic, socket based runtime construction system

Discussion in 'Assets and Asset Store' started by ElroyUnity, Oct 17, 2015.

  1. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    Of course, this code is better to fix, so as not to make unnecessary calls.
     
    ElroyUnity likes this.
  2. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Oh I see, makes sense!

    Thanks very much for the fix, I will definitely have a look at the Inventory Pro integration again on the new update :)
     
  3. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    Even better this way:

    Code (csharp):
    1.  
    2. public virtual bool Place()
    3.     {
    4.         currentStackSize--;
    5.  
    6.         //Reduce or remove an element from the character slot
    7.         var characterCols = PlayerManager.instance.currentPlayer.inventoryPlayer.characterUI;
    8.         for (uint i = 0; i < characterCols.collectionSize; i++) {
    9.             if (characterCols [i].item == this) {
    10.                 characterCols.SetItem (i, this, true);
    11.                 if (currentStackSize == 0) {
    12.                     characterCols.NotifyItemRemoved (this, this.ID, i, 1);
    13.                     characterCols [i].item = null;
    14.                     characterCols [i].Repaint ();
    15.                 }
    16.                 break;
    17.             }
    18.         }
    19. ......And so on without changes
    20.  
    Thus he also removes the object from his hands :)
     
    Last edited: Mar 7, 2017
    YOAJ1, twobob and ElroyUnity like this.
  4. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Thank you very much! Super appreciated!
     
  5. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi Elory!
    I got a question, again ;)
    Must I put the whole terrain object into buildingSocket layer to put foundations on terrain?
    I found the demo scene shows this: when start playing mode,the terrain's layer automatically set to building socket.
    What should I do if I need terrains to be in another specific layer?
     
    ElroyUnity likes this.
  6. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hey!
    Nope, if you go to the layers manager (Window/uConstruct/...)
    Just add the layer of your terrain to the socket layers and it shouldnt change it :)
     
  7. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    got it, I'll try it.
    thanks as always :)
     
    ElroyUnity likes this.
  8. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    My pleasure :)
     
  9. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    As you saw in my game's trailer, I changed the building system to "plan then build" type, so the building blocks put down first is not finished yet, players will need to put resources into the building to finish it.
    Here is the question: what do I do to force the player build each building part in certain order, like you can't build a pillar first before the base or the other pillar under it is finished?
    I thought about using conditions but this system should only affect the "build" part, not the "plan" part. It'll affect both if I make the condition into building's prefab. Any ideas?
    And I'm imaging another way to achieve this, is it possible to only activate the building parts that have full supports, and deactiveate those doesn't have supports from finished buildings? And I can let the player enter a "planning" state that shows all planned buildings, then only show the supported ones for actually building action when they turn the "planning" state off.
    Any ideas?
     
    ElroyUnity likes this.
  10. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Thats a very interesting idea. Could you send me your skype in a pm? I will be able to assist you better :)
     
    twobob likes this.
  11. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    Does this package work with navmesh agents. Can an agent walk inside the building and go through an open door?
     
    ElroyUnity likes this.
  12. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Well as long as you mark it as an obstacle it shouldnt :)
     
  13. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    I want them to be able to walk inside.
     
    ElroyUnity likes this.
  14. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi @Elroy,
    Because of the time difference, I think I'll just paste my question here so you can answer when you got time :)

    I was wondering if I can close the overlapped sockets with same types and only leave one socket active?
    For example, two bases snap together, there will be 2 pair of pillar sockets overlapped together and one set of 2 wall sockets overlapped together. For I have triangle bases, the socket's direction may not always be the same, overlapped sockets will make the to-be-placed building glitch between the two sockets, it's quite annoying.
    Maybe close or hide extra overlapped sockets will fix it and raise the performance a bit?
    Would like to learn how to do that if it's possible.
     
    ElroyUnity likes this.
  15. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Ahh uhmm done it before but without unity's nav mesh, I think I used Apex or smth similar that allows runtime multithreaded path generation :)
    Yea, are you the one I spoke to on skype/ email?
     
  16. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    yeah, that's me :)
    and I got your message, thanks again!
     
    Last edited: Mar 16, 2017
    ElroyUnity likes this.
  17. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    How well does this work on uneven terrain? If you look at games like Stranded Deep or ARK you can build foundations on uneven terrain.

    Also is it possible to make it work with stages, so you build a blueprint/base item then upgrade it by hitting it with a tool to finish it.

    Like in this video at 18:45:
     
    ElroyUnity likes this.
  18. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    About uneven terrain - you could make it "fit" to the slope of the terrain OR flat the ground under the terrain

    About building stages - not a built-in feature, but I know a couple that implemented it :)
     
  19. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    We have a procedural smooth voxel based VR game in development and we picked up Uconstruct for players to use for making structures and decorating their worlds. Before diving in and trying to do it all from scratch, we were wondering if anyone else has had any experience with Uconstruct and VR (we are developing for Vive + Steam)? Any packages or support for VR in the pipeline? Thanks in advance!
     
    ElroyUnity likes this.
  20. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Personally, been using uConstruct for a vr project (both Oculus + VIve with touch) and it worked pretty well.
    Very easy to customize it to work with VR and the new update will make it automatic :)
     
    Tethys likes this.
  21. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    Awesome! We started with the wonderful, free asset VRTK off the asset store and they provide some pretty easy to follow examples on how to get other systems listening for their interaction. Good stuff, thanks for the reply!
     
    recon0303 and ElroyUnity like this.
  22. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    we did:)
     
    ElroyUnity likes this.
  23. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    @ElroyUnity In the PhysicsObjectEditor, there are a couple of warnings that we have. You appear to have used #if UNITY_5_3 instead of #if UNITY_5_3_OR_NEWER. Secondly, in the UCSavingManager, there is a reference to Application.loadedLevelName. Just a heads-up ;)
     
    ElroyUnity likes this.
  24. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yep fixed it but didn't yet submit the fix - thanks for that :)
     
    Stormy102 likes this.
  25. Absalomium

    Absalomium

    Joined:
    Feb 6, 2017
    Posts:
    6
    Hi!

    We have bought uConstruct for our next game, it is a great tool and nice feature for players. We work since two month with it and now we notice realy long loading times of the uConstruct building groups at game start. One of our groups have 670 buildings with about 2000 sockets and that one takes about 3,5 minuits to load on a quadcore i7... Have anybody an idea what that issue could be?
     
    ElroyUnity likes this.
  26. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Wow that's a new one, thanks for letting me know!

    Already working on a new save & load mechanic for uConstruct 2 which is A LOT faster. will try to put it on V1.X in the next 2-3 weeks and send it over to you, sorry for the inconvinience!
     
    Absalomium likes this.
  27. Absalomium

    Absalomium

    Joined:
    Feb 6, 2017
    Posts:
    6
    No problem at all. Thanks for your support!
     
    ElroyUnity likes this.
  28. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Anytime!
     
  29. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    uConstruct 2?? :confused:
     
    ElroyUnity likes this.
  30. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    More information soon ;)
     
    Last edited: Apr 27, 2017
    llJIMBOBll likes this.
  31. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Don't you dare keep me hanging! :p Sounds pretty promising...
     
    ElroyUnity likes this.
  32. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi I think i found a bug, it was like it before i tried to explain but wasn't clear.

    When you have rotate with player turned on, and go to rotate a wall or stair to snap to the foundation, it doesn't snap correctly to the foundation. the angles are different.

    Like it set to the world snap and not the newly placed foundation, which is randomly placed and not inline with world axis.


    I hope this makes sense :D

    Really amazing systems by the way, i'm also using uNature with UFPS :D Thank you Sir!
     
    ElroyUnity likes this.
  33. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Interesting catch!

    Will have a look this week :)

    Thanks for the report and happy you like it so far :D
     
    llJIMBOBll likes this.
  34. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    79
    hello
    im trying to figure out your unet integration following your document.
    when i try to add the unet building placer it says
    can't add script component 'UnetBuildingPlacer' because the script class cannot be found...

    any ideas?
    thanks
     
    ElroyUnity likes this.
  35. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Did you enable the extension on Window/uConstruct/Manager/Extensions/U/unet?
     
  36. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    79
    thanks for the reply

    yes unet is enabled on the extension manager
     
    ElroyUnity likes this.
  37. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhm I see -
    Latest unity version I presume? will check it out.
    If you check in the uConstruct folder - > scripts/core/extensions/unet/integration and then open up the script does it show up as gray or white?
     
  38. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    79
    unity 5.6.0f3

    the scripts are in grey (visual studio 2015)
     
    ElroyUnity likes this.
  39. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Seems like the integration isn't activated then :)
    Can you send me a screenshot of the extensions window with the UNet tab open?
     
  40. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    79
    Last edited: May 17, 2017
    ElroyUnity likes this.
  41. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
  42. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Apparently another customer had that as well and its something with the line endings,
    He told me that after using this: https://www.assetstore.unity3d.com/en/#!/content/73980 (free of course)
    It worked, give it a shot and lmk if it fixes it :)

    Note: Haven't had time to test it and I don't even know if its related but he said that it fixed it for him so nothing to lose :)
     
  43. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    79
    thanks
    i tried it but didnt fix it for me unfortunately
    still the same errors as before
     
    ElroyUnity likes this.
  44. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Okay,
    Will try it out today :)

    Feel free to remind me if I don't send you a fix in the next few hours :)
     
  45. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Okay checked and seems like it works on my end,
    Can you try checking it on a new project and see if it works for you?
     
  46. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    79
    ok
    a new project still the same errors
    tried the line ending fixer, still the same errors
     
    ElroyUnity likes this.
  47. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Can you send me a project with your issue privately?
    Will see if its something with your setup
     
    Tegleg likes this.
  48. Tegleg

    Tegleg

    Joined:
    Jun 10, 2013
    Posts:
    79
    ok i sent it through your website contact form

    thank you for sticking with this
     
  49. txzeenath

    txzeenath

    Joined:
    Sep 26, 2016
    Posts:
    6
    It appears that uNet integration is not properly checking conditions.
    In the entities manager.

    Code (csharp):
    1.  
    2.                 Debug.Log("Checking conditions..");
    3.                 if (!building.CheckConditions()) // check conditions serverside
    4.                 {
    5.                     Destroy(instance);
    6.                     Debug.Log("Not allowed. Destroy");
    7.                     return;
    8.                 }
    9.  
    "Checking conditions" appears. But not "Not allowed". The building is then placed.

    The building will properly disallow placement on the client. But if I tap the placement button fast enough or remove the conditions client side, the server doesn't catch it. I'm using the provided collision condition.

    I haven't dug through it yet to see where exactly it's failing the check.

    -Edit

    Found that the conditions script uses triggers to work. Which isn't going to work properly when the object is spawned and checked at the same time. I just threw in a boxcast under CheckCondition.

    Super sloppy fix to CollisionCondition script:
    Code (csharp):
    1.  
    2.         public override bool CheckCondition()
    3.         {
    4.             RemoveNullReferences();
    5.             int count = collisions.Count;
    6.  
    7.             if (UnityEngine.Networking.NetworkServer.active && count == 0)
    8.             { //Check for collision on server.
    9.                 Transform collT = _collider.transform;
    10. //Probably need to scale the position as well, but owell.
    11.                 RaycastHit[] hits = Physics.BoxCastAll(collT.position, Vector3.Scale(_collider.size * .5F, collT.localScale), Vector3.up, _collider.transform.rotation, 0F);
    12.                 foreach (RaycastHit hit in hits)
    13.                 {
    14.                     Collider collH = hit.collider;
    15.                     if (collH.enabled && !allowedTags.Contains(collH.gameObject.tag) && !collH.transform.Equals(rootBuilding) && !collH.isTrigger)
    16.                     {
    17.                         count = 1;
    18.                         break;
    19.                     }
    20.  
    21.                 }
    22.             }
    23.  
    24.             return count == 0;
    25.         }
    26.  
     
    Last edited: May 19, 2017
    ElroyUnity likes this.
  50. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hehe yep thats correct, good catch!
    Will be sure to include a fix :)