You can download this game on https://github.com/Donno1994/PenguinShooter
When I first saw some demos of the Bitcoin LN being used inside a minecraft game, I was fascinated by the ease of usage to pay ingame. I dreamed of a future in which you can pay all stuff online, just with scanning it with your LN wallet. I decided to buidl on Lightning and release my own game, even though I didn’t have much experience in game development.
This is a hobby project, which I created as a single person in my spare time. It is definitely not the most amazing game of all time and it probably still contains some bugs, but I hope it gives the user a feeling how future games could use the Lightning Network to provide a fast and non-custodial way to purchase ingame stuff.
The prices are not very high, so please don’t blame me if it doesn’t work perfectly as expected. Playing through the whole game takes about 30–60 minutes and costs about 50–100 cents depending on the stuff you buy. Depending on your game style, it can get more expensive, but if you just want to play a funny demo game and fight some monsters, you won’t be spending more than a dollar in total. Actually, if you just want to make one payment for testing purposes, you can buy an apple for 3 satoshi and then exit the game ;)
I imagined a game, which you can play for free, but have the opportunity to buy some ingame stuff without paying for some ingame currency first, without providing your credit card information, or similar.
It should be a game in which you want to pay for some ingame features, by just scanning a QR code in the game and paying that invoice with your Lightning Wallet. There are several projects that already let you pay content online and also play games after you pay with LN, but wouldn’t it be cool, to play a game and inside the game you pay some services? This is what this project is about. You pay while playing the game.
How does this work?:
In the game you have QR codes displayed, which contain LN invoices. You can scan the QR code with your mobile LN app, or click it to copy it to your clipboard, and then pay it with your desktop LN wallet.
As soon as the invoice is paid, my Raspberry Pi LN node will inform the game about the successful payment and a certain action is done in the game.
The whole process is super fast because LN payments are almost instant.
If you have a direct channel to my node and your wallet is ready to go, there might be less than 5 seconds between clicking the QR code and seeing the action happening. You just click, paste, pay. That’s it. Every QR code is clickable. Click it and the invoice is copied to your clipboard.
Create a direct channel for better ingame speed:
My LN node should be connected enough, so the average user doesn’t need to open a channel to my node. However, if you want to have a quick reaction in the game, it might make sense to open a direct channel to my node. If you are almost dead and you want to buy HP potion, you don’t want to wait 2 seconds longer just because your node has to try several routes first.
My LN Node: firstname.lastname@example.org
The game is a RPG in which you have to fight some animals to lvl up. A pretty simple game idea. You can run the game itself without using Lightning. However, if you want to do anything, you have to do micropayments to my Raspberry Pi LN node.
- Opening the door. Your first payment in the game.
The game basically starts with your character standing in front of a wall which displays a LN invoice in the form of a QR code. If you want to open that door you have to pay the 150 satoshi invoice (about 0.6 cents).
You can either scan the QR code with your mobile LN wallet or click the QR code which copies the invoice to your clipboard and then paste it into your desktop LN wallet. Pay it and the door opens!
You can either move your character with the arrow keys or a better way is to move with the w,a,s,d keys. Optionally, you can also click on the ground. This works best with camera option 3 (see below)
You have three camera options to choose from.
1. First person view
2. Third person view (Default)
3. Independant camera: The camera will follow your character but will not rotate when you turn your character. You can rotate the camera with right mouse click. If you click on the ground you will move to that point.
3. Creating your first enemy.
When you enter the main area and walk straight ahead, you see a dummy sheep in front of a shield. Sheep are the first monsters you should fight. They are Lvl. 1, have little attack and defense and only attack you after you attack them. You can’t fight that dummy sheep, but you can buy some sheep to fight against! Every sheep costs you 5 satoshi. Click the “+” sign on the shield until you reach your desired amount you want to buy. Do you want to create 10 sheep? Click “+” 10 times and your QR code will display a 50 satoshi invoice (0.2 cents). Either scan it with your phone or click it to copy it. Pay the invoice and as soon as it’s paid, you see 10 sheep spawning in front of you.
On the bottom of your screen you see a shortcut panel in which you see a gun symbol. You can drag and drop that symbol in your shortcut area on any keyboard number 1,2,3,4,5,6,7,8,9 and 0. If you then press that number on your keyboard you will shoot a bullet straight forward. If it hits an animal, it will get damage and eventually die after some hits.
At the beginning you can shoot once a second but you can upgrade your shooting ratio with LN payments.
To make things easier you can double click any animal to activate auto focus and auto shoot. If you want to cancel this, just turn your character with “a”, “d”, “left arrow” or “right arrow” or click anywhere on the ground.
After you reach certain levels, you can use skills, which will have better effects than bullets (see chapter Skills).
5. Lvl. System
When you defeat enough monsters and collect experience points, you can reach new levels and get stronger. You get more health points, mana points (which are used for skills), attack points, defense points, and you might unlock skills or other features. When you get stronger you can also try fightning stronger monster. After the sheep, the next one would be a rabbit. Stronger monster cost a bit more, but also give you more exp points. The exp/satoshi ratio gets better the stronger the monsters are.
In this game you have 4 skills that you unlock at different levels.
You find the skills in your Inventory (press “I”) and drag and drop it into your shortcut area. To use the skill, you have to select a target (click an animal) and press the shortcut key. If you have enough MP your skill gets activated and after some cooldown time you can use it again.
1. Fire Shot: It is similar to a bullet, but follows your target (you can’t miss it like with a bullet) and it makes more damage.
2. Lightning: It creates good damage and also damages two more animals which stand close to your target.
3. Fire Ball: A fire ball falls onto your target and creates much damage.
4. Meteor: A meteor storm will attack your target and damages all animals nearby. A very effective and strong skill.
Instead of using a gun or skills, you can also use grenades to damage all animals in the vicinity. These grenades are actually apples, bananas and kiwis which only differ in cost and strength. In the following example I will describe apples, but they work all the same.
Drag and drop an apple into your shortcut area, hold the number pressed and release the key. The longer you press the key, the farer you throw the apple. You can throw several apples if you want. If you press the key of the bob-omb symbol, all your apples will explode and damage all animals in the vicinity. The explosion will also push them away so you can rescue yourself from a dangerous situation.
If you want to buy apples, search for the apple shield in the game (on the left side after you enter the first door) and press the “+” sign. Pay the invoice and receive your apples. To make everything a bit easier, you can also buy them in the store (see chapter Store). Bananas and kiwis can only be bought in the store.
Because you might run away from monsters while playing, it might be difficult to scan or click QR codes if you move all the time. So after you click a QR code, it will be copied to the right bottom of your screen to make it easier to pay.
An even easier way is using the store. In the store you can choose several things at once and pay them with a single invoice. You don’t have to search for the correct shield and pay every item separately.
On the top right corner, choose what you want to buy and how much. After you select your items, press the “invoice” button and your invoice gets displayed. Pay it to receive your items in a super quick time.
1. Buy animals: Choose which animals you want to buy. Easier than pressing the “+” and “-” Buttons lots of times.
2. Buy HP and MP potion. You can heal yourself with these items.
3. Buy weapons: Buy apples, bananas and kiwis
4. Upgrade your character: Increase your shoot rate, your moving speed or decrease your skill cooldown. (You have to pay a separate invoice for these upgrade)
While testing I figured out, that I mostly use the shop and not the shields in the game, because the shop is easier to use. I didn’t remove the shields from the game, because I like it when you get invoices displayed in an open game world that you can just scan to pay. However, I stopped creating a shield for every item because you probably just buy it in the shop anyway. Example: HP/MP potion, bananas, kiwis can just be bought in the shop.
After you enter through the first door, you will find a tiger in a cage on the left side. After you reach level 6, an invoice gets displayed with which you can open the cage and the tiger will be yours. He will help you attack monsters. He can’t die. If monsters attack him, they don’t attack you ;)
The tiger is one of the more expensive items in the game (2000 satoshi/ 8 cents), but you also just pay once and then you always keep him. Even if you close the game and start it again, you will have him by your side.
10. Save the game
If you close the game, it is saved automatically in a text file “save.txt” in the folder “Resources” (this folder is located in the folder where you execute your game). Don’t change anything inside this file, otherwise you will have to start from the beginning!!!
All monsters that you bought will not be saved, so better kill them before you close the game. Also the last door (a kind of final level) needs to be purchased again after you restart the game.
11. Possible Multiplayer Feature in Future Releases?
When started testing with several games open, I realised a bug. If one person pays to open the door, my LN node would inform every game that the door invoice was paid and everyone playing this game would see that the door opens. This worked with every invoice. If someone paid for 10 rabbits, these 10 rabbits would spawn in every game. While this might be considered a feature instead of a bug (you could play together with your friend and just one of you has to pay), this also created a problem.
If you die and you pay 100 satoshis to respawn, everyone playing this game would respawn as well, so I worked on preventing this.
Now everyone who plays this games will play on his own without other people interacting with their payments.
However, I am very open to create some kind of multiplayer stuff. Maybe a certain monster or item which can be bought by one player, but which is actually distributed to every player, playing the game at that moment of payment. I used exactly that for creating a simple chat feature.
12. Chat with others via LN
While I tried to disable the multiplayer function in almost every feature (see chapter above), I kept it as a kind of chat program.
If you open the chat window, you can choose a name and enter a text. A LN invoice will be generated with your name and text as a memo. When that invoice is paid, everyone playing this game will get informed and will display the memo “Name: This is my text” in his own chat window.
Please understand, that this feature started as a bug (see chapter above) which I wanted to remove. I don’t know if a LN chat program already exists, so I see it as a demo application and kept it in the game. Not more. Don’t be offended by the poor design. Because of limited testing, it probably contains some bugs.
If you like this project, please give me your feedback. If I get a good feedback, I consider continue developing on this game, or maybe starting new LN projects in future. If nobody cares about this, I will probably not continue, as it took me half a year of hard work to finish this game. So please let me know your opinion :)This game should be seen as a fun demo game to test ingame LN payments.
If you have helpful critiscism, your’re more than welcome to let me know how to improve it.
You can contact me on Twitter @BR_Robin or on Reddit u/Donno_