You have dealt with an understood some of the major challenges with creating a 2048 game. Now, we are going to take it a step further. We are going to integrate the open source 2048 code into our own Rails application to see how we can use these two pieces of knowledge together.
- Use Rails and JavaScript knowledge together
- Integrate two systems using API endpoints and AJAX
- Utilize open source software
We want to incorporate a few fun features with the existing 2048 game that will make it more interactive. This will be done with a rails application which will contain some of the original 2048 source code.
- Allow users to log in to the system
- Allow users to view, resume, delete and save their games
- Allow users to view a leaderboard which will show them the highest scores of other users registered in the system
These features seem great, but how exactly are we going to do this?
- Integrate OmniAuth with one OAuth-based strategy (Github, Twitter, Facebook, Vimeo)
- Create basic CRUD routes for users
- Support either authentication using cookies/session data, OR using an authentication token generated by the API
- Create API endpoints in the Rails app for:
- Saving the data from the game
- Loading and sending the saved data to the game
- Return the leaderboard data
- Update the "Storage Manager" feature in the game to integrate AJAX to:
- Send game data to the rails API upon save
- Load game data from the rails API when the users requests it
- For some information about the current storage implementation, look here
- Figure out how to update the leaderboard more often than when a save occurs
- Use WebSockets to stream leaderboard updates in real-time
- Add Tic Tac Toe as an available game to play as well as 2048