In this project we are creating an experience that mergers the viewers online identity via facebook profile with an interactive aquatic fishing environment. The viewer will be able to log in to facebook and generate a representative fish that will swim around a virtual in a manner dependent upon the viewers likes and interests on their facebook profile. They will be able to interact with this fish in various physical ways including using a fishing pole to attempt to catch their fish and other fish in the pond.
API’s,getting and parsing data:
The following is how we calculate the mainstream value from the likes:
mainstream_val += (rating/movie_top_rating + votes/movie_top_votes)/2
mainstream_val += (rating/tvshow_top_rating + votes/tvshow_top_votes)/2
mainstream_val += (rating/game_top_rating + votes/game_top_votes)/2
mainstream_val += (playcount/music_top_playcount + listeners/music_top_listeners)/2;
mainstream_val /= numlikes;
We then use ajax to send the user’s facebook uid, their name, mainstream value, and fish color they’ve selected on the login page to a database which can be queried by the processing application. The processing application sends the server the id of the last fish it received the the server can send back only new fish that have been added since that id was seen. The server sends this request for new fish every second or so concurrently with the drawing of the fish so there is little delay between the user’s facebook submission and the fish being added.
The fish are rendered via an algorithm made by Nicolas Tang (found on openProcessing). If the fish are within a radius of 350 pixels from the lure, we use an update_angle function to steer them towards the lure. We also adjust their speed such that they will quickly proceed towards the lure, but slow down when they get close to it.
Fish may like some lures more than others(based on mainstream value). If they like the lure, they will swim towards it faster.To prevent the fish from swimming off of the screen, they are programmed to detect each edge (top, bottom, left, and right). If the fish is too close to an edge and its angle indicates it is moving closer, the fish will decelerate. Once the fish’s speed reaches a minimum, we use the update angle function to steer them towards the center.