Dismiss Notice
Hey Guest,
If you are interested in ghosting, the Ghosting Awards for January 2025 has just been announced:

Click here to check it out!

[FRHD-Lang] Generate complex tracks

Discussion in 'Anything and everything Free Rider' started by KillerMeemStar, Jul 30, 2016.

?

What should I add next?

  1. Circles

    35.7%
  2. Curves

    34.7%
  3. Fill area

    44.9%
  4. Shading

    55.1%
Multiple votes are allowed.
  1. m1.c3

    m1.c3 Active Member Official Author

    Some Codes I Made (open)
    Code:
    mode(0);
    set("x",0-50);
    set("y",50);
    set("w",9);
    set("h",12);
    set("s",4);
    text(x,y,w,h,s,"MonospaceLines","TEXT HERE");
    Code:
    rect(0-2000,50,4000,2000);
    mode(1);
    rect(0-2000,0-2000,4000,4000);
    Code:
    for("x",0-1000,1000,50,1);
    for("y",0-1000,1000,50,1);
    line(x,y,x*5,y*5);
    mode(1);
    set("a",0-1000);
    set("b",2000);
    rect(a,a,b,b);
     
    Last edited: Jul 31, 2016
    SCrane and KillerMeemStar like this.
  2. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    Nice! the last one is pretty sick
     
    m1.c3 likes this.
  3. m1.c3

    m1.c3 Active Member Official Author

    Thanks :) Can you use exponents? I tried doing ^x but it didn't work
     
    KillerMeemStar likes this.
  4. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    Just added them - they should work now
     
    m1.c3 likes this.
  5. viiruMIAIMIAU

    viiruMIAIMIAU Well-Known Member Official Author

    I was playing around in this and managed to break a bomb
    I have to put it on pastebin because its too lenghty for a post
    http://pastebin.com/qzsXW4EX
     
    KillerMeemStar and m1.c3 like this.
  6. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    btw you can, on the website, click "get link" and it will give you a link to the website with your code loaded
     
    m1.c3 likes this.
  7. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    m1.c3 likes this.
  8. m1.c3

    m1.c3 Active Member Official Author

    Thanks I didn't know you could have inside parenthesis
     
    KillerMeemStar likes this.
  9. m1.c3

    m1.c3 Active Member Official Author

    Code:
    for("x",0-1000,1000,50,1);
    for("y",0-1000,1000,50,1);
    line(x,y,x+(y/(0-100)),y-(x/(0-100)));
    
     
  10. viiruMIAIMIAU

    viiruMIAIMIAU Well-Known Member Official Author

    How do I make the track code back to FRHD-Lang? I edited the track in the normal editor so it doesnt have a full FRHD-Lang code. Maybe try add a Track code -> FRHD-Lang transfer. If its already possible in some way then nvm
     
    KillerMeemStar and m1.c3 like this.
  11. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    I will add that next - a track import tool ;)
     
    m1.c3 likes this.
  12. m1.c3

    m1.c3 Active Member Official Author

    Lard Line Modifier
    This program makes infinite non-physical black lines that you can easily adjust up, down, left, or right. (Click the spoilers below for more info)
    Horizontal
    Code:
    set("v",0-50);
    set("x",0-699245);
    set("y",(0-1)*v);
    set("z",(0-1)*x);
    line(x,y,z,y);
    Vertical
    Code:
    set("v",0);
    set("x",0-699245);
    set("y",(0-1)*v);
    set("z",(0-1)*x);
    line(y,x,y,z);
    When entered into Free Rider Lang, this should come out to "-lard 1i lard 1i##"-Horizontal, "0 -lard 0 lard##"-Vertical
    Simplified Versions (open)
    Horizontal
    Code:
    set("v",0-50);
    line(0-699245,(0-1)*v,699245,(0-1)*v);
    Vertical
    Code:
    set("v",0);
    line((0-1)*v,0-699245,(0-1)*v,699245);
    These are useful for making multiple lines.
    Explanation (open)
    Examples (open)
    This creates a box around spawn. (I added a regular line at the bottom)
    Code:
    set("v",0-50);
    line(0-699245,(0-1)*v,699245,(0-1)*v);
    set("v",30);
    line(0-699245,(0-1)*v,699245,(0-1)*v);
    set("v",0-40);
    line((0-1)*v,0-699245,(0-1)*v,699245);
    set("v",40);
    line((0-1)*v,0-699245,(0-1)*v,699245);
    line(0-40,50,40,50);
    If you make an example, you can send it to me in a PM and I'll add it above. (I'll credit you for it)
    Please like this post if you learned something :thumbsup:
     
    Last edited: Aug 4, 2016
  13. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    Version 0.0.3 (Alpha)
    Another small update.
    Added:
    • import function. See example below
    • now you can use spaces whenever you want, for example "rect(0-40,50,80,80);" is equivalent to saying "rect(0-40, 50, 80, 80);"
    Import Function
    People have requested a way to convert normal tracks to FRHD-Lang code. That's not what this is :p but it's a step toward that direction.
    The reason I have not made a conversion method yet is simply because it would be very very complicated. (for me to program, at least :p). I could easily make it so it just translates all the lines to line functions, but that would be a ton of code. What if you imported a track that contains a filled-in rectangle? That's a lot of lines - and it would be hard to detect it was a rectangle.

    Anyways...

    The import function is very simple. For example, the default track code is "-18 1i 18 1i##" (when you click "Draw a Track" and then "Export"). To import this default track, simply do:

    Code:
    import("-18 1i 18 1i##");
    And it will add that track to the output.

    Just ask me if you need any help, or this didn't make sense ,_,

    Coming Soon
    • Now I'm working on a pattern tool (e.g. bricks) as suggested by m1.c3
     
    Last edited: Aug 1, 2016
    m1.c3 likes this.
  14. InTheSavce

    InTheSavce Well-Known Member Official Author

    m1.c3 likes this.
  15. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    KillerMeemStar Similar to polygon, I like messing with the track code and I love what you are doing with this.. I know enough JavaScript to mess around a bit, but not enough to do anything like this, and I want to commend you on how well this works. However, I do have a couple suggestions:

    - Currently, you can only edit variables using the set(); function, but what if variables in this reacted similar to the way the do in traditional JavaScript. I think the large majority of it should be this way, adding while(); functions, changing the for(); function to work like it does in JS, and being able to easily edit a variable after it has been defined. (You could even use "var" or "int" to define them). This would make it much easier for beginners to catch on to, because there are plenty of JS tutorials on the web that would make it easier.

    - I think that all the info here in this thread should be on the FRHDLang website as well, because the tutorial page there is somewhat lacking. If you want, I can write up a full documentations with each function that can go in a tab on the website.

    - Don't add an image import function. There are many tracks that individuals publish using AutoGen Programs already that get deleted or completely ridiculed, but still push more worthy tracks out of hot and trending. In the past people have tried to make Autogen programs public to the FreeRider community but their threads have been deleted. Don't let this happen to you, this is a great piece of work, don't taint it with image to track generation.

    Lastly, I don't know where all I will be able to help, but if you need someone to help with documentation or even a little bit of the coding, let me know. I would be glad to help and be part of this cool project.

    (Also, the code generation page isn't currently working, it just constantly says that there are unmatched parentheses)
     
    KillerMeemStar and m1.c3 like this.
  16. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    Lol nice. Have you every programmed before? You got this really quickly
     
    m1.c3 likes this.
  17. m1.c3

    m1.c3 Active Member Official Author

    I've programmed a little before, but Lang has really helped me out :)
     
    KillerMeemStar likes this.
  18. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    KillerMeemStar So I spent the past couple days playing around with the code searching for ways to generate random terrain. I figured out how to do it, but it will take some time before I can make the code plausible, because we can't generate random numbers yet, and we don't have "if" statements. I think adding those two things will open up an insane amount of possibilities for using this code.

    (Also, I found that using this to generate mathematical equations is kind of fun - ex. riding the bike at the bottom of a parabola produces some crazy speed/glitches)
     
    KillerMeemStar and m1.c3 like this.
  19. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    m1.c3 I figured you would like this
    Generate Tracks based on Mathematical Equations
    You can use this code to generate any track based on a mathematical equation relating x and y variables. Currently, you can only use equations that are based off of y (y=blank). Without the use of logarithmic and/or trigonometric equations, this mostly limits you to polynomial equations. Here is the code to generate it:
    Code:
    set("xx",0-1000);
    set("yy",0);
    for("x",0-999,999,3,4);
    set("y", EQUATION HERE );
    line(x,y,xx,yy);
    set("xx",x);
    set("yy",y);
    Usage
    The fourth line holds the equation in the second portion of the set(); function. All you have to do is insert the expression for the y=equation after the comma. Be sure to use proper order of opperations. Keep in mind that in freerider, up is considered negative and down is considered positive.
     
    Last edited: Aug 6, 2016
    KillerMeemStar and m1.c3 like this.
  20. m1.c3

    m1.c3 Active Member Official Author

    I don't quite understand it, but you've given me a lot to work with. Thanks :)
     
    KillerMeemStar likes this.

Share This Page