Welcome to Mule Invaders
The power of MuleSoft and APIs allows you to truly create anything. In the video game Mule Invaders, you control Max the Mule with the WASD keys. The game is very similar to any type of classic retro shooter you may have played growing up. This game is compatible with the 8bitdo gamepad.
There are three main parts to this game, one is the game client, one is the Flow Designer project, and the other is the Mule Invaders Terminal Heroku application.
- The game client will pole your CloudHub URL on the /hack endpoint and listen for any of the other HTTP endpoints to check if they have been hit with a POST request.
- The Flow Designer project creates five different API Endpoints.
- The Mule Invaders Terminal Heroku application is a similar user-interface to hitting each Flow Designer endpoint with an HTTP request.
This is the endpoint that the Mule Invaders client application listens to and polls to listen for a new update from the KV Store.
SpawnShield gives the player invincibility for 5 seconds and protects the player from incoming vulnerabilities. You can see in-game that the text will flash “protected by Anypoint Security” when the shield is spawned.
PowerLaser gives the player a spread laser cannon that changes the particle to red and allows you to kill enemies faster.
API Blaster increases the fire rate of laser cannons. Pew pew pew.
Spawn score gives you bonus +1000 points and creates the slot machine sound effect.
Test the game
In order to play Mule Invaders, first, you have to create your backend Flow Designer project and publish your project to get your CloudHub URL. Click on the Open Flow button by clicking the three dots on the top right-hand side of this window and you can open up this project.
When you open the project, you will have to enter your own HTTP Listener. Click on the Fix button, click Add Connection, then add the Host as 0.0.0.0 and the Port as 8081.
Once you have no errors in your project, click the test button make sure it runs. You can test your API in any REST client such as Postman to publish a POST request to one of the API endpoints by using the Mocking Service URL on the top right of the window after you click test.
Once the Flow is operating as expected, publish it to your Runtime Manager.
Once you have successfully published your application, go to Runtime Manager, and grab your public URL and add
/hack to the end of the URL. That will be the URL you will enter in your Mule Invaders game client.
Downloading Mule Invaders
Mule Invaders is a standalone application for either Mac or PC. Click one of the links below to download.
On your Macbook, you may get a security warning when trying to open the application. Please go to System Preferences > Security & Privacy > and Click Open Anyway.
When you open the application, enter the URL that you get from Runtime Manager. Then go into Postman and hit each API endpoint with a POST request while you are playing the game. You will notice that powerups will spawn in the game every time you hit an API endpoint with an HTTP POST request.
Want to keep learning how to develop powerful integrations and APIs with the MuleSoft platform? Visit our tutorial resources at https://developer.mulesoft.com/tutorials-and-howtos.
Enjoy the game, tweet us your highscore on Twitter @MuleDev
Thanks for playing.