Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Dreamteck Splines - Powerful and Flexible Spline Solution

Discussion in 'Assets and Asset Store' started by Dreamteck, May 11, 2016.

  1. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Okay I forwarded the last 2 emails
     
  2. adaptivemobiledevelopment

    adaptivemobiledevelopment

    Joined:
    Mar 20, 2018
    Posts:
    30
    Question about mobile performance and how I should hand this situation.

    I am using 8 splines right now. Each spline guides a unit to a building before destroying it. There are multiple units going to the same building. 10-15 at a time on the same spline. Should I be using Sample Target – User? I"m not sure how this would work as I am destroying the units when they get there so if I set unit 2 to follow unit one what would happen when unit one get destroyed? Is there a better way to do this?
     
  3. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Yes, in this case it is advised to use a Spline User sample target. Attach an empty Spline User to your spline computer and then have all your followers use the Spline User instead of the computer.
     
  4. adaptivemobiledevelopment

    adaptivemobiledevelopment

    Joined:
    Mar 20, 2018
    Posts:
    30
    Thanks I did that and it dramatically reduced the CPU load!
     
    Dreamteck likes this.
  5. adaptivemobiledevelopment

    adaptivemobiledevelopment

    Joined:
    Mar 20, 2018
    Posts:
    30
    Another quick question. Is it possible to make a spline follower rotate around its self? I have a UFO and I want it to spin around while it follows the spline. I tried using the custom rotation but I can't seem to get it working.
     
  6. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    You can either modify the rotation offset's Y axis in the range 0-360 or make the UFO object a child of the follower and rotate it.

    In order to modify the rotation offset, you will need a variable to store the rotation:
    float spin = 0;

    and in Update:

    spin += spinRate * Time.deltaTime;
    if(spin > 360f) spin -= 360f;
    follower.motion.rotationOffset = Vector3.up * spin;
     
  7. adaptivemobiledevelopment

    adaptivemobiledevelopment

    Joined:
    Mar 20, 2018
    Posts:
    30
    Thanks again. That worked fantastic!
     
  8. adaptivemobiledevelopment

    adaptivemobiledevelopment

    Joined:
    Mar 20, 2018
    Posts:
    30
    Another question. Not sure if this is spline related. I seem to be getting some micro stutters on the splines movement. When a follower is moving it is not smooth. It hiccups every so often. Like micro freeze for 1ms then continues. I'm not sure if this is a spline setting or maybe a unity setting. I have looked at the profile and there are no large spikes during the hiccups. Any ideas?
     
  9. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    We don't have any settings for intentional stuttering so there might be an issue with your scene. What do you mean by a 1ms stutter? Do you mean that you get a 1ms spike in the performance? I don't think you would be able to notice if a frame lags with an additional millisecond.
    Try opening the profiler and inspect the performance there. When you see the spike, pause and inspect where it is coming from.
     
  10. Milionario

    Milionario

    Joined:
    Feb 21, 2014
    Posts:
    138
    Hi is it possible for the Spline User to follow the spline with a negative speed but still facing forward and not changing the direction? For example a roller coaster cart when it loses momentum on the way up it should start going back on the track but still facing the same direction.
     
  11. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Yes, you will still need to set the follow direction to Backward but in the Transform tab (follower.motion in the API), you can set the rotation offset to 0, 180, 0.

    Best regards,

    Mitko
     
  12. Milionario

    Milionario

    Joined:
    Feb 21, 2014
    Posts:
    138
    Worked
    Worked beautifully
     
  13. Mr_NPE

    Mr_NPE

    Joined:
    Jul 2, 2018
    Posts:
    1
    Hi Dreamteck,

    I've been using your Dreamteck splines to make a hose asset out of rigid-bodies with colliders and Dreamteck node components linked to spline points. This has worked quite well but now that I am trying to make this all part of a unity prefab I have found that when putting a instance of the prefab in my scene the spline modifies the positions of all the connected rigid-bodies with node components. When linking the nodes to the spline points I followed the same method in the "Dreamteck Splines: Nodes and Junctions" tutorial. Is there something I'm missing when using a spline computer with spline points linked with nodes inside prefabs?

    Regards
     
  14. immeasurability

    immeasurability

    Joined:
    Apr 22, 2014
    Posts:
    125
    hi! how create spline by transforms?
     
  15. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Apologies for the very late reply - we sometimes forget to look at the Forum thread but we are quick to reply to mails in our support inbox - support@dreamteck.io

    I haven't seen this issue before, can you provide an example of the issue (just a scene with the spline setup that we can create a prefab of) so we can test it out? Thank you!
     
  16. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Can you be a bit more specific of what you want to achieve?
     
  17. immeasurability

    immeasurability

    Joined:
    Apr 22, 2014
    Posts:
    125
    everything is in order, I redefined the script, adding the ability to directly use transforms instead of inconvenient nodes

    Code (CSharp):
    1. public struct SplinePoint{
    2.      
    3.         public Transform        _transform;
    4.  
    5.         public Vector3            _position;
    6.         //public Vector3          position;
    7.         public Vector3            position {
    8.  
    9.             get {
    10.  
    11.                 if(this._transform == null) {
    12.  
    13.                     return
    14.                         this._position;
    15.                 }
    16.  
    17.                 return
    18.                     this._transform.position;
    19.             }
    20.  
    21.             set {
    22.  
    23.                 this._position = value;
    24.  
    25.                 if(this._transform == null) {
    26.  
    27.                     return;
    28.                 }
    29.  
    30.                 this._transform.position = this._position;
    31.             }
    32.         }
    33. }
     
  18. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Interesting approach. This, unfortunately, will not work with multithreading. What is the reason you decided to go that way instead of using Nodes? Maybe we can implement a feature in the future that would solve that issue.
     
  19. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Just wanted to pop in and say I haven't used this in a while. I recently started using it again because I am doing some things with race tracks. OMG the new spline mesh with channels is fantastic. It's not Easy Roads (which I own), but this tool is fantastic for my current prototyping it needs.

    I have a request / suggestion for the channels. And maybe I just missed how you might do this already.
    When you have only 1 mesh on a channel and set it to place mode, it would be great if you could still choose random and it chooses randomly between no mesh and the one mesh that is there.

    I was also curious if there was some way to really get a grip on very hard turns over 90 degrees with a road piece. Right now and as a common problem sharp turns like that just don't go well. You get crazy overlapping meshes and just crazy things happening. I'm sure it's a long shot but was thinking you guys might have a suggestion or solution.

    Anyhow, fantastic work guys. This thing has come a long way since I last used it. So glad I made that investment a while back. =)
     
  20. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Oh another feature request for the spline mesh. To be able to change the mesh at each spline point or segment.
     
  21. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Very glad you like the new additions!
    It's possible to add an empty space for the Spline Mesh we will look into it.
    Unfortunately, detecting sharp turns and handling geometry for them automatically is a very complex task and it's something that will increase the price of the plugin dramatically if we implement it.

    Can you elaborate a little bit on the mesh changing feature request? Currently, each channel has a clip range which can be set to work only for a given spline segment. That way you can stack up several channels one after another and have a different mesh for different spline regions.
     
    wolfen231 likes this.
  22. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402

    For the mesh changing. My idea is that lets say I am using a normal road piece... but at point 42 (or segment 42-43) I want to do a super sharp turn... and instead I could just throw in my own mesh at that position. -shrugs-

    It would also do pretty well for intersections and such. if I put in a 4 way or 3 way piece and use the nodes to intersect.

    Anyhow if i REALLY needed all this I could probably just go install Easy Roads haha.
     
  23. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    I am actually using ER and Dreamteck S in combination for my project right now...

    I suppose both of them help achieve a better outcome.
     
  24. LondonStevey

    LondonStevey

    Joined:
    Jun 26, 2015
    Posts:
    33
    Hi!
    I'm using your spline system for updating my skiing game and am loving it! Great documentation for creating your own SplineUsers etc. I'm dynamically generating variable length and width runs using the PathGenerator but want the triangle sizes to be the same for each run. It looks like everythings created based on the Resolution and Slices values, so have started creating a custom PathGenerator for this. Am I right in thinking there's nothing out of the box for that at the moment? (Obviously want to save as much dev time as possible! ;)) If not, I just want to check my solution for a variable length runs that will always have the same size triangles:
    In a nutshell its:

    double splinePos = 0;
    float triLength = 2;
    SplineResult evaluateResult = new SplineResult();

    while(splinePos < 1)
    {
    Evaluate(evaluateResult, splinePos);
    splinePos = computer.Travel(splinePos, triLength, Spline.Direction.Forward);

    // Recalculate the vertex position
    }

    Is the travel function the best bet for this?

    Many Thanks

    Steve
     
  25. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Sent a reply at support@dreamteck.io but to also answer in the thread: You can set "Uniform Samples" to true in the Settings foldout of your Path Generator to achieve this effect.
     
  26. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    I have a collision update that checks the trigger on a tag... which is a path generated mesh, all works well until I

    Set path generator faces double sided On I get jittery collision updates...

    Rather than continually being collided with the mesh its on and off throughout the entire mesh, so if my character was gliding on it it jitters. This does not happen without one sided checked off.
     
  27. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Hi team,

    I have heavy performance issues with the following code that sets the Result.Rotation to a transform. (SplineResult.cs) Did you have any efficient ideas to speed up this getter?
    Thank you..

    Code (CSharp):
    1. public Quaternion Rotation {
    2.             get {
    3.                 if (Normal == Direction) {
    4.                     if (Normal == Vector3.up)
    5.                         return Quaternion.LookRotation(Vector3.up, Vector3.back);
    6.                     else
    7.                         return Quaternion.LookRotation(Direction, Vector3.up);
    8.                 }
    9.                 if (Direction == Vector3.zero) {
    10.                     return Quaternion.LookRotation(new Vector3(0f, 0.0001f, 0f), Normal);
    11.                 } else
    12.                     return Quaternion.LookRotation(Direction, Normal);
    13.             }
    14.         }
     
  28. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Hmm, not sure what can be simplified here. How many times per frame are you calling this? Also, are you using this in a for-loop several times for the same spline result? If SplineResult.rotation (or SplineResult.right) will be used multiple times, it is always a good idea to cache their values and use the cached value. Finally, have you tried running the profiler using Deep Profile? It would tell you exactly which is the main culprit here.
     
  29. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Quaternion.LookRotation() is not that fast because of the internal calculations and use internally about 3 times Math.Sqrt(double) for quaternion values between 0.0 and 4.0.

    I was able to optimize my FastSqrt() to about 100% percent against System.Math.Sqrt() with a minimal lower precision by a 256KB table lookup.

    FastSqrt is optimized for Quaternion and trigonometry use case.
    Untitled-1.jpg

    Code (CSharp):
    1.         private static double[] fast_sqrt_table;
    2.         private static double fast_sqrt_q = 0;
    3.         private static double fast_sqrt_end = 4.0d;
    4.         private static bool fast_sqrt_table_done = false;
    5.         private static int fast_sqrt_granulation = 4000;
    6.  
    7.         [MethodImpl(MethodImplOptions.AggressiveInlining)]
    8.         public static double FastSqrt(double x) {
    9.             if (!fast_sqrt_table_done) {
    10.                 fast_sqrt_q = fast_sqrt_granulation / fast_sqrt_end;
    11.                 Fast_Sqrt_Build(fast_sqrt_granulation, fast_sqrt_end);
    12.             }
    13.             if (x > fast_sqrt_end) return Math.Sqrt(x);
    14.             if (x <= 0d) return 0d;
    15.             return fast_sqrt_table[(int)((x * fast_sqrt_q)-1)];
    16.         }
    17.  
    18.         private static void Fast_Sqrt_Build(int granulation, double end) {
    19.             double x = 0;
    20.             double step = end / granulation;
    21.             fast_sqrt_table = new double[granulation + 1];
    22.             for (int i = 0; i < fast_sqrt_table.Length; i++) {
    23.                 fast_sqrt_table[i] = Math.Sqrt(x);
    24.                 x = x + step;
    25.             }
    26.             fast_sqrt_table_done = true;
    27.         }
    28.  
    Further spline movement require a bit less LookRotation() complexity. The next spline sample never have the opposite direction, if so.. the spline is broken for any reason. Now FastQuaternionLookRotation() works in about the half of the time than Quaternion.LookRotation() and does the job extremely well.

    Edit: Was able to speedup FastSqrt a bit.
    Untitled-1.jpg
     
    Last edited: Oct 18, 2018
    Dreamteck likes this.
  30. immeasurability

    immeasurability

    Joined:
    Apr 22, 2014
    Posts:
    125
    hi! now i have real problem)))
    in scene window no editor tools for edit splines (empty project, clear import asset)
    no tools(((

    test in:
    Unity 2017.1.2p4 (64-bit)
    Unity 2017.2.0p4 (64-bit)
    Unity 2017.3.1p4 (64-bit)
    Unity 2018.1.4f1 (64-bit)
    Unity 2018.1.7f1 (64-bit)
    Unity 2018.2.3f1 (64-bit)
    Unity 2018.2.12f1 (64-bit)
     
  31. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Hello, try resetting the editor layout. Sometimes this is known to cause issues and we are not sure why.
     
    Sebastian_Trick3d likes this.
  32. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    * This happen for example if only one script has Red errors. This stops compiling all other stuff until all errors are solved. You should open the console and post the errors here. I sure there are.
    * Don't install the Incremental compiler 042.preview.21. (does not work with an island fail)
    * Make sure the gameobject spline computer you want to work on is not disabled.
    * Quit Unity. Delete the folder //Assets/Library/ScriptAssemblies. Restart Unity. During Unity .net update to 4.x sometimes stuff is broken.

    * The unity Prefabs are completely new. since 2018.3. and occurring as obsolete in all Dreamteck verions now.
    * Trying to register preference item: "Compiler". [PreferenceItem] attribute is deprecated. Use [SettingsProvider] attribute instead. https://forum.unity.com/threads/pre...settingsprovider-instead.554437/#post-3740488
     
    Last edited: Oct 20, 2018
  33. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Thank you!
    We still haven't released an official 2018.3 support version but we have been looking at the new prefabs and will make sure everything works smoothly once 2018.3 is out of BETA.

    About the compilation issue, immeasurability mentioned that they are importing Dreamteck Splines into an empty project which leads me to believe that it is probably the "Layout Issue" we're having.
     
  34. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    326
    +1 for 2018.3 support, please, pretty please!!! I know it's still beta but we are basing our project on it as we want to use the nested prefab features.

    @Dreamteck Think Dreamteck Splines is absolutely wonderful by the way. Having a great time with it.

    I'm constructing a roadway using prefab tiles and the tiles all contain splines. At each end of the splines I have nodes. So a straight piece might have 2 splines, one for each direction. Like slot car racing.

    When the tiles are instantiated, what's the best way to join the nodes together? Is there a way to merge nodes?
     
  35. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Alright guys, point taken! We'll rush this and try to provide support as early as the end of next week :D Didn't expect that that many people would be using 2018.3 with Dreamteck Splines but if this is the case, we're on it!

    Just to make it clear:
    In Dreamteck Splines we have two terms - Control Point and Node. The Control Point is a point that is used to define a spline and a Node is a special component that is used to bind Control Points to actual game objects in the scene. That being said, you have a couple of options to join the road tiles:

    1. Create two additional game objects with a Node component and place them where your four splines connect between the segments. Then you can call Node.AddConnection to connect splines inside the node. You can then use the node API to find connected splines and switch between them when following.

    2. Don't connect the splines at all, just keep a reference to the next and the previous spline somewhere inside your road segment. If you're not dealing with junctions, I would suggest using this approach - it's the cleanest of all

    3. Merge splines. In order to merge the splines, you will need to get all control points from the splines you want to merge, remove the duplicate ones (the endpoint ones) and feed them using SplineComputer.SetPoints to one single SplineComputer, deleting all the separate ones. In terms of following, this is the simplest approach because you won't need to switch splines during the follow
     
  36. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Hey, Devs,

    Can you please list any issues you have had with Dreamteck Splines under 2018.3b here? It would be really helpful for us in order to make sure we aren't missing anything when rolling out the new update.
     
  37. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    326
    Wowzers - that's fantastic.

    This was what I had in mind. I have 4 node game objects per tile prefab currently. When I create the tile game objects, I imagined I could choose one of each pair of joining ones, add the connection of the other, and delete the other.

    Nice. I will have intersections so there will be junctions - but they will be in the middle of the tiles, so this could work.

    I really like this approach and think I'll probably try this first. It seems I will have a bit more work on building the map, but that's way preferable to complexity during the game itself.

    Thanks again for Dreamteck Splines, the speedy response and all the creative ideas.

    As you can see, we're just beginning to add splines to the 2018.3 game but I will definitely report any issues found here. So far, it's really only been "GetPrefabType is obsolete" warnings (CS0618) - and for now we've just disabled those using pragmas. No idea what impact that has yet.
     
    Dreamteck likes this.
  38. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    I have some small ideas for an enhancement.

    1) Spline editor: Often the spline point lost it's original position while simply click on a spline point, without any movement. This is annoying because all other connected node and objects will remove in this case.

    There are 2 optimizations possible
    A) The easy way. Wait for 0.3s then accept movement.
    B) Move the spline point only, if the mouse screen point (x,y) was moved by abs(x1) or abs(y1) pixel.

    Get the original position of the spline point. Get the mouse position in world space.
    Measure the delta between.
    Get the screen mouse position.
    Start to move only, if the screen position of the mouse was moved by 1 pixel from the click mouse position.
    Move the spline point relative by difference of the delta position. This will make sure the spline point will not jump to any unwanted work position because of different camera positions.

    2) If the bezier tangents gizmos are close to the center point, it's really a pain to move the center point of the spline point. When in move mode, it would recommended to have the center gizmo only by any additional key has pressed. Eg. "C" if Move is activated.
     
    Last edited: Oct 21, 2018
    Dreamteck likes this.
  39. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    #2 Issue?
    If a computer component is folded then the spline editor disappears. I didn't realize this behavior and thought omg... there is anything broken. This is a bit irritating and took me a while to fiddle out. ;)
    Untitled-1.jpg

    Question:
    StaticNode.Connection[] connections = staticNode.GetConnections();
    Does this create a reference in connections to staticNode.GetConnections(); ?

    How do I get a copy by value of staticNode.GetConnections() to compare with a new changed properties?

    Edit:
    Unfortunately computer.SetPointTangents() from the node does not change anything:
    (flatten tangens) The code should set all tangents.y to the same y value of the node.position.y.
    But does not, I'm doing anything wrong?

    Code (CSharp):
    1. StaticNode staticNode = (StaticNode)target;
    2. StaticNode.Connection[] connections = staticNode.GetConnections();
    3. // ... Flatten Y tangent values
    4. bool lDown = Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.L;
    5. if (lDown) {
    6.     // ... Invert all tangents on a staticnode
    7.     if (connections.Length > 0) {
    8.  
    9.         Debug.Log("StaticNode: Flatten all tangents Y // connections.Length " + connections.Length);
    10.  
    11.         var y = staticNode.transform.position.y;
    12.         for (int i = 0; i < connections.Length; i++) {
    13.             // ... Target position of all Tangent.y
    14.             var t1pos = connections[i].computer.GetPointTangent(connections[i].pointIndex);
    15.             var t2pos = connections[i].computer.GetPointTangent2(connections[i].pointIndex);
    16.  
    17.             t1pos.y = y;
    18.             t2pos.y = y;
    19.  
    20.             connections[i].computer.SetPointTangents(connections[i].pointIndex, t1pos, t2pos);
    21.         }
    22.  
    23.         staticNode.EditorRefresh();
    24.         staticNode.BakeConnections();
    25.         SceneView.RepaintAll();
    26.     }
    27. }
    28.  
     
    Last edited: Oct 23, 2018
  40. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Unfortunately, this is a Unity thing. Folding a component in the inspector will prevent the editor methods from being called and I'm not sure how we can work around this.

    We don't have a StaticNode class but if this is a class that inherits from our Node class, then yes, it provides a reference to the connections array.

    I'm not sure what might be happening with SetPointTangents. It works for me if I call it on a Spline Computer. Maybe there is a problem with that StaticNode class? Does this happen for you with a regular Node?
     
  41. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Solved it:
    Changes on a Node or StaticNode (your team has developed for me) always require an update function based on the default Dreamteck code.
    var computerPoints = connections.computer.GetPoints();
    connections.computer.UpdateConnectedNodes(computerPoints);

    Code (CSharp):
    1. for (int i = 0; i < connections.Length; i++) {
    2.      // ... Target position of all Tangent.y
    3.     var t1pos = connections[i].computer.GetPointTangent(connections[i].pointIndex);
    4.     var t2pos = connections[i].computer.GetPointTangent2(connections[i].pointIndex);
    5.     t1pos.y = y;
    6.     t2pos.y = y;
    7.     connections[i].computer.SetPointTangents(connections[i].pointIndex, t1pos, t2pos);
    8.  
    9.     // ... Update required
    10.     var computerPoints = connections[i].computer.GetPoints();
    11.     connections[i].computer.UpdateConnectedNodes(computerPoints);
    12. }
     
  42. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Oh, I know who you are! Sorry about that. Yes, I'm up to speed now.
    Strange, calling SetPointX should automatically be calling Node update. We will inspect this.
     
  43. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Yes I'm the master of the dynamic splines samples. ;) I solved the issue with selecting the tangents at the StaticNode as well.
     
    zKici and Dreamteck like this.
  44. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    326
  45. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    ECS is still pretty new to us and we need to take a lot more time to research it and figure out good/bad practices design-wise before we could start thinking of implementing it. From what I know about ECS so far, I think that in order to pull it off, we will need to re-design it fundamentally and if this turns out to be true, then we might just branch it and create a new Spline Tool with a different architecture that would improve on Dreamteck Splines and would be upgradeable from Dreamteck Splines. It is all still pretty early to say.
     
  46. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    There is no way to combine ECS with the spline system, so people can simply use out of the box.

    ECS is interesting if you have a local area where to move > 5.000-60.000 objects on PC at the same time and all the actions happen in the camera range of this local area.

    1) Now think about, how many objects you want to move on a spline in your game....And how many times per frame you can calculate a position/rotation on a spline without cooking the cpu? If less that 2000 then you can do out of the box with unity. So you don't need the ECS system.

    2) Currently there is no efficient way to fill the NativeArrays that hold data of the game objects for the entity manager. Also not any load or save method for a chunk of game objects. Preparing 1000 game objects and ***DATA in a loop for the entity manager requires about 100ms. If you have several sets of animated objects you must prepare them all at awake() or start().

    3) All spline data access must be scheduled in Jobs. The spline samples must be stored into native array to work with ECS and the jobs. But that happen if we have to go on another spline is connected by a node? All this new spline sample data must to into an NativeArray again. Did you remember point 2) ***

    4) I do not want to think about if we have animated splines, where all spline sample data change in each frame. o_O

    But yes.. on some basic conditions it works.
    Pack all sample data at start into a NativeArray, prepare the entity manager with a game objects you want to move at start or awake. Use jobs to move all the stuff. As a spline user you require valued acknowledge about the ECS system to handle your unique required options also.

    On the other hand, if your spline network spreads over your whole game-world and you want to access all spline samples data time by time at any location globally, plus you move only several object (~1000) at the same time, ECS will be not your friend.
     
    Dreamteck likes this.
  47. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    326
    Is that right? It looks more like a complete paradigm shift to me.

    Thank you for all your comments - I've only started looking at ECS as an option for our game. Some of the introductory vids seem to present it as "the future of Unity", though I guess time will tell.
     
  48. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    326
    This vid from Unity co-founder and CTO Joachim Ante is the one I was talking about:

    "The future of Unity (Entity Component System & Performance)"

     
  49. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Within the new version 2019.1 seems they have new functionalities to get pre serialized entity.manager data directly streamed into the entity manager. This is currently with 2018.3 not possible.

     
    Last edited: Oct 30, 2018
    Colin_MacLeod likes this.
  50. Colin_MacLeod

    Colin_MacLeod

    Joined:
    Feb 11, 2014
    Posts:
    326
    Love that "Bladerunner" scene. So cool