[HomeBrew] New Game - Tetris Clone for GBC

Discussion of programming and development for the original Game Boy and Game Boy Color.
Post Reply
User avatar
Ryoga
Posts: 61
Joined: Wed Mar 16, 2016 2:08 pm
Location: World 9 - Warp Zone
Contact:

[HomeBrew] New Game - Tetris Clone for GBC

Post by Ryoga »

Hello everyone...

I am currently focused on the development of several homebrew game projects. The first of them is a Tetris clone (it's a project that for lack of time I have not been able to continue with its development until now) that I have called "Tetris: The Soviet Mind Game" in honor of the unlicensed game of the same title developed by TENGEN for NES.

The game right now is in a very initial state however it is playable. As you can see in the following screenshots it consists of a first screen of presentation to which I would like to see some more and a menu screen in which the user can select the level of difficulty and see a screen that is accessed to a list of records.
Title Screen
Title Screen
00001.png (3.19 KiB) Viewed 7591 times
The game still has no sound effects or music and is in fact one of the immediate tasks I want to undertake. After pressing the START button you can directly access the main game screen, which is divided into two zones.
In-game screenshot
In-game screenshot
00002.png (1.26 KiB) Viewed 7591 times
The main area in which the player places the pieces to make lines and earn points and a second section in which at the moment only it is shown which the next piece that the game offers to the player.
In-game screenshot
In-game screenshot
00003.png (1.67 KiB) Viewed 7591 times
In this second section I would like to add a score marker and another marker that reflects the level of difficulty just below the table dedicated to visualize the next piece that is offered to the player.

To choose the next piece that is offered to the player I use a modified version of the following (very-old) program that allows to generate random numbers: https://www.youtube.com/watch?v=PhCHgO2Kaqg

OLD - Random Number Generator Source Code

Code: Select all

#include <gb/gb.h>
#include <stdio.h>
#include <ctype.h>
#include <rand.h>
#include <gb/console.h>
#include <gb/drawing.h>

#include "pc18966_2.h"

unsigned int r,seed,key;

void clscr();
void main_loop();
void print_title();
void print_marquee();
void print_solid_marquee();
void print_message_INTRO();
void print_message_usage();
void print_messageAtXY(int x, int y, char *c);
void plot_intro_image(unsigned char *tile_data, unsigned char *map_data);

void main(){
	
	plot_intro_image(pc18966_2_tile_data, pc18966_2_map_data);
	
	print_marquee();
	print_title();
	print_message_INTRO();
	waitpad(J_START);
	
	clscr();
	print_solid_marquee();
	main_loop();
}

void main_loop(){
	
	seed=0;
	key=0;
	r=0;
	
	while(1){
		print_messageAtXY(1,2, "Press A Button !");
		if(joypad() == J_A){
  			while(joypad() == J_A){seed++; if(seed>=255)seed=1;}
  			initrand(seed);
  			print_messageAtXY(1,4, " ");
  			gprintf("Seed = %u ",seed);
  			if(!0){
   				r=rand();
   				print_messageAtXY(1,5, " ");
   				gprintf("Rand = %u  ",r);
  			}
		}
		if(joypad() == J_B){
			// do nothing
		}
		if(joypad() == J_SELECT){
			clscr();
			print_solid_marquee();
		}
		if(joypad() == J_START){
			clscr();
			print_marquee();
			print_title();
			print_message_usage();
			waitpad(J_START);
	
			clscr();
			print_solid_marquee();
		}
		delay(35);
	}
}

void print_marquee(){
	gotoxy(0, 0);
	color(BLACK, WHITE, SOLID);
	box(156,140,2,2,M_NOFILL);
	box(154,138,4,4,M_NOFILL);
	box(152,136,6,6,M_NOFILL);
}

void print_solid_marquee(){
	gotoxy(0, 0);
	color(BLACK, WHITE, SOLID);
	box(156,140,2,2,M_NOFILL);
	box(155,139,3,3,M_NOFILL);
	box(154,138,4,4,M_NOFILL);
	box(153,137,5,5,M_NOFILL);
	box(152,136,6,6,M_NOFILL);
}

void plot_intro_image(unsigned char *tile_data, unsigned char *map_data){
	set_bkg_data(0, 0, tile_data);
	set_bkg_tiles(0, 0, 20, 18, map_data);
	SHOW_BKG;
	DISPLAY_ON;
	delay(5000);
	clscr();
}

void print_messageAtXY(int x, int y, char *c){
	gotogxy(x,y);
	gprintf(c);
}

void print_title(){
	print_messageAtXY(3,1,"Rand Generator");
}

void print_message_usage(){
	print_messageAtXY(1,3,"Controls:");
	print_messageAtXY(1,4,"");
	print_messageAtXY(1,5,"A - Gen. Number");
	print_messageAtXY(1,7,"SELECT - Erase SCR");
	print_messageAtXY(1,8,"START - HOW TO...");
	print_messageAtXY(4,11,"PRESS START!");
	print_messageAtXY(8,14,"2014");
	print_messageAtXY(4,15,"Programmed by");
	print_messageAtXY(8,16,"Ryoga");
}

void print_message_INTRO(){
	print_messageAtXY(1,3,"This is a homebrew");
	print_messageAtXY(1,4,"software for the");
	print_messageAtXY(1,5,"Game Boy console.");
	print_messageAtXY(1,6," ");
	print_messageAtXY(1,7,"Controls:");
	print_messageAtXY(2,8,"A - Gen. Number");
	print_messageAtXY(4,11,"PRESS START!");
	print_messageAtXY(8,14,"2014");
	print_messageAtXY(4,15,"Programmed by");
	print_messageAtXY(8,16,"Ryoga");
}

void clscr(){
	int x, y;
  	for(y = 0; y < 20; y++){
    	for(x = 0; x < 30; x++){
      		gotoxy(x, y);
      		gprintf(" ");
		}
	}
	gotoxy(0,0);
}
In-game screenshot
In-game screenshot
00004.png (1.57 KiB) Viewed 7591 times
On the other hand, apart from the typical pieces that are part of the classic Tetris game I would like to add more rare pieces like those that can be seen in some portable Tetris machines made in China. So if you have any idea of a Tetris piece design that meets these characteristics, please indicate how they are to be added to the final set. Since the game is still under development so any idea or contribution is allowed.

I put the link to a video that shows the current state of the game: https://www.youtube.com/watch?v=lUUcIghRsts
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Sumez »

Just a heads-up - though I can probably provide a billion more of these "do and don't" points on Tetris along the way ;) - regarding the randomizer, you definitely want some sort of protection against crappy RNG. The SNES Tetris games have completely random piece selection and are horrible for it. The original NES game however will always reroll exactly once if it gets the same piece twice in a row, so that this will happen with lower frequency than you'd expect from pure randomness.
This doesn't really make the game as lenient as it would sound - it's still way more fierce than most newer versions of Tetris - but it definitely makes the selection of pieces feel less absurd to the player, and improves the idea of the actual puzzle, which is centered around finding a place for every possible piece - not five S pieces in a row.


EDIT: Another thing I noticed in the video... it seems you are only rotating your pieces clockwise? Any reason for that? I would assume you are planning on using both buttons for rotations.
User avatar
Ryoga
Posts: 61
Joined: Wed Mar 16, 2016 2:08 pm
Location: World 9 - Warp Zone
Contact:

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Ryoga »

Sumez wrote:Just a heads-up - though I can probably provide a billion more of these "do and don't" points on Tetris along the way ;) - regarding the randomizer, you definitely want some sort of protection against crappy RNG. The SNES Tetris games have completely random piece selection and are horrible for it. The original NES game however will always reroll exactly once if it gets the same piece twice in a row, so that this will happen with lower frequency than you'd expect from pure randomness. This doesn't really make the game as lenient as it would sound - it's still way more fierce than most newer versions of Tetris - but it definitely makes the selection of pieces feel less absurd to the player, and improves the idea of the actual puzzle, which is centered around finding a place for every possible piece - not five S pieces in a row.
I understand what you want to say and it makes sense. It makes sense to generate a logic so that the random generation does not mess up. :beer:
Sumez wrote: EDIT: Another thing I noticed in the video... it seems you are only rotating your pieces clockwise? Any reason for that? I would assume you are planning on using both buttons for rotations.
As I say in the first post, the game is in a very early version of development so for the moment only the pieces are allowed to rotate in one direction, but the idea is that in the final version the A and B buttons can be used to turn the pieces in both directions. :beer:
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Kasumi »

