Wanted to create army fights simulation tool for other MMOs like travian, but decided to build my own MMO.

What it does

Game, where player controls unlimited amount of chess figures in a unlimited map, which expands itself by every new player. Every chess figure is a massive army. On attacking enemy chess, player can watch a simulation how these armies were fighting. The point of the game is to conquer lands by conquering every grid tile in a map. And to protect conquered lands - build many defensive towers and walls around the conquered territory.

How I built it

The game was initially made with Ruby on Rails, a client with angular, but later client was overwritten with vanillaJS and backend overwritten with Sails.js to increase performance. At first it had PostgreSQL database. There are 500 functional heavy-load tests which cover all the unique possible gameplay scenarios. Using PostgreSQL on Sails all these tests ran in about 2-3 minutes. By moving from PostgreSQL to MongoDB, also with some extra indexing, new database structure, all the same tests ran in only 12 seconds. Twelve seconds!

Challenges I ran into

The hardest challenge was to make defensive tower shots to be validated by backend without losing the performance. Imagine a simple tower defense game, where many enemies are damaged in real time by many defensive towers. I want that to have in a huge MMO scope, also to have it validated in backend and equally shown the same damage and the same action to all players. This logic made my backend very complex. Also there are a dozen complex formulas which i dont understand by my self and asked for help at stackoverflow - like how to determine x y coordinates, where a newly registered player should appear in a spirale-based map without iteration. But what i care most - is performance. When i find a theory how to greatly increase performance of the game, i complete this task as urgent.

Accomplishments that I'm proud of

Amazing performance, which i am most proud of. Impressive functional tests speed - all the heaviest logic of the project tests in 12 seconds, where each test hits the database approximately 10 times.

What I learned

Sails.js i learned only by making this game. Also mongodb, redis, Artificial Intelligence.

What's next for armygrid

This game is still under active development. The backend will be finished after 2019. The art is only from placeholders and will be bought after few months from now (now 2018 july). The complete game should be finished in july 2019 or so.

Share this project: