[Kde-games-devel] KSirtet & libksirtet updates for KDE4.0

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Apr 4 23:57:26 CEST 2007


Hi,

On Tuesday 27 March 2007 10:18, Nicolas Roffet wrote:
> KSirtet and all other games depending on libksirtet like KFoulEggs and
> Klickety are not in a good shape for KDE 4. :(
> (But Klickety seems at least to work. It's slow on my computer, but it's
> working... KSirtet and KFoulEggs are not working...)

just in case you'd like a few more ideas, here's a mail with some suggestions 
for KSirtet, I sent to Nicolas Hadacek some time ago.

Regards
Thomas

----------------------------

Hi Nicolas,

first off: Thanks a lot for a nice game of tetris!

A few suggestions that came to my mind while playing, maybe some of those are 
worth implementing:

* Key handling:
I haven't read the code, but it seems KSirtet uses Keypress-Events directly. 
This is a fairly straightforward approach, but I think it is limited, and 
could be improved. Two problems: 
a) When I need to move a tile fast and far, I tend to keep the key pressed, 
instead of trying to press the key repeatedly at a high rate. However, this 
won't work well, unless I adjust the keyrepeat delay and frequency before 
playing KSirtet. It would be nice, if this was configurable inside the game.
b) When trying to slide a tile beneath another tile at high levels, timing is 
difficult to impossible. Suppose the falling block that should be slid under 
a block already there. However, the sliding can only be done at the very last 
point of movement, right before the block has "landed". Currently you need to 
get lucky (or be really good at it) to produce a keypress event exactly at 
the right moment. Instead, it would be nice, if you could start pressing the 
key earlier (while the block is still next to the block it should be slid 
under), and right before KSirtet considers a block as landed, it will check 
whether a key is currently pressed, and if so, move it one step.

Both of these (in principle, the details may be slightly hairy) can be 
achieved by using a method like this:

MyWidget::keyPressEvent (QKeyEvent *event) {
        KKey key (event);
        if (leftAction->shortcut().contains (key)) {
                left_key_pressed = true;
        }
        [...]
}

MyWidget::keyReleaseEvent (QKeyEvent *event) {
        KKey key (event);
        if (leftAction->shortcut().contains (key)) {
                left_key_pressed = false;
        }
        [...]
}

void QObject::timerEvent ( QTimerEvent * ) {    
        // or some slot called by a custom timer

        if (left_key_pressed) moveLeft ();
        [...]
}

(See also http://edu.kde.org/development/kaction.php, or ask for more info. I 
used something like this in a game I wrote)

* Tile generation
Randomness is a central part of the game, but I've often wondered, whether it 
would be possible to reduce the influence of luck. E.g. sometimes a good game 
is ruined by a long streak of bad luck (series of wrong tiles), and of course 
the other way around. I suggest two new game mode (with separate highscores):
a) Reduced randomness: Instead of generating truely random tiles, maybe you 
could generate blocks of 24 tiles or so, with each of the 7 different tiles 
guaranteed to appear 3 to 4 times in that block. Then the next block would be 
generated according to the same rules. This should rule out long streaks of 
bad/good luck, but still be random enough not to be predictable. Of course 
the numbers are just a wild guess, and may have to be tweaked.
b) Replayable games: Might not be an equally good idea, but here it goes: 
Would it be possible to play two games with the exact same random seed, i.e. 
the exact same sequence of tiles? This might - for instance - be a nice idea 
for competitive plays: Two players would both get the exact same sequence of 
tiles, and so the scores would be more comparable.

* UI
- When I started playing KSirtet, the first problem was figuring out, how to 
adjust the starting level. I suspected it in the Mode-Menu, and I think 
that's where it should be.
- I think it would be cool, if the window was simply resizable instead of 
having a view menu with zoom in / out.

Well, that's it for now, hope you find some of these comments useful. Thanks 
again for your work on KSirtet.

Regards
Thomas Friedrichsmeier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20070404/9f9ad7ae/attachment.pgp 


More information about the kde-games-devel mailing list