Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f193b0f
Initialize repository
Jan 2, 2020
a2fa94d
Did vast majority of work, time to test!
sdmoran Oct 9, 2020
979ddad
Import of sdmoran/a4-creative-coding
Oct 9, 2020
fd84fe4
👴🐔 Checkpoint
Oct 9, 2020
1ecb65e
🍕🛀 Checkpoint
Oct 9, 2020
137b580
🏯🤗 Checkpoint
Oct 9, 2020
1621181
🏮🍝 Checkpoint
Oct 9, 2020
887ed9c
🚿🌞 Checkpoint
Oct 9, 2020
8dbe64c
🎈⛑ Checkpoint
Oct 10, 2020
c99894f
🌞🐃 Checkpoint
Oct 10, 2020
457615a
👫📌 Checkpoint
Oct 10, 2020
36fc45a
🏟🍯 Checkpoint
Oct 10, 2020
f1fea36
🙍🚘 Checkpoint
Oct 10, 2020
11028e4
🍿🍈 Checkpoint
Oct 10, 2020
1b21d45
📕💆 Checkpoint
Oct 10, 2020
0791a4a
🚔🍂 Checkpoint
Oct 10, 2020
ef9a40a
🎍⛑ Checkpoint
Oct 10, 2020
893f432
👖🛎 Checkpoint
Oct 10, 2020
d0209a4
🌺🙈 Checkpoint
Oct 10, 2020
b1e0204
✨🌖 Checkpoint
Oct 10, 2020
485d5ab
🏨🍤 Checkpoint
Oct 11, 2020
bd7507d
🏎🎢 Checkpoint
Oct 11, 2020
ff71162
🌮🙆 Checkpoint
Oct 11, 2020
899f1a9
🏏🐡 Checkpoint
Oct 11, 2020
e21b928
🎸🌌 Checkpoint
Oct 11, 2020
0651a16
👭👙 Checkpoint
Oct 11, 2020
4b9d26e
🍪🍳 Checkpoint
Oct 11, 2020
af246f8
🍐📹 Checkpoint
Oct 11, 2020
51a1b20
💂🏡 Checkpoint
Oct 11, 2020
ff5b503
😘🏉 Checkpoint
Oct 11, 2020
c700618
🍲🎱 Checkpoint
Oct 11, 2020
7c34abe
☺️🍎 Checkpoint
Oct 11, 2020
018e272
🍶👍 Checkpoint
Oct 11, 2020
96947c5
🍞🏣 Checkpoint
Oct 11, 2020
3adcd48
🍃🌑 Checkpoint
Oct 11, 2020
fdb56e2
🍱🐞 Checkpoint
Oct 11, 2020
c0c3bac
🌘💷 Checkpoint
Oct 11, 2020
8a6f91f
🔔🚿 Checkpoint
Oct 11, 2020
3858986
⛸💏 Checkpoint
Oct 11, 2020
17ba3f0
🌯📌 Checkpoint
Oct 11, 2020
11db836
Added gitignore and untracked node_modules
sdmoran Oct 11, 2020
3271e9d
Update readme
Oct 11, 2020
a5a0a5c
🦄🌒 Checkpoint
Oct 11, 2020
8991c20
Undid whatever shenanigans Glitch did that made my git freak out
Oct 11, 2020
b894ce7
Merge branch 'fix' of https://api.glitch.com/git/a4-sam-moran into ma…
sdmoran Oct 11, 2020
fbfa9cf
Un-destroyed my repo, thanks Glitch :(
sdmoran Oct 11, 2020
c01997f
Update README.md
sdmoran Oct 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
env.sh
Empty file added .glitch-assets
Empty file.
45 changes: 45 additions & 0 deletions API.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const { MongoClient } = require("mongodb");
const ObjectID = require('mongodb').ObjectID;

const host = process.env.MONGODB_HOST
const user = process.env.MONGODB_USER
const password = process.env.MONGODB_PASSWORD
const database = process.env.MONGODB_DATABASE

const uri = `mongodb+srv://${user}:${password}@${host}/${database}?retryWrites=true&w=majority`

const client = new MongoClient(uri);
client.connect()



// This block of code is for inserting records into the DB.

// try {
// client.connect()
// .then(() => {
// let words =
// // "aerobics, archer, arena, arrow, athlete, badminton, ball, baseball, baseball bat, basketball, baton, batter, bicycle, bike, biker, billiards, bobsleigh, boomerang, bow, bowling, boxing, canoe, cathcer, chest plate, club, coach, competitor, curling, cyclist, dartboard, darts, deadlifting, diving, dodgeball, dugout, dumbbell, e-sports, end zone, exercise, fencing, field, field hockey, figure skating, finish, fitness, football, formula one, free throw, frisbee, goal, goalie, golf, gym, gymnast, half time, hammer throw, handball, hang gliding, hardball, helmet, high jump, hole in one, home run, home team, hurdle, ice hockey, ice skating, jogging, judo, jump rope, karate, keeper, kitesurfing, kneepads, kung fu, lacrosse, lawn bowling, loser, marathon, nascar, off season, offside, olympics, overtime, penalty, ping pong, pit crew, pit stop, pitcher, pole vault, puck, race, rafting, rally, referee, rock climbing, roller derby, roller skating, rugby, sailing, score, shoulder pad, ski, snorkeling, snowboarding, soccer, softball, somersault, stadium, start, studded shoes, sumo wrestling, surfing, swimming, synchronized swimming, table tennis, target, team, teammate, tee, tennis racket, trampoline, triathlon, tug of war, ultramarathon, volley ball, wakeboarding, water polo, water ski, weightlifting, wetsuit, windsurfing, winner, yoga"
// //"apple, apple juice, apple pie, apple sauce, asparagus, avocado, bacon, bagel, baguette, baked beans, baked potato, banana, banana bread, banana split, barbecue sauce, bean, beer, beet, bell pepper, biscuit, blackberry, blueberry, bread, broccoli, brownie, bubblegum, burrito, butter, cabbage, cake, candy necklace, caramel apple, carrot, cauliflower, caviar, celery, cereal, cheese, cheeseburger, cheesecake, cherry, chicken burger, chicken nugget, chili, chocolate, chocolate bunny, chocolate cake, chocolate egg, chocolate milk, churro, citrus, cocktail, coffee, cookie, corn, corn dog, cotton candy, crab stick, cranberry, croissant, cucumber, cupcake, curry, donut, egg, energy drink, fish and chips, fish burger ,fish sauce, fondue, french fries, french toast, frog butt, fruitcake, garlic, garlic bread, grape, grapefruit, gravy, grilled cheese, grilled chicken, guacamole, gummy bear, gummy worm, ham, hamburger, hash brown, honey, hot chocolate, hot dog, hot sauce, ice cream, ice cream cake, ice cube, iced tea, jalapeno, jam, jawbreaker, jelly, kebab, ketchup, kiwi, lamb chops, lasagna, lemon, lemonade, lettuce, lime, liquorish, lollipop, mac and cheese, macaroni, maple syrup, margarine, martini, mashed potatoes, mayonnaise, meatball, meatloaf, melon, milk, milkshake, monkey brain, mushroom, mustard, nacho, noodle, olive, omelet, onion, onion ring, orange, orange juice, oyster sauce, pancake, papaya, peach, peanut butter, pear, peas, pepper, pepperoni, pickle, pie, pigs in a blanket, pineapple, pizza, plum, pomegranate, popcorn, popcorn chicken, potato, potato chip, prawn cracker, pretzel, prune, pudding, pumpkin pie, radish, raisin, ranch sauce, raspberry, ravioli, relish, rice, salsa, salt, sandwich, sausage, scrambled egg, shrimp, smoothie, soda, soup, space cake, spaghetti, spare ribs, sprout, star fruit, steak, strawberry, stroop waffle, stuffing, sugar, sushi, sweet potato, taco, tail fin soup, tangerine, tea, toast, tomato, turkey, turnip, vodka, waffle, wasabi, watermelon, whipped cream, whiskey, wine, yogurt"
// let wordArr = words.split(", ")
// let docs = []
// for(let i = 0; i < wordArr.length; i++) {
// let doc = {word: wordArr[i]}
// docs.push(doc)
// }
// client.db("a4-webware").collection("words").insertMany(docs)

// })
// } catch(e) {
// console.log(e)
// }


// Get the specified number of words from the db
const getWords = function(num) {
var queryDoc = {};

return client.db("a4-webware").collection("words").aggregate([{ $sample: { size: num } }]).toArray();
}

exports.getWords = getWords;
65 changes: 10 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,14 @@
Assignment 4 - Creative Coding: Interactive Multimedia Experiences
===
## Drawing App

Due: October 9th, by 11:59 PM.
Sam Moran

For this assignment we will focus on client-side development using popular audio/graphics/visualization technologies; the server requirements are minimal. The goal of this assignment is to refine our JavaScript knowledge while exploring the multimedia capabilities of the browser.
Glitch Link: https://a4-sam-moran.glitch.me/

Baseline Requirements
---
My project is based on the same idea as Skribbl.io. It is a multiplayer game where one player is given a word to draw, and the other players have to guess the word based on the drawing.
I used WebSockets to communicate between clients and the server and synchronize state in near-realtime. This was a difficult task because I had to synchronize both the internal state of
the server and all clients, as well as the UI state of the clients, with very low latency so that the game plays smoothly. I mostly accomplished this; the one major feature I didn't have
time to figure out is changing the player who is in control of starting the game when the current player in control disconnects. Aside from that, the game works as expected and intended!
Have fun!

Your application is required to implement the following functionalities:

- A server created using Express. This server can be as simple as needed.
- A client-side interactive experience using at least one of the following web technologies frameworks.
- [Three.js](https://threejs.org/): A library for 3D graphics / VR experiences
- [D3.js](https://d3js.org): A library that is primarily used for interactive data visualizations
- [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API): A 2D raster drawing API included in all modern browsers
- [SVG](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API): A 2D vector drawing framework that enables shapes to be defined via XML.
- [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API): An API for audio synthesis, analysis, processing, and file playback.
- A user interface for interaction with your project, which must expose at least six parameters for user control. [dat.gui](https://workshop.chromeexperiments.com/examples/gui/#1--Basic-Usage) is highly recommended for this. You might also explore interaction by tracking mouse movement via the `window.onmousemove` event handler in tandem with the `event.clientX` and `event.clientY` properties. Consider using the [Pointer Events API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events) to ensure that that mouse and touch events will both be supported in your app.
- Your application should display basic documentation for the user interface when the application first loads. This documentation should be dismissable, however, users should be able to redisplay it via either a help buton (this could, for example, be inside a dat.gui interface) or via a keyboard shortcut (commonly the question mark).
- Your HTML and CSS should validate. There are options/plugins for most IDEs to check validation.

The interactive experience should possess a reasonable level of complexity. Some examples:
### Three.js
- A generative algorithm creates simple agents that move through a virtual world. Your interface controls the behavior / appearance of these agents.
- A simple 3D game
- An 3D audio visualization of a song of your choosing. User interaction should control aspects of the visualization.
### Canvas
- Implement a generative algorithm such as [Conway's Game of Life](https://bitstorm.org/gameoflife/) (or 1D cellular automata) and provide interactive controls. Note that the Game of Life has been created by 100s of people using <canvas>; we'll be checking to ensure that your implementation is not a copy of these.
- Design a 2D audio visualizer of a song of your choosing. User interaction should control visual aspects of the experience.
### Web Audio API
- Create a screen-based musical instrument using the Web Audio API. You can use projects such as [Interface.js](http://charlie-roberts.com/interface/) or [Nexus UI](https://nexus-js.github.io/ui/api/#Piano) to provide common musical interface elements, or use dat.GUI in combination with mouse/touch events (use the Pointer Events API). Your GUI should enable users to control aspects of sound synthesis.
### D3.js
- Create visualizations using the datasets found at [Awesome JSON Datasets](https://github.com/jdorfman/Awesome-JSON-Datasets). Experiment with providing different visualizations of the same data set, and providing users interactive control over visualization parameters and/or data filtering. Alternatively, create a single visualization with using one of the more complicated techniques shown at [d3js.org](d3js.org) and provide meaningful points of interaction for users.

Deliverables
---

Do the following to complete this assignment:

1. Implement your project with the above requirements.
3. Test your project to make sure that when someone goes to your main page on Glitch/Heroku/etc., it displays correctly.
4. Ensure that your project has the proper naming scheme `a4-firstname-lastname` so we can find it.
5. Fork this repository and modify the README to the specifications below. *NOTE: If you don't use Glitch for hosting (where we can see the files) then you must include all project files that you author in your repo for this assignment*.
6. Create and submit a Pull Request to the original repo. Name the pull request using the following template: `a4-firstname-lastname`.

Sample Readme (delete the above when you're ready to submit, and modify the below so with your links and descriptions)
---

## Your Web Application Title

your hosting link e.g. http://a4-charlieroberts.glitch.me

Include a very brief summary of your project here. Images are encouraged when needed, along with concise, high-level text. Be sure to include:

- the goal of the application
- challenges you faced in realizing the application
- the instructions you present in the website should be clear enough to use the application, but if you feel any need to provide additional instructions please do so here.
You will need at least 2 players connected in order to start the game. Only 1 player can draw at a time. If the leader (player in control of starting the game) disconnects before the game
starts, the server must be restarted, else the game will be unable to be started.
Loading