Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

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

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

  1. thevisad

    thevisad

    Joined:
    Jan 29, 2018
    Posts:
    8
    That's the trick pony I was looking for right there. I didn't realize that it changed the terrain layer to that as it was tagged as Terrain with the default layer selected. Adding in the BuildingSocket to the UFPS layer detection handled the collisions properly. Thank you much for your on point response!
     
    ElroyUnity likes this.
  2. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Anytime! Happy it helped :)
     
  3. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Ok guys a little update for both uConstruct and uNature -

    As you have noticed updates went down during the past few months during to my military service but I plan to comeback big time.

    For that - I need anyone who have used either one of the system to give some points that he would like to improve so I can make it all happen.

    The first things that come to mind -

    uNature:
    - better performance
    - less memory usage
    - reduce scene size
    - easier UI
    - ?More Features?

    uConstruct:
    - better demo
    - fix some batching
    - improve sockets and snap points
    - improve performance, memory and the save&load system


    I dont have an ETA about when it will be done but I promise to make sure it will be super good before releasing.

    Elroy
     
    dimon_babon likes this.
  4. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    I think this is a bit buggy with the new >2018.3 prefab system:
    uConstruct: Detected a building that isn't registered in the database. Added it to the database.

    I had it happen to me multiple times where i would drag an object into the Resources folder to create a new prefab, and the created prefab would have an ID of the old object that it was originally copied from, but the object in the scene (the one that turns blue, indicating it's a prefab now) would have the correct ID, and you have to press "Apply All" to update the ID in the prefab to the correct one. (It doesnt show you that two objects are any different, but still updates the ID)
     
    ElroyUnity likes this.
  5. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Using the asset in my project which also uses the new prefab system and didn't notice any issues... Can you try on a new project?
     
  6. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    83
    Hi ! Would it be possible to create rooms with a drag drop layout/blueprint system, similar to games like two point hospital ? Basically the player creating the room layout and dropping furniture inside? Thanks!
     
    ElroyUnity likes this.
  7. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Uhmm not sure I understand what you mean,
    You mean pre-created rooms that you can simply just place?
     
  8. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    83
    ElroyUnity likes this.
  9. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
  10. Carneyson

    Carneyson

    Joined:
    Jun 28, 2019
    Posts:
    5
    Hello. I was looking at different assets to use in a small webgl game and this seems like a perfect fit for the level editor.

    However there is one area I would like to modify that I don't think would take long but wouldn't have the slightest idea how to go about it using the existing structure & would definitely need help.

    I would like to keep the existing save & load system using the persistent data path for user levels. But also add the option to load from the streaming assets path via Unity's WWW form.

    This would allow me to place new levels(uconstruct binary files) I create (tutorials for example) into the streaming assets path that the player could load, edit and then save into their own persistent data path. This would essentially act as a file system for Uconstruct developer made levels on a webgl build without needing an external database and significant changes.

    A breakdown would be

    - User loads game
    - Level editor default save menu is shown with all user creations in the persistent data path
    - Player clicks tutorial button on the left side of menu, the persistent data levels are replaced by all uconstruct binary files located in the streaming assets path.
    - Player loads a level from the streaming assets path, they can then choose to save as, which will save the level into their persistent data path (due to the streaming assets being read only).

    The final step would be adding a small search bar on the left side of the load menu that can then open sub folders of the streaming assets folder. This could be used for secret levels or ones being tested for example. The user might type in "TESTLEVELS10" and gain access to all levels within that subfolder of the streaming assets not visible by default.

    Another breakdown would be

    -Show all uconstruct files in main Streaming Assets folder

    If folder name search box is used
    - Show all uconstruct files in Streaming Assets Path + Folder Name (the levels in this folder are hidden by default, only searching the correct string reveals them)

    Here is some examples of the Unity WWW form. It's basically just adding an extra if option to Uconstructs existing load path to enhance the webGL functionalities.

    https://docs.unity3d.com/530/Documentation/ScriptReference/Application-streamingAssetsPath.html

    https://stackoverflow.com/questions/47804594/read-and-write-file-on-streamingassetspath

    The option to export uconstruct files from the web via a download using the WWWform would be amazing too, but that requires a small amount of javascript coding & wouldn't be essential until WEBGL gets bigger. (I've linked an example below)

    https://forum.unity.com/threads/webgl-saving-a-file-in-the-browser.506800/


    Sorry for the text wall for what's essentially a data path change. I would love to buy unconstruct as it looks brilliant, but I don't think i will be able to adapt the existing save code without some help.
     
    ElroyUnity likes this.
  11. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Uhmm
    So basically just a way to dynamically load saves? including assets?
     
  12. Carneyson

    Carneyson

    Joined:
    Jun 28, 2019
    Posts:
    5
    Yes basically, but it wouldn't even need the assets to be loaded. Just the uconstruct binary save files. Using the WWW form to access streamingassets to make up for the lack of a proper file system on webgl.

    Here is a crude example image

    https://imgur.com/a/6w42TJM



    The option to export/download level save files from web would be incredible too, it would allow uconstruct to work seamlessly between web & standalone builds without needing a server backend. Uploading can be achieved by similar methods but that's getting off topic.
     
    ElroyUnity likes this.
  13. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Ohh okay that makes sense :)
    Basically what you are looking can all be found in the "UCSavingManager" class, it handles the serialization and deserialization of saves.

    The answer to your questions is there, it feeds a stream with all the data of the game and you can simply extract the bytes from it and send it over the WWW form
     
  14. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    This issue surfaced again for me:
    BaseBuilding.HandlePlacing seems to have a problem where it's collision condition checks are lagging one physics frame behind, because it moves the transform, and then immediately calls CheckConditions(), but those conditions have not had their colliders/collisions updated for the new position yet.
    So when i call HandlePlacing for the first time on an object, its /collision with other object/ conditions all return false and i can always place a building where i should not be able to for 1 first tick. Basically isFit always true on first call.
     
    ElroyUnity likes this.
  15. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Good catch!
    I will work on a fix where it doesn't check conditions/ placement with position changes.
     
  16. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    Any ETA on the fix?
     
    ElroyUnity likes this.
  17. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Yep out of town but go to HandlePlacing method,
    Then to an if statement that would look something like
    if(!IsFit && LastFitSocket != null)

    And then inside the statement block (inside the { )

    Add to the end - socket = LastFitSocket;


    Lmk if works
     
  18. dimon_babon

    dimon_babon

    Joined:
    Dec 30, 2018
    Posts:
    25
    'LastFitSocket' is not being set anywhere
     
    ElroyUnity likes this.
  19. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Home now:
    sorry got confused with a different thing,
    WIll work on that today and try to get it done asap
     
    dimon_babon likes this.
  20. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Sent a patch on pm
     
  21. eky

    eky

    Joined:
    Sep 28, 2017
    Posts:
    5
    Hi ElroyUnity,

    I like your terrainmodificiationcondition but it's only for détails(grass...). Can you do the same for Tree. I really tried to find a solution since days but it seems complicated. Can you help me please?

    Thanks.
     
    ElroyUnity likes this.
  22. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Hey, will try to get for you something on the weekend if I get time to be in the office :)
     
  23. JWN

    JWN

    Joined:
    Apr 20, 2015
    Posts:
    1
    Yo,
    I noticed that since each building only connects to 1 other building & socket, it's possible to have A wall that could be attached to multiple floors fall when using CheckForGroundCondition.
    Is there a suggested way of having it so buildings can be connected to multiple buildings or is that something I will have to code myself?
     
    ElroyUnity likes this.
  24. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    I guess you could code that but that will be some work. Another approach is to modify the CheckForGround condition to maybe check using raycasts
     
  25. eky

    eky

    Joined:
    Sep 28, 2017
    Posts:
    5
    Hi ElroyUnity, thanks for the answer. Did you find a solution for the tree, maybe a part of code to change in the script or to complete. I think if you have done the détails(grass etc), you should do the same with the tree. I know Treeinstances is a little bit specific and I haven't your level on programmation C#.
    I will try to code a version with 1 tree = 1 prefab. Lots of prefabs of tree on the terrain, and when i hit all this prefabs(using tag = tree can be a solution) I destroy them (I suppose iI can make a change on buildingplacer script on the Update ( I like this script, it is the main, I have done already so many change or add code).... But I am sure it will be most clean and optimize to use TreeInstances and the tree terrain data etc.
    By the way, i don't see really were I should change/add the code to remove the tree etc.
    When i think at that, a construction soft like this one, it's funny that nobody haven't this problem because the tree are an elements that we often find on a terrain and that we need to remove when we construct something on a terrain,? :p

    I use your software on my project, it's really important for me, normal for a city-builder.
    This is my project, Food Industry, on the facebook's page you can see lots of screenshots : https://www.facebook.com/foodindustry.754
    The official site in construction : https://foodindustry.wixsite.com/foodindustrygame

    I make a crowfunding soon on Kickstarter too, and the game will be on Steam(PC/digital download). Maybe in some months/end 2019 an early access will be ready, I hope !

    I want to precise a detail in terrainmodificationcondition, its not easy to find and use the scale that indicate the size on the ground of the grass/details and the postion that should be remove(ex: for a square field I need to write scaleX = 10000 and scaleY 10000, and offsetX = - 10 offsetY = -10, all that to remove the grass/détails around this field. It's not really intuitif and difficult to find the good number for some prefabs(Strange forms, big prefab and lot of différents forms). Hope its not to confuse^^

    I am french and i am sorry if my English suck a little bit haha.
    Thanks for your help Elroy, and sorry for the answer late.
     
    ElroyUnity likes this.
  26. eky

    eky

    Joined:
    Sep 28, 2017
    Posts:
    5
    Hi again I forget to ask
    There are Save system, I remember to try quickly. The problem that i have find it's that I can't choose a slot where i want save the game. It's directly save and I don't know where to found my save by the way( I mean on script and in an interface for example, or just to know where to search in the script to make myself ).
    When we start Unity can't choose the save game there aren't an Interface with all the loads game.
    To be Honest, I have check quickly the system and scripts, but my first feeling it s that I have to complete the script to use in my projects and that they miss a part for the save => we save the data like buildinggroup ? and the other stuff in the game ? Interface , prefab on scene, all the other stuff. I mean how we save all the scene. I feel that your save , is saving only the buildinggroup that we construct.
    ...hmmm i think its really confused all that, i need to check a little more^^... or maybe that speak to you what i am saying... I just know that I have to make a proper save/load system for my game include with your system
     
    ElroyUnity likes this.
  27. eky

    eky

    Joined:
    Sep 28, 2017
    Posts:
    5
    Hi ElroyUnity,
    Important question.
    I have a problem with the number of building Type. There are a max number and there are some bug if we try to make more and we can't use it, it's really problematic and i really need to have more building type. How can I fix this please.Thank you.( I try to change the code but I haven't find the solution yet)

    An other question, less important. I don't really see the difference between snap and socket, I always use socket, but i have the sentiment that sometimes it can be better to use snap, same if i don't really understand. I have tried to use snap without success.
    Thanks for your help.
     
    ElroyUnity likes this.
  28. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Hey, haven't had any time to touch unity, been busy with the army.
    I recommend just editing the script that changes the grass details and adding a tree removal to it too, not very code complicated, I will do it when I get home and have time to work on Unity :)


    Well the UCSavingSystem takes all building groups and saves them into bytes that you can save, you can then put these bytes into a file.

    Then the other way around, read the bytes from the file and then load it into the system using the UCSavingManager again.

    Yes, the system uses flags and so has a limited number, like unity's layers.
    I would recommend reducing some unused building types and if you need them all, you can change the building types into scriptable objects. I will do that too when I am home :)
     
  29. eky

    eky

    Joined:
    Sep 28, 2017
    Posts:
    5
    Thanks very much to have take your time to answer. I would like more but it already give me a way to do stuff.
    i have seen that in building type you use enum and i was thinking if I could change again int. Is it possible or I misunderstand the enum system(I m going to check on Google at the same time.. same for scriptable objects)
    Maybe I use to much buildng type too and i haven't need(I have to do some test for that so)

    For the tree problem. on the terrainmodification there are something like index(it's public), default is 0, it is the 0 index of terrain.data? and in 0 you have detail(grass) ? Maybe tree is on an other index ? It's probably not that but it can be a solution at the problem(same if I don't see how to do it). By the way, I thing it's more complicated that just change detail against tree and just removal. I have check quickly and it doesnt seems to be like you thing(but I try to do like you say and find a solution)

    Thanks again a good luck for at the army.
    Waiting for your return !
     
    ElroyUnity likes this.
  30. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Regarding tre problem, what I meant is trying to get the tree index in the radius of the building and then decreasing his height to .01, that's what I would do.

    and will try to get you a good built-in solution when back from the army :)
     
  31. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    421
    im trying to use this for a weapon system and needing the building group to be the weapon the player is holding at the end. how would i go about making my weapon when equipped update to the correct building group
     
    ElroyUnity likes this.
  32. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Uhmm in order to use it as a weapon building system I would recommend saving the weapon's building group individually and then when loading the weapon, loading its group and making it a children of the weapon
     
  33. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    421
    im having problems making this work. sorry. would you mind recommending which of your videos i should study for understanding this better?
     
    ElroyUnity likes this.
  34. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    You have issues with the building or the saving?
     
  35. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    421
    Saving. I have the weapon parts all working. They show up and everything. I dont think I'm following how to save properly. I watched the extending save video.
     
    ElroyUnity likes this.
  36. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Well on every building group you have a save method that packs everything into an object, then you can serialize it (using BinaryFormatter or w/e) write it to somewhere and then when you want to load you read the file, deserialize and use the Load method on the object.
     
  37. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    421
    Is callloadd the method to use for loading?
     
  38. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    421
    Ignore that. I found the load. Sorry about that
     
    ElroyUnity likes this.
  39. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    141
    I noticed that this asset hasn't been updated in awhile. Any plans to update or add any new features?
     
  40. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Np, did you figure it out?

    Hey,
    Been in the army for the past year or so and therefor didnt have free time to work on the assets/
    But It will get better soon and then will start updating both uConstruct & uNature
     
  41. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    421

    My sons birthday is today so I've been focusing on prepping for that so have been able to write the code to use it. But I believe I found everything needed in your codes and i think I understand it well enough. Thanks for checking.
     
    ElroyUnity likes this.
  42. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    141
    Thanks for the update. I see. I was mainly checking to make sure that the asset hasn't been forgotten. I have plans to use the asset and I would hate to start work with it and it is no longer supported.
     
    ElroyUnity and drcfrx like this.
  43. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Ok cool! happy birthday to him :)
     
  44. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Nope haven't forgotten about it, I try to check the forums at least two times a week, same for mails. once the army service is over I will be back and work harder on the assets :)
     
    recon0303, gearedgeek and drcfrx like this.
  45. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    421
    Thank you :)
     
  46. Diego_Graphics

    Diego_Graphics

    Joined:
    Nov 3, 2014
    Posts:
    84
    I am thinking about buying this asset and using it in a current mobile project. for me, performance is the deciding factor. so here's a question:
    does the uConstruct system use the Entity Component System and the Job System?
     
    ElroyUnity likes this.
  47. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582
    Hey, sorry for late response been away due to army.
    No it doesnt :)
     
  48. Mooselicious

    Mooselicious

    Joined:
    Nov 20, 2019
    Posts:
    3
    Hi!

    Been using Uconstruct for awhile now on my development account and love it. Just one question, I would like to change the UI save slot sort order to be sorted by creation date & most recent instead of alphabetical using system.linq. I'm guessing changes need to be made here but I can't figure it out, any suggestions? Thank you

    Code (CSharp):
    1. public virtual void FetchLevels()
    2.         {
    3.             for(int i = 0 ; i < LevelEditorSaveSlot.slots.Count; i++)
    4.             {
    5.                 Destroy(LevelEditorSaveSlot.slots[i].gameObject);
    6.             }
    7.             LevelEditorSaveSlot.slots.Clear();
    8.  
    9.             var levels = GetLevels();
    10.  
    11.             for(int i = 0; i < levels.Length; i++)
    12.             {
    13.                 LevelEditorSaveSlot.CreateInstance(saveSlotsParent, saveSlotPrefab, Path.GetFileNameWithoutExtension(levels[i]), levels[i]);
    14.             }
    15.         }
     
  49. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,582

    You need to look at the last changed date of the file save by accessing System.IO.File.GetLastWriteTime and order by that :)
     
  50. drcfrx

    drcfrx

    Joined:
    Jan 26, 2013
    Posts:
    38
    @ElroyUnity Don't tell me you're on a 5 years Army Tour right? :eek:
    I hope you're well and fine! ;)
    (Still hoping to see some more love to this asset tho, just saying ;))