# Create infinite curve

This topic is 1882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

So I basically start with a straight line from 0,0 to 0,10 (x,y space),and i need to add another line of that length,connected to the old one,but which slowly makes a curve,then another one....

The point is,I want the lines connected.

The bigger problem is doing this for infinite time.How would you go about it?

##### Share on other sites
We are going to need either a much better description of the situation (ideally including why you are trying to do this) or a picture of what you want this to look like: My mind-reading skills are not what they used to be. ;)

##### Share on other sites

I just need to code random generated curves forever. For example,you start with 100 floats,representing points. With those 100 floats you have to create a random curve.When you move forward,you delete the first float,and create a new one,but that new one IS based on the 99th one.Basically each new float is somehow linked to the float behind it.

or look at it from this point,you always have 100 points.You first create a curve.Whenever the player moves forward,you create a new point where the player WAS last time,and that new point is creating a new curve.

So,if player is is on point 1,but moves to point 2,point 1 will equal to a new point.You do that untill all points have been recreated to form a new curve.

Edited by noatom

##### Share on other sites
Sorry, but you are still not making a lot of sense. I don't understand what you are trying to do, or the connection between the 100 floats and the random curve, or what you mean by a float being based on another, or the nature of the link between the new float and the float behind it.

You probably have a more natural problem in mind, and you convinced yourself that it could be reduced to something like what you are describing. If you explain the circumstances in which the need to solve this problem arose, we will be in a much better position to help you.

##### Share on other sites

ok,the real problem is: " implement a road ,that has curves,and that goes one forever". When it says goes on forever,it means that when the player goes forward,the road will become longer.

its in 2d space btw

Edited by noatom

##### Share on other sites
If I understand you correctly, you are wanting to create something similar to snake right? Meaning you have a path and you have a head of the path where it grows but as it grows at the head, the tail gets shorter so you always have the same number of points, right?

##### Share on other sites
I am assuming only a quite small part of the curve is visible at any time. If the player can only move forward you can then simply store the visible portion of the curve and generate new parts as needed. The old parts can be easily discarded. If the player can also move backwards you probably need something more complicated (but it depends on your needs).

##### Share on other sites

I may be misunderstanding, but you want a curve that you can add control points to?  That should be straightforward enough.  As long as you keep adding points to a spline, it will keep getting longer.  A catmull rom spline, my go-to spline, only looks at 4 control points at a time, so you can remove points that are already off-screen, and add more on as they approach on-screen.  (I also like catmull rom because all the control points are on the curve)

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634059
• Total Posts
3015292
×