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

    zeke15 Well-Known Member Official Author

    Awarded Medals
    Do you know basics math functions in forms such as y=mx+b, or y=ax^2+bx+c that you could graph on a graphing calculator or on paper? If you remove the "y=" portion of these equations, and put the rest into the spot where it says "EQUATION HERE", it will then create a track that matches that equation.

    Here is a sample equation for a basic parabola:
    y=-0.002x^2+50
    Which then gets put into the program like this:
    Code:
    set("xx",0-1000);
    set("yy",0);
    for("x",0-999,999,3,4);
    set("y",(0-0.002)*x^2+50);
    line(x,y,xx,yy);
    set("xx",x);
    set("yy",y);
     
    KillerMeemStar likes this.
  2. m1.c3

    m1.c3 Active Member Official Author

    Thanks I know y=mx+b but what about (for example) set("xx",x);?
     
    KillerMeemStar likes this.
  3. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    "xx" is the last x value that was looped. The last 4 lines are looped by the "for" command (the last 4 in the for command indicates 4 lines to be run)
    Same with "yy", it's the last y value that was looped.

    zeke15 I'll add if statements and a rand(min,max) function now

    In the future I would like to attempt to make a random terrain generation function, with jump distances that are calculated so they are smooth
     
    m1.c3 likes this.
  4. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    The code has gotten pretty messy and error-prone, so I'm going to rewrite the program ;-;
     
    zeke15 and m1.c3 like this.
  5. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    the xx and yy variables are used to create the lines that make up the graph. They just link the last value that was looped to the new value. (It provides the second point needed for the line(); function)
     
    KillerMeemStar and m1.c3 like this.
  6. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    rip
     
    KillerMeemStar and m1.c3 like this.
  7. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    zeke15 m1.c3
    Instead of working on the programming language, I'll start the editor
     
    m1.c3 likes this.
  8. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    Ok, btw, where did you learn how to do all this?
     
  9. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    BrandonioProductions ;D

    For Java. Once I had a basic knowledge of the language, I just googled anything I wanted to learn, I copied and pasted code, then eventually learned from experience
     
    m1.c3 likes this.
  10. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    I guess I am binge watching tonight lol. I learned a lot of javascript from online tutorials and junk, but most of it has more extensive prosessing done that it doesn't fully work properly outside each tutorial site, and most of them don't teach integration into websites and what not. That is what I am working on learning.
     
    KillerMeemStar likes this.
  11. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    Well BrandonioProductions is for Java, not JavaScript. JS is for websites, and Java is for general applications.

    You could try for JavaScript
     
    m1.c3 likes this.
  12. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    yeah I know. This should give you an idea of how much I can currently do/how much I know. I made this, even though it is pretty simple:
    http://codepen.io/zeke15/pen/VjLNPp
     
    m1.c3 and KillerMeemStar like this.
  13. zeke15

    zeke15 Well-Known Member Official Author

    Awarded Medals
    Btw, I like the random notation in your code that shows how to make a creeper face, I saw that when looking through it earlier XD KillerMeemStar
     
    m1.c3 and KillerMeemStar like this.
  14. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    lol I thought I'd save it for a Minecraft track, but then realized theres like 20 of those already.

    nice code. btw if you didn't know, StackOverflow is a great place to find answers, but I wouldn't really recommend asking questions :p they are very strict lol

    At this point, I'd recommend learning some programming concepts, e.g. recursion, object-oriented programming, and some other stuff. For that if you want, you can look up "recursion javascript tutorial" or something like that.

    For practicing, Project Euler is great. It has many challenges, mostly aimed at programmers.

    Java, IMO, is one of the best languages to start learning. JavaScript can probably seem sometimes kind of magic, but Java can clear that up.

    Python is another great language to begin learning, but is really not that common. It has nothing special IMO. I hate it (not as much as PHP though)...
     
    zeke15 and m1.c3 like this.
  15. F1n1sh

    F1n1sh Well-Known Member Official Author

    How do i make a code for the top box?
     
    m1.c3 likes this.
  16. END3R

    END3R Member Official Author

    English... oops.. sorry. :(
     
    KillerMeemStar likes this.
  17. Sono

    Sono Well-Known Member Official Author

    KillerMeemStar I love this so much.
    Have you considered embedding the visual part of your application in the webpage? It would be pretty easy. Check out p5.js - a JavaScript library that makes drawing lines and shapes to a webpage as easy as pie.

    I've already designed a working (kinda) FRHD editor in Java-Processing, and translating the code over to p5.js would be basically copy and paste. If you would like some help on the visual stuff so you can focus on the language then let me know - I'd love to help!

    PS. Python is my baby - don't bash on it! -.-
     
    KillerMeemStar and m1.c3 like this.
  18. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    I kind of stopped working on FRHD-Lang, for this:
    http://community.freeriderhd.com/threads/frhd-advanced-editor-accepting-beta-testers.5975/

    you can help me with it if u want... kind of sucks you just did basically the same thing xD

    ps: i havent worked on it in a while, BUT i am going to do something pretty sick: a text tool that uses any font you have installed on your computer :D
     
    m1.c3 likes this.
  19. Sono

    Sono Well-Known Member Official Author

    Ya that was basically my project. Had to put it on hold indefinitely due to school getting in the way of progress.
    What language are you using for the project?
     
    m1.c3 likes this.
  20. KillerMeemStar

    KillerMeemStar Well-Known Member Official Author

    java (with JavaFX)
     
    Empire and m1.c3 like this.

Share This Page