Home Made Tetris

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
Peregrin_Tuk
Posts: 9
Joined: June 23rd, 2016, 7:09 pm

Home Made Tetris

Post by Peregrin_Tuk » October 23rd, 2016, 3:33 am

Hi Everyone, I'm practicing programming and this time, I made a Tetris using Chilli's Framework... It took me some time to finish it, but I think it works in a pretty decent way... I just wanna to share it with you...Bye!
Attachments
Home_Made_Tetris.rar
(520.25 KiB) Downloaded 142 times

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: Home Made Tetris

Post by Pindrought » October 23rd, 2016, 5:34 am

Awesome stuff.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Home Made Tetris

Post by albinopapa » October 23rd, 2016, 7:27 am

Ah, tetris, hours of my life I want back...

I'm surprised the code actually compiled. You only included the files in Game.h, just can't figure out how the other files knew about each other. It must be because you only use header files and no CPP files. I was messing around and tried moving the definitions to the cpp files, but then started getting errors left and right saying that things were undefined. It's usually a good idea to have the function signatures in the header while putting the implementations in cpp files, but it does require a fair bit of extra work trying to not create circular references.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Home Made Tetris

Post by chili » October 23rd, 2016, 7:42 am

Yeah, when you do it with only .h files, it can compile fine as long as the headers are included in the right order. It's safer to include everything the header uses in the header itself of course.

Personally, I often just use .h files. Less time wasted shifting between .h/.cpp files. Can become a problem in large projects though, where compile times can stack up.

Slick looking game man, good job! The code is really clear and simple to understand. Good use of containers.

Tetris is on the list for games to cover in the series.
Chili

freebattie
Posts: 197
Joined: August 4th, 2016, 10:05 am

Re: Home Made Tetris

Post by freebattie » October 23rd, 2016, 3:17 pm

hmm if i try and do release mod x86 my antivirus quarantees it? dont get why, and dose not run in debug mode x86 ether? only runs in 64x debug/release
this is the error i get in debug mode x86
1>c:\users\freebattie\downloads\home_made_tetris\kill_the_aliens\engine\score.h(411): error C4703: potentially uninitialized local pointer variable 'list_to_travel' used

User avatar
Peregrin_Tuk
Posts: 9
Joined: June 23rd, 2016, 7:09 pm

Re: Home Made Tetris

Post by Peregrin_Tuk » October 23rd, 2016, 3:30 pm

That's because "travel_ list" is initialized inside a switch statement. Was my mistake to not initialize it as null_ptr when declare it. The error is thrown because in case none of the conditions inside the switch were true you will be accessing undefined places in memory.

freebattie
Posts: 197
Joined: August 4th, 2016, 10:05 am

Re: Home Made Tetris

Post by freebattie » October 23rd, 2016, 3:43 pm

yeah ok that fixed it :)

EDIT: but my antivirus still dosent like it in x86 release mode lol

User avatar
warnakey
Posts: 10
Joined: October 26th, 2016, 6:34 am

Re: Home Made Tetris

Post by warnakey » October 30th, 2016, 3:13 pm

Hey Peregrin_Tuk,

Your Tetris game is really awesome! I was also curious about some of the extra art pieces in the build - Kill the aliens. Were you originally going to make this a Space Invaders type game, but then switched over to Tetris?

Awesome work.

User avatar
Peregrin_Tuk
Posts: 9
Joined: June 23rd, 2016, 7:09 pm

Re: Home Made Tetris

Post by Peregrin_Tuk » October 30th, 2016, 5:30 pm

Thanks Warnakey. First I was about to create some classic shooting game, but I leave the project and a couple of months later I was in the mood to make a simple game and it came to me the idea of tetris... I just used that old folder and didn't find a way to change the name of the containing folder without having problems to compile the project..

Post Reply