Run Taotie Run – new Here Be Monsteres mini-game made with Dart and StageXL

Using StageXL and Dart, I built anoth­er mini-game themed around our MMORPG Here Be Mon­sters this week. The game fol­lows a pack of Taotie mon­sters, which is a type of spir­it mon­ster cre­at­ed when a ghost with immense hunger pos­sess­es a Chi­nese pot. Taotie orig­i­nates from Chi­nese folk­lores and is one of many mon­sters that you encounter in the world of Here Be Mon­sters as seen in the in-game almanac page on Taotie:

Taotie's almanac page 

 

Run Taotie Run

As the play­er, you assume the role of the leader of this pack of trav­el­ling Taotie who are look­ing for any­thing and every­thing to eat (I’m not mak­ing these up, accord­ing to the folk­lores they eat just about any­thing!) when they ran into a Star­i­um show­er (i.e. aster­oids falling from the sky).

Screenshot 

Being pots, you will crack and die if you get hit by an aster­oid, hence the premise of the game is for you to lead your Taotie min­ions and nav­i­gate through the aster­oids and sur­vive for as long as you can.

To make things slight­ly more inter­est­ing and to encour­age play­er to take more cal­cu­lat­ed risk, how fast you accu­mu­late points towards your score is based on how you play. If you choose to hide around the edges you might have a bet­ter chance of sur­viv­ing longer but your score also increase at a much slow­er rate com­pared to if you were to spend more time around the cen­tre of the screen where your reac­tion time will be more thor­ough­ly test­ed by the incom­ing aster­oids:

Hint 

Whilst self-preser­va­tion is of the high­est pri­or­i­ty (you get hit direct­ly and it’s game over..), to dis­cour­age you from using your min­ions as mere can­non fod­ders the rate you accu­mu­late score is also direct­ly pro­por­tion­al to the num­ber of min­ions you have. So keep your min­ions alive and you’ll pick up points a lot faster as a reward!

What’s more, there will occa­sion­al­ly be Cher­ries appear­ing on the screen for a brief moments, and col­lect­ing them before they dis­ap­pear will yield a hand­some 10000 bonus points towards your score!

Screenshot Screenshot

 

 

stream_ext

To cre­ate the desired effect of the min­ions fol­low­ing your every move but always being sev­er­al steps behind, I used the Zip func­tion from the Rx’s set of APIs which I had begun port­ing over to Dart with a small project called stream_ext which is avail­able on pub.dartlang.org here.

It’s also worth men­tion­ing that the Rx’s APIs had been stud­ied and tak­en into account in the design of Dart’s Stream type which already con­tains the most com­mon­ly used Rx APIs such as fold, map and where, so my port­ing effort is strict­ly lim­it­ed to those more ‘exot­ic’ func­tions such as zip, merge, com­bineLat­est and delay just to name a few.

Using zip, it made it very easy to cre­ate a stream of mouse move events which is some steps behind the source (the mouse move events emit­ted when­ev­er you move the mouse), see the high­light­ed lines 137–138 below:

image

 

Please give the game a go and let me know what you think and any sug­ges­tions you have on how to make it more fun!

 

Links

Play the Game

Source Code

stream_ext

Rx.zip