I can't tell if you're only inspired by Tengen's name or if you want to just create a clone of it (or other classic Tetris games.)

But just in case you're willing to put in more modern things... I like a Tetris game with 1 cell a frame delayed auto shift.

I press right. The piece moves one cell to the right. If I continue to hold right for say... 6 to 12 frames, the piece begins shifting right at one cell a frame.

The slowest auto shift I can stand is Tetris DX which seems to be one cell every three frames. If you do nothing else, please consider fast delayed auto shift.

In case you're willing to go nuts with modern mechanics, I recommend reading about TGM rotation (specifically its wallkicks which are for the most part intuitive and fair, while not allowing silly things like other wall kicks

Also about an initial rotation system. Even if you don't plan to max the speed of the game, all of these quality of life things are pretty nice. I really miss the stuff once it's not there, coming from Tetris Grand Master.

I make this humble post because so many people close Tetris not realizing how much more one can do than Game Boy Tetris.
Last edited by Kasumi on Tue Dec 05, 2017 6:59 am, edited 2 times in total.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by FrankenGraphics »

You might want to call it "the soviet mind game" instead of the full title for legal reasons. I think i can recall the title is privately owned.
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Sumez »

Ryoga wrote: I understand what you want to say and it makes sense. It makes sense to generate a logic so that the random generation does not mess up. :beer:
Not so much "mess up" as basically the fact that "true random" (within a computers pseudo-random capabilities that is) doesn't really feel "random" to a human. More than a few of the same piece in a row will feel wrong even if it's perfectly viable. More importantly though, it just isn't fun to deal with.

The NES version of Tetris is more "fair" than pure random, but only to a certain extend - You still have absolutely no way to guess what the next piece will be after the current preview. The GB version is very similar, but the RNG method is extremely bad, and it's always biased in favor of some pieces over others.
The TGM series takes the reroll to a much larger degree, rerolling multiple times and remembering the last four pieces instead of just the last one. The result is a Tetris game that's much easier to deal with on low gravity, but the game amps up the difficulty in other areas instead.

There's a TON of really deep theory behind a simple seeming game like Tetris. A lot of minor things matter a lot to people who play Tetris on a high level. Stuff like how long it waits before spawning a piece after a previous one locks, how the pieces rotate, how fast the pieces move when you hold down left or right, or how long it needs to "charge" before it starts repeating. Even minor differences tends to make a big impact on gameplay in a game like this, which is why people have very strong opinions on the various different implementations of Tetris.
FrankenGraphics wrote:You might want to call it "the soviet mind game" instead of the full title for legal reasons. I think i can recall the title is privately owned.
Yeah Tetris is a trademark, and they are pretty aggressive about it. Just wait till tepples discovers this thread. :P
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by tepples »

Even some of the parameters (field dimensions, standard piece set) are copyrighted, as a U.S. judge ruled in June 2012. This led me to withdraw a project from public availability. It also led me to realize how e-sports are less legitimate than ball sports.
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Sumez »

The thing about the field size and piece set is really up for debate and has indeed spawned many debates since that verdict - many people, myself included, would defend the fact that the playfield dimensions (10x20) and available pieces (literally every single possible shape you can make with a tetramino) are pretty much a mathematical requirement for the game concept to work - a concept which they do not own a patent for. As such, it seems like a gross mistake to consider these aspects a part of the Tetris copyright.

I'm pretty sure, however, that The Tetris Company have never sued anyone who haven't tried to make money off the concept. Stuff like Cultris and Nullpomino still exists and never had a lot of issues as far as I'm aware.


And yeah, calling Tetris a "sport" while at the same time defending the exclusive rights to license anything playing like it, is just repulsive.
User avatar
Ryoga
Posts: 61
Joined: Wed Mar 16, 2016 2:08 pm
Location: World 9 - Warp Zone
Contact:

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Ryoga »

Kasumi wrote: In case you're willing to go nuts with modern mechanics, I recommend reading about TGM rotation (specifically its wallkicks which are for the most part intuitive and fair, while not allowing silly things like other wall kicks

