Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using scripting to generate meshes over time
#1
Hi,

First post here, and I have to say your asset it brilliant. It is used for so many things in our game and it always perform exactly how we need it to.

My question is;

We're using splines and generators to generate train tracks in runtime. However, right now they are just turning on and popping into existence visually. We want to turn this into a gradual process, as if the rail track is appearing from start to end over time. We've done a few prototypes to test how this can be done best, but, none of our solutions feel good enough to us. So I wanted to ask what would you do in this case so we can get some new ideas we haven't thought of yet and keep prototyping.

Goal;
Make a train track (user cannot change the shape or location at all) appear from one edge of the terrain to the other, from start to end. The tracks however are composed of multiple splines and connections. I would also have to hide the area where the track is "currently" appearing.

What we've tried so far;

- Start with all CP's (and the track mesh) under the terrain, and slowly raise each CP up one by one, so the track kind of raises out of the ground. Possibly could put a spline controller to follow roughly the location of the transition from under the terrain to over it to mask the spot with a "rail constructing train car".
- Start with all CP's where they are supposed to be and increase the "range" on the path over time to make the mesh grow from start to end. Again, I could find a way to sync the exact spot the mesh is "appearing at" and a controller to mask the appearance, but I couldn't get this to work when going through connections etc. Only worked for a single spline and its own generator.

I'm more looking for ideas and direction as we're all amateur game devs and we might be missing easy solutions to our problems in our learning process.

Thanks a lot.
Reply
#2
Hi

Thanks a lot for the compliment Smile

I thought of some more solutions, but not sure they would succeed where the ones you mentioned failed:

You could use a Variable Mix Shapes module, to combine two shapes, one for the normal track, one for the appearing one
You could use the Scale tab of the Shape Extrusion module
You could use the TRS Path module to move the path above/under ground

Did this help?

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
#3
Hi again,

I've managed to solve the previous problem by using an object with a spline controller and a custom script attached where the custom script gets the current spline and talks to its generator to make it appear at the relative position of the controller. With a custom selector logic I can now send this object anywhere on my network and make it "build" the roads. Your suggestions solved further few issues and I can now confidently say that we're happy with the system enough to proceed to the end with it.

Which brings me to some new questions if I may;

As we are creating a city, and every road segment is a separate spline (so every intersection adds 2-8 splines and many connections), we're ending up with a LOT of "create mesh" modules, either in a single massive generator or in 100s of small generators. Is there a way of combining (adding together into a single output) the splines, the volumes or the meshes in the generator graph, or somewhere else, so we can manage these 100s of splines in a single generator with a single create mesh output for example?

(as a further example; wanting to edit the output layer turns into a 1000~ click operation in either of our cases, and adding new road segments to the system is much more difficult than it could be if we had a "combine splines" module we could place before the shape extrusion. This would reduce the number of modules in our generator by about %85 while keeping the result exactly the same)

Please let me know if I'm missing anything in this thought process and how we might solve the scaling issue.
Reply
#4
Hi
When creating meshes via extrusion, as of now, only the last module (Create Mesh) takes multiple inputs. To reach what you described, both Volume Mesh and Shape Extrusion should too take multiple inputs. This is something I am aiming to do at some point, but nothing is done for now.
To solve your issue, I see two solutions for you to do. I strongly recommend solution A.
A- have a script that modifies all the modules for you. For example, that script would have a reference Volume mesh module, and at each change it will apply the modification from the reference module to all the existing modules.
B- modify the source code of the Volume Mesh and Shape Extrusion modules to make them take multiple inputs. If you are not already familiar with the Curvy Generator code, you might find this difficult to do.
I hope this helped. Feel free t ask me further questions
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
#5
(02-11-2022, 11:51 AM)_Aka_ Wrote: only the last module (Create Mesh) takes multiple inputs.

See, simply not knowing this and having missed the [] detail next to the input was making my life so much harder than it needed to be, so already you've helped. My generators had the same number of create mesh nodes as extrusion and volume mesh nodes. Now I only need 1 (or more like 5) create mesh nodes instead of about 40.

And I think all you need is a "combine paths into shape" node that takes multiple splines as input, does everything that is currently done in the "path" tab of the shape extrusion node (range and resolution and whatnot) for each connected spline in its own Spline:# tab, and puts out a "single path" that contains all of the paths (with gaps etc because range already applied) and the applicable ranges the shape extrusion can multiple-extrude from.

In this case the most common entry point (many splines into whatever) would be multi user. I don't think anyone would need a multiple-input volume mesh node anytime soon if multi spline use in the same generator was easier somehow.

Anyhow, thank you again for the direction. It helps a lot. I'll get back to you if anything comes up.
Reply
#6
You are welcome, and thank you for the suggestion. I took note of it, and will consider it when working on a solution to simplify multiple extrusions.
Thanks again, and 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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cant Generate Meshes At Runtime alms94 5 22 01-26-2024, 11:27 AM
Last Post: _Aka_
  Disable rebuild of meshes in dynamic mode Zilk1 1 8 10-04-2023, 09:50 AM
Last Post: _Aka_
  Combining two separate meshes ava_ava 2 7 07-26-2023, 05:49 AM
Last Post: ava_ava
  How to generate mesh on spline at runtime? _RicO 8 17 07-19-2023, 08:55 AM
Last Post: _Aka_

Forum Jump: