Check out my new course Learn you some Lambda best practice for great good! and learn the best practices for performance, cost, security, resilience, observability and scalability.
Using StageXL and Dart, I built another mini-game themed around our MMORPG Here Be Monsters this week. The game follows a pack of Taotie monsters, which is a type of spirit monster created when a ghost with immense hunger possesses a Chinese pot. Taotie originates from Chinese folklores and is one of many monsters that you encounter in the world of Here Be Monsters as seen in the in-game almanac page on Taotie:
Run Taotie Run
As the player, you assume the role of the leader of this pack of travelling Taotie who are looking for anything and everything to eat (I’m not making these up, according to the folklores they eat just about anything!) when they ran into a Starium shower (i.e. asteroids falling from the sky).
Being pots, you will crack and die if you get hit by an asteroid, hence the premise of the game is for you to lead your Taotie minions and navigate through the asteroids and survive for as long as you can.
To make things slightly more interesting and to encourage player to take more calculated risk, how fast you accumulate points towards your score is based on how you play. If you choose to hide around the edges you might have a better chance of surviving longer but your score also increase at a much slower rate compared to if you were to spend more time around the centre of the screen where your reaction time will be more thoroughly tested by the incoming asteroids:
Whilst self-preservation is of the highest priority (you get hit directly and it’s game over..), to discourage you from using your minions as mere cannon fodders the rate you accumulate score is also directly proportional to the number of minions you have. So keep your minions alive and you’ll pick up points a lot faster as a reward!
What’s more, there will occasionally be Cherries appearing on the screen for a brief moments, and collecting them before they disappear will yield a handsome 10000 bonus points towards your score!
To create the desired effect of the minions following your every move but always being several steps behind, I used the Zip function from the Rx’s set of APIs which I had begun porting over to Dart with a small project called stream_ext which is available on pub.dartlang.org here.
It’s also worth mentioning that the Rx’s APIs had been studied and taken into account in the design of Dart’s Stream type which already contains the most commonly used Rx APIs such as fold, map and where, so my porting effort is strictly limited to those more ‘exotic’ functions such as zip, merge, combineLatest and delay just to name a few.
Using zip, it made it very easy to create a stream of mouse move events which is some steps behind the source (the mouse move events emitted whenever you move the mouse), see the highlighted lines 137-138 below:
Please give the game a go and let me know what you think and any suggestions you have on how to make it more fun!
I specialise in rapidly transitioning teams to serverless and building production-ready services on AWS.
Are you struggling with serverless or need guidance on best practices? Do you want someone to review your architecture and help you avoid costly mistakes down the line? Whatever the case, I’m here to help.
Check out my new course, Learn you some Lambda best practice for great good! In this course, you will learn best practices for working with AWS Lambda in terms of performance, cost, security, scalability, resilience and observability. Enrol now and enjoy a special preorder price of £9.99 (~$13).
Are you working with Serverless and looking for expert training to level-up your skills? Or are you looking for a solid foundation to start from? Look no further, register for my Production-Ready Serverless workshop to learn how to build production-grade Serverless applications!
Here is a complete list of all my posts on serverless and AWS Lambda. In the meantime, here are a few of my most popular blog posts.
- Lambda optimization tip – enable HTTP keep-alive
- You are thinking about serverless costs all wrong
- Many faced threats to Serverless security
- We can do better than percentile latencies
- I’m afraid you’re thinking about AWS Lambda cold starts all wrong
- Yubl’s road to Serverless
- AWS Lambda – should you have few monolithic functions or many single-purposed functions?
- AWS Lambda – compare coldstart time with different languages, memory and code sizes
- Guys, we’re doing pagination wrong