SFML community forums

General => SFML projects => Topic started by: Tank on July 03, 2008, 11:34:13 am

Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on July 03, 2008, 11:34:13 am
Hello,

I've written a small Tetris clone called "Tanktris" for university using SFML, which is indeed a very great library.

The game texts are in German, but I think the most things are self-explanatory. To start a new game in the menu, choose "Neues Spiel".
All sound effects and musics are CC-licensed, the graphics were done by a good friend of mine. It took me about 20 hours to finish the game.

I hope you like the game, feedback is always appreciated.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Xylankant on July 03, 2008, 12:01:31 pm
Impressive! I never knew 20hrs of work could result in something like this :)
And it works very well, too ^^

Great for v1.0, congratz and thank you!

Only thing I'd like to be added is a Volume-Control and a key that drops a block immediately *gg*

P.S.: How about a tutorial? ;)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on July 03, 2008, 12:34:36 pm
Thank you very much for your feedback.

Well, I hope I'm right with 20 hrs -- don't blame me if I needed more. ;)

Yes, I originally had the idea of providing at least a volume control for the music (to turn it off for example, if it's getting annoying after a while), and I'm still unhappy with the fact, that there's still the disabled "Options" menu entry. So I guess it's more a version 1.0 RC than final 1.0.

Your idea for dropping the blocks immediately by pressing a key is now on my Todo list, thanks for that. I think that'll speed up the gameplay a lot.

What do you mean by a tutorial? Describing how to write a Tetris-like game with SFML? I kinda thought about this some days before by myself, since I'm so thankful that Laurent wrote such a great library, that I want to give something back to him and of course to the community in general.
But I got a better idea. ;) I have started to develop a library called "SFMLGame", which will provide useful mechanisms for programming games, like I used them in my Tetris game. This library will be built on top of SFML. When getting to a usable state of development, I hope to make Tanktris available as some kind of tutorial project for SFMLGame. My primary plans for SFMLGame are to provide the developer with common classes like menus, automated animations, config/savegame loaders and writers etc. But this is still heavily in the pipeline and needs a lot of time and work to accomplish.

Oops, a lot of "Blah blah" in my posting not really thread-related. ;) Again, thanks for your motivating and constructive feedback. I thing I'll implement both of your ideas.

Greets
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Laurent on July 03, 2008, 12:52:50 pm
Wow, very good job, I'm impressed :)

If you want you can add it to the Projects category on the wiki, so that binaries and sources will be available to other people.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on July 03, 2008, 01:19:35 pm
Thank you. :) I've added it to the wiki (http://www.sfml-dev.org/wiki/en/projects) and hope, that the "long form" is okay.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: dabo on July 03, 2008, 01:24:36 pm
Nice game, the blocks are really starting to fall quickly after a while, I thought I had everything under control and then 1 minute later "Game Over" :D
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Laurent on July 03, 2008, 01:29:17 pm
Quote from: "Tank"
Thank you. :) I've added it to the wiki (http://www.sfml-dev.org/wiki/en/projects) and hope, that the "long form" is okay.

It's ok, but you should have created a new page; the Projects page is just the index ;)

I did it for you.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Xylankant on July 03, 2008, 02:10:58 pm
Quote from: "Tank"
What do you mean by a tutorial? Describing how to write a Tetris-like game with SFML?
exactly :)
Quote from: "Tank"
But I got a better idea. ;) I have started to develop a library called "SFMLGame", which will provide useful mechanisms for programming games, like I used them in my Tetris game.
But that sound's great, as well :D

However, it'd be kind of "teaching", having a tutorial that explains the steps in building a Tetris-like game "from bottom to top" using SFML rather than providing another library on top of SFML (which is a good idea nevertheless, in my oppinion!)

Well, back2topic ^^

I just realized the speed in TankTris is increasing by time rather than by cleared lines. Interesting new concept for a Tetris, indeed!
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on July 03, 2008, 04:13:13 pm
Quote from: "dabo"
Nice game, the blocks are really starting to fall quickly after a while, I thought I had everything under control and then 1 minute later "Game Over" :D


Hehe. Do you think the difficulty is too high? I did some balancing before and decided to make Tanktris a "quick game". This of course results in fast game overs.

@Laurent:
Thanks for moving the Wiki article.

Quote
I just realized the speed in TankTris is increasing by time rather than by cleared lines. Interesting new concept for a Tetris, indeed!


