
SkiX, the SkiFree Game
Run in dev mode
npm install
npm run dev
Run tests on Visual mode
npm run cy:open
Run tests on Unit mode
npm run test
Code challenge
This project is a answer to the following code challenge:
Changes made after the code being forked:
PROJECT SETUP
- The babel and wepack setup was update to use newer versions. Allowing, for example, the usage of private resources inside Classes.
- Security issues related to modules being used is also now solved.
- Added source maps to improve debugging.
- Added Eslint to enforce best pratices and code quality.
- jsDoc setup to generate documentation based on comments from source files.
BUG FIX
After get crashed when hitting an obstacle, the skier should be able to get and be facing to the left side up after pressing the left arrow
.
BUG FIX
There was a bug when starting the game and imediately calling ObstacleManager.placeNewObstacle() method. There were no conditionals checking the value of the variable previousGameWindow
.

REFACTOR
Skier
: The property Skier.assetName
is moved to Entity
class to be able to be used by any class extending the Entity class.
Game
:
FEATURE
- The skier is now able to jump when pressing the
shift
key. - It original speed is incresed to two times. When jumping the skier does not get crashed if it hit any
rock
obstacle.
FEATURE
- The
Ramp Jump
obstacle is now implemented. - When hitting the
ramp jump
the skier behaves like it's jumping.
TESTING
- Deprecated Jest in favor of Cypress to get a real browser environment to test the game. Jest setup would need at least one addon to deal with canvas and you still does not have a real browser environment. This change is now allowing
visual testing
. - Written unit tests to cover initial reported issue.
- Written unit tests to cover the
jump
funcionality. - The test suite now is now able to be run as
unit test
andvisual testing and unit test
mode.



REFACTOR
The image assets were encoded into base64 strings and stored as js modules and now are they are built and loaded together with the main
and unique
bundle file
.
This is a change which improves the game loading and make it easiest to update any asset
FEATURE
The rhino is up and hungry!
- Rhino runs from right to left based in skier currently position
FEATURE
Game Stats Panel
- Display time
- Display distance
- Display speed
- Display style
FEATURE
Game console. The game console is the welcome screen allowing the player to select the game mode to start or check the game rank.
PROJECT SETUP
- Continuous integration setup using Circle CI.
- Online demo is being deployed at vercel.
FEATURE
Rank Database. It is saving the match data to indexeDB through voodux
Notes
NOTE 1
:
Except for the pop up widgets
and data persistence
features, this game is a VanilaJS implementation. For sure we can decrease the development time and improve the game experience
by using 3 party libraries or framework, but the main idea is to show how to do things with pure JS.
NOTE 2
:
Rather building a back end to persist data, I have added voodux to the project to persist data in a local nosql database.
NOTE 3
:
Inside some classes such as Game and GameConsole there is a reference to the browser global window object. It may sounds dumb, but it provides support to visual testing throuhg Cypress. Cypress works by rendering the tested code in a iframe in the right side of the screen when you run it in a non headless mode.
Improvement suggestions:
- Implement better UI for asking player name.
- Give the player an option after being ate by rhino.
- Refactor game console.
- Deprecate voodux usage in favor of native IndexedDB API to reduce the bundle size.
- Write more unit tests.
- Write more e2e tests.
- Code coverage.
- Code documentation. jsDoc is already set up.
Known bugs
- When rhino is running into skier direction AND if iskier direction
- There are some cases where you are fast pressing arrows and you are eaten by rhino, the skier reappears in the screen.