Overall, apart from getting terrorized by CORS, this project was great fun I gained good experience from working on it.
    What did I end up learning?
  • In the end, I learned loads about JavaScript while working on my game, and Python while working on APIs and databases.
  • In JavaScript I learned about interacting with CSS and animating, event handlers, sending API requests, cookies, and probability systems.
  • In Python I learned about using sqlite3 with python, writing API to interact with databases, storing data, analyzing and interacting with data, and posting/getting fron APIs
  • I also learned a few more minor things like CSS styling, encrypting data, and different bits and pieces with the inner workings of APIs.

What didn't I get to?
In the end, I didn't get to create my rocket escape, and only implemented an honestly lame endgame that costs a bunch of a new currency to complete. Other than that, I am pretty
satisfied with how far I got with this game. I had a lot of struggle I overcame with APIs, and I'm proud of myself for overcoming those issues.
How did I use x in y system?
  • I used cookies to store username data, and later called those cookies to interact with my API
    I did this by first saving the cookie by taking the inner HTML values of a form on our login page, then storing it in a browser cookie named 'username'. Then I continued by defining a function "getCookie(name)", where the name of the cookie was 'username'. I would then define a constant that is a list of all of the cookies on the site. Then, I looped through that list, checked whether the name of the cookie was 'username', and grabbed the value of it if it was. Using this process, I could call the getCookie() function whenever I needed to get the username of the player.
  • I used sqlite3 to store game data to be loaded using a get request that activates on window load
    I accomplished this by creating tables in SQLite3, and pushing data to them through my Python API. I would first use a post request from my frontend to update the data on my backend, pushing the data to the database. When I would use a get request, I would look for the data in the database by username, and if the username existed, would grab the data from the database I accomplished this using the execute() and fetchone() functions mainly.
  • I used default variables to make sure new players didn't get null or undefined game data
    I didn't do this how a traditional default variable is defined, but instead checked for the existence of a username, and if that username didn't exist, I would assign default values decided by me to the user.
  • I used if statements to verify the existence of variables
    In many of my if statements, I would have something like if (username). This would check the boolean value of username, and if it didn't exist, it would be assigned the value of False, while if it did exist, it would be assigned the value of True. I used this with my default variable system, first checking if username is true meaning there is a username, then loading data afterwards.
  • I used get/post requests with my APIs to store and retrieve game data
    In my backend, I would first define a class for use with my API blueprint. Then, I would define the get function which would be called when our frontend made a GET request to our backend. In my get() function for my user data class, I would first check my database using execute() and fetchone(), and if if (cursor.fetchone()) returned true, then I would grab data from the database from the user's name, and would send it back to the frontend in a jsonified response. If it returned false, I would send default values back in the same way.
  • And much much more knowledge was used throughout the project
    I used a lot of document.getElementById() to change the HTML elements on my game, I used a lot of try-catch block statements to catch errors formatted like try{code} catch(error){console.error(error)}, event listeners to stop certain actions and listen for certain mouse coordinates, while and if statements for looping and conditionals, and referencing of stylesheets and javascript files to clean up my main html file.

  • I can honestly say that I could have used my time much more effectively, but I still made many commits (much more towarsd the end to be completely transparent)
    to both the frontend and the backend.
    My commit graph for October:

    Key Commits on Backend:
    Started Game
    Got API Working
    Finished Game Mostly
    Username and Pass Saving
    Login/Registration System
    Top 10 API
    Finalized database, last real change
    Key Commits on Frontend:
    Moved Game to Front
    Added Login Page, Register Page
    Finished Leaderboard on Frontend

    This is the end of me documenting my CSP Tri 1 Journey :)