Yes exactly. ;) My plan was to make the game more "hectic", so I chose to do level-ups depending on time, instead of score/lines. So a good strategy is to build a huge "tower" in the first levels and throw in the line blocks (4x1) in higher levels, because you get a lot more points then. Anybody broke my highscore of 126000, yet? ;)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: dabo on July 03, 2008, 04:29:26 pm
Quote from: "Tank"
Quote from: "dabo"
Nice game, the blocks are really starting to fall quickly after a while, I thought I had everything under control and then 1 minute later "Game Over" :D


Hehe. Do you think the difficulty is too high? I did some balancing before and decided to make Tanktris a "quick game". This of course results in fast game overs.


No I think it's good the way it is, I just wasn't ready for it, next time I am.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Xylankant on July 03, 2008, 04:47:54 pm
Quote from: "Tank"
Anybody broke my highscore of 126000, yet? ;)
Just got 134800 :D
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on July 03, 2008, 07:45:49 pm
Beat this one:
Highscore (http://pitload.org/file/1212)

To be honest: I'm playing with the implemented "drop block" feature, which makes getting points a lot faster. :)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Xylankant on July 03, 2008, 07:48:34 pm
lolz..."cheated" out by developer ;)

But yes, I imagined this new feature to make making points faster *g*

...Operation gelungen, Patient tot ;) (sry, don't know an english expression for that)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: dabo on July 03, 2008, 07:59:56 pm
Quote from: "Xylankant"
lolz..."cheated" out by developer ;)


There's a reason I always have the top score for my games :D
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Mindiell on July 03, 2008, 10:20:34 pm
There is my highscore (http://mindiell.free.fr/perso/highscore.gif)

And I did not use a "drop block" feature... I just played... with an hex editor  :oops:

Therefore, your game is very sympathic :)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on July 04, 2008, 11:00:51 am
Quote from: "Xylankant"
lolz..."cheated" out by developer ;)
But yes, I imagined this new feature to make making points faster *g*
...Operation gelungen, Patient tot ;) (sry, don't know an english expression for that)

I never cheat, like Mindiell. ;) I was just able to keep a fair amount of time at level 12, had a big tower and two 4-liners. ;)

@dabo:
Absolutely true! If you want to become a master at a game, program it yourself. ;)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: l0calh05t on July 28, 2008, 01:57:40 pm
the dl link seems to be down
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Daazku on July 28, 2008, 02:26:48 pm
True...
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on August 09, 2008, 02:53:47 pm
I'm sorry, I've accidently deleted the files from my server. I uploaded the new release candidate, namely 1.0RC2. Included are a pause feature, instant drop[tm] and rotating blocks counter-clockwise. Also some changes have been made in gameplay, mostly the delays between dropping and getting new blocks.

Be sure to take a look at the included README file to find out about the controls.

Download

Tanktris 1.0RC2 Win32 (http://boxbox.org/~stefan/pub/tanktris-1.0rc2-win32.exe) (12.6 MB)

The link in the initial post has also been corrected. Included in the self-extracing archive are the SFML 1.3 runtime libraries together with the OpenAL runtime libraries setup program. Hopefully this works on mostly every system without the need for other libraries.

The Options menu has been dropped, since I'm currently working on the SFMLGame lib to get some more generic menu functionality. Up to then, there'll be no in-game menu for configuring controls etc.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: dabo on August 09, 2008, 04:23:58 pm
Just got 73500, looks like I need to practise :)

EDIT: 112800 is my best now :)

Is the "block dropping"-speed based on score or time?
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on August 10, 2008, 08:35:43 am
112800 is very good, I'll check mine when I'm at home and post it. ;)

The falling speed changes at each level.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on September 11, 2008, 03:54:36 pm
Since the game is nearly (except options & key configuration) complete, and I'm not planning to do any more coding on it, I've finally released the sourcecode. I've also packed a Linux binary archive.

