Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mapping of huge rail tracks(80miles)
#1
Hi, can you give me some best practices to create these rail tracks? 
The path should be loaded from the file and everything should work in real time.

Tracks and other things related to the train will be generated on the spline.
I need some tips how to optimize this? It is possible to cut spline to smaller spline? Or Maybe one big spline is more efficient.

Thanks.
Reply
#2
Hi,

First of all, read these two pages
https://curvyeditor.com/documentation/generator/optimizing_performace  (this one is about curvy generators)
https://curvyeditor.com/documentation/splines/cache?s[]=performance  (this one is about splines)

Then (and this is maybe something you are already aware of) the first thing to do if you want to optimize is to profile. Unity included a decent profiler https://docs.unity3d.com/Manual/Profiler.html
Also, if you use a recent Unity version you can download this useful package too https://blogs.unity3d.com/2019/05/13/introducing-the-profile-analyzer/

Then, to answer your specific questions:
  • It is best to generate a mesh from a long spline than generating multiple meshes from small splines and combining them.
  • If needed, Curvy can serialize and deserialize splines from/to Json. More about it here: https://curvyeditor.com/documentation/import_export (functionality available through the API too)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Thanks, i will try it.
Reply
#4
Hi,
I have a new question. I have my predefinded long straight spline with only 5 points. And i want to generate meshe in runtime, and unload unsed meshes. Can i generate mesh in space between points? Or mesh can be generated only when start and end are point. What is best approach? Smile
Reply
#5
You can do that by using the Range property of the Shape Extrusion module
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#6
Hi,

I have a similar problem. I have to generate GameObjects along my track. Is there any way of Object Pooling to reuse old GameObjects?
Reply
#7
Hi,
Pooling is automatically done when creating game objects through the Curvy Generator. To see it at work, you need to be in play mode. The script handling the pooling is attached to the Curvy Generator game object and is called Prefab Pool. It will create objects when needed, and store them for later use when not needed anymore.
Does this answer your question?
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#8
I don't find a documentation of the Prefab Pool and don't understand it's settings. Can you please explain it to me?

I have tried editing the spline on runtime, but that only generates new GameObjects and don't delete/disable/reuse the old ones.
Do I have to edit the spline on runtime to use pooling? What am I missing?

What I try to accomplish is similar to the infinite track example, but instead of a mesh I like to enable/disable GameObjects. So when my train passes the track, the sleepers behind the train should be placed in front.
Reply
#9
Hi,

The Prefab Pool need to be documented. Sorry for that. I am leaving for the airport in 10 mins, so here is a quick explanation:

If you keep the params by default, Curvy will handles things properly: create a cube when needed, and push it back in the pool for further usage when not needed anymore. The current number of available objects in the pool is shown here:

   

Open the attached scene, hit play, and what that counter: when you reduce the length of the spline, the number of used objects is reduced, and they go to the prefab pool, increasing the counter.

About the parameters of the pool:
  • Min Items is the minimal number of items in the prefab.
  • Speed: is used to defined a rate at which the prefab creates objects. Just give it a small number if needed.
Most of the time you will not need to set parameters to the pool. Curvy should handle things properly by itself. But if you need to, just tweak those parameters and keep an eye on the objects counter.

Sorry for the answer not as detailed as I would have liked.
Have a nice day


Attached Files
.zip   temp.zip (Size: 10.2 KB / Downloads: 3)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#10
I think I got it now! Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  3D Platformer Rail Grind Asarge 1 6 07-19-2023, 09:12 AM
Last Post: _Aka_
  Distorted rail lines when copy-pasting generator KennUnity3D 2 10 10-10-2022, 06:55 PM
Last Post: KennUnity3D
  Is curvyspline a good solution for a 2D rail grinding game? bazz_boyy1 2 8 03-01-2022, 11:49 AM
Last Post: _Aka_
  Train tracks with transparent middle? jh092 4 2,250 07-03-2020, 07:13 PM
Last Post: _Aka_

Forum Jump: