Author Topic: ML Tetris (mltetris.mo)  (Read 2247 times)

petabyte

  • Freshman
  • **
  • Posts: 89
ML Tetris (mltetris.mo)
« on: May 26, 2021, 02:46:14 AM »
Source code: https://github.com/petabyt/mltetris
Download: https://github.com/petabyt/mltetris/releases/download/0.1.0/mltetris.mo

Of course, I was too lazy to actually write the game myself, so I ported somebody
else's code. (http://spritesmods.com/?art=zx3hack, GPL3)

Demonstration:


theBilalFakhouri

  • Developer
  • Hero Member
  • *****
  • Posts: 1091
  • UHS-I
Re: ML Tetris
« Reply #1 on: May 26, 2021, 08:02:34 AM »
Cool, thanks for sharing
Waiting some new DIGIC 5 models . . .

petabyte

  • Freshman
  • **
  • Posts: 89
Re: ML Tetris (mltetris.mo)
« Reply #2 on: November 02, 2022, 11:25:43 PM »
Update:
Will eventually be merged into magiclantern_simplified. https://github.com/petabyt/magiclantern_simplified/tree/tetris
Some notes:
- menu_redraw_blocked is set to 1 to prevent flickering as menu is being drawn.
- task_create is called to keep the ML menus in place after the game is quit.
- Code is based on my project, ptetris (https://github.com/petabyt/ptetris/), which can be compiled and run with X11/rawdraw

dpjpandone

  • Senior
  • ****
  • Posts: 407
Re: ML Tetris (mltetris.mo)
« Reply #3 on: November 19, 2022, 01:26:24 AM »
Does not work on EOSM. The game starts but none of the buttons work.

petabyte

  • Freshman
  • **
  • Posts: 89
Re: ML Tetris (mltetris.mo)
« Reply #4 on: November 19, 2022, 03:13:37 AM »
Should work if you compile it yourself. MODULE_KEY_PRESS macros might be different.

dpjpandone

  • Senior
  • ****
  • Posts: 407
Re: ML Tetris (mltetris.mo)
« Reply #5 on: November 25, 2022, 05:21:17 PM »
I did compile myself, Where to change MODULE_KEY_PRESS macros? you use same format as arkanoid (working) what else could be the problem? Is it because EOSM has "Q" "Set" combined? so game does not start?


Code: [Select]
switch(key)
    {
    case MODULE_KEY_Q:
        running = 0;
        return 1;

game does not start until "Q" ?
The blocks fall, just cannot move or flip them and cannot exit until level fills up and Game Over

petabyte

  • Freshman
  • **
  • Posts: 89
Re: ML Tetris (mltetris.mo)
« Reply #6 on: November 25, 2022, 07:16:30 PM »
Is it because EOSM has "Q" "Set" combined? so game does not start?
Maybe? I don't know, I've never used an EOS M and I'm not familiar with the button macros.
Are you compiling https://github.com/petabyt/magiclantern_simplified/tree/tetris/modules/tetris or https://github.com/petabyt/mltetris?
Wouldn't make sense if none of the buttons work, I assume it must be some kind of major bug. Maybe try in Qemu?

dpjpandone

  • Senior
  • ****
  • Posts: 407
Re: ML Tetris (mltetris.mo)
« Reply #7 on: December 02, 2022, 07:57:21 PM »

dpjpandone

  • Senior
  • ****
  • Posts: 407
Re: ML Tetris (mltetris.mo)
« Reply #8 on: December 28, 2022, 04:28:38 AM »
OK!

I picked up a 5D3 last week and the game works on this camera. I would like to suggest some small improvements:

-I think the speed should start off slower and increase over time
-pressing a direction and holding it should be read as multiple button presses in that direction. This would improve playability and reduce wear and tear on the hardware
- The game should be the highest level priority for drawing graphics, as it stands the audio meters conflict with the top of the screen.

I will do some homework on my end to try to implement some of these proposals and see if you like them.. In the meantime if any of these ideas appeal to you and you have suggestions I would love to discuss further!

Thanks for such a neat module!

petabyte

  • Freshman
  • **
  • Posts: 89
Re: ML Tetris (mltetris.mo)
« Reply #9 on: December 28, 2022, 04:55:13 AM »
Quote
I think the speed should start off slower and increase over time
Good idea! I'll implement this when I have the time.

Currently I haven't touched the tetris code since August, so I'll have to find the time to re-read the source code and fix a few things.
Eventually, it should end up in the magiclantern_simplified repository or other forks as it has a compatible license.

dpjpandone

  • Senior
  • ****
  • Posts: 407
Re: ML Tetris (mltetris.mo)
« Reply #10 on: December 28, 2022, 06:05:28 AM »
I found myself failing to align the blocks perfectly on the tiny screen and one down press makes it permanent. This small change makes it more playable (IMO):

Code: [Select]
case MODULE_KEY_PRESS_DOWN:
    testfield.currBlockY++;
if (fieldIsPossible(&testfield))
        {
            fieldDup(&field, &testfield);
        }


        //mustFixBlock = 1; //This stobs the block on the current row (not needed if we don't want block to drop instantly
        break;
    }

dpjpandone

  • Senior
  • ****
  • Posts: 407
Re: ML Tetris (mltetris.mo)
« Reply #11 on: December 28, 2022, 06:26:25 AM »
Good idea! I'll implement this when I have the time.


this might be helpful (from Pong lua script)

Code: [Select]
game_speed = 3
    counter = 0

    ball_dx = game_speed
    ball_dy = math.random(-game_speed, game_speed)

    AI_maxspeed = game_speed

    while menu.visible do
        --gradually increase speed
        counter = counter + 1
        if counter == 1000 then
            counter = 0
            game_speed = game_speed + 1
            AI_maxspeed = game_speed
        end

so in the case of tetris a higher (speed) number slows the game down since MSLEEP uses this variable, so maybe start with a speed of 300 and decrement by 5 each time a line is cleared?

petabyte

  • Freshman
  • **
  • Posts: 89
Re: ML Tetris (mltetris.mo)
« Reply #12 on: December 28, 2022, 11:55:46 PM »
I've abandoned the archived tetris module (https://github.com/petabyt/mltetris) but the last one I've worked on is https://github.com/petabyt/magiclantern_simplified/tree/tetris/modules/tetris (complete rewrite)
It's been a while since I've touched the two, but the more recent one is much better at rendering, but has slight game logic issues. Can't remember exactly what.