Pixel Tank - the best tank battle you can play in CC!

Started by Mr_Octopus, Dec 03, 2023, 04:34 AM

Previous topic - Next topic

Mr_Octopus

BATTLECITY is a classic game on Famicom. The goal of it is to defeat all enemy tanks and defend the base.

And now, you can play it in Minecraft!


=== [ PIXEL TANK ] - the best tank battle in ComputerCraft! ===

You cannot view this attachment.

This game is developed to imitate the game Battlecity. However, there is still a lot of difference. Try it now!

To install it, run codes below to execute installer:
pastebin run LYVUBJAQ
Feel free to comment below, ask for help, or give suggestions to help me improve this!
Bugs that reported below will be fixed first.
It is allowed to share or edit the code whatever you want, but please be sure to indicate the source and the author.


Requirements

Game version:
This game is developed based on CC restitched-1.101.2, Fabric 1.19.2. There should be no compatibility problems in higher versions, but may crash in lower versions.
For any crashing in any versions, please comment below and I'll try to fix it quick.

Peripherals:
This game requires an advanced computer to show colorful UI.
This game requires a speaker to play, in order to play different sounds.
If you have mod CC:C Bridge and mod Create installed, you can enjoy the game with a huge monitor and a wireless joystick! Please view toturials below to see how to do.

Introduction & Tutorial
How to Play ========
Welcome to Pixel Tank! Experience exciting battle and win high scores!
After installed the game, simply run tank.lua to start the game.

If nothing goes wrong, you will have a menu like this:

You cannot view this attachment.

Use W/S to select buttons and Space to confirm.

If you only have mod ComputerCraft installed, then select "Play on this device" and hit Space. The game will run in this computer's screen.

We will talk about the second choice later.

You cannot view this attachment.

Congratulation! You now entered the game. Let's try some features now.
Select and press "Singleplayer" button to start a game.

Warn: if you got a error that says "attempt to index local 'file' (a nil value)" then it means that you didn't installed the game correctly. Please remove the folder "Levels/" if it exist, and run installer again. If this problem still occurs, comment below.

You cannot view this attachment.

Now we have started Stage 1. Use W/S/A/D to move your tank (that yellow arrow), and Space to fire your cannon.

Your goal is to defeat all the enemie tanks (white arrows) and avoid them to destroy your base (&).

You can hit Enter to pause the game at any time. Press Enter again to unpause, or hit rightShift while pausing to go back to main menu.


In the map you can see different blocks.

Brown ones are bricks which can be breaked easily using your cannon.

White ones are iron blocks that is impossible to brake by cannon. Maybe stronger ones can do this...

Green ones are forests that can hide yourself while letting bullets to fly through. But be careful that your enemies can hide in that too.

Blue ones are water ponds that tanks can't drive on it, but bullets can fly through easily. Maybe there's a type of advanced tank can hover on water?


When all the enemies are defeated, the game will switch to the next stage.

Sometimes you may found a block that have "U" or other letters written on it, this is a bonus block. Hit it by your cannon to get reward.

H: Health. You can get 1 more HP after eating this.

U: upgrade. Your tank will be upgraded after eaten this, and will be stronger after upgrade. Below is all 5 levels that you can have.
Level 1: the most basic one. You have this when you're born from base.
Level 2: gatlin tank. It have a faster cannon that can shoot more bullets per second.
Level 3: based on lv2, it will have a stronger engine which makes it move faster.
Level 4: based on lv3, this tank have armor-piercing bullets that can break iron blocks.
Level 5: based on lvl4, this tank have an air cushion that can hover on water!

G: god time. After eating this you will found shields around your tank. You can't be damaged during this time.

B: bomb. All the enemies will blow up into pieces when a bomb is triggered.

F: freeze. Those enemies are freezing that they cannot move for 10 seconds. Go and defeat them!


You may found that enemies have different colors in some stages. That is because they have upgrades.
Orange enemies have a faster shooting speed.
Purple enemies have a super engine that moves very fast.
Red enemies have heavy armors that you have to shoot them 4 times to destroy them.


Useful and interesting functions ========

Back to menu, you will find there's many buttons waiting for you to try it out. Let's do it now.

You cannot view this attachment.

Level editor allows you to customize your own stages.

Select "Edit level" to customize one of the stages. Names with a green spot on the left means this map is currently existing. You can select one of the existing maps to edit them, or select an empty one to create a new map.

Game will read maps one by one, so if you create Stage 10 while Stage 9 isn't exist, then the game will skip Stage 10 and back to Stage 1 when you winned in Stage 8.

