SFML community forums

General => SFML projects => Topic started by: amhndu on April 26, 2014, 12:44:38 pm

Title: mini-tanks, an artillery 2d game with Tanks , inspired by Pocket Tanks.
Post by: amhndu on April 26, 2014, 12:44:38 pm
Introduction
Hi ,
This is an artillery , turn-based 2d game I made, which is far from complete yet but it does have some gameplay.
It is inspired from Pocket Tanks and Scorched Earth.
It features a fully destructible procedurally generated terrain , generated using simplex noise.
SFML is used for Window creation,Graphics and Input.

Controls and Objective:
Use mouse to click on the HUD to start setting Rotation(or press R) of the turret or power by moving your mouse left or right.
While setting rotation you'll see a cross hair helping you set the angle and
while setting power , the power gauge's outline will change from Black to Red.
Use Arrow Keys Left or Right to move the Tank.
Click on "FIRE" on the HUD or press Space to fire.
It is a very simple game , destroy other tanks and you win, with only one type of weapon.

Source:
Github: amhndu/tanks-game (https://github.com/amhndu/tanks-game).

Compiling:
To compile you need a C++11 compiler( and also SFML 2.1 ).
Download the source or clone the repository from github :
https://github.com/amhndu/tanks-game
and use cmake (or cmake-gui)

Executables:
These are outdated.
https://www.dropbox.com/s/ixu8g65mszea4b4/tanks-bin-win32.zip (compiled using g++ 4.8.1)
https://www.dropbox.com/s/v4shlyt8j8odv4e/tanks-bin-linux32.tar.gz (compiled using VC 2013 and requires VC2013 redistributable)
These are statically linked 32-bit executables.

Video
http://www.youtube.com/watch?v=YbG_ej2fQKE

So try and what do you think ?  :D
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: Geheim on April 26, 2014, 07:46:24 pm
Oh look at that, totally reminds me of Worms (I love such games) ;)

Very cool stuff you already implemented!
What did you use for the landscape? A vertexArray which stores each pixel?
Whats the CPU cost? ( I tried something similar ages ago and had quite high CPU costs haha)

Keep it up and add more weapons pls!
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: zmertens on April 26, 2014, 09:34:22 pm
That reminds me of Worms too. Cool!
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on April 27, 2014, 03:46:34 am
Oh look at that, totally reminds me of Worms (I love such games) ;)

Very cool stuff you already implemented!
What did you use for the landscape? A vertexArray which stores each pixel?
Whats the CPU cost? ( I tried something similar ages ago and had quite high CPU costs haha)

Keep it up and add more weapons pls!
I looked at different things but finally settled with using an image, you can look at the source.

Glad you like it.
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: The Illusionist Mirage on April 27, 2014, 06:01:21 am
Yea, really cool, and the video looks nice too. :)
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on April 30, 2014, 12:32:34 pm
Yea, really cool, and the video looks nice too. :)
Thank you.

