View Full Version : Tetris!
Hi all,
I've been working on this a bit and thought I'd try to generate some hype about it :) I still have some weird threading issues with my timer but I think I know a workaround.
The look was inspired by OSX widgets and I kind of think it might be cool to create a dashboard-like interface for XBMC where widgets can be moved around and added/removed relatively easily. I havent actually done this yet but am considering it.
I guess to make this a real widget I would make it smaller. What do you all think of the idea? I still have some layout issues with this but the final version will look pretty close. I guess if there are going to be more widgets on the screen I should make it smaller...
http://img106.imageshack.us/img106/790/tetris2vp9.png (http://imageshack.us)
Gah ... wheres the edit post button when you need it?
really cool!!, maybe you can add a online score feature. Combine with snake and space invaders (xbmc's gamercard). HEHE. :rolleyes:
Good thinking... sent rockstar a PM.
Rockstarr
2007-01-05, 07:20
Awesome!
I was waiting for this! :grin:
You will get PMed...
I guess I did mention this a long time ago... man I've been away for a while... As far as the widget system goes, I'm going to have to give a lot of thought to a management interface. I have a half finished Sudoku script I can turn into another widget probably...
I don't suppose anyone knows a way to get at input from the analog thumbsticks?
Rockstarr
2007-01-05, 17:12
I don't suppose anyone knows a way to get at input from the analog thumbsticks?
like this?
Left ThumbStick 264
Left ThumbStick Button 276
Left ThumbStick Up 280
Left ThumbStick Down 281
Left ThumbStick Left 282
Left ThumbStick Right 283
Right ThumbStick 265
Right ThumbStick Button 277
Right ThumbStick Up 266
Right ThumbStick Down 267
Right ThumbStick Left 268
Right ThumbStick Right 269
Nuka1195
2007-01-05, 17:43
nice script, will this be in svn anytime soon?
you can see an example of the left thumbstick by downloading ambient light control pad here where you uploaded the cnn script
http://xbmc-scripting.googlecode.com/svn/trunk/
Donno just added better support for them. (Angles)
Just put v1.0 into SVN... I'm considering this RC1 and would definitely like feedback... Especially on sounds, color scheme, etc.
I gave the scoring alot of though
Every 15 lines you level up (speed increases by 40%)
Every clear is LEVEL * ROW^2 (clearing 4 lines at a time is optimal efficiency)
At level up you get level * 15 bonus (almost as good as clearing 4 lines)!
I would like to know if you think the speed increases too slowly or quickly.
Rockstarr
2007-01-05, 23:43
Works nice.
I just had some freezes when I used the right trigger to "slice" a block down.
And I would change the button layout to make it a little bit more intuitive.
X for rotate left, B for rotate right and down to move a block down a step for example.
I always press the wrong buttons :blush:
Ohh yeah the triggers... those were originally for testing before I got the timer working.
Im doing all my recent dev on the laptop. I think originally I was going to keep B for exit but I guess back will do fine.
Do you think it makes sense to have two drop buttons? One to drop all the way down and one that will drop to just a little off the ground so you can slide it in?
Rockstarr
2007-01-06, 00:29
Yes definatly.
Sometimes you have to switch a block sidewards on the ground to get it to the right position.
AlTheKiller in IRC informed me he has been working on his own tetris script and showed me this great database...
http://www.tetrisconcept.com/wiki/index.php/Tetris_Guideline
I won't be going with everything but I will employ the standard controls... also my field is too wide! I should be 20x10 and not 20x11. Thats what I get for not counting carefully.
Yay! Ok I finally figured out that thread bug. Apparently the main thread of XBMC (or at least whatever thread calls onAction) CANNOT be blocked waiting for a lock. It absolutely hates it! The fix is to spawn a new thread that does the real action handling and let the main thread return. Very very lame.
But this fix makes the program rock stable right now and MUCH more responsive. Before I was dropping actions like crazy to avoid deadlock but with these threads thats not a problem. I also changed the controller controls and fixed the width problem. Please try out the SVN copy! I think this might have just gone gold :)
def onAction(self, action):
def SubProc(view,action):
view.onActionProc(action)
thread = threading.Thread(target=SubProc, args=(self,action))
thread.setDaemon(True)
thread.start()
def onActionProc(self, action):
lock.acquire()
Nuka1195
2007-01-06, 06:45
You need to work on your changelog entries. :)
Nice game, well done.
The MAME versions use A and B to rotate. I wonder if for games you should make the buttons configurable?
Sorry I'm used to spamming commits in cvs. So changelog is generated from commit comments? How do I view it?
I gave this a test and here's some findings:
*) I'm still on a CRt tv and it's hard to see where is gonna land, something with colors I believe that makes it harder than it oughta be
*) would be nice if there's a tiny tiny pause before next block starts falling, as it is now, it feels like there is 0 delay
*) Agree that there needs to be a way to "nudge" block downwards a little faster
other than that, looks promising!
I gave this a test and here's some findings:
*) I'm still on a CRt tv and it's hard to see where is gonna land, something with colors I believe that makes it harder than it oughta be
I think the blue block on a dark blue background is a problem. I will either desaturate the background or change that block color to gray. A popular option is to add a "ghost piece" beneath the current piece where it will land, that might look a little obtrusive.... maybe vertical gridlines will help?
*) would be nice if there's a tiny tiny pause before next block starts falling, as it is now, it feels like there is 0 delay
I think you should get in the habit of looking at the next block before the current one sets :) When things get fast you will need to plan ahead
*) Agree that there needs to be a way to "nudge" block downwards a little faster
Right trigger currently increases gravity (this might be too fast? I will look at halving the frequency). Down and A does hard drop (locks the block). Up brings the block to 2 blocks above the ground.
other than that, looks promising!
Thanks!
I just added a pause screen but still on the agenda for v1.0:
1. Revisit sounds (I added a few more recently)
2. High-score saving
3. A "game over dialog" with---
Game Score: XXXX
High Score: XXXX
[new game] [high scores] [submit score] [quit]
Im not sure if the online score will make it into v1.0 but I will try!
Ill get it out this week hopefully.
woohoo, level5 is faaaaaaaaaaaaaast
when you increase gravity (mapped to left, right would feel more natural), I think tetris should abort this once the piece has 'settled' otherwise you don't have a chance unless you release trigger quick as he**. hope you understand what I mean...
Good idea! Maybe disable the extra gravity until one or two ticks of the timer have passed on a new piece? EDIT: done
I thought I updated the SVN copy to right trigger but I guess I havent yet.
Definitely need better movement sounds :-/
The speed maxes out near level 7 I think. I've only gotten that far once and quickly died. Im not sure of my score at the time since Im missing the game ending dialog but it was more than 1000. Im anticipating the best players to get maybe 4000.
EDIT: added a ghost piece for now.. am still working on highscores
EDIT2 High scores all there! Need to Make the score gui prettier and save/load high score settings
Nuka1195
2007-01-16, 07:42
I just want it noted that my high score was done on the PC, where it's not as responsive and the keyboard is harder to use. :)
last time I tried tetris, it had 'next block' in upper left corner. this feels unnatural to me (would maybe be better in left bottom). Also, maybe white borders instead of black might work better, since most colors are on the dark side
After playing for a while I just kinda notice the color in my peripheral vision and know which it is. I dont think lower left is good. If your eyes are near the bottom then the board is relatively empty and so you should have enough time to see the piece. Later on as the board fills up your eyes would tend to move higher and you have less time to make decisions.
However, as of my last commit I just hit v1.0! I am pretty happy about it too and am submitting this to xbmcscripts.com
I will add theme support to a 2.0 version if that happens. Something I had in mind for blocks:....
:angry: :rolleyes: ??? :stare: :nod: :oo:
Haha
Nuka1195
2007-01-17, 05:27
the text now overruns the dialog to submit start over..., on the buttons in 720p.
Also, it's best if you don't include the thumbs.db, it conflicts if you already have the file.
I was thinking it looked better in 720p without it being super stretched... but I thought the text was barely in, maybe theres a font difference. Did you prefer it the other way?
Future Plans:
v1.1
Theme support
Control remapping
Default Music?
Sound On/Off...
Fullscreen mode? Not sure how to best use the extra space... I tend to not maximize stuff when using a computer.
v2.0
Remade as a widget for the widget manager (might strip ALOT of functionality out)... make it super small on the screen
Nuka1195
2007-01-17, 08:41
I don't use the default fonts and I've edited font.xml for 720p so the fonts are bigger. The default fonts do look ok and I like it better not stretched, so I guess I would leave it the way it is, but...
Maybe an option for small pad and large pad. The current (not stretched is a little small from 10' away, for me anyways. the stretched, though the aspect ratio is off, vertically is easier for me. Maybe 525-550 for the height for large and keep the existing for the small.
Also could you make the controls configurable? I find myself in the heat of level 5, pressing down when i want to just go left. Might just be my controller or me. :) Tetris in MAME is A&B rotate piece. DPAD L&R for moving left and right and DPAD Down for gravity. Or an option to disable the fast drops, I think gravity is enough.
Maybe press start to start the first game or go to the highscores dialog on script startup.
Maybe no audio on gravity, it might work smoother that way.
And for the next piece location, again Tetris in MAME places it directly above the playing field. I guess you would have to redesign your pad, but it would stand out better than where it is. Though once you get use to it, i guess it doesn't matter.
Maybe a quit/resume dialog to ask to quit, if a game is running.
The straight piece comes out flat in MAME also.
Great game though.
Thanks for the feedback!
I have a suspicion that the gravity is smoother than it sounds because it is concurrent with the timed gravity which adds its own beep. I'll try playing with the sound to see if its any better. Really I almost never use that thing since the other drops are a lot quicker but I think alot of people are familiar with the gravity one though so I want to make it better.
It looks like configurable controls is definitely in for v1.1. ..... Heh I originally intended for this thing to be light and quick but the feature creep is definitely coming in. I think I will fork it come widget time and maintain a full-version and the widget version.
I could handle widescreen alot better if I had more control over setCoordinateResolution. It assumes you always want to stretch stuff to fill the screen but that is not a good idea for things like logos and pictures or anything you want to stay in the same aspect ratio. Hmm if there was a setManualResolution(720,480) it would be easier... or just add keywords to the existing call. I'll look into how easy that would be to add to the module.
Actually could your skin builder help here? I am worried about losing the ability to quickly add controls though since they would span multiple xml files. Is this issue real? Also the skin builder was broken recently and am not sure how stable it is... I normally generate alot of my controls programmatically but this script had a few sprinkled in each dialog and is more skinning friendly (dont know how the tabs will work though). I have a feeling though that the skin builder is better suitted to theme support than different resolutions...
I dont really see the point of a quit/resume dialog since you can quit and pause at any time... I could add the the high scores menu button to the pause dialog though... The reason it currently has only the one control is because check boxes dont have any focus texture... I guess in XBMC they can now only be found in the settings menus which use a different highlight control.
The tetris guideline (http://www.tetrisconcept.com/wiki/index.php/Tetris_Guideline) specifies all the pieces should spawn horizontally 2 rows above the playfield. But I usually drop them vertically and tended to prefer that (even though this makes the end game more difficult). If others want it more official style though I'll relent.
Anyway I am satisfied with v1.0 for now. Once blittan brings it up on xbmcscripts Ill make an announce thread in the other python forum but people can grab it from my sig right now :)
Rockstarr
2007-01-17, 16:04
Great work! :)
It becomes really hard in level 5. ;)
Highscore list in pause menu is a good idea.
So you can check how much points are left to the first place. ;)
Nuka1195
2007-01-17, 19:53
Using guibuilder, you add a <resolution> tag at the top of the xml file and then it does the setCoordinateResolution() for you. It also adapts for 16x9 displays. *see setResolution() in guibuilder.py
Apple Movie Trailers uses multiple xml files. The main window, a context menu and the settings window. It has the updated guibuilder.py in svn. I still need to update the list control, that's changed alot, but it does work.
chunk_1970
2007-01-18, 01:57
Just got to say....
Superb..Lovely graphics gameplay is spot on.
yeah, very nice script...
i think i got second on the score board, level 6 is impossible!!!!! lol
I am glad to hear you guys enjoying it :) It makes me feel motivated to add those extra options I have planned.
On the higher levels you really have to have a relatively clear board and let pieces fall naturally while you plan your next move. I have gotten up to level 8 twice and that one is very difficult. The speed maxes out around there. You probably need to be as fast as this guy (http://www.youtube.com/watch?v=jbnLja3OXEc) to survive.
I roughly calculated that his performance would score around 7500 on my scale. Something to aim for!
Rockstarr
2007-01-21, 18:07
Hi.
I have a few suggestions for the next version.
1. Highscoresubmitting
It would be good when you could check if a score is really a new highscore before submitting.
Maybe check if the score would be in the top10 or top20.
This way the database would stay a little bit more clean.
2. Highscoresubmitting 2
When I submit a score I can submit the same score again by just klicking the submit button again.
Maybe you can disable or hide the button when a score is sent.
3. Accountchecking
In the last days I often have found Highscores with user ID "-1".
Maybe there is an error in your script with the account check.
(highscore libary returns +1 on error)
Keep up the great work! :cool2:
Rockstarr
2007-01-21, 18:09
Hi.
(highscore libary returns +1 on error)
Typingerror.
highscore libary returns -1 on error
Hi Rockstar... I found bug#2 and fixed that (dont know why I didnt think of that during testing). I didnt realize the highscore database is strictly limited to a top 10 thing.. so I will gray out that button if it is not?
Hmmm, I think in my code I might check for userID == "0" instead of userID == "-1" ? I will fix this too.
Rockstarr
2007-01-22, 01:04
Its not "strictly" limited but I think its kind of pointless when a score of lets say 2 points is sent to the db and reaches rank 300. (just for example)
You can send as much scores as you want but who cares about rank 500? :;):
Nuka1195
2007-01-22, 03:21
me, as i'm sure i will not be above that. :)
slang123
2007-01-23, 21:18
Hi, I love this script. My housemate is dave (2nd highest score), he has some suggestions:
1, Make the speed increase linear, cause at the moment when you get to level 9 its not possible. There should be a speed limit so that you could in theory play forever, but in practice you couldn't as its so hard
2, Give some reward score wise for dropping pieces faster
3, Have options to change the controls (I think you are planning this already), and an option to change piece color (he is getting confused as he used to play the gameboy color version)
Finally, is there a fix in XBMC that lets you scroll left and right faster? Cause you need to tap left/right on the later levels to play, and I know this is not the fault of the script but XBMC.
Thanks, I look forwards to future releases.
Wow level 9? Dave is pretty nuts :) the speed maxes out at around 20/second.. I thought this occurred at level 8 (I've only gotten there a few times) but I will check my calculations and may tweek the speed in later levels. I think I'll make it max out at level 10 and make the level 10 speed the current level 8 speed. Now that Tetris is included in the t3ch build I feel it my duty to make it alot better!
On track for v1.1
Key Configurator (almost done) this is on the pause dialog
Language localization (finished)
Better Widescreen Mode (finished)
Auto Update (not done)
Small bug fixes.. nothing major
Autoupdate is the big key since it will allow me to add features at my own leasure.
v1.2 Plans
Different themes:
. Modern - the current theme
. Aqua with gel blocks (Full screen?)
. Retro with oldschool nintendo sounds graphics
. Mini - tiny!
Also I would like to include different game modes. Here are some ideas that came up in IRC. Please give feedback!
Normal: Present Mode
Marathon: Level 1 difficulty.. you play until you die or get bored. Score is the number of lines you clear with multi-line bonus. Should I start this at a higher level?
Time Attack: Score as many points as possible in a limited time... 10 minutes? Normal scoring? Line scores? Level advancement?
Survival: Live as long as you can? Score = time. Start at level 6? Can't start slow with this mode obviously so I dont know how advancement works.
I guess these go on the new game dialog?
slang123
2007-01-29, 02:54
Excellent, we look forwards to the new release, especially the retro theme. At the moment level 11 (see screenshot for proof that he's got there) isn't even maxed out, it definitely continues to speed up. It hurts my eyes to watch him play :eek:
http://www.fileden.com/public/2007/1/28/thumb_45bd44647696a073170000.png (http://www.fileden.com/pview.php?fid=145750&fname=screenshot016.png)
WTF level 11?! :oo: That isnt exactly a good argument for me to slow it down :laugh:
Don't forget C&C for the different game modes :)
only 158 lines and that score ? looks funky :shocked:
Pike its quite possible since the clear bonuses grow linearly with the level. Also clearing 4 lines at a time is 16x more than clearing just 1 (and so is 4 times more efficient with points/line).
4 lines = 16 x current level ... 4 points per line
3 lines = 9 x current level ... 3 points per line
2 lines = 4 x current level ... 2 points per line
1 lines = 1 x current level ... 1 point per line
levelup = 15 x current level - almost as good as a 4-line clear
The score grows quadratically over time...
Yes I feel a bit dumb now, I thought I was 100> lines myself, but looks like I'm around 80 :o
tetrisdave
2007-02-04, 22:57
hey all this is dave,
iv always loved tetris and this is an awesome replica, as slang123 said the only problem is the pieces dont move across fast enough but i dont think you can help that :no:
If u could make it so colours are changeable it would be easier for people who have played on nintendo, but i must warn you, i'd get even better! :nod:
As for the speed i think it maxes out around level 11/12, i had 1 lucky game that got to level 17 :nerd: and i didnt notice speed changes but i spose i wasnt really concentrating on that!
1 other thing is u should make the leaderboard longer and only 1, maybe 2, entries per person so others can get on.
Thanks for the game, keep up the good work ;)
1 other thing is u should make the leaderboard longer and only 1, maybe 2, entries per person so others can get on.
This is already the case with the SVN of Tetris ;)