Skip to content

Jerenaux/westward

Repository files navigation

Westward

Westward is an open-source aspiring MMORPG written in Javascript. The game is not online at the moment as the project is not actively maintained anymore.

Disclaimer: Westward began as a closed-source project, and has grown that way for more than 2 years. As a result, the current codebase is messy and not very collaboration-friendly. Documentation is sorely missing, the tests are a mess, and the code itself looks like what a 2+ years codebase maintained by one guy can look like. You can make that change! I invite you to point out where the code is particularly unclear and where the lack of documentation is particularly painful. I will give top priority to addressing these feedbacks.

Vision

As a game, Westward aims to be a collaborative MMORPG where the players have to build a nation, starting from scratch and progressively settling a large continent. A more lengthy description can be found on the description page of the game.

As an open-source project, Westward aims to be a great collaborative experience for contributors of all sorts. The goal is also to be a learning experience, for me as well as for developpers interested in gamedev. I hope the contributions and the community will grow into a space for us to learn and have fun improving that game.

For more insight into the evolution of the project, check out the dev logs.

Community

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. At some point a Docker image should be rolled out to facilitate that process (feel free to contribute on that front if that's your area of expertise!)

Prerequisites

  • A recent version of Node.js
  • A MongoDB instance listening on port 27017

Installing

Clone this repository, then navigate to it and install the dependencies:

npm install

You should also create a file called .env at the root of the directory. This is where the dotenv package will be looking for environment variables. Your local version doesn't need to define any environment variables, but dotenv will complain if that file is missing.

touch .env

Running the game

The most straightforward way ton run the game server is to do:

node dist/server.js

Then navigate to localhost:8081 to play the game.

If you make modifications to the game, don't forget to rebuild it using webpack, which you can do by running:

npm run webpack

Alternatively you can run webpack-dev-server to automatically watch for changes and rebuild when changes are detected. You can do so by running:

npm run watch:webpack

The file package.json defines all the npm run ... commands that are available. Feel free to add more if you think that would be useful!

Using Docker

Alternatively, you can use the Dockerfile to create a container with all the necessary components already installed. You need to have Docker installed. Then, in the directory where you clones the project, run:

docker-compose build
docker-compose up -d

The default port when using the Docker way is 80, so you need to navigate to <IP_of_your_Docker_machine>:80 to be able to access the game (e.g. 192.168.99.100:80).

Running the tests

Some tests have been set up, mainly focusing on testing the client/server API and some internal server functions. They can be run as follows:

npm run test

These tests could be improved in a million ways, by being better documented, being more clean, or simply by adding more tests. In an ideal world, the tests could act as a gateway to the codebase, providing a clear view of what is going on and helping contributors dive in. It's not the case yet, but feel free to contribute on that front!

Deployment

The master branch of this repository is deployed on an AWS EC2 instance maintained by myself. I will not elaborate too much on that aspect since it doesn't impact contributions, but I can provide more information if there is demand for it.

Built With

  • Phaser 3 on the client side - The best Javascript game engine
  • Node.js on the server side
  • MongoDB for the database

Contributing

Please read CONTRIBUTING.md for details on the process for submitting contributions.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Thanks

Many thanks to the following people for supporting Westward on Patreon:

  • Sean Pope
  • Flavius Poenaru, currently working on Kaetram, an open-source 2D HTML5 adventure

Donate

If you are interested in Westward and want to see it grow, I invite you have a look at my Patreon page where you can find a listing of rewards for various levels of recurring contributions. Even the smallest contributions can go a long way as a signal of your interest and your support.