Squirrels VS Dwarves, a real-time, multiplayer, team based game, is my front-end capstone made at the Nashville Software School.
I enjoy building software from the ground up and understanding each building block, especially when I can build tools to help others and me along the way. Combined with the majority of my previous programming experience being in the Unity 3D game engine, I decided to build an app to fuse together my enjoyment of building tools and games.
Dwirrel
/dwʌ'ɹ̩'(ə)l/
noun a fictitious word to be used when Squirrel and Dwarf should occur next to each other, but they sound bad in said sentence.
My Goals - Why I made furry forest dwellers and mythical mine dwellers murder each other for my pleasure
My previous programming experience was making little games in Unity 3D, so I decided that I wanted to make the foundations of one of those games, but I wanted to do it purely in JavaScript. My goals (listed in the MVP definition at the bottom of the Readme) were to make a real time multiplayer game in pure Javascript using Firebase Real-time Database.
- Clone down locally
- Run: npm init
- Run: npm install
- Run: grunt
- Start local sever
- If you are using my firebase, then you will need to be added to it, otherwise you can create your own.
- If using your own firebase,
- Add apiKey.json file in js/
- Fill in your api key and sender id
{ "apiKey": "Your api key", "messagingSenderId": "Your msi" }
- To be able to use Google login, it must be enabled under Sign In providers Sign In Methods in Authentication.
- Your ip must be added to the list of acceptable ips in Authorized Domains under Sign In Methods in Authentication.
- Add apiKey.json file in js/
- You're ready to starting editing!
- If something is not happening that should be happening:
- Check if firebase is being updated, if it is, the issue is most likely in view or mergeData().
- Enjoy punching the brick wall. I'm not a sadist, but you might be.
- If firebase is not being updated, check in model or checkInput().
- Check if firebase is being updated, if it is, the issue is most likely in view or mergeData().
- main.js executes automatically, triggering startGame() in controller.js
- startGame() activates the listeners of the Firebase real-time server and begains the mainLoop()
- mainLoop() checks for which screen the player is on (loading, login, main menu, game, etc.)
- If the game is being displayed,
- Check if the game should be updated this frame and calculate how many steps must be taken to keep the game at 60 fps.
- shouldMergeDataThisFrame checks if new data has been sent form the listeners,
- If so, merge the data (tiles, gems, and players) with current data, making sure only to use NEW data and not data already integrated into the game.
- updateGemPosition checks if gems are being carried and updates their pos
- checkInput checks for player input, calculates if they can do it, and executes it.
- shouldMergeDataThisFrame checks if new data has been sent form the listeners,
- Once the amount of times this frame the game should be run to maintain 60 fps is completed,
- view.printDataCount prints lag and other extra data on the screen.
- view.draw draws the players, tiles, gems, and health bars.
- requestAnimationFrame(mainLoop) is called to run the loop again.
- Check if the game should be updated this frame and calculate how many steps must be taken to keep the game at 60 fps.
- If the game is being displayed,
- main.js
- Triggers controller
- controller.js
- Deals with bulk of game logic
- Calls view and model
- view.js
- Draws game onto screen
- model.js
- Interacts with firebase
- game.js
- Holds globally used functions and variables
- animationController.js
- Deals with choosing the correct animation for a player
- Displays the animation
- apiKey.json
- Holds the firebase api key
- gameMaker.js
- Creates the lobby, tiles, players, gems, and gameState tables on firebase.
- mapMaker.js
- Creates the tiles for the map
- login.js
- Logic for google login and logout.
- Health Bars
- Can't move through allies
- Create player and join through Google
- Block being destroyed animation
- Player Animation?
- Lobbies for multiple Games?
- Refactor to use auth.currentUser()
- Implement logout
- ? Health regen or..?
- Restrict movement to map
- Streamline adding a player and starting game as player
- Ability to kill enemy
- Player lobby
- Smaller Modules / Refactor code
- See vision around ally
- Only see enemy player if can see their tile.
- Squirrel & Nut image
- See direction player is facing
- Face direction of keys even if cant move
- Pickup enemy gem and move it
- Drop enemy gem
- Mine through blocks
- Only see your team and team base
- See squares around you
- Can't pick up your own gem
- Move around with arrow keys
- Spacebar to mine through object