Making Egg Trainer 1
Welcome to this article (and potentially series) about the development of Egg Trainer! In these article(s) we'll cover different stages of development for the persistent browser based game called Egg Trainer.
I've actually developed Egg Trainer to a workable state about a year ago, but since I'm rewriting the whole game from the ground up, I decided to begin writing this series to 1. gain some attention and excitement, and 2. entertain my fans. Let's begin.
Premise
Egg Trainer is a Pokemon-inspired persistent browser based game where you buy eggs, hatch them, train the creatures and battle them against each other. I love Pokemon, so I decided to boil down the best parts of those games to their core mechanics for this project. Thus: Training and Battling. There's also some elements of surprise in what hatches from the eggs, and collectability.
The game's current build doesn't let you login without an alpha account - this is so I can limit the amount of feedback and bug reports during the main development. The plan was (and is) to open the game to beta players when the main features are ready, but you *can* currently collect eggs and creatures. Contact me with your username for an alpha account if you're interested.
The Template
I decided, before beginning on the rewrite, that I could reuse some elements of the website. So, I began developing the MERN template using my favourite tech stack: MySQL, Express, React and Node.
The MERN template has a number of essential features: account management, email validation, administration panel, etc. It's also, in theory, easy to set up (I'd love some feedback from people trying it out). There are a few legalities that need to be addressed, namely account deletion (right to be forgotten) and the data collection notice - I'm not entirely certain I got these right, but at least I made an effort.
The signup process is thus:
1. Enter your email, username and password
2. A validation email is sent to your inbox
3. Click the link in the email
4. You're set to go!
You've probably noticed a big red flag - "password". Yes, I do in fact collect passwords, but they never touch the database without being hashed and salted via bcryptjs first. I've done extensive research into password management and, although I can't say for certain, I'm reasonably confident that they're secure. HOWEVER, I must implore anyone deploying this template to ensure that you're using HTTPS protocol - it's not hard, certbot is a thing.
Another privacy concern are cookies - although there are no ads in the template, I do make it clear that the template uses cookies, and in fact I disable the site entirely if the user doesn't agree to use them. This might change in the future, we'll see; this is actually my first time using cookies, so I'm being overly cautious.
The Microservices
Not every game will require every element of Egg Trainer, so some parts of the template were isolated into microservices. A microservice is simply a part of the program which runs independently from the main program, often having it's own codebase and configuration. This has a few benefits - I can keep the main game's code simple without extra clutter, and I can modify the microservices without having to alter the main game at all.
At the time of writing, there are two microservices planned: news-server and chat-server. News-server is already functional and live, and can be accessed with a GET request here:
GET http://dev-news.eggtrainer.com:3100/news
This can be accessed via REST requests in the client to get formatted news articles for the homepage feed. I like to keep my players up to date with news posted directly to the game's main page.
The second microservice hasn't been written yet - chat-server. The game will have a chat window that allows people to communicate, at first in general rooms and DMs, and later in 1v1 battles. This feature was requested, and I liked it so much it became part of the template plan. It will in theory use REST as well, utilizing it's own internal account and logging systems. I haven't exactly planned it out yet, as it's not needed just yet...
Administration Panel
There is also an administration panel under construction, which will only be available to accounts with admin privileges. The client uses cookies to determine if the admin panel is shown, and the back-ends will ensure that nobody but the admins can access it, of course.
The admin panel will be simple - allowing access to the ban/unban feature, as well as an easy way to publish news articles with a click. More info such as chat logs and game monitoring will be added as I need them.
Conclusion and Links
I'm not sure if this article is very substantial, but hopefully it gives you an insight into the MERN template. Hopefully, by the time the next article is written, the template will be complete, and ready for conversion into Egg Trainer.
My name is Kayne Ruse of KR Game Studios, you can find me on the net as Ratstail91.
Egg Trainer Website: https://eggtrainer.com/
MERN-template repo: https://github.com/krgamestudios/MERN-template
news-server repo: https://github.com/krgamestudios/news-server
Business Enquiries: krgamestudios@gmail.com