Also about an initial rotation system. Even if you don't plan to max the speed of the game, all of these quality of life things are pretty nice. I really miss the stuff once it's not there, coming from Tetris Grand Master.

I make this humble post because so many people close Tetris not realizing how much more one can do than Game Boy Tetris.
Good points. The original idea was to create a clone that resembles the classic from a playable point of view.
Sumez wrote: The NES version of Tetris is more "fair" than pure random, but only to a certain extend - You still have absolutely no way to guess what the next piece will be after the current preview. The GB version is very similar, but the RNG method is extremely bad, and it's always biased in favor of some pieces over others. The TGM series takes the reroll to a much larger degree, rerolling multiple times and remembering the last four pieces instead of just the last one. The result is a Tetris game that's much easier to deal with on low gravity, but the game amps up the difficulty in other areas instead.
Okay. Thank you for providing such good information regarding the random generation of parts. It really is an interesting topic that I take note of. :beer:
FrankenGraphics wrote:You might want to call it "the soviet mind game" instead of the full title for legal reasons. I think i can recall the title is privately owned.
Yes, it's just what I was thinking.
tepples wrote:Even some of the parameters (field dimensions, standard piece set) are copyrighted, as a U.S. judge ruled in June 2012. This led me to withdraw a project from public availability. It also led me to realize how e-sports are less legitimate than ball sports.
I had no idea about this. However today you can find repositories of source code with the implementation of Tetris made in languages such as Java or C / C ++. These Tetris clones use the same set of pieces as the original. In any case this makes me rethink things about the game.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by tepples »

For RHDE, whose build phase closely resembles that of Rampart, I decided to reverse engineer the rules by which the pieces in Rampart were chosen, so that they aren't considered quite as arbitrary of a set (and thus not as large of a creative effort). I ended up with "pentominoes and smaller polyominoes that fit in a 3x3 box and don't contain the O tetromino". I imagine that Atari Games rejected the O because it produces an undesirable 2-cell-thick wall and rejected pieces that don't fit in 3x3 because it would complicate movement and rotation.

Robert Pelloni made a Tetris clone for his RPG Bob's Game that used an 8x16 field (like Dr. Mario) and the six trikings instead of the seven tetrominoes. Polykings are like polyominoes except that blocks can also be connected diagonally.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by zzo38 »

Sumez wrote:A lot of minor things matter a lot to people who play Tetris on a high level. Stuff like how long it waits before spawning a piece after a previous one locks, how the pieces rotate, how fast the pieces move when you hold down left or right, or how long it needs to "charge" before it starts repeating. Even minor differences tends to make a big impact on gameplay in a game like this, which is why people have very strong opinions on the various different implementations of Tetris.
tepples wrote:Even some of the parameters (field dimensions, standard piece set) are copyrighted, ...
A program can have a lot of options to change such things as, field dimensions (and perhaps even geometry), piece sets (both fully custom and defining by rules are possible, so the tetrominoes need not be programmed in), various stuff about timing, visibility, and a lot of other stuff. And then, is not Tetris; it is a superset.
(Free Hero Mesh - FOSS puzzle game engine)
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Sumez »

You can make derivatives of Tetris by changing factors such as the playfield size and available pieces yes, but as I was pointing out in another post, these aren't just randomly chosen! There's a perfect mathematical beauty to Tetris where everything matches up perfectly and ensures an incredible depth to the puzzle that makes up the game.
A lot of pople see Tetris as a fun casual game, but there's really a lot more to the game. Add or remove two cells from the width of the playfield and you have a completely different puzzle that might be fun to play for a while but in no way has the same absurd lastability as the classic Tetris recipe.

The thing is - game mechanics can't be copyrighted. It might sound a bit absurd, but you can make a complete copy of an existing game as long as you don't use any recognizable assets that should be considered a part of the game's copyright. Of course, what constitutes a copyrightable asset is a grey area, but since the selection of pieces and the dimensions of the playfield are central to the game mechanics of Tetris, I think it's dead wrong to consider them as such, and the court that made the descision referenced by tepples failed to see this.
This robs any other developers the opportunity of creating a competing Tetris styled puzzle game that is better than the officially licensed games, and the reality of the situation is exactly that now we are stuck with official releases which are absolutely horrible for competitive single player gameplay due to a ridiculously stupid ruleset being enforced by The Tetris Company.
Yes, this is how much people care about Tetris.
User avatar
Ryoga
Posts: 61
Joined: Wed Mar 16, 2016 2:08 pm
Location: World 9 - Warp Zone
Contact:

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Ryoga »

