Falling Blocks

My first game. :wink: (nothing original of course)

http://www.launchts.com/hob/hob.jnlp

I’m having trouble with the “Application’s digital sig. can not be verified” (even after using keytool && jarsigner ).

Any help / advice is appreciated.

Cheers!

Try not asking for permissions, your application isn’t doing anything that demands it. Good job, although the game feels highly unresponsive to my input!

The controls seem a little sluggish, sometimes I press a key and it misses it.

Horizontal movement allows the blocks to move through eachother :slight_smile:

Very nice for a Tetris clone. But like what Riven said, moving horizontally allows the block to move through another block. Would like to see a different variation of Tetris though. Such as with power ups or some kind of other wild game play never done before in a Tetris game.

Thanks. I’ll look into the jnlp permissions.

I agree with you guys, sluggish controls. I’m struggling with the fact that when you press a key it easily sends 3 or 4 key press events. If I have each keypress move a block x+1 (or x-1 depending on direction) on the grid… then each press might send the block zipping across the play grid. To slow this down, I’m using if(blockLoopDelta > blockSpeed){move()}else{blockLoopDelta+=gameDelta} logic to keep the blocks for zipping 3 or 4 units per millisecond. unfortunately, this requires 3 or 4 key press events to move a block. :-\

Any thoughts on how to control how may key press events occur per a users physical press (or how to make the controls react correctly)?.

Lastly, I’ll put some collision detection in there for horizontal collisions (clearly, I only have boundary and vertical collision detection).

Thanks.

Do this: when the key is pressed down set a flag (but only a flag) indicating the the key is down, when it is released set the flag to it being released. Only check for the key state in the game loop, sorted!

Hello,

I removed the tags (like keldon85 suggested - not asking for permissions I don’t need) from the jnlp and it doesn’t complain about the digital signature. Now, I’ll fix the horizontal collision and the sluggish controls.

Thanks!

The best way I found to reduce this problem is to just drop my framerate to about 20 or 25 frames per second.

I agree that big smashes and wild game play never done before in Tetris would be more interesting. But for this little game I’m just trying to get my feet wet (maybe just get a somewhat polished product built).

Game update:
I used keldon85’s suggestion and updated the controls to be more responsive. Essentially, I used the key press AND the key release events to detect when the user holds a move key down (sending multiple key presses and no key release). I was able to react to someone rapidly taping a move button (no skips). Also, detecting key release allowed me to manage the accidental zippy moves across the play grid.

Also, I’ve added horizontal collision detection. so you can’t slide a block into a landed block.

The last bug mentioned was the ability to “flip” your current falling block into a landed block. I think I’ll leave that one in as a feature of the game… maybe that can be my “wild game play…” feature. (just kidding).

Thank you so much for your advice (lots to think about), please keep the advice coming it is a great motivator.

meanwhile… enjoy a casual game of falling blocks at http://www.launchts.com/hob/hob.jnlp

60 fps Tetris

Check out Tetris concept too- your random generator is a little off. What you should do is shuffle a list of tiles so that you don’t generate unplayable sets. Also only shuffle like this as any other way is likely to yield an unequal distribution of possibilities:

for ( int i = 0; i < deckSize; i ++ ) {
      swap ( i , randomGenerator.generate ( deckSize - i ) + i );
}

By the way you can still hit the keys without anything happening; are you resetting the flags each frame? And don’t let Tetris deceive you, it runs at 60fps :slight_smile: Flipping into a block should be handled in the same way as falling, you see if a potential move will put you in a bad position and reject the request to move it. Know the power of the game loop:

gameLoop () {
   check_input
   update_game_state
   render_frame
   wait_for_synchronization
}

Hmm, guess I got a lot to learn about Tetris…

Oh by the way, something that’s probally useless to say now, I’m gonna say anyway…

If you are signing the application yourself, Java won’t be able to verify it. If your application is requesting permissions to the system and your application is not signed at all, Java also cannot verify the digital signature (because it has none).

Well the gameboy version set the standard for its gameplay in the sense that if you want your Tetris game to feel good just copy the GameBoy Tetris timings :slight_smile:

Thanks for seeing this one. I ran a loop over my random block factory 2000 times. The distribution of blocks is extremely unbalanced. I’ll have to learn about this “shuffle” concept you mention above.

I added levels, found and fixed a bug in the block movement, and implemented Collections.shuffle(list) as the randomizer (even distro of blocks now) :slight_smile:

http://www.launchts.com/hob/hob.jnlp

Thanks for your help! More feedback is welcome.