Search Unity

[Released] Terra Slicer & S.A.M.

Discussion in 'Assets and Asset Store' started by gilley033, Nov 5, 2013.

  1. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    The error reported by mes0 will be fixed soon. I've added it, and an additional error with the names of the output slices/terrain data to the known issues in the OP.

    The latter bug was introduced with v 4.2.0 and is pretty major, so I'd avoid slicing for the time being until it is resolved; I should be able to submit a fix for both issues tomorrow.

    Thanks for your patience!
     
  2. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Okay, the new version with the bug fixes mentioned above has been submitted to the store. As always, you can email me with your invoice number to get the update now.

    Please note that the bug which caused detail objects to be mixed up has been present since the initial release of this kit, so if you had detail objects on a terrain you sliced, I would go back and make sure the detail objects are correct, and if they're not, re-slice the terrain.

    I apologize for the trouble!

    Regards,
    Kyle Gillen
     
  3. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Update 4.2.1 has been accepted and is now live on the Asset Store. All users, especially those who downloaded or uploaded to 4.2.0, should update to this new version!
     
  4. dajyareo

    dajyareo

    Joined:
    Dec 7, 2014
    Posts:
    11
    Hi there. I'm using Unity 5.3 and the latest version of the Dynamic loading kit (I just updated to 4.2.1) and it seems to be working fine except that scenes are being re imported as opposed to just re-enabled. What I mean is, when I go out of range for a scene, it'll unload all the child objects of that scene. Then when I go back into range, it'll load a new copy of that same scene so now I've lost all the state in the previously loaded scene and have a new copy of it loaded in the hierarchy. Have you seen this before?

    Thanks!
     
  5. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    @dajyareo

    Hi, first things first, thanks for purchasing my kit!

    What you are seeing is normal operating procedure when using the default Non Pooling Primary Cell Object Sub Controller. When using this component, when a cell goes out of scope, it is completely removed from the scene, and when it is needed again it is reloaded.

    Generally this is a good thing, as it keeps memory usage low (which is one of the main purposes of using dynamic loading).

    With that said, there is the issue of saving/loading state, which you've now run up against. There are two ways to solve this issue.

    The first (and easiest) is to use a Pooling Primary Cell Object Sub Controller. A basic version of a pooling sub controller has been provided, and you can find it under Component - > Dynamic Loading Kit - > Sub Controllers. This basic version does what you appear to want; rather than destroy the cell and it's objects, it simply disables the root game object associated with the cell, and when it's needed again that root object is enabled. State doesn't have to be saved/loaded because the cell (in your case the scene) is never destroyed.

    There are two issues with this. First, even disabled game objects take up memory, which may or may not be an issue for you depending on your world size. Second, if you have a repeating world that is relatively small (say 4x4 cells), there's a chance that you may need multiple copies of a cell at any given time, so the state will have to be synchronized between the copies.

    The second way to solve the issue of saving/loading state is to manually take care of it, i.e., when a cell is unloaded save its state, and when a cell is loaded load its state. This will obviously take some work on your part, but it will allow you to take advantage of the lower memory usage of a dynamic loading solution. If you decide to go this route, there are several different approaches, though the one I would suggest is to create custom Cell Actions (read about here), which you add to the root object of each cell.

    You just need to put the logic for saving the cell's state into the DoStuffBeforeCellIsDeactivated method, and the logic for loading the cell's state into the DoStuffAfterCellIsActivated method. Both methods are coroutines, allowing you to spread the logic over multiple frames (if needed). How the state is actually saved/loaded is an implementation detail, but hopefully this is enough to get you started. Please feel free to post here or contact me via email if you need any additional help!

    Regards,
    Kyle Gillen
     
  6. yezo

    yezo

    Joined:
    Dec 23, 2014
    Posts:
    6
    Hi Kyle,

    It was interesting to read all your insights about this product, and watching the videos. They are really shedding some light on implementing large worlds in Unity.

    Before I commit to buy the kit, I wanted to know your thoughts on these two questions:

    1. Imagine the case of a largish open world game (think map of GTA scope, but much less densely populated with NPCs and buildings). In relation to this, what's the workflow of creating and incrementally editing the terrain? Ideally, I imagine the way is to make a whole giant terrain (think 10000x10000) using Unity first and then slice it using the tool, then parent the NPCs and buildings to the cell patches. When I decide to change some part of terrain, I modify the giant terrain again and just re-slice and re-generate the cell scenes. When I regenerate the scenes, my buildings remain parented to the terrain patches, so I don't have to re-add them.
    Then, it appears that the Unity terrain editor doesn't support terrains larger than 2000x2000. This only leaves us to resort to one-by-one single terrain cell patches creation/editing while manually making their seams to be coincident with the neighbors - which is obviously flawed. What is the recommended workflow for large terrain editing?

    2. Other case is large cyclic terrain procedural generation (think planets). The generation should happen for all the planet at once, so the user sees something like a progress bar and could wait. What is the suggested way to do this?
    I was thinking:
    - generate a whole planet heightmap procedurally as a single texture
    - programmatically create a Unity terrain from that heightmap
    - use your slicing tool programmatically on the giant terrain
    - generate NPCs and buildings on the slices
    - create all the required world components
    - let the player drive around on the vast landscapes of our planet while looting alien settlements
    Is this way generally possible/recommended?

    Thanks in advance!
     
  7. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    @yezo

    1) Im my kit each world can have a primary object group, which is your terrain/world meshes, and multiple secondary object groups. It's best to split the npcs/scenery up from the terrain (into one or more secondary groups), that way if you need to edit the terrain you won't need to worry about reparenting the other stuff to them.

    Honestly the best way to edit the terrain would probably be to use an external program like World Machine. Otherwise I would test out how editing a large Terrain within Unity is performance wise, which you can do before purchasing my kit. If it works okay then I'd say doing edits on the large terrain and reslicing would probably be best. Perhaps another user can chime in on what's worked best for them.

    2) For procedural generation, as long as the dimensions of the world (number of rows, columns, widths of each colums, length of each row, etc.) are set ahead of time, you shouldn't have any issues. What you'll need to do is create a custom Primary Cell Object Sub Controller (or maybe Cell Object Loader). These are the components in my kit actually responsible for retrieving the objects when the DLK needs them. Usually they just get precreated scenes/prefabs, but there's nothing stopping you from precurally generating the objects/terrains at runtime. The methods you'll use are all coroutines, so you can utilize multiple frames to do the generation. This is all theoretical though. I haven't implemented much procedural generation stuff, with my kit or otherwise, so there may be issues I'm overlooking.

    I'll give both of your questions some more thought on Monday. I'm out of town right now and typing this on my phone. Not ideal!

    Regards,
    Kyle Gillen
     
    Last edited: Jan 4, 2016
  8. yezo

    yezo

    Joined:
    Dec 23, 2014
    Posts:
    6
  9. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    On further review, I think the above covers everything. If something is still unclear or you have further questions please let me know!
     
  10. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
  11. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Hi guys,

    At the request of another user, I'm going to be attempting to add better support for custom materials when using the Slicing Tool. Right now I am just planning on per slice auto material generation, where the textures on the custom material of the base terrain are sliced for each new material.

    If there's anything you think should be added on top of this, please let me know!
     
  12. Pequisto

    Pequisto

    Joined:
    Apr 21, 2015
    Posts:
    66
    Hi Kyle,

    I've recently purchased your Terrain Slicing & Dynamic Loading Kit asset and am running into the same issue each time I press play in the editor.

    After following the Quick Guide, the Complete Guide and then your video playlist on DLK, I still can't figure out where I went wrong--I checked everything.

    I have a 16km x 16km terrain tiled via World Machine into and 8 x 8 grid and then further subdivided using the Terrain Slicer tool into 500m x 500m tiles for a grand total of 1024 terrain tiles (32 tiles x 32 tiles). I've created the prefabs, generated the scenes and, to the best of my knowledge, configured the Dynamic Loading Manager correctly. I've employed the Non-pooling Asynchronous Scene Loader script as well as the Prefab Loader script and the result is the same so I know I've forgotten something somewhere.

    Every time I press play in the editor, I receive the following errors:

    2016-02-11_12-19-44.png

    2016-02-11_12-21-48.png


    Any help on this would be much appreciated. Thanks!
     
  13. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    @Pequisto

    It looks like your scenes have not been added to the Build Settings.

    This should have been done automatically if you used the Scene Generation Tool (so there's some error with the tool if that's the case), but if you didn't use the Scene Generation Tool then you'll need add them manually (this should be in the DLK setup videos, but I need to put that whole series into text form for easier referencing). Luckily this is easily done.

    On the top Unity main menu, simply go to File -> Build Settings. Then, navigate to the folder where your scenes are stored in your project, and highlight them all at the same time and drag and drop them onto the "Scenes in Build" area of the Build Settings window.

    I think that should solve your issues, but there's a chance that some other errors crop up once the scenes are correctly added to the Build Settings.

    Let me know if you run into any additional troubles!

    Regards,
    Kyle Gillen
     
  14. Pequisto

    Pequisto

    Joined:
    Apr 21, 2015
    Posts:
    66
    Beautiful! Thank you for the quick response, Kyle.

    The error was actually something else related to Scene Generation (read: wrong terrain prefabs used for scene generation).

    Cheers!
     
  15. lzt120

    lzt120

    Joined:
    Apr 13, 2010
    Posts:
    93
    any plan to convert the js version to C# so that custom functionality paticularly by its own programmer may be more easily
     
  16. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Is there a particular script you're focused on? The only Java Script files that are being used (some are still in the project because there's no easy way to delete them, that I know of, but they're not being used) are the DrawDetailMap and SetNeightbors scripts. Everything else should be in C#, though I may be missing something!
     
  17. infinitesunrise

    infinitesunrise

    Joined:
    Mar 11, 2016
    Posts:
    7
    Hey Kyle, I purchased the DLK a week back and am just now getting into learning how to use it with my game. I've followed your PDF instructions for slicing up terrain with the config file, prefabbing the slices, generating scenes from those prefabs, creating a World Grid for those scenes, and then linking everything together with a Dynamic Loading Manager (I went with the Non-Pooling Async Scene Loader because I have no idea what I'm doing yet :p ). I believe I've filled in all the relevant field's within the DLM's components, but when I play my scene I get the following error:

    Code (csharp):
    1. RequiredComponentNotFoundException: A World Grid is missing from the World with ID 0.
    2. DynamicLoadingKit.World.Initialize (DynamicLoadingKit.ComponentManager componentManager)
    3. DynamicLoadingKit.ComponentManager.InitializePhase1 ()
    My World component's ID is (arbitrarily) 2, and I don't see any components erroneously referencing a World ID of 0. My Component Manager component's ID is 1. I notice that if my World component's 'Destroy Objects On Play' checkbox is checked this error freezes the game, while if left unchecked all my terrain objects stay loaded no matter what although I'm able to control my player object. I imagine I've configured something incorrectly or missed a step as I'm still wrapping my head around your system, any idea where I where I went wrong based on this error message?
     
  18. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Hi @infinitesunrise

    First, thanks for purchasing the kit. Second, I apologize for the issues you are facing!

    I'm not positive, but it sound like there are one of two things happening.
    1. An extra world component is lying around in the scene somewhere. It sounds like you've checked this, but just make extra sure this is not the case.
    2. Your'e using a Persistent Data Controller (likely if you're just starting out) and "Auto Save Data On Game Exit" on the ComponentManager is checked. In this case, the ComponentManager may be trying to create a World at startup from some save data. This most likely shouldn't be happening, but if it is you should be able to eliminate this as a cause by checking the "Use Custom Save/Load Solution" option on the ComponentManager.
    Since it appears you are using the Cell Object Preview feature, you might also try removing the preview objects before entering play mode. It's very strange that the "Destroy Objects on Play" option is causing Unity to freeze. This option is very limited in scope, and looking at the code I can't see how it could possible be causing a freeze. I'm scratching my head on that one!

    If the above advice doesn't help, then the next step will be to send over a test project. Hopefully that won't be too hard, but if you're project size is large you may have to duplicate it and remove anything you can. I'll PM you the email to send the project to.

    Thanks,
    Kyle Gillen
     
  19. infinitesunrise

    infinitesunrise

    Joined:
    Mar 11, 2016
    Posts:
    7
    Thanks for the quick reply! After I read it I realized that I could test for both of your suggestions by clearing my initial DLK test out of my project and just trying it again... Aaand it worked! Terrain is now loading and unloading beautifully across an 8 x 8 slice / 8km x 8km terrain area. So I can't be exactly sure now what the issue was, but I had already suspected #1 since I had erroneously dragged a gameobject or two into some of the DTL's component fields earlier today and had spent a minute cleaning up the extra components that thereby got dropped into it. That probably screwed something up and as I'm still getting acquainted with how everything is organized I probably just didn't realize that I missed one. No apologies necessary for any issues, I'm a hobby programmer and this is my first Unity project. My game features a pedal-powered glider that the player powers via an actual indoor bike trainer, and experiencing it soaring over dynamically loading, epic-scale terrain for the first time was... Well jeez, well worth the 45 bucks for the fully-featured kit that enables it! If you don't mind, I'll probably have a few other questions related to integrating it into my game as I progress. Actually I can think of a few off the top of my head:

    -To confirm I understand how to edit the world later on: If I want to change the topology of my terrain, I'm assuming I have to edit the source unity terrain object(s), and redo the process of slicing and prefabbing? Also assuming that I don't have to remake my scenes, but just move around any gameobjects within them that no longer match up with the edited terrain topology?

    -My glider doesn't use a rigidbody for physics, but instead detects the height of the ground below it using:
    Code (csharp):
    1. terrainHeight = Terrain.activeTerrain.SampleHeight(transform.position);
    This still seems to work fine in slice_1_1, but breaks elsewhere. During play I notice that my base scene stays loaded, and that my glider object stays within it. Could you suggest a method of determining which slice my glider is in and how best to get it's terrain object?

    -I also notice that when slices are unloaded they remain visible in the hierarchy view, albeit empty. Just confirming, is this intended behavior?

    Again, thanks. I'm already enjoying this tool.
     
  20. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    @ infinitesunrise I'm glad you got that issue figured out! To answer your other questions . . .

    That is correct, so long as you don't change the size of the terrains and when you re-slice you ensure the generated prefabs overwrite the existing prefabs in your scenes (basically, just make sure the prefab names and output folder are the same), you shouldn't need to adjust anything other than the game object positions within each scene. If you have issues with this let me know!

    You can use the TryGetWorldCellPositionIsIn method of the World class (it is an instance method so you'll need a reference to the World component in your scene). You'd use it like so:
    Code (CSharp):
    1. //Assuming you have your World stored in a variable
    2. //called "world" and player transform stored in a variable called "playerTransform".
    3.  
    4. float GetTerrainHeight()
    5. {
    6.     WorldCell worldCell;
    7.     //The method returns false if the position does not fall within a
    8.     //world cell (i.e., the position is outside the
    9.     //bounds of the world. If you know this will never happen,
    10.     //then you don't need the if statement
    11.     if (World.TryGetWorldCellPositionIsIn(playerTransform.position, out worldCell))
    12.     {
    13.         Terrain terrainPlayerIsIn = ((WorldCellWithTerrain)worldCell).Terrain;
    14.         return terrainPlayerIsIn.SampleHeight(playerTransform.position);
    15.     }
    16.     else
    17.         return 0f;
    18. }
    19.  
    There are some calculations run using this method, so it may not be great to use it every frame. Please let me know if you see a performance hit when using it (I haven't tested it myself). If there is, I will look into adding other alternatives.

    You may be wondering why I don't automatically keep track of which terrain the player is in. The reason is, I would need to do this when the player crosses a boundary. That's not an issue when the inner area of the Active Grid is a single terrain, as the boundary always corresponds to the boundary of the currently "active" terrain.

    However, when the inner area is larger (say 2 x 2 terrains), the boundary now corresponds to the outer edge of those four terrains. I don't track the player's movement between those four terrain, as long as they stay within the boundary, so right now there's no easy way to stay up to date on which terrain the player is in.

    I'll look into changing this but no gaurantees!

    This is actually new behaviour with the latest version of Unity, and something I didn't even realize was happening until you just pointed it out! However, there shouldn't be any issues, it looks like Unity just shows you whatever scenes have been loaded in the hierarchy. If the scene has a drop down arrow that means it's actually loaded, otherwise it's just there so you could theoretically reload it manually if you needed to (but you shouldn't need to).

    I'll investigate further to make sure there are no issues, however. They've made quite a few changes to scene management with some of the latest versions and I haven't stayed up to date quite as well as I should have.

    Please let me know if you have any more questions or run into additional problems!

    Best Regards,
    Kyle Gillen
     
  21. infinitesunrise

    infinitesunrise

    Joined:
    Mar 11, 2016
    Posts:
    7
    Clutch! All very intuitive and understandable, thanks again for the quick help and the awesome kit!
     
  22. infinitesunrise

    infinitesunrise

    Joined:
    Mar 11, 2016
    Posts:
    7
    Whoops! Looks like WorldCellWithTerrain.Terrain is internal to DynamicLoadingKit, the script on my player object can't see it. Maybe I'm being a newb and there's a formal way to access it, but if not it'd be cool if there was a getter method in future updates. But FYI in the meantime I found that I can use a vertical Raycast from the player position to detect the terrain below it and get the height, like so:

    Code (csharp):
    1. float getTerrainHeight()
    2. {
    3.     Ray ray = new Ray(transform.position + transform.up * 3.0f, -Vector3.up);
    4.     RaycastHit hit;
    5.     if (Physics.Raycast(ray, out hit, Mathf.Infinity, playerMask))
    6.     {
    7.         return hit.point.y;
    8.     }
    9.     return 0.0f;
    10. }
    This will probably break once I start adding objects to my world, but I'm sure that'll be the least of my problems because I have no forward / above hit detection yet either :p
     
  23. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Hmm, I am looking at the code right now and Terrain is definitely a public property. Are you sure you are not trying to access "terrain" rather than "Terrain"? Because "terrain" is internal so that may be why you are seeing an issue. I'm glad you found another working solution. Your new method should be better than the old way of sampling the terrain height, since you are planning on performing custom hit detection anyways and will need to cast a ray for this (as far as I can tell). You mine as well detect the Terrain the same time you're detecting any other objects, right?
     
  24. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Hi everyone,

    I just wanted to provide a quick update on what I've got in the works.
    1. Revising some of the code base to work better with the new Scene Management class.

    2. Improvements to the Scene Generation workflow. I want to add support for baking multi-scene light maps. My only concern is that currently baking a single scene with a terrain takes forever, so I can't imagine how long multiple scenes will take.

    3. Improved world editing aimed at making it easier to edit portions of the world in the editor.

    4. I am still considering adding a LOD system. The main reason I have resisted up until now is because for Terrain (and perhaps meshes as well), in order to match the seams of neighbors with differing LODs, you have to edit the edge of the higher quality LOD to match the edge of the lower quality LOD. I am thinking of just leaving this up to you as the user. Any opinions on this?

    5. Another possible system I am thinking of adding is a sort of nesting system. Imagine you have a large map that is a sort of overview of your world. This would be your outer world. Now imagine that the user can scroll between different regions of this over world (each of which is a cell on the over world) and press a button to enter that region. They enter a nested world, which can in turn have many nested worlds. This is still in the early stages of planning, so if you have any thoughts let me know!
    Please let me know if you have any questions regarding these plans.

    Regards,
    Kyle Gillen
     
  25. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Another quick update. I am currently working on expanding the slicing tool to make use of what I'm calling "Post Slice Processors."

    Each processor is a scriptable object, and the slice configuration file will contain an array field where you can provide multiple different processors. The processors are run in order, so you can create processors that depend on earlier processors.

    What's the point of these processors? Basically, to allow you to perform custom actions on each slice after they have been created. The possibilities are virtually endless. Some tasks I envision processors handling include:
    1. Adding scripts to each slice. Because the processors can be created by you, you can determine exactly what scripts should be added to each slice, and how the data on those scripts should be calculated.
    2. Detecting scenery and auto assigning them to each slice.
    3. Currently the slicing tool does not support slicing of custom materials, and I am hopeful that processors are a means of rectifying this.
    Creating these processors will be as simple as creating a new script that derives from PostSliceProcessor (which in turn derives from ScriptableObject). I'll be providing some of my own processors so you can simply copy them to get started. Processors I am planning on including are:
    1. A general purpose processor that slices materials. This will generate sliced textures for each slice, but all other properties will be copied as is.
    2. A material slicer for the ats Colormap Ultra Terrain Shader 2.5. I don't foresee any trouble, but at the same time there are no guarantees!
    Please let me know if you have any ideas for additional processors that you think should be included with the kit, or any feedback on the general idea.

    Thanks!
     
    Last edited: May 27, 2016
  26. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    I am happy to report that the (now renamed) Slice Processor is working quite well. I have successfully implemented a processor that works with the ats Colormap ULTRA Terrain Shader, so any users of this shader will soon be able to slice there terrains. The sliced terrains utilize the original terrains color map, normal map, and alphamap, which means material blending (of rocks, roads, etc.), will work out of the box (assuming they worked with the original terrain).
     
  27. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Hey everyone, I just wanted to update you on an issue I've discovered. In Unity 5.3 they made some changes to the EditorUtility.SetDirty method which I did not catch. Unfortunately, all my custom editors currently use this, and the result is that changes made to MonoBehaviours are not being saved properly.

    I'm currently converting all editor scripts to make use of SerializedObjects, and once that is complete and tested, I will be submitting the update to the Asset Store, at which time anyone who wants the update immediately can email me the request with their invoice number.

    I apologize for this. I hope it hasn't had an effect on too many people (no one has reported the error, so that's something).

    In some good news, I've added Asset Bundle support to the package, so you can expect to see this in the update as well! I was hoping to test and iterate on the Asset Bundle integration some more, but in light of the bug mentioned above, it will be released as is. So, it's not a finished product by any means, and I will be taking any feedback on how to improve it.

    Thanks,
    Kyle Gillen
     
  28. riquid

    riquid

    Joined:
    Mar 18, 2015
    Posts:
    20
    Hi there~ I'm stuck on a bit of a dumb problem. I'm using the dynamic loading kit for my area but need to load in my pathfinding as I move through the areas. I am using a* for this and I think the most efficient way to go about this would be to create a new pathing map for each zone which would contain info for that zone and the zones directly adjacent to it. I would then need to load a new one of these each time I moved terrain tiles. However, I simply cannot figure out how I'd go about getting notified when I had tripped the boundry monitor in the dynamic loading kit so that I would know that I had moved tiles.

    If I'm not mistaken, I think I would simply need the dynamic loading kit to send the name, or position in the terrain array of the center most tile anytime I cross a boundry and the game loads in new tiles.
    Any ideas?
     
    Last edited: Jun 19, 2016
  29. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    I can't speak about the best approach to doing pathfinding, but for your proposed approach, there should definitely be a callback method in the kit that notifies you when the cell the player is in changes. I'll add this to the next update, as well as a method you can invoke to get the current "active" cell (which will be the cell the player is in).

    In the mean time, what you can do is get a reference to your player's transform (the same transform which is supplied to the Active Grid) as well as the World component you are using.

    Then, use the TryGetWorldCellPositionIsIn method (a method of the World component), passing in the player's position as the position argument. If this method returns true it means the position fell within the bounds of a valid cell, and the out parameter will contain this WorldCell.

    If you are using Terrain, you can cast this world cell to a WorldCellWithTerrain, which should allow you to access the Terrain associated with the cell, as well as its neighboring terrain (note that making these properties public was a recent change, and I cannot remember if they were part of the last update, so you may have to wait for the next update before accessing these properties). You can check if this terrain is the same as the terrain from the previous call to TryGetWorldCellPositionIsIn, that way you are only forcing an update to the pathfinding when a change has occurred. You can also access the cells index within the world grid via the CellOnWorldGrid property, as well as the position of the cell via the CellPosition property.

    Hopefully this helps. As you start to really get into the implementation of your pathfinding integration and you find that there is some limitation to the DLK API (as has already been pointed out), please let me know! I can usually make a change and get a working update to you in less than a day assuming you send me an invoice number for your Terrain Slicing & Dynamic Loading Kit purchase.

    Best Regards,
    Kyle Gillen
     
  30. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    @riquid

    I just checked and the Terrain property (as well as the neighbor access properties) of the WorldCellWithTerrain class are not part of the current package. Still, you should be able to use the CellOnWorldGrid property to track when the active cell the player is on has changed, and initiate a pathfinding update that way.

    I'm going to add a new event to the Active Grid class to send out a notification of when the cell the player is on has changed.

    If you'd like to get this update as soon as it's ready, please PM with your invoice number and an email I can send the update to.

    One last thing. It may be worth looking into Object Groups, which were added in the most recent update. You can find more information about these here. Basically, they allow you to load stuff on top of your main objects, so when a cell is loaded, in addition to loading your main object (such as your terrain), secondary objects are loaded.

    The only issue is that they will try to load objects for all the cells that are currently loaded, which might not be what you want (as it sounds like you want to load the pathfinding object associated only with the cell the player is on). In that case, you can create a separate World Grid, World, and Active Grid dedicated to loading the pathfinding objects only. The Active Grid will then use the same player as your original Active Grid. You can also share the same Boundary Monitor between your two Active Grids, as well as the same Primary Cell Object Sub Controller between your two worlds. Just make sure the ID fields of the two Active Grids are different (same goes for the two Worlds, and two Component Managers; so you can just set the second one of each component to ID = 1).

    You can set the new Active Grid's Outer Ring Width field to 0 so that it only loads the cell the player is on.

    Hopefully this is useful information. Please PM me if you need additional help, or want to get the update early.

    Best Regards,
    Kyle Gillen
     
  31. riquid

    riquid

    Joined:
    Mar 18, 2015
    Posts:
    20
    Thank you so much! In that case, I'll wait for next release before doing my pathfinding rather than jerry rigging something in the interim. As always, your support is top notch. I've already purchased everything you've made but with service like this, it makes me tempted to buy them all a second time just to say thanks.
     
  32. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Thank you riquid, those kind words are much appreciated! Hopefully I will have time to look into pathfinding integration soon. You're use case sounds like a general use case, so it would be a good idea for me to figure out the best approach. I'll try to prioritize it after completing the next update, which will include some awesome new features, major bug fixes and of course the API updates described in my previous two posts.

    Best Regards,
    Kyle Gillen
     
  33. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    The update should be ready on Monday or Tuesday. I just need to put it through an intense round of testing and finish quick guides for the new features.

    Again, if you want the update sooner than it will be available on the Asset Store, email me or PM me with your invoice number and an email (if PM'ing me) I can send the update to.
     
  34. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Sorry for the delay. The update is finished; I just need to complete some of the documentation for the new features (Asset Bundle Integration and Slice Processors).

    It should be ready today or tomorrow!
     
  35. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    v 4.3.0 has been submitted to the Asset Store!
     

    Attached Files:

  36. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    When the new forum went live, I updated the new thread, but forgot to update this one once they reverted. 4.3.0 is live in the Asset Store in case anyone missed it.

    Also, if you have any suggestions for improvement to the kit, whether it be documentation, workflow issues, or features, please let me know!
     
  37. thejanitor

    thejanitor

    Joined:
    Mar 29, 2014
    Posts:
    1
    I am generating my terrain procedurally at run time and am wondering if your kit provides a solution to the lag caused creating terrain objects at run time (SetHeights etc having to be called in the main thread causing noticeable lag). The only way of getting around this I can think of is creating a new scene at run time (which I don't think is actually possible in unity) containing new procedural terrain tiles and loading that asynchronously.
     
  38. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Hi janitor,

    Unfortunately no, my kit isn't focused around procedural terrain generation and therefore I haven't looked into the feasibility of producing terrain at run-time. Might just have to wait for the new (theoretical?) terrain system. The only thing I can think of is to try breaking the SetHeights call into mini calls so you are not trying to set the entire terrain's heightmap data in a single frame, though I am guessing you have already tried that.

    Sorry!
     
  39. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Hello all,

    I just discovered a bug with the terrain slicer (well, two bugs, but only one is major).
    • [Major] When slicing a terrain using a slicing region that does not start at normalized position x=0, y=0, the splatmap is off. This is due to an error in the texture offset calculation (which I have already corrected in an unpublished build).

    • [Minor] When slicing a terrain, the position of the slicing region is reset when it is moved via the transform gizmo in the scene view. Use the sliders in the inspector (X and Z normalized position) while this is fixed.
    An update is being pushed to the store, but if you need a fix for either issue sooner please email me with your invoice number. Note that if your slicing region starts at 0, 0, this will not be an issue, so if you are just slicing an entire terrain into smaller pieces you shouldn't need to worry about this issue.

    Sorry!
     
  40. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Unity 4 users, please read!

    The example scenes in the Unity 4 version show "Missing Scripts" on the components. This is because the GUIDs incorrectly got changed. Please follow this guide on how to fix these issues.
     
    Last edited: Sep 23, 2016
  41. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    The latest update has been submitted to the Asset Store.

    Also, I've completed a revamp of my website, please take a look at let me know what you think!

    I think I have one of the best API's out there, at the very least among Asset Store Developers. What do you think (find it here)?
     
  42. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    Version 4.3.2 has been submitted to the Asset Store. This version fixes an issue where an exception would be thrown when trying to add a World Grid asset to the World Grid field of a World component.

    As always, if you need the update sooner, email me with your invoice number!
     
  43. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    The latest update is live on the Asset Store, in case anyone is interested!
     
  44. Despellanion

    Despellanion

    Joined:
    Mar 18, 2015
    Posts:
    19
    I recently purchased this kit and ran into an ocean of errors when attempting to create a world grid configuration file (see attached images).

    I'm using Unity 5.3.5 (64-bit). For the record: I had to run the Unity auto updater on the kit when importing it due to incompatible scripts. I have also tried Unity 5.4.1 with a new empty project.

    For now the only portion of this kit that I can use that has no error is the terrain slicing.

    worldgrid_errors.jpg worldgrid_config.jpg
     
    Last edited: Jan 7, 2017
  45. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    For anyone seeing this issue, I've tracked it down to an error in the Unity 4 version (which will be installed on your machine if you have any version lower than Unity 5.4.1f1). This will be fixed in the next update. If you are seeing this error in Unity 5.4.1f1 or above, let me know!
     
    Last edited: Jan 11, 2017
  46. riquid

    riquid

    Joined:
    Mar 18, 2015
    Posts:
    20
    I've been using the kit for quite a while but in my current project, I've run into an odd error and I just can't figure out what I'm doing wrong. It's an endless world that recenters but when it loads new columns or rows, those are not connected to the rest of the world. Any idea what might be causing this?

     
  47. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    I'll start a private conversation so we can discuss how to solve this issue. It could be a bug, or it could be an odd occurrence due to your use case and some particular settings. We'll get to the bottom of it though!
     
  48. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    A quick update:

    The issue reported by riquid was indeed a bug which would result in layers (if using 3D worlds) and columns loading at incorrect positions when the using origin re-centering and changing the origin cell to something other than column = 1, layer = 1 via the inspector. This has been fixed and will show up in the next update. Please email me your invoice number if you need the fix sooner!
     
  49. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,192
    It's time for a little discussion of an improvement I have been thinking about and will finally getting around to implementing.

    The kit currently includes a world origin re-centering feature which is ideal for large worlds (it helps to avoid floating point issues). However, with a large world, you might also need some kind of fixed point data or other precise data point (maybe you just need doubles for your game, for example) type to represent different data in your world. For instance, imagine you have an in game map, and the player can teleport to any location on that map. Standard protocol with this kit's API is to pass in the location you want to teleport to, and then the cell that the position falls within will be calculated and that cell will be loaded at the origin, and the player moved to the correct location within that cell.

    There's an issue with this when dealing with large worlds, however, as passing in a float for the position will result in problems when the position is really far from the origin. There are other situations that this arises, and still others where you may wish to translate a game world absolute position (represented by your precise data type) into a scene specific float value (for setting a transform position, for instance).

    The solution I have come up with is to create an interface that you can implement in order to create your own more precise data type. The specifics of the implementation don't matter (so long as they work for your game), only that some basic operations are supported (adding/subtracting/multiplication/division, converting a float to your data type). This way, when a method of the API requires a position, you can pass in your custom data type, and everything should just work.

    This is all theoretical, but I don't see why it shouldn't work. Please feel free to comment on this idea!
     
    Last edited: Jan 31, 2017
  50. boxhallowed

    boxhallowed

    Joined:
    Mar 31, 2015
    Posts:
    513
    Assume I want to slice a terrain of 100,000m x 100,000m into 400 whole integer parts (250mx250m per part), could this tool do that? Would each slice be an individual terrain (not copying the transformations of its neighbor)? Will each new terrain split generated be in the object inspector panel? I need a tool like this for World Streamer.