Visit the Tanktris Wiki page (http://www.sfml-dev.org/wiki/en/projects/tanktris) for downloads.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: dabo on September 12, 2008, 02:50:32 am
I'm gonna check it out.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on September 13, 2008, 11:00:21 am
It would be very nice if someone using Linux Debian (or derivates, like Ubuntu) and the SFML libraries from the repositories could compile from the sources and try to start a new game.
Someone's experiencing problems with a floating point error when choosing New Game.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Avency on September 13, 2008, 11:22:37 am
This someone is right:
Code: [Select]
Floating point exception
This might help you to fix the problem:
Code: [Select]
==10696== Process terminating with default action of signal 8 (SIGFPE)
==10696==  Integer divide by zero at address 0x63655045
==10696==    at 0x4040FA7: sf::Randomizer::Random(int, int) (in /usr/lib/libsfml-system.so.1.3)
==10696==    by 0x805F4D0: MoverProvider::applyRandomTemplate(Mover&) (moverprovider.cc:77)
==10696==    by 0x8056CB2: InGame::createNext() (ingame.cc:402)
==10696==    by 0x8058E99: InGame::onEnter() (ingame.cc:249)
==10696==    by 0x8061CC0: Tetris::setState(State*) (tetris.cc:119)
==10696==    by 0x8061EFB: Tetris::startGameState() (tetris.cc:143)
==10696==    by 0x80624FE: Tetris::run() (tetris.cc:73)
==10696==    by 0x805B146: main (main.cc:7)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: christoph on September 13, 2008, 11:23:13 am
Also there is no offical 1.3 in any current Ubuntu Repos (as Intrepix was frozen too early) there are the exact packages that will enter Ubuntu from the debian side after 8.10 is out on my launchpad ppa:

Code: [Select]
deb http://ppa.launchpad.net/christoph-egger/ubuntu hardy main
deb-src http://ppa.launchpad.net/christoph-egger/ubuntu hardy main

https://launchpad.net/~christoph-egger/+archive

@Avecy:
This someone is me ;)

Are you debian? Debian SFML or selfmade?
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Avency on September 13, 2008, 11:30:26 am
Quote from: "christoph"
Are you debian? Debian SFML or selfmade?

Ubuntu, SFML is compiled from the repository.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on September 13, 2008, 01:22:16 pm
That's really strange. I've just compiled SFML myself (when 1.3 was released, there were no Debian package) and it builds fine (I hope it still does, I've done a system upgrade some days before (Debian Lenny) and did not recompile since then).

To be honest I can't see any reason why there should be a floating point exception. The game crashes when using Random() -- with integers. Also, up to the point where it crashes, no "serious" floating point operations take place. I'm just wondering what causes that exception.

Also it crashes in the initialization part of the game. Everything gets loaded in InGame:onEnter(), then this method calls InGame::createNext() to create the next block -- which utilizes applyRandomTemplate() to get a random block type with random graphics, using sf::Randomizer::Random. I really can't see anything from up to that point.

I'll be at home tomorrow and will recompile the whole code under my Debian Lenny, which got updated the last days. If I'll get that exception too, I highly suggest that there's something wrong with other libraries (after some googling, I found out that newer versions of the libc6 are making trouble; but also ATI graphics cards seem to not work together with some programs under special circumstances)

What graphics card do you have, Avency? And thanks for your bug report.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on September 13, 2008, 01:24:45 pm
Bah, okay, I should open my eyes a bit more:
Quote
Integer divide by zero at address 0x63655045


I think this is something to be able to start with. :)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on September 13, 2008, 01:37:13 pm
Alright, before uploading packages, they should really be double-checked.. The problem was that the "data" directory was missing in both the Linux and sourcecode archive.

I'm sorry for the inconveniences and thanks again for the bug reports. I hope everyting's working now, the archives have been re-uploaded.

Edit: Laurent, would it be a good idea to implement division by zero checks for Random()?
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: christoph on September 13, 2008, 02:04:15 pm
Works great!
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Laurent on September 13, 2008, 02:08:13 pm
Quote
Edit: Laurent, would it be a good idea to implement division by zero checks for Random()?

And then return what ?
In my opinion, getting a system exception is more obvious than a possible incorrect value, for the programer to fix his error.
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Tank on September 13, 2008, 04:39:12 pm
Quote from: "christoph"
Works great!

Great. :)

Laurent:
You're obviously right. I didn't thought about that a C++ exception is thrown. Nevermind. :)
Title: Tanktris - a Tetris clone [RC2 & Sourcecode released]
Post by: Laurent on September 13, 2008, 04:50:18 pm
It's not a C++ exception, it's a system interruption (unless you've turned on a compiler specific option to convert it to a C++ exception).