JavaScript JavaScript Revolution

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Trumpet63
    Mostly Ignored
    • Mar 2011
    • 471

    #1

    JavaScript JavaScript Revolution


    I have made a rhythm game engine using javascript and the library processing.js, and it’s open source, and actively in development. Here’s a demo, recorded on my very lame computer:



    Track my progress

    Features
    - Converts any .sm text file into note information with time values in seconds
    - Handles any changes in bpm without changing scroll speed
    - Supports multiple difficulties in one file
    - Displays notes with a vector-bases noteskin, which has potential for more visual effects
    - Supports different scroll speeds
    - Code infrastructure has support for more than four keys
    - “Controller Visualization” displays theoretical play using a new controller concept (i.e. it's a controller with two buttons for each arrow direction, played with one button above and below each finger)
    - Accepts input and allows you to hit notes (make them disappear) and it send the accuracy information to console.log


    Why is This a Thing?

    The point of open source projects are to push an industry or product forward, and change the status quo, this project is intended to:
    - Put some skilled coders to work
    - Make me better at coding, and fill my spare time
    - Get people to consider the possibilities and give people on FFR something to be excited about
    - Make the best dang rhythm game we can, and fill it with new, awesome features


    How to Use This Program
    1. Get a .sm file
    2. Get an audio file
    3. In code.js, edit the line: String lines [] = loadStrings("FILEPATH.sm"); to include your file.
    4. In code.js, edit the line: var audio = new Audio("FILEPATH.abc"); to include your file.
    5. Open main.html in your browser. Due to Chrome and IE security protocols, if you're running it locally, you need to open it in Firefox.
    6. There are several options:
    . Change your scroll direction by changing line 22 in code.js, either "Up" or "Down"
    . Change your offset by changing the value of manualOffset on 72 in code.js
    . Turn the controller visualization on or off by changing showController on line 23 to either true or false
    . To set your own keys, you need to change line 343 to the key codes of your preferred setup


    How to Contribute to This Project
    - Download it and use it
    - Post in the thread about having used it
    - Post in the thread about things you do/don’t want it to do
    - Try to understand the code
    - Ask things when you don’t understand the code
    - Write your own code, and submit it to the GitHub page
    - Teach me how to use GitHub
    - Help me write a better formatted OP
    - Start your own project, and make an even better engine


    Bugs, Issues, or Oversights


    Todo
    X Handle input
    - Interface for selecting songs within a folder
    - Interface for options menu
    - Results screen
    - Return to home screen after results screen
    - Crazy ideas that are only relevant once the other todo’s are done, like:
    . scoring
    . results graphs
    . support for held notes, mines, and pull-off held notes (i.e. like osu!mania)
    . visual effects on note hit
    . difficulty calculation algorithm


    Technical Overview

    View Documentation

    Parses .sm file:
    1. Converts text into an array of strings, one string per line of the text file
    2. Finds title, artist, offset, and bpms
    3. Finds the line number where the notes for each difficulty starts, and associates the names of the difficulties
    4. Using the bpm and information about the measure, associates each note with a time position

    Displays notes:
    1. Based on the size of the display region, scroll speed, and receptor position, determines the range of times that can be displayed for a frame
    2. Populates an array with the positions of the notes to be displayed on screen
    3. Draws receptors and notes

    Displays controller visualization:
    1. Finds next note
    2. Based on a set of rules, determine the point to which the hit-circle must move next
    3. Determines distance of the nearest note from receptors
    4. Determines the percent of the distance to the receptors that the note has traveled since it was first found
    5. Display the hit circle based on that percent and its destination and origination points
    Last edited by Trumpet63; 06-30-2016, 12:40 PM.
    2014 October 7th 1:03 AM

    Zageron: Trumpet
    Trumpet63: yes, im here
    Zageron: You have a problem.
  • Xayphon
    sausage
    FFR Simfile Author
    • Nov 2008
    • 1630

    #2
    Re: JavaScript JavaScript Revolution

    vid is not available in germany

    on a serious note, if I were to try to contribute to this if I find myself being bored during the semester, would picking up javascript be very hard if all I know is java and python?

    would it also be possible to set up an API doc for this?

    Comment

    • Trumpet63
      Mostly Ignored
      • Mar 2011
      • 471

      #3
      Re: JavaScript JavaScript Revolution

      Originally posted by Xayphon
      vid is not available in germany
      Ah, that would be because the music is copywritten, I added a gif for you

      Originally posted by Xayphon
      on a serious note, if I were to try to contribute to this if I find myself being bored during the semester, would picking up javascript be very hard if all I know is java and python?
      I don't think javascript is inherently hard, and the library has very good documentation as well. There aren't really any specialized functions that I used, other than those from processing.js that draw the stuff.

      Originally posted by Xayphon
      would it also be possible to set up an API doc for this?
      I'd love to, but... what is an API doc?
      Last edited by Trumpet63; 10-18-2015, 06:07 PM.
      2014 October 7th 1:03 AM

      Zageron: Trumpet
      Trumpet63: yes, im here
      Zageron: You have a problem.

      Comment

      • Rapta
        🡸Index🡻Is🡹Fun!🡺
        Profile Moderator
        FFR Simfile Author
        Global Moderator
        • Dec 2010
        • 1948

        #4
        Re: JavaScript JavaScript Revolution

        That's a nice song
        Old Quotes
        Originally posted by IwasAsquidOnce
        Note the left hand pinky. It stretches out into attack mode to make etienne's hand appear larger, an intimidation technique for the arrows.
        Originally posted by Mourningfall
        [3:51 PM] Mourningfall: i spent the second half of that song getting face fucked by a fly
        Originally posted by Xiz
        Hi I see rapta come play TWG next game
        Originally posted by xXOpkillerXx
        Rapta thinks alot about memes and fonts. I'd be inclined to think he's town because wolves wouldn't have time to meme would they ?
        Originally posted by Prawnskunk
        if we keep releasing engines that work on 1/4 of people's computers, we'll get there
        Originally posted by gold stinger
        do u even agrabah
        Originally posted by gold stinger
        Today at 12:53 AM
        I have no fucking idea how you were able to identify that specific line from meme show so you are basically an elder god of memes
        Originally posted by Psychotik
        When I think Mother’s Day, I think Venetian Snares.
        Originally posted by Haku
        have you heard someone mention eating pancakes to negate friday 13th?




        Originally posted by Prawnskunk at 10:53:56pm on 10/26/11
        OMFG VC! I want your programming fingers in or around my mouth OnO
        Originally posted by Storn at 3:03 PM
        We have so many batches open. Its like a backlog clearance sale. ALL FILES MUST GO!!
        Originally posted by ToonE156 at 11:07 PM
        You've never felt intimacy until you've practiced Jiu Jitsu ground techniques with the only girl in class

        Comment

        • Xayphon
          sausage
          FFR Simfile Author
          • Nov 2008
          • 1630

          #5
          Re: JavaScript JavaScript Revolution

          Originally posted by Trumpet63
          Ah, that would be because the music is copywritten, I added a gif for you
          thanks

          Originally posted by Trumpet63
          I don't think javascript is inherently hard, and the library has very good documentation as well. There aren't really any specialized functions that I used, other than those from processing.js that draw the stuff.
          I can imagine the most trouble coming from drawing on a canvas and the like. It was quite the load during my programming internship, so that's the main thing I'm anxious to learn. I definitely had more fun programming logic than draw lines xd

          Originally posted by Trumpet63
          I'd love to, but... what is an API doc?
          Java and Javascript both have dedicated code documentation syntax which can be converted into a fully functional API/HTML documentation within an integrated developing environment (such as Eclipse or IntelliJ in Java). It uses specific syntax used in comments in your code, for instance:



          By (automatically) generating an API doc of your whole project where each function and variable has been commented/documentated, you can get a library overview of your own project similar to the official documentation of a programming language including a class tree, function overviews, and variable listings. For example:

          (excerpt of some functions with the content of your comment)
          (class tree)


          It generally helps understanding code much better
          Last edited by Xayphon; 10-18-2015, 06:43 PM.

          Comment

          • Trumpet63
            Mostly Ignored
            • Mar 2011
            • 471

            #6
            Re: JavaScript JavaScript Revolution

            That's gonna be a lot of work, but I'll look into it. I'm currently using notepad++ as my IDE, and my comments probably aren't very thorough right now, nor are they in the right format. I'm sure there's a plugin that'll do something like what you're talking about.
            2014 October 7th 1:03 AM

            Zageron: Trumpet
            Trumpet63: yes, im here
            Zageron: You have a problem.

            Comment

            • DossarLX ODI
              Batch Manager
              Game Manager
              FFR Simfile Author
              • Mar 2008
              • 14989

              #7
              Re: JavaScript JavaScript Revolution

              Originally posted by Xayphon
              on a serious note, if I were to try to contribute to this if I find myself being bored during the semester, would picking up javascript be very hard if all I know is java and python?
              I came into my co-op June this year with only Python; Javascript wasn't that bad. It helps if you have someone to ask questions about the language.

              Also, what Xayphon posted is JSDoc format. There are parameters and return values for the functions, and it helps someone get an idea of what the functions are used for. PHPStorm and Brackets are two very solid IDEs for web development.

              The biggest issue I see in the current code (I know it's just starting out, but this should be resolved ASAP) is that basically everything is in one javascript file. Splitting up functionality into multiple files separates which file contains certain functionality, and it prevents code files from getting too large.

              On another note, airbnb is a good javascript coding standard. Running a JS linter through that current code is encouraged.
              Last edited by DossarLX ODI; 10-18-2015, 07:29 PM.
              Originally posted by hi19hi19
              oh boy, it's STIFF, I'll stretch before I sit down at the computer so not I'm not as STIFF next time I step a file

              Comment

              • Trumpet63
                Mostly Ignored
                • Mar 2011
                • 471

                #8
                Re: JavaScript JavaScript Revolution

                This is good! I will look into all these things.
                2014 October 7th 1:03 AM

                Zageron: Trumpet
                Trumpet63: yes, im here
                Zageron: You have a problem.

                Comment

                • Trumpet63
                  Mostly Ignored
                  • Mar 2011
                  • 471

                  #9
                  Re: JavaScript JavaScript Revolution

                  Made some changes to the OP:

                  - Bugs section has been moved to the GitHub page because it accomplishes the same thing much more elegantly.
                  - Added a link to a doc I've been using to record the development I do for the project. Visit it if the thread seems inactive.

                  I'm going to be working on improving documentation this weekend. After a huge amount of blood sweat and tears I found a documentation generator that supports the standard syntax, and also works. Don't suggest any others, I've tried them all at this point >_<

                  Here's a sample of what the documentation program generates:



                  It shows the documentation alongside the code, which I didn't view as an essential feature, but there it is anyways.
                  2014 October 7th 1:03 AM

                  Zageron: Trumpet
                  Trumpet63: yes, im here
                  Zageron: You have a problem.

                  Comment

                  • Wayward Vagabond
                    Confirmed Heartbreaker
                    FFR Simfile Author
                    • Jul 2012
                    • 5866

                    #10
                    Re: JavaScript JavaScript Revolution

                    Oooo

                    Comment

                    • Trumpet63
                      Mostly Ignored
                      • Mar 2011
                      • 471

                      #11
                      Re: JavaScript JavaScript Revolution

                      Added documentation webpage to the OP. Site is hosted through gh-pages. (how cool is that!?)

                      I have documentation for the big 3 modules on there. Feel free to tell me how bad it is, but now I want to focus on adding the ability to handle user input.
                      2014 October 7th 1:03 AM

                      Zageron: Trumpet
                      Trumpet63: yes, im here
                      Zageron: You have a problem.

                      Comment

                      • Trumpet63
                        Mostly Ignored
                        • Mar 2011
                        • 471

                        #12
                        Re: JavaScript JavaScript Revolution



                        BIG UPDATE!

                        This is actually playable now... in a sense. You can press buttons and hit notes, and they disappear when you hit them!

                        To set your own keys, you need to change line 343 of code.js:
                        Code:
                        var buttonsKeys = [69, 70, 75, 79];
                        (currently this is my setup, EFKO)

                        The first number is the key corresponding to the farthest left receptor, and then the next one it the second receptor, etc. To find out what key numbers your setup uses, this page will help.

                        Your accuracy information is sent to console.log. I use firebug to see it, there may be another way.

                        Please try this out, let me know if you can get it working and how it feels ^_^
                        2014 October 7th 1:03 AM

                        Zageron: Trumpet
                        Trumpet63: yes, im here
                        Zageron: You have a problem.

                        Comment

                        • PhantomPuppy
                          Washed and Irrelevant D7
                          • May 2012
                          • 1808

                          #13
                          Re: JavaScript JavaScript Revolution

                          glad to see how much progress ur making on this trumpet good luck with the rest!

                          10th OT (D3): 13th
                          11th OT (D6): 11th
                          12th OT (D6): 6th
                          13th OT (D7): 31st
                          14th OT (D7): 25th
                          15th OT (D7): LAST PLACE LOL
                          16th OT (D7): LAST PLACE LOL


                          Originally posted by Funnygurl555
                          you know what they say

                          under all the rust is really shiny...……… metal

                          Comment

                          • Trumpet63
                            Mostly Ignored
                            • Mar 2011
                            • 471

                            #14
                            Re: JavaScript JavaScript Revolution

                            Thank you
                            2014 October 7th 1:03 AM

                            Zageron: Trumpet
                            Trumpet63: yes, im here
                            Zageron: You have a problem.

                            Comment

                            • lurker
                              ur worst nitemare
                              FFR Simfile Author
                              • Jan 2003
                              • 1628

                              #15
                              Re: JavaScript JavaScript Revolution

                              dude
                              h y p e
                              some feathery f**k

                              Comment

                              Working...