The C++ upgrade of my JavaScript game.
(The video's small size is because GIFs don't have codecs for compression, and GitHub doesn't allow embedding MP4s...)
- If compiling from source, you'll want Visual Studio 2022
- pre-compiled executables are provided if that's not an option for you
- OpenGL 3.3 or later
- Earlier versions almost certainly work if you update the shaders (change
#version 330 core
to#version 150 core
or whatever) - Your GPU almost certainly supports this (yes, even if it's an ancient Thinkpad)
- Earlier versions almost certainly work if you update the shaders (change
- 3GHz+ CPU recommended
- Faster CPU -> more bullets on screen
- Multithreading not available, too difficult (also I have no idea how to approach multithreading RNG)
- RAM requirements unknown, but 100MB is good
- More bullets -> more RAM needed
- No audio requirements, because there's no audio
- Windows-only and 64-bit
- But it should be very easy to compile it for another platform
Install Visual Studio (2022) and the GitHub extension (I don't know if that's needed), then clone this project and run x64 Release (also make sure you're on the solution, not project).
Pre-compiled executables are available under "Releases" in the GitHub repository.
Making your own levels is now a thing! (Although the levels are very simple, and they take a while to make.) How to do so:
- Navigate to the
mods
folder. - Add a new folder. This will be the name of your mod.
- Add a
levels
folder to your mod's folder. Your custom levels go here. - Add some text files and make your custom levels!
- Several fields need to be given. I suggest looking at one of the pre-made custom levels and copying it and modifying it.
- Every level needs a
Name
(string),Color
(3 floats in range [0,1] for RGB),LevelTypes
(at least one string; recommended "modname" and "random-modname"), andLevelWeights
(1 float for each type; recommended 1.0 is the base weight). - Optionally, levels can contain a
RandomStartPositionCount
(int, default = 5, for number of starting positions),RandomStartPositionXValue
(float, default = 20, x-distance from edge), andRandomStartPositionYRange
(float, default = 256=320-2*32, y-range for starting positions). - Once the assignments have been set,
[LEVEL_START]
needs to appear, then you can start adding walls and powers and stuff. - Look at
docs/custom-levels.md
for more information.
The custom level interpreter is very simple and barebones, so if you want to put something at the center, you have to put the coordinates as 320 160
instead of GAME_WIDTH/2 GAME_HEIGHT/2
. Also you can't do any math to your numbers; they need to be the raw numbers (no "sqrt(3)" or "20*8", just "5" or whatever). I know this sucks but adding an expression parser is annoying (although there is a popular library for this task) and adding Lua (or maybe Python?) would've been a much larger hurdle (although this Wikipedia list is much larger than the last time I looked at it so maybe it's easier than I thought?).
Making your own powers is also now a thing! (Although very limited.) How to do so:
- Follow the same steps as making custom levels, but add a
powers
folder in your mod's folder. - Every power needs a
Name
(string),Color
(3 floats in range [0,1] for RGB),PowerTypes
(at least one string; recommended "modname" and "random-modname"), andPowerWeights
(1 float for each type; recommended 1.0 is the base weight). - Optionally, powers can contain a
PowerTankDuration
(double, default = 500, for duration the tank has the power) andPowerAttributes
(strings, default = "stack" and "mix", just something to help when randomizing powers) - Once the assignments have been set, do
[TANKPOWER_START]
to set up the tank power, then[BULLETPOWER_START]
to set up the bullet power. - Check the provided powers for syntax and stuff. They contain basically every operation currently available.
- Look at
docs/custom-powers.md
for more information.
The custom power interpreter is also very simple and barebones.
Will come soon™.
I didn't find a good way to easily build documentation, so... the documentation is quite lacking. However, there is some. Check the docs
folder.
- Visual Studio (2022) - C++ IDE from Microsoft
- FreeGLUT - OpenGL Utility Toolkit; cross-platform way to make windows and get inputs
- GLEW - OpenGL Extension Wrangler Library; for getting the latest OpenGL commands on Windows (where "latest" is >1.1 or so)
- OpenGL Mathematics (GLM) - OpenGL-happy matrix and vector math library
- rpmalloc - Memory allocator, for some extra performance
This is my personal project so I won't be taking others' contributions. (Plus I've learned so much and would rather make a sequel at this point.) If you wanna do something with this project, you can fork this repository and do whatever you want.
GNU General Public License v3.0
SPDX-License-Identifier: GPL-3.0-only
- JS Tanks (made by me): tanks.html
- the JS version has significantly less stuff and way worse power mixing, so play this C++ version instead!
- Many people across the Interwebs who made StackOverflow and other forum posts
- Lots of YouTube tutorials, GDC talks, and my CS professors providing assistance
- The vague inspiration I had for this game back when I made it: some top-down Flash tank game. I've tried searching for it multiple times but have never found it, so given my continuously fading memories of that game I played, I'll probably never find out what it actually was. (No, it wasn't Wii Tanks (that's not a Flash game, come on!). I think the game had a more cartoonish than realistic artstyle. I don't remember if there were powerups. My closest guess was some old Atari game remade in Flash, but my searches didn't find anything useful.)
- Super Smash Bros. for being a very fun game
- (Smash Bros the party game, not the competitive fighting game; use items!)
- The Cherno is very helpful for OpenGL
- Solarian Programmer has good starter code for hardware rendering
- The Coding Train is helpful, but wasn't specifically used for this project (probably was used for the JS game, but I don't remember)
- Factorio's Friday Fun Facts are amazing and got me interested in low-level C++ optimizations
- Nitronic Rush is the other game that made me want to learn C++ in the first place
- N++ for just being a good game (also the developers had some good GDC talks and have a useful game development blog)
- Creeper World for also just being a good game
- Outer Wilds for just being a really good game