View Full Version : I'm working on a tetris implementation.
JoshuaD
06-12-2007, 06:33 PM
I'm working on a Tetris implementation that I hope will blow away every other implementation out there.
Here's an early, simple two player theme screenshot:
http://img244.imageshack.us/img244/8562/tetrisah5.png
Thanks to "tetrablocks" for the block images, I haven't gotten around to making some yet.
The game is infinitely configurable and will implement battles over the internet, with multiple team play configurations, FFA and whatever else I can think of.
I'm posting for two reasons:
1) Let the community know about it
2) Get feedback on what game play issues are a must, and what people are looking for.
I could go on and on about what I've got designed into the back end, but that would just be a waste of time. If you guys are interested I can answer any questions, and I'll certainly post up newer versions as they come along.
Today I'm posting up a very early version that doesn't have any bells and whistles implemented in the front end. This is just to get some feedback on the game play and see what you guys think is good and what is lacking.
Things like High scores, an opening screen, configuration, and network play are all already under development -- most of it is already implemented, just not designed into the GUI yet.
Anyway, let me know what you think.
I put together a quick single-player theme for this, so it's a little different than the screen shot.
This requires Java. It's rendering in OpenGL via slick (http://slick.cokeandcode.com/default.htm) and the rest of the GUI is done in swing.
The key config is currently:
Without "Num Lock" on:
Soft Left: Numpad 1
Soft Right: Numpad 3
Soft Drop: Numpad 2
Hard Left: Numpad 4
Hard Right: Numpad 6
Hard Drop: Numpad 5
Rotate Clockwise: c
Rotate Counter clockwise: z
Flip(rotate twice): x
Pause: p
Please let me know what you like and don't like. I hope for this to eventually be very user-base oriented, so I care a great deal what people like and don't.
P.S I had never seen the "hold block" feature before, but I like it and I'll implement it as an option soon.
Download Newest Version:
Game v0.6.5 (http://joshman.ath.cx_3A81/Game_V0.6.5.zip)
cdsboy
06-12-2007, 07:34 PM
Well ignoring the cockiness, good luck beating out lockjaw. If i were you i would go for the multiplayer angle because currently we lack a good multiplayer tetris.
JoshuaD
06-12-2007, 08:21 PM
I'm sorry, cockiness wasn't my goal. I'm excited about the project is all.
I started working on it a while back when I couldn't find a good tetris clone out there. Now that I've gotten this far along and discovered LockJaw, I can only hope to do what it does and then some. Multi-player has been my goal from the beginning, so I'm glad to hear I'll be able to at least fill that niche.
haven't played it yet, but i second the multiplayer excitement.
heboris/lockjaw is a pretty amazing combo that lacks only 1 thing as far as i'm concerned: netplay. if you can get SRS/ARS selection, 20g, and netplay, your game will be very popular around here...
edit: you never having seen hold is not a great sign... *sigh*
ok, well i'm trying it, or trying to, my laptop's numpad (on a toggle that switches out jkl,uio,789) is not being detected--perhaps you could make a left hand centric build (asd,qwe with jkl for rotations is my ideal) or, not to imply that you aren't probably on top of it, implement key config asap.
that being said i got three O's in a row while fiddling--how does your randomizer work?
JoshuaD
06-12-2007, 08:53 PM
Throw this (http://67.80.155.193_3A81/defaultKeyConfig.tkc) into the keyconfig directory. This will now use ASD for the soft movements, QWE for the hard movements, and JKL will do the various rotations.
I'll try to make a key config available soon.
that being said i got three O's in a row while fiddling--how does your randomizer work?
It gets a random seed based off the current system time, and then uses that to generate random numbers using the java Random class.
The Block Generator class is incredibly simple, so I'll quote it below:
import java.util.*;
public class BlockGenerator implements Blocks {
Random rand;
public BlockGenerator() {
long seed = System.currentTimeMillis();
rand = new Random( seed );
}
public BlockGenerator(Random r) {
rand = r;
}
public int nextBlock() {
return Math.abs( rand.nextInt() ) % BLOCK_COUNT;
}
}
i wrote an autohotkey script to change the controls to something manageable. your hard drop is a firm drop but there is no way to lock after using it. this means you have to stop and wait for the next piece to show up on the screen between every move--that alone makes things very very frustrating. horizontal movement is inconsistent, seemingly as a result of the complete lack of DAS. this makes misdrops ultra common. there are absolutely no wall kicks... and no lock delay, i mean, i guess there is some because of the way that hard drop works, but it is really weird and makes it feel like all the "sticky" tetris of old. the randomizer gives 2 or even 3 of the same pieces in a row constantly.
on a lighter note: 10 is the highest lvl and it isn't nearly fast enough to be the end of the game!
immediate:
1. go play lockjaw, go play heboris, and, though i never thought i'd say this, go play tetriszone.
2. decide on a ruleset/color scheme or at least fix the existing colors (the sega colors go along with at least the way i think you intend your rotation to work.)
[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][x][x][x][x]
[ ][ ][ ][ ][ ][ ][o][o][ ][ ]
[ ][ ][ ][ ][ ][ ][o][o][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ][x][ ]
[ ][ ][ ][ ][ ][ ][ ][ ][x][ ]
[ ][ ][ ][ ][ ][ ][o][o][x][ ]
[ ][ ][ ][ ][ ][ ][o][o][x][ ]
this move doesn't work, and probably should...
jujube
06-12-2007, 09:48 PM
I started working on it a while back when I couldn't find a good tetris clone out there.
that's because lockjaw and heboris don't have the word "tetris" associated with them in any way http://www.tetrisconcept.net/forum/images/smilies/icon_wink.gif as you improve your game i would suggest changing the name so you don't draw any negative attention. it would be a shame if you spent a lot of time building a good netplay game, only to have it shut down.
Needle
06-12-2007, 09:54 PM
aside from playing the mentioned games, I would also recommend reading up on the Tetrisconcept wiki, as it contains definitions for many of the rather obscure technical terms that are commonly used in discussion.
eg. the guideline, Sega/TGM rules, ARS, SRS, DAS, ARE, IRS, IHS, soft/hard/firm(sonic) drop, zangi-moves, lock delay, wallkicks(twists), lock reset rules, randomizer algorithms, initial stances, free speed/forced speed, millisec-based/frame-based, etc etc etc.
JoshuaD
06-12-2007, 09:57 PM
Thanks to everyone for the feedback. I'm headed out to work now, but when I get home tonight I should be able to start implementing some of the things that were brought up. Within the framework I have most of it sounds trivial to implement, especially with that tetris WIKI outlining how things should be done. In the meantime, keep any criticism/comments coming. I appreciate it.
It's just a shame I came across this forum this late into my development. At least it wasn't even later.
tepples
06-13-2007, 01:46 AM
The Block Generator class is incredibly simple
Your code implements what Lockjaw calls the "Memoryless" randomizer, as seen in most older (pre-2001) Tetris products. More recent Tetris products tend to use a randomizer more like that used in card games: shuffle the "deck" of 7 tetrominoes and then deal each into the next piece queue. Mr. Rogers calls it the "Random Generator (http://www.tetrisconcept.net/forum/../wiki/index.php?title=Random_Generator)"; Lockjaw calls it "7-piece Bag". I don't have JDK installed right now, but here's some untested code:
public class TTCRandomGenerator implements Blocks {
Random rand;
int[] deck;
int cardsLeft;
public BlockGenerator() {
this(new Random(System.currentTimeMillis());
}
public BlockGenerator(Random r) {
deck = new int[BLOCK_COUNT];
cardsLeft = 0;
rand = r;
}
protected void reshuffle() {
cardsLeft = BLOCK_COUNT;
for (int i = 0; i < BLOCK_COUNT; ++i) {
deck[i] = i;
}
}
public int nextBlock() {
if (cardsLeft == 0) {
reshuffle();
}
if (cardsLeft > 1) {
int r = Math.abs( rand.nextInt() ) % cardsLeft;
int swap = deck[r];
deck[r] = deck[--cardsLeft];
return swap;
} else {
return deck[0];
reshuffle();
}
}
}
Oh, and if you want to implement replays, you're going to have to make the randomizer classes implement Serializable too.
Air Gear
06-13-2007, 01:58 AM
I haven't tried yours yet, but let me say that figuring out whether you want to make it a classic-style or modern-style game (or give options for each) will be a major issue. When people are talking about the lock delay, ARE, and 20g, the assumption of a modern-style game is made. It can go either way, but it's your call; a few considerations in each case:
If you want to go classic-style, that'd mean a lock delay of zero or very close to it. That makes any movements which occur faster than the player can control the piece impossible; consider trying to make a piece fall 2 blocks per frame (2g) with this setup. It wouldn't work if the game is taking input at 60 Hz. Hence these games top out at 1g (a drop of one block per frame), which, if there's good control (such as a DAS that's as fast as the framerate), is not going to challenge any of us. However, if you make the game run smoothly at a higher rate, it would be possible to still make it difficult and classic-style, just at, say, 85/100/120+ Hz.
If you want to go more modern-style, well, first you'll have to familiarize yourself with high-speed play. That's the big issue since, with a significant lock delay, something like 20g is a necessity. I won't say as much about this one since everyone else will, except there's one big point: there are a LOT of ways to do lock delay. The three big ones that come to mind over here are resetting the lock timer on any movement/rotation ("infinite spin"; not a favorite here), Arika's resetting the timer when the piece drops, and only resetting the timer for the next piece.
Last thing: tepples brought up how randomizers tend to go in Tetris games, but Arika has its own system; you'll need to look up that one, too. It's somewhere between the two and has an adjustable parameter that you can have fun with; the original TGM uses 4 and the games since use 6. If you wanted to do something like the original Tetris's system, just slightly nicer, even using Arika's system but with the parameter as 2 would work...
JoshuaD
06-13-2007, 05:21 AM
Well, my gamelogic code is running on a different thread than the rendering code.
The GameLogicjust does what it does, and every once in a while the rendering engine comes along and say "hey what do you look like?" (in a thread safe manner of course). So it seems like implementing 20G wouldn't be a difficulty here, as long as none of my game logic calculations are too intensive, which I'm certain their not.
JoshuaD
06-13-2007, 05:33 AM
And I just did some testing, incredibly fast falling blocks does absolutely nothing. I've got it refreshing every millisecond and the CPU isn't even being taxed.
Edit: and this reveals all the flaws in the current motion of my blocks. I'll be implementing wall jumps and whatever else I can do tonight. If I get anything of interest done I'll post it up for some feedback, if not tonight then in a few days.
Thanks again to everyone for helping out.
Needle
06-13-2007, 05:37 AM
That's another design philosophy issue: whether to base the system on milliseconds and have the framerate depend on processor speed, or lock it at a fixed 60 frames per second.
While at first sight, more frames per seconds seems better, a fixed framerate has the advantage of affording consistency in individual frame-level controls to the user. PC-based games often use a msec-based variable framerate model, and well-recognized console and arcade games like Tetris DS and TGM use the fixed framerate model.
JoshuaD
06-13-2007, 05:56 AM
That's another design philosophy issue: whether to base the system on milliseconds and have the framerate depend on processor speed, or lock it at a fixed 60 frames per second.
While at first sight, more frames per seconds seems better, a fixed framerate has the advantage of affording consistency in individual frame-level controls to the user. PC-based games often use a msec-based variable framerate model, and well-recognized console and arcade games like Tetris DS and TGM use the fixed framerate model.
Well, I'm not against fixed framerates, I just don't like having the two seperate entities entwined. The rendering engine should be doing what it's doing, and the game logic engine should be doing what it's doing. A slow down in the rendering engine should not affect the game engine.
Pineapple
06-13-2007, 08:49 AM
It doesn't need to. Hane an interupt that happens 60 times a second. Each call, it increments a variable. Your game logic loop checks for non-zero, and when it is non-zero, it processes a frame and decrements the counter. Whenever the counter is 0 (which it will be unless the game is really struggling), it just does nothing (this may include giving CPU time to other tasks). If you do this, then you will probably see it doing very little for a lot of the time.
Oh, and what Needle said is generally correct, but I know of at least one "PC-based" game that uses a fized framerate.
Needle
06-13-2007, 09:31 AM
Yeah, hence "often". Heboris and Lockjaw both use 60fps.
The rendering engine should be doing what it's doing, and the game logic engine should be doing what it's doing.
Again, this a an issue of philosophy - as alien as it might sound, for some people, the game logic should slow down when the processor is overloaded. (Obviously this doesn't fare well in things like multitasked environments, games with heavy load, or games where motion can be sliced into infinitely small units.)
I guess PC-based games use msecs and independent logic/video more often due to the platform's nature of having hardware with varying processing power. Caring about slowdown comes less into consideration when one is developing on a console or arcade hardware running on one fixed hardware configuration. When it does happen, slowdown also seems to be more tolerated on 2D arcade/console hardware - in fact, some modern shoot-em-up games simulate slowdown on purpose as part of the intended game design, to allow the player more time to think when many bullets are onscreen.
Not saying that fixed 60fps is better; just pointing out that both are valid methods with their own philosophies.
JoshuaD
06-13-2007, 11:42 AM
Alright, I some of the basic stuff implemented.
Block Ghosts Wall Jump (no floor jump yet) SRS Rotation. Firm Drop Locking
I've also set level 6 to the fastest the game can render at: 1 block per millisecond. I don't know how fast this is relative to 20G yet, but it's currently my internal max. I'd have to change some code up to go faster, but it's certainly doable if we need it. I definitely want to support 20G. Clearly level 6 wouldn't be this fast, I just put it there for easy access.
Still no Key Config, GUI code always takes me a while to write, so I'm putting that off until I have the game play up to some decent standard. It should only be a few more days, hopefully today took a big chunk out of it.
In the next few days I hope to implement a better delay system, a simple key config, and whatever other game play issues there are. Once I get a basic configuration setup that people are happy with I'll go on to creating the GUI and the networking stuff. Once the GUI is up and running you guys will have a better idea about what's configurable and what isn't, and can hopefully tell me what else needs to be implemented to cover all the different game styles.
Does anyone know if 1 row per millisecond is at least as fast as 20G? I don't mind changing code around, but it would be nice if this is fast enough.
I also changed the buttons around. It uses the arrow pad now, down for soft drop, up for hard (firm?) drop. Up again when it's sliding to lock the block into place.
Right now the delay system is all haywire. I'm going to completely changing it tomorrow, so just ignore it's badness tonight.
V0.6.01 (http://67.80.155.193_3A81/Blocks_v0.6.01.zip)
Matt: I'm not sure if you saw my previous post, but you can use this (http://67.80.155.193_3A81/defaultKeyConfig.tkc) key config. It's setup the way you like. Just put it in the /keyconfigs folder and it will load.
Also: I've been trying to think of a name for this forever. If anyone has any suggestions I'm glad to hear them.
JoshuaD
06-13-2007, 11:45 AM
Yeah, hence "often". Heboris and Lockjaw both use 60fps.
The rendering engine should be doing what it's doing, and the game logic engine should be doing what it's doing.
Again, this a an issue of philosophy - as alien as it might sound, for some people, the game logic should slow down when the processor is overloaded. (Obviously this doesn't fare well in things like multitasked environments, games with heavy load, or games where motion can be sliced into infinitely small units.)
I guess PC-based games use msecs and independent logic/video more often due to the platform's nature of having hardware with varying processing power. Caring about slowdown comes less into consideration when one is developing on a console or arcade hardware running on one fixed hardware configuration. When it does happen, slowdown also seems to be more tolerated on 2D arcade/console hardware - in fact, some modern shoot-em-up games simulate slowdown on purpose as part of the intended game design, to allow the player more time to think when many bullets are onscreen.
Not saying that fixed 60fps is better; just pointing out that both are valid methods with their own philosophies.
I'll have to look into this more. Without thinking about it too hard, I'm pretty sure I can setup my current independent system to simulate a fixed FPS system like you're describing, so if it's really wanted, I should be able to do it. Hell, I could probably even make it an in-game option.
It doesn't need to. Hane an interupt that happens 60 times a second. Each call, it increments a variable. Your game logic loop checks for non-zero, and when it is non-zero, it processes a frame and decrements the counter. Whenever the counter is 0 (which it will be unless the game is really struggling), it just does nothing (this may include giving CPU time to other tasks). If you do this, then you will probably see it doing very little for a lot of the time.
Oh, and what Needle said is generally correct, but I know of at least one "PC-based" game that uses a fized framerate.
It doesn't need to. Hane an interupt that happens 60 times a second. Each call, it increments a variable. Your game logic loop checks for non-zero, and when it is non-zero, it processes a frame and decrements the counter. Whenever the counter is 0 (which it will be unless the game is really struggling), it just does nothing (this may include giving CPU time to other tasks). If you do this, then you will probably see it doing very little for a lot of the time.
Oh, and what Needle said is generally correct, but I know of at least one "PC-based" game that uses a fized framerate.
i use a fixed timestep for the physics and game logic. but but because rendering speed may vary, i implemented the accumulator scheme:
http://www.gaffer.org/game-physics/fix-your-timestep/ (http://www.gaffer.org/game-physics/fix-your-timestep/default.htm)
this is a very error prone way to do things. dynamic time step is sometimes really hard to debug (over / underflows, divisions by zero, whatever can happen if your delta-t is out of bounds)
only disadvantage of a fixed timestep & loop accumulator is that you need a high-resolution timer.
kotetsu213
06-13-2007, 12:30 PM
It's not, what you have is essentially 16G, so if the well is empty then the block will be 1 frame late.
Needle
06-13-2007, 12:57 PM
20G is the piece falling for the full height of the well in a single game-logic cycle. I imagine if you have the ghost piece implemented, you might be able to reuse the code for that?
something seems to have gone wrong, that link is to the same version as you the one you posted before...? the filename has a .1 in it, but the archive seems to be the same... and thanks for the keyconfig file! although j should rotate left, k right, and l be the double as opposed to the way it is now--no worries, my beloved autohotkey saves the day once more.
fix it so i can try it! hah.
tepples
06-13-2007, 03:35 PM
I've also set level 6 to the fastest the game can render at: 1 block per millisecond. I don't know how fast this is relative to 20G yet, but it's currently my internal max.
What you have is 16.7G. That's very close to 20G, which is 1200 cells per second.
Needle is right: Firm or hard drops, the ghost piece, and 20G use essentially the same code. Whenever the tetromino enters, moves, or rotates, fake a hard drop and move the ghost piece to where it ended up. Then you can handle >1G by simply checking whether the tetromino fell past the ghost piece height, and you can change firm or hard drop to simply set the gravity to 20G for one cycle.
I definitely want to support 20G. Clearly level 6 wouldn't be this fast, I just put it there for easy access.
If you go 30 lines per level (like Tengen Tetris on NES) and use lock delay, then it's not bad at all to put 20G at level 6. Specifically, the TGM games hit 20G at around 140 lines.
JoshuaD
06-13-2007, 09:06 PM
something seems to have gone wrong, that link is to the same version as you the one you posted before...? the filename has a .1 in it, but the archive seems to be the same... and thanks for the keyconfig file! although j should rotate left, k right, and l be the double as opposed to the way it is now--no worries, my beloved autohotkey saves the day once more.
fix it so i can try it! hah.
hahaha, my bad. The good one's up at the same link.
As far as 20G's go:
How does one define 20G exactly? Fall the entire height of the well in one Logical frame? If that's the case, I'm running at 1G; falling one row per frame at the pace of one frame per millisecond.
If I'm wrong about that (hopefully I am), and I'm running at 16 or 16.7G like someone else said, is there ever going to be a need for 17, 18, or 19G? If not, I can just special case 20G out. However, if there's a theoretical demand for these in-between speeds I'll have to modify my game code so it can handle increments bigger than the block size, if not I can get 20G running pretty quickly.
If that last paragraph doesn't make sense, let me rephrase: Would the level before the 20G level be 19G or 10G? 10G seems to make more sense to me.
Keep any comments coming. If anyone has a link or opinions about how a delay system should work let me know. I am going to implement one similar to what I saw in LockJaw unless there's something better.
JoshuaD
06-13-2007, 09:18 PM
If you go 30 lines per level (like Tengen Tetris on NES) and use lock delay, then it's not bad at all to put 20G at level 6. Specifically, the TGM games hit 20G at around 140 lines.
All of that is going to be really easy for the user to configure. At this point all I need to write for you guys to configure that stuff is the GUI giving you access to the variables.
I envision user-made rule-sets with corresponding highscore files. If I'm playing on a ruleset that gives out 3000 points per block fallen and you are playing on one that gives none for block fallen, it doesn't make much sense to compare our scores. So each would have it's own highscore file to compare to it's own sorts of games.
This idea is simple to extend to timed game fastest time/highest score and battle mode leader charts.
Anyway, these are some of the exciting (well, exciting to me) ideas that I've got either in the works and already implemented. Once we get the gameplay to an acceptable level I can go back to implementing or writing a GUI for all this cool stuff. I would be very surprised if it took me even to this weekend to get the game play running well at 20G, but we'll see.
JoshuaD
06-13-2007, 09:34 PM
20G is the piece falling for the full height of the well in a single game-logic cycle. I imagine if you have the ghost piece implemented, you might be able to reuse the code for that?
Hahah. The ghost piece was actually the sorest spot for me.
I'm not sure if anyone's a coder, but I'm a big fan of only putting code in your program once, and of really separating the functionality of classes so they know the least about each other as possible and do what they're supposed to do and nothing else.
For example the graph should be a dumb graph. It shouldn't know anything about game logic. The block generator should generate blocks on request.. The game logic should figure out what's going on in the game, it shouldn't be directly handling and parsing key input or rendering. etc.
The ghost blocks just ruined all this for me.
Like I said earlier, I have a GameLogic class that handles all of the moving and falling of blocks and a GameRenderer class that checks in on the Logic class, requests a few numbers, and then goes about it's buisiness of rendering the information in the game.
When I add network play, that "requests a few numbers" step is going to be done over the network.
Firstly, it should be obvious that the ghostblock's position is a derived variable, it's a function of the block position and the graph.
So there's no reason for the GameLogic class to calculate, keep, or in any way know about the ghost block's position. It's really an entity that should be created during the rendering process; nothing interacts with it and the user doesn't directly control it. It's a visual element and nothing else.
BUT the GameRenderer class had no framework in it for calculating block positions and the like. It gets a list of maybe 10 numbers and the graph, and goes about calling graphics functions.
All the framework for calculating the ghost block's position was in the GameLogic.
So either I could slow down my network play (unacceptable) or duplicate some code (Evil).
Finally I decided to duplicate some code since it's the only thing that makes sense, but the process was pretty funny. I had a ghost block on the screen after literally a minute and then I sat there for an hour thinking about how to get a ghost block on the screen the correct way.
Anyway, just venting. I hope you all enjoyed a peek at my incredibly anal-about-code mind. http://www.tetrisconcept.net/forum/images/smilies/icon_smile.gif
To tell you the truth, I'm still not entirely happy with my solution. Just typing this up brought to light what I think is the crux of the problem and the solution. I think the problem is that I haven't implemented the network yet, and the ghost-block code should go into a class I intend to write at that time. In fact, now I'm happy. That's how it should be.
Thanks for listening! Time for (real) work.
jujube
06-13-2007, 09:48 PM
If that last paragraph doesn't make sense, let me rephrase: Would the level before the 20G level be 19G or 10G? 10G seems to make more sense to me.
the difference between 10G and 20G is substantial enough that it would be good to have at least 2 or 3 fall speeds in between. i did some testing on tetris DS with a 10x20 well, 12 Hz sideways speed, 183ms DAS, no initial piece movement. on level 13 (13G) an O piece can reach the wall at about the same time it touches the bottom of the well. at 17G a piece can still move over a column or two before it touches bottom. this is a small difference but gives the player a bit more freedom of movement compared to 20G. of course, if you were to implement ARE and initial movement/rotation a piece could land away from the center of the well, even at 20G.
btw is there a readme file anywhere in your download that tells what to extract and how to run the game?
JoshuaD
06-13-2007, 10:08 PM
If that last paragraph doesn't make sense, let me rephrase: Would the level before the 20G level be 19G or 10G? 10G seems to make more sense to me.
the difference between 10G and 20G is substantial enough that it would be good to have at least 2 or 3 fall speeds in between. i did some testing on tetris DS with a 10x20 well, 12 Hz sideways speed, 183ms DAS, no initial piece movement. on level 13 (13G) an O piece can reach the wall at about the same time it touches the bottom of the well. at 17G a piece can still move over a column or two before it touches bottom. this is a small difference but gives the player a bit more freedom of movement compared to 20G. of course, if you were to implement ARE and initial movement/rotation a piece could land away from the center of the well, even at 20G.
btw is there a readme file anywhere in your download that tells what to extract and how to run the game?
I'm running late to work, but I know that Java 1.5 associates with Jars and will make them executable. All you need for this to work is java installed. Then either double clicking on the jar, or if that doesn't work, typing "java -jar Tetris_v0.6.01.jar" at the command line.
I've messed around with making .exe's to hide this process like Azureus or Eclipse, and that's something I'll certainly include in v1.0. If it's easy to do I'll try it tonight to make things a little easier for you guys.
JoshuaD
06-16-2007, 01:21 PM
Download Newest Version: Version 0.6.2 (http://67.80.155.193_3A81/Game.zip)
Keys are currently setup like this, just something I quickly made for testing:
Up: Firm Drop
Down: Soft Drop
Left: Shift Left
Right: Shift Right
Z: Counter clockwise
C Clockwise
X: Flip (180* rotation)
V: Hold Block
P: Pause
End: Hard Drop
(Sorry Matt, that key config I gave you may not work any longer)
This version's gamplay should be much, much better than the previous versions. It currently has SRS, Wall Kicks, DAS, >20G speeds, hold block (no graphics for it yet, just the functionality), firm drops, hard drops, and probably some other stuff I've forgotten about.
There are a few places where the kicks aren't doing what they should, here's one example:
[] [][][][][][]
[]() [][][][][][]
[]() [][][][][]
[]()() [][][][][]
[] [][][][][][]
[] [][][][][][]
[] ()[][][][][]
[]()()()[][][][][]
I will implement these cases eventually. The problem is I need to be very specific with what rotations are ok otherwise there are some really silly ones allowed. Please let me know when you come across a rotation that you expect to work that doesn't.
Sideways slides into small spots while free-falling isn't working perfectly either. I changed up some code to allow >16G gravity and I had to scrap the code that ensured these slides worked. I'll be fixing it soon.
Level 3 is 1G, level 4 is 6G, Level 5 is 20G, level 6 is 334G.
jujube
06-16-2007, 06:35 PM
very nice game, and it's interesting to combine a memoryless randomizer with 20G which makes for a good challenge. just a few thoughts:
1. the sideways delay is pretty low (i'm guessing 100ms) and makes it hard for me to tap.
2. it seems like my inputs control the current piece until i hard drop or the next piece is in the playing field. this causes double-hard dropping for me in higher levels. if i don't hard drop the current piece, i'll end up rotating or shifting it at the last moment, when these inputs are intended for the next piece.
3. a keyboard shortcut to start a new game.
the SRS rotations and kicks seem pretty accurate. i'll play some more and see if i spot anything that's off. fun game http://www.tetrisconcept.net/forum/images/smilies/icon_smile.gif
edit: auto-pause on task switch would be nice, also when i start a new game the first piece has landed and the second piece is falling.
edit: it seems to freeze if i make it to level 7 (happened 3 times).
jujube
06-16-2007, 08:30 PM
T wallkicks in SRS
() [][][][][][][]
[]()()[][][][][][][]
[]() [][][][][][]
[][][][][][][]
[] ()[][][][][][][]
[]()()()[][][][][][]
() [][][][][][][]
()()[][][][][][][]
[]() [][][][][][]
() [][][][][][][]
()()()[][][][][][][]
[] [][][][][][]
JoshuaD
06-16-2007, 08:53 PM
Thanks Jujube.
1)Damn. 100ms exactly. Nice guess! It will configurable by a slider, so don't sweat those details.
2) This is a big deal. How do the other games work? Do they put a small delay on the beginning of the drop of a new piece?
I know a fading animation on the dropped block with a flash at the end (for the lock timer) will help with this problem, but it won't solve it.
3) You got it. I'll add a Ready... set....GO!" Countdown type timer too.
Nice catch, thanks. I fixed it now. It was trying to go to level 7 when there's only 6 levels. It didn't like that. http://www.tetrisconcept.net/forum/images/smilies/icon_wink.gif
Just to give you an idea of what things are configurable and what aren't, here's the current game play config file. Anything in there can and probably will have an option in the GUI.
{
int rows = 21;
int columns = 10;
boolean wallKicks = true;
int floorKicks = 5;
boolean infiniteFloorKicks = false;
boolean randomInitialHoldBlock = false;
boolean sideCollision = false;//TODO: Rename me
int lockDelay = 500;
int hardDropLockMinDelay = 60; //how long the user has to press a left or right key after a hard drop so it slides in.
//it's a minimum because they always have at least the length of a frame to enter it in.
int sideMoveSpeed = 16;
int sideMoveDelay = 100;
boolean hardShiftsAllowed = false;
boolean hardDropsAllowed = true;
boolean firmDropsAllowed = true;
boolean softDropsAllowed = true;
boolean holdBlockAllowed = true;
boolean flipAllowed = true;
public boolean stopSoftDropEachFall = false;
int initialLevel = 0;
int[] scoreValues = new int[] {4, 50, 150, 400, 900 };//perpiece dropped, one line, two lines, three lines, four
final int[] attackValues = new int[] {0, 0, 1, 2, 4 };
public int startDropRow = 0;
public int startDropCol = 4;
//334G is (1, >=blockSize*20)
//20G is {1, blockSize * 5/4}
//16G is {1, blockSize}
//12G is {1, blockSize * 3/4}
//8G is {2, blockSize}
//4G is {4, blockSize}
//2G is {8, blockSize}
//1G is {16, blockSize)
final int[] frameRate = new int[] { 15, 10, 5, 3, 1, 1 };
final int[] incs = new int[] { 1, 1, 1, 1, 20, 400 };
public int softDropSpeed = 1;
public int softDropInc = 4;
public int linesPerLevel = 4;
int trashRowMinBlocks = 3;
int trashRowMaxBlocks = 7;
}
DIGITAL
06-16-2007, 08:58 PM
() [][][][][][][]
[]()()[][][][][][][]
[]() [][][][][][]
[][][][][][][]
[] ()[][][][][][][]
[]()()()[][][][][][]
() [][][][][][][]
()()[][][][][][][]
[]() [][][][][][]
[][][][][][][]
()[][][][][][][]
[]()()()[][][][][][]
Long live ARS!
JoshuaD
06-16-2007, 09:07 PM
T wallkicks in SRS
() [][][][][][][]
[]()()[][][][][][][]
[]() [][][][][][]
[][][][][][][]
[] ()[][][][][][][]
[]()()()[][][][][][]
() [][][][][][][]
()()[][][][][][][]
[]() [][][][][][]
() [][][][][][][]
()()()[][][][][][][]
[] [][][][][][]
Hrm, that's another one of those "ceiling kicks". The block is actually pushed downward by the ceiling.
Do you have any similar ones that SHOULDN'T work? I know if I allow shifting in all 8 or even 4 possible directions when trying rotations, some stuff breaks. Here' an example that looks bad to me.
<> represents the "center" block; it's what's getting moved at most 1 square when doing wall kicks and floor kicks. (Except with I blocks who sometimes get two squares).
()[][][][][]
()<>()[][][][]
[][][][] [][][]
[][][] [][][][]
[][][][] [][][][]
[][][][][][][][][]
[][][][][][][][][]
[][][][][][][][][]
[][][][][]
()[][][][]
[][][][]<>()[][][]
[][][] ()[][][][]
[][][][] [][][][]
[][][][][][][][][]
[][][][][]
[][][][]
[][][][]() [][][]
[][][]()<>[][][][]
[][][][]()[][][][]
[][][][][][][][][]
jujube
06-16-2007, 09:32 PM
1)Damn. 100ms exactly. Nice guess! It will configurable by a slider, so don't sweat those details.
i know the limitations of my finger speed and/or my keyboard http://www.tetrisconcept.net/forum/images/smilies/icon_lol.gif and also Lockjaw is a good reference for timings like that.
2) This is a big deal. How do the other games work? Do they put a small delay on the beginning of the drop of a new piece?
i'm not a programmer, but i can direct you to this:
http://www.tetrisconcept.com/forum/viewtopic.php?t=576 (http://www.tetrisconcept.net/forum/viewtopic.php?t=576)
jagorochi did a frame-by-frame analysis of TAP Death at level 500 (where most players do not manually lock). it's a very different game but that might give you some idea of how it could work, maybe with some modification to fit your needs.
()[][][][][]
()<>()[][][][]
[][][][] [][][]
[][][] [][][][]
[][][][] [][][][]
[][][][][][][][][]
[][][][][][][][][]
[][][][][][][][][]
[][][][][]
()[][][][]
[][][][]<>()[][][]
[][][] ()[][][][]
[][][][] [][][][]
[][][][][][][][][]
[][][][][]
[][][][]
[][][][]() [][][]
[][][]()<>[][][][]
[][][][]()[][][][]
[][][][][][][][][]
the 2nd diagram shouldn't work. believe it or not though, in SRS a T piece will go from where it is in the 1st diagram to the 3rd with one rotation. see T-spin triple setups (http://www.tetrisconcept.net/forum/../wiki/index.php?title=T-Spin_Triple_Setups) in the wiki.
JoshuaD
06-16-2007, 10:23 PM
Does this (http://www.the-shell.net/img/srs_study.html) page look accurate? Some of those moves look funky as hell to me, but I don't have much experience with SRS.
that's jago's page and it is completely accurate--enjoy that SRS.
colour_thief
06-16-2007, 11:53 PM
SRS definitely has it's fans and it's... not fans. I can live with the base rotation (so low gravity play), but the wallkicks drive me insane.
() [][][][][][][]
[]()()[][][][][][][]
[]() [][][][][][]
[][][][][][][]
[] ()[][][][][][][]
[]()()()[][][][][][]
() [][][][][][][]
()()[][][][][][][]
[]() [][][][][][]
[][][][][][][]
()[][][][][][][]
[]()()()[][][][][][]
Long live ARS!
The worst thing is that this is impossible in SRS:
()[][][][][][][]
[]()()[][][][][][][]
[] () [][][][][][]
[][][][][][][]
[] ()[][][][][][][]
[]()()()[][][][][][]
This doesn't even use a wallkick in TGM. You could do it in the oldschool original arcade Sega Tetris. Any rotation system that has 4 kicks and doesn't allow this is designed by an idiot. Clearly nobody would ever want this to happen:
()[][][][][][][]
[]()()[][][][][][][]
[] () [][][][][][]
()
()()()
[][][][][][][]
[] [][][][][][][]
[] [][][][][][]
OH SNAP!
JoshuaD
06-17-2007, 12:15 AM
Does anyone have a page like Jago's on TGM?
colour_thief
06-17-2007, 12:20 AM
Nothing that holds your hand quite that much, but it's a much easier system to understand. It tries:
-base rotation
-1 right of base rotation
-1 left of base rotation
That's pretty much it. If you want to be anal there are 3 exceptions to this rule, but they're not very important. Details are on the wiki:
http://www.tetrisconcept.com/wiki/index.php?title=TGM_Rotation (http://www.tetrisconcept.net/forum/../wiki/index.php?title=TGM_Rotation)
JoshuaD
06-17-2007, 12:26 AM
Excellent. That's a really easy system to implement then.
JoshuaD
06-17-2007, 12:32 AM
I'm guessing there's never a need for floor kicks because of the way the blocks rotate?
tepples
06-17-2007, 12:47 AM
2) This is a big deal. How do the other games work? Do they put a small delay on the beginning of the drop of a new piece?
Games that allow the player to "firm drop" (piece moves immediately onto the stack) usually have a small delay before another piece enters. See [[ARE (http://www.tetrisconcept.net/forum/../wiki/index.php?title=ARE)]].
Just to give you an idea of what things are configurable and what aren't, here's the current game play config file. Anything in there can and probably will have an option in the GUI.
Heh, a Lockjaw clone http://www.tetrisconcept.net/forum/images/smilies/icon_wink.gif
I'm guessing [that in TGM,] there's never a need for floor kicks because of the way the blocks rotate?
In TGM rotation, there is occasionally a need for floor kicks, especially for the I and T tetrominoes. [[Floor kick (http://www.tetrisconcept.net/forum/../wiki/index.php?title=Floor_kick)]] gives examples. The first two TGM games didn't have floor kick, but TI and TGM ACE do. I'd suggest using 1 right, then 1 left, then 1 up; that's what I did for the system used in Lockjaw: The Overdose (http://www.pineight.com/tod/default.htm) milestone 4 and Tetramino for NES (http://www.pineight.com/nes/default.htm).
colour_thief
06-17-2007, 12:59 AM
I'm guessing [that in TGM,] there's never a need for floor kicks because of the way the blocks rotate?
In TGM rotation, there is occasionally a need for floor kicks, especially for the I and T tetrominoes. [[Floor kick (http://www.tetrisconcept.net/forum/../wiki/index.php?title=Floor_kick)]] gives examples. The first two TGM games didn't have floor kick, but TI and TGM ACE do. I'd suggest using 1 right, then 1 left, then 1 up; that's what I did for the system used in Lockjaw: The Overdose (http://www.pineight.com/tod/default.htm) milestone 4 and Tetramino for NES (http://www.pineight.com/nes/default.htm).
TGM3 added more than just floorkicks. I pieces got some wallkicks as well. See KAN's page for reference, linked in the TGM Rotation wiki page. http://www.tetrisconcept.net/forum/images/smilies/icon_wink.gif
Oh and Josh original TGM/TGM2 didn't wallkick the I piece... I forgot to mention that (though as mentioned above, this changed in TGM3).
to clarify, if you are implementing ARS, you'd probably make the most people happy by using the modifications from TGM3. you'd make even more people happy if you had a heboris/lockjaw selection for the various rotation systems/color sets. (which, btw, i've always felt should be independently configurable)
JoshuaD
06-17-2007, 03:03 AM
Hey Matt: The skins and the rotation system will definitely be independent.
I had ORIGINALLY intended for the block set and the rotation system to be independent, but I'm discovering that it's not very useful considering how closely linked the two are.
From what I read TGM3 will be how I'll do ARS, the previous versions seem a little limited if you want things like wall kicks.
And of course you could still turn off wall kicks in any rotation system, or make firm drop the default drop in SRS, etc.
caffeine
06-17-2007, 03:35 AM
why not create your own rotation system? both SRS and ARS have their flaws.
JoshuaD
06-17-2007, 04:17 AM
why not create your own rotation system? both SRS and ARS have their flaws.
I think I'll do that once I get some of the other features up and running. Thanks for the vote of confidence. http://www.tetrisconcept.net/forum/images/smilies/icon_smile.gif
tepples
06-17-2007, 05:11 AM
why not create your own rotation system? both SRS and ARS have their flaws.
What's the big flaw of SRS, other than perhaps 1. the 2-block movements for 3-wide pieces and 2. the infinity rule that normally comes along with SRS?
DIGITAL
06-17-2007, 05:43 AM
why not create your own rotation system? both SRS and ARS have their flaws.
What's the big flaw of SRS, other than perhaps 1. the 2-block movements for 3-wide pieces and 2. the infinity rule that normally comes along with SRS?
Crazy wallkicks?
Pineapple
06-17-2007, 05:50 AM
why not create your own rotation system? both SRS and ARS have their flaws.
What's the big flaw of SRS, other than perhaps 1. the 2-block movements for 3-wide pieces and 2. the infinity rule that normally comes along with SRS?
You forgot 3: the seemingly random wallkick order. This is partially why I'm creating mine to be ARS-like not SRS-like...
JoshuaD
06-17-2007, 06:11 AM
Alright. I've changed my logical frame-rate from variable to a constant 1 millisecond, whereas the rendering engine just renders along as fast as it can up to a (user defined) maximum.
I like this constant frame-rate logic engine better. It guarantees stuff happens exactly right always, where before things may have been off by a few milliseconds here and there due to the framerate not being an exact multiple of some timer variable (or vice versa).
I've also started implementing some animation, along with ARE. What's the deal with ARE? Nothing on the screen can be changed during that time, but rotations and shifts can be queued up?
And should ARE happen before or after we clean up full rows? The few things I've been reading suggest before we clean up, but doing it after makes much more sense to me.
Thanks for all the input guys.
edit: Well I did some calculations and I've got terrible news about my new constant-rate logic engine. After 49 and 3/4 days of continuous play there may be a very slight (off by a few milliseconds) one-time inconsistency in the game play due to the maximum number that can be held in a long. If any of you guys run on a marathon for 49 days and somehow notice this un-noticeable inconsistency, I apologize in advance. http://www.tetrisconcept.net/forum/images/smilies/icon_lol.gif
JoshuaD
06-19-2007, 09:15 PM
Alright, I've got a newer version. The big addition is the Key Config, but I've also made some small game play improvements, along with some basic animations.
Download v0.6.4. (http://joshman.ath.cx_3A81/Game_v0.6.4.zip)
Enjoy. Like always let me know what you do and don't like.
lee n
06-20-2007, 01:35 AM
The key config doesn't appear to be working properly.. I tell it to use certain keys and then it doesn't respond to them anyway.
JoshuaD
06-20-2007, 02:06 AM
The key config doesn't appear to be working properly.. I tell it to use certain keys and then it doesn't respond to them anyway.
What keys? What name does it show when you assign it? Thanks.
lee n
06-20-2007, 02:24 AM
http://195.238.77.198_3A3000/pictures/DhkfAyogS.png
The arrowkeys are working fine (which show up in swedish here since the computer I'm using atm is running a swedish OS), but the buttons for the rotation doesn't register at all.
the problem seems to be... strange... it fixed itself for me after a while... hold doesn't work, should it?
JoshuaD
06-20-2007, 05:53 AM
Yea, it's definitely a little buggy. I'll fix it up tonight or tomorrow, depending on when I get the time. I should have waited to post it until I had checked it over.
That's what happens when you go on an all-night code spree. http://www.tetrisconcept.net/forum/images/smilies/icon_wink.gif
JoshuaD
06-27-2007, 09:22 PM
Hey guys, sorry I took so long to post up a new version, I ran into some problems with the launcher I was using when I added sounds. But this is a pretty good version, so it's worth the wait. http://www.tetrisconcept.net/forum/images/smilies/icon_wink.gif
I've added the graphics for the hold-block, fixed the key config dialog and added sounds. I've also done a lot of back-end remodeling to support the various rotation systems. This version has most of the single player aspect of the game done, only game configuration and high scores/best times remain. After that I can move on to the network play.
I'm also going to be moving most of the configuration files to xml so they're user editable. That will probably be the next thing I do, so this will be the last version I put up for a while.
Let me know what you think so far!
Download Game v0.6.5 (http://joshman.ath.cx_3A81/Game_V0.6.5.zip)
vBulletin® v3.8.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.