• Create Account

## Create infinite curve

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

8 replies to this topic

### #1noatom  Members

919
Like
0Likes
Like

Posted 19 November 2013 - 01:11 AM

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?

### #2Álvaro  Members

20267
Like
1Likes
Like

Posted 19 November 2013 - 01:16 AM

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. ;)

### #3noatom  Members

919
Like
0Likes
Like

Posted 19 November 2013 - 01:23 AM

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, 19 November 2013 - 01:31 AM.

### #4Álvaro  Members

20267
Like
0Likes
Like

Posted 19 November 2013 - 01:32 AM

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.

### #5noatom  Members

919
Like
0Likes
Like

Posted 19 November 2013 - 01:58 AM

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, 19 November 2013 - 02:06 AM.

### #6HappyCoder  Members

4740
Like
0Likes
Like

Posted 19 November 2013 - 02:11 AM

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?
My current game project Platform RPG

### #7apatriarca  Members

2311
Like
0Likes
Like

Posted 19 November 2013 - 03:20 AM

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).

### #8LorenzoGatti  Members

4089
Like
1Likes
Like

Posted 19 November 2013 - 03:46 AM

Omae Wa Mou Shindeiru

### #9ferrous  Members

5772
Like
0Likes
Like

Posted 21 November 2013 - 08:04 PM

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)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.