Any comments /advice on the source ?
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: Gobbles on May 04, 2014, 05:08:47 am
Take a look at Scorched Earth, almost identically similar game. You might be able to pull some inspiration from it.
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on May 07, 2014, 05:10:44 pm
I need a little help, can someone compile this game for Windows and provide a statically linked executable for windows 32-bit.
Title: AW: A game feat. Tanks , inspired by Pocket Tanks
Post by: eXpl0it3r on May 07, 2014, 05:26:10 pm
A build script would be nice. ;)
If nobody beats me to it, I could build a Windows binary later this evening. ;)
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: Geheim on May 07, 2014, 05:30:23 pm
"GameSetupScreen.h" is missing
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on May 08, 2014, 04:42:06 am
"GameSetupScreen.h" is missing
Sorry about that , seems i didn't commited it .You can clone the updated repo.
A build script would be nice. ;)
Well , I could have provided one but I do not know any cross-platform tools that could help me. :( Anyway I think this is a good time for me to learn cmake I will try and make one build script.
I used my IDE to do it for me.  :D
Also , to quote myself from my OP,
Quote
To compile , just compile all c++ files with a c++11 compiler( and link to SFML 2.1 ).
.
On linux , you can compile using these commands :
Quote
$ git clone https://github.com/amhndu/tanks-game
$ cd tanks-game
$ g++ -std=c++11 -O2 -o game *.cpp -lsfml-graphics -lsfml-window -lsfml-system -lGL -lGLU
Run :
Quote
$ ./game
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: Geheim on May 08, 2014, 10:31:53 am
Here you go: https://dl.dropboxusercontent.com/u/8088302/Tanks.7z (https://dl.dropboxusercontent.com/u/8088302/Tanks.7z)

Please check your code! I get tons of warnings (most of them because of missing type conversion, but still).
I also got some errors, which were easy to fix though.
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on May 08, 2014, 11:01:52 am
Here you go: https://dl.dropboxusercontent.com/u/8088302/Tanks.7z (https://dl.dropboxusercontent.com/u/8088302/Tanks.7z)

Please check your code! I get tons of warnings (most of them because of missing type conversion, but still).
I also got some errors, which were easy to fix though.
What errors ? I get none on g++ 4.8.1.

Thanks for helping me out.
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: Geheim on May 08, 2014, 11:21:46 am
What errors ? I get none on g++ 4.8.1.

Nothing big, you probably have a different warning level on your compiler (idk how it is called for your compiler) and mine does treat some warnings as errors too like:
deltaScroll = -menuList.size()+itemsVisible;
Which gives me error C4146 (http://msdn.microsoft.com/en-us/library/4kh09110.aspx) for example.
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on May 08, 2014, 12:23:18 pm
What errors ? I get none on g++ 4.8.1.

Nothing big, you probably have a different warning level on your compiler (idk how it is called for your compiler) and mine does treat some warnings as errors too like:
deltaScroll = -menuList.size()+itemsVisible;
Which gives me error C4146 (http://msdn.microsoft.com/en-us/library/4kh09110.aspx) for example.
FYI , g++ has no concept of warning/error levels but you can turn on and off many different warnings (like passing -Wfoo).

Besides , is the executable statically linked ?i doubt it, as the size is very small . If it isn't please also provide the necessary dlls.
I am unable to run under wine in linux as it requires the vc++ 2013 redist. library.
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: Geheim on May 08, 2014, 12:31:35 pm
Ah I see, thanks.

Besides , is the executable statically linked ?i doubt it, as the size is very small .
It is linked statically ;)
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on May 16, 2014, 06:56:59 am
Has anyone really tried this  ? :-\
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: The Illusionist Mirage on May 16, 2014, 11:36:32 am
I tried to build the src and it does compile without throwing any warnings or errors :D

But during the gameplay, pressing 'H'  key causes this:
(http://puu.sh/8OjVi.jpg)

and this:

(http://puu.sh/8OjY1.jpg)

Apart from that the gameplay is really very smooth.
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on May 16, 2014, 12:31:20 pm
I tried to build the src and it does compile without throwing any warnings or errors :D

But during the gameplay, pressing 'H'  key causes this:

Oops! I forgot to remove those keybinding. Fixed it.
See here (https://github.com/amhndu/tanks-game/commit/f2ae217451b588d694dc10d5e5198bca1681f5a4).
Delete the cases and recompile (or update your repo.)

Quote
Apart from that the gameplay is really very smooth.
:)
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: The Illusionist Mirage on May 16, 2014, 12:42:12 pm
But I still have two more small critics left - include a descrption of the controls(rather than the user having to guess which key does what) and also the fix the aim option('R' button press). The aim works too smoothly  ;)
Title: Re: A game feat. Tanks , inspired by Pocket Tanks
Post by: amhndu on May 16, 2014, 04:06:03 pm
But I still have two more small critics left - include a descrption of the controls(rather than the user having to guess which key does what) and also the fix the aim option('R' button press). The aim works too smoothly  ;)
I'll add the controls in the readme , also I've given the controls in the OP :)
to quote myself  :
Quote
Controls and Objective:
Use mouse to click on the HUD to set Rotation(or press R) , power and fire(or press Space) , Arrow Keys Left or Right to move the Tank.
It is a very simple game , destroy other tanks and you win, with only one type of weapon.

I've made the aiming and power setting option less smooth and aim setting is fixed.