I have found one of my old Tetris machines built in China and I have managed to make it work to see the set of rare pieces that are included in it and that are not part of the original set of Tetris pieces. Let's see if I take some time and try to make a small design of them using the GBTD tool.
Sumez wrote:You can make derivatives of Tetris by changing factors such as the playfield size and available pieces yes, but as I was pointing out in another post, these aren't just randomly chosen! There's a perfect mathematical beauty to Tetris where everything matches up perfectly and ensures an incredible depth to the puzzle that makes up the game.
It's just what I was thinking about doing.
Sumez wrote: The thing is - game mechanics can't be copyrighted. It might sound a bit absurd, but you can make a complete copy of an existing game as long as you don't use any recognizable assets that should be considered a part of the game's copyright. Of course, what constitutes a copyrightable asset is a grey area, but since the selection of pieces and the dimensions of the playfield are central to the game mechanics of Tetris, I think it's dead wrong to consider them as such, and the court that made the descision referenced by tepples failed to see this. This robs any other developers the opportunity of creating a competing Tetris styled puzzle game that is better than the officially licensed games, and the reality of the situation is exactly that now we are stuck with official releases which are absolutely horrible for competitive single player gameplay due to a ridiculously stupid ruleset being enforced by The Tetris Company.
Yes, this is how much people care about Tetris.
It's a very interesting debate and the truth is that I agree with you.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by tepples »

The original developer prefers the romanization "Alexey Pajitnov".

So anyway, these are the six one-sided triplets or trikings.

Code: Select all

         _     _           _
 _ _ _  |_|_  |_|_ _   _ _|_|
|_|_|_| |_|_|   |_|_| |_|_|
             _
   _       _|_|
 _|_|_   _|_|
|_| |_| |_|
And these are the eighteen 1-sided pentominoes and smaller that fit in 3x3 and do not contain the O tetromino. (The I4, I5, L5, N5, and Y5 are too long, and the O4 and P4 contain O.)

Code: Select all

 _   _ _
|_| |_|_|
         _     _         _         _     _ _   ___     _   _
 _ _ _  |_|_  |_|_ _   _|_|_   _ _|_|  _|_|_| |_|_|_  |_|_|_|
|_|_|_| |_|_| |_|_|_| |_|_|_| |_|_|_| |_|_|     |_|_| |_|_|_|
   _       _       _ _   _ _
  |_|_   _|_|     |_|_| |_|_|
 _|_|_| |_|_|_   _|_|     |_|_
|_|_|     |_|_| |_|_|     |_|_|
   _     _       _         _
  |_|   |_|     |_|_     _|_|_
 _|_|_  |_|_ _  |_|_|_  |_|_|_|
|_|_|_| |_|_|_|   |_|_|   |_|
User avatar
Ryoga
Posts: 61
Joined: Wed Mar 16, 2016 2:08 pm
Location: World 9 - Warp Zone
Contact:

Re: [HomeBrew] New Game - Tetris Clone for GBC

Post by Ryoga »

Thanks tepples. The following pieces are part of the set of rare pieces (mainly pentaminoes) that are included in the Chinese Tetris machine that I have in possession.
tepples wrote:

Code: Select all

 _   _ _
|_| |_|_|
         _     _         _         _     _ _   ___     _   _
 _ _ _  |_|_  |_|_ _   _|_|_   _ _|_|  _|_|_| |_|_|_  |_|_|_|
|_|_|_| |_|_| |_|_|_| |_|_|_| |_|_|_| |_|_|     |_|_| |_|_|_|
    _ _     _ _
   |_|_|  |_|_|
 _|_|         |_|_
|_|_|         |_|_|
   _        _         _
  |_|     |_|       _|_|_
 _|_|_   |_|_ _    |_|_|_|
|_|_|_|  |_|_|_|     |_|
So I'm thinking about adding 3 game modes. One with the traditional pieces, another that exclusively uses the rare pieces and another way that tries to mix the two sets of pieces.

I hope I can bring a DEMO with the progress soon.
Post Reply