Select "Delete level" to delete one of the stages. Warning: you can't undo your deletion.


"Settings" allows you to customize your game a bit more. You can decide whether you want to play a hardcored game or an easy one.

default_stage: the stage to play when the game starts.
enemy_spawn_delay: seconds to wait before an enemie spawns.
volume: game volume. You can set it to 0 if you don't want to hear sounds.
default_HP: the amount of HP that players have when the game starts.


"Multiplayer" is similar to Singleplayer but it will add Player2 as a light blue tank.
Player2 uses arrow keys (up/down/left/right) to move, and E to fire.


You cannot view this attachment.

Back to this menu. If you have mod CC:C Bridge and mod Create installed then you can enjoy your game on huge monitors and use wireless joystick to play!

To do this, you need to prepare:
at least 1 redrouter_block (CC:C bridge)
at least 5 redstone_link (Create)
at least 1 linked_controller (Create)
at least 2 wired_modem and some cables.

and connect them together like this:

You cannot view this attachment.

Use cables and wired_modems to connect the redrouter_block to the computer. Also it is fine to just attach the redrouter to the computer, but make sure that the redrouter's face and its up/down/left/right side is free.

Caution: wired_modems need to be switched ON to work. right-click them to do this.

Use the same way to connect the speaker and the monitor to the computer. Recommended monitor size is 5*3.


Then connect those redstone_links with the redstone_controller. You can learn how to do this in mod Create's ponder.

Finally, run tank.lua and select "Play on monitor using joystick", and enjoy your PlayStation!

Hint: You can connect 2 redrouters to the computer, so that you can play Multiplayer using joysticks.



Known Bugs & Issues

  • The border of the map may be braked when shooting to it. This causes no problem but looks weird.
  • Terminate the program while editing levels will crash the level file. Game will skip the file if it crashed, but it ill crash the game when using level editor to customize it. The way to solve is to delete it.
  • Due to redstone delay, play using joysticks may be not very enjoyable because there's about 50ms lag.
  • Game will be not very enjoyable if the server's TPS is less than 18.
  • The game might me unstable when running on emulators like CCEmux or CraftOS-PC. play on in-game computers to have full experience.


Finally, just enjoy the game and don't blame me on what a mess the code is LOL

Mr_Octopus

This game also supports any devices that have a screen larger than 24×18 (e.g. pocket computers.) Recently I applied an update so that it is possible to play it on different screen sizes.

QuickMuffin8782

Quote from: Mr_Octopus on Dec 03, 2023, 04:34 AM-snip-
This is a great game! However, I'd love to see it up in the Pinestore (https://www.pinestore.cc/), so I can install it to my OS, and play it when it is started.
GOTTA GO FAST!!!! - Sunrise Studios now calling testers! Check the post!
Gitlab - Join my official discord! - SS Discord

Mr_Octopus

Quote from: QuickMuffin8782 on Dec 04, 2023, 10:08 PMThis is a great game! However, I'd love to see it up in the Pinestore (https://www.pinestore.cc/), so I can install it to my OS, and play it when it is started.

Good news! I've just uploaded it to https://pinestore.cc/projects/47/pixel-tank.

Xella

Hello, this game looks great, but I am having a few issues. The main issue is with installing the game.
You cannot install this from PineStore as it will crash during installation, because the txt file that is deleted is never closed. I also had the game crash during gameplay. I would prefer to talk on Discord if that's possible. I have sent you a friend request. :)

By the way, could you remove any unnecessary sleep() calls from the installer?

(I'm the creator of PineStore if that's relevant)

Mr_Octopus

Quote from: Xella on Dec 11, 2023, 08:18 PMHello, this game looks great, but I am having a few issues. The main issue is with installing the game.
You cannot install this from PineStore as it will crash during installation, because the txt file that is deleted is never closed. I also had the game crash during gameplay. I would prefer to talk on Discord if that's possible. I have sent you a friend request. :)

By the way, could you remove any unnecessary sleep() calls from the installer?

(I'm the creator of PineStore if that's relevant)

Got it and I'll work on it later. Thanks for replying and feel free to discuss any problems wth me through discord.

I've already made a lot of tests but it seemed that there's still a lot of errors during gameplay. It will be polished more times in future.

Mr_Octopus

Great News! Version 1.6.0 has been released and here's changelog:

  • Now we have more bonus blocks: bomb and freeze.
  • Animation upgrade.
  • More good-looking scoreboard when a stage is completed.
  • Fixed bugs. Thanks to @Xella and now the game is runnable in emulators. (Warning: running in emulators make the game unstable. Be aware.)