Shop Learn
Tetris in 1080p VGA with music and sound — Parallax Forums

Tetris in 1080p VGA with music and sound

RaymanRayman Posts: 12,315
edited 2021-02-14 01:19 in Propeller 2

Wanted to test out the @Ahle2 sound system with a game and realized I could convert the Tetris game from EVE to regular P2 VGA.

EVE version screenshot here: https://forums.parallax.com/discussion/172636/720p-full-color-graphics-with-eve3-gpu#latest

Seems to have worked out well.
Found a mod file with tetris in the name here: http://janeway.exotica.org.uk/release.php?id=32592
Seems OK.

«1

Comments

  • RaymanRayman Posts: 12,315
    edited 2021-02-14 21:34

    Here's the files for this. I've tested this with P2 eval board with A/V board on basepin 0.

    It has USB kB/mouse but input is set for the computer keyboard using the terminal window of FlexProp... Uses WASD keys...

    The pin definitions and such are in mostly in Platform.h.

    Easiest way to test may be to open tetris.c in FlexProp GUI and compile and run from there.

    Update 1b: Updated the top level file, tetris.c, to give proper attribution for the original version and also the graphic.
    Update 1c: Added a preview window, made the game 10x18 and added a "game over" message.

  • Ken GraceyKen Gracey Posts: 7,336
    edited 2021-02-14 05:21

    Wow! Can I turn this into a Quick Byte?

    That was the fastest success I've ever experienced with the P2, especially using [new to me] tools like FlexProp!

    Ken Gracey

  • Cluso99Cluso99 Posts: 18,013

    Can we have a video please?
    I’m sure Quick Bytes will be so much better with a vid :)

  • RaymanRayman Posts: 12,315

    @"Ken Gracey" Sure! Feel free. I believe it's all MIT licensed.

    This attribution got lost in this quick merging of codes:
    //MIT Licensed Tetris game from here: https://github.com/Gregwar/ASCII-Tetris

    I should add that back into tetris.c, where it was...

  • RaymanRayman Posts: 12,315

    One kind of interesting technical note is that the display is double buffered.
    There was horrible flicker before this as the play area was erased and then redrawn.
    The quickest way to fix this was to just double buffer.

    Was very easy to implement. Just made a second copy of the tile and color buffers like this:

    'RJA making double buffer
    Tiles2       '1920x1080 in 16x16 tiles '20 bits for tile address, 12 bits for color set index
                long    $0[120*68]
    
    'alignl
    TileColors2  'One long for each tile, picks four colors from 256 color palette.  Note:  bytes are read little endian
                long    $01_00_01_00[120*68]
    

    Then, pointed the VGA scanline assembly driver to these buffers instead of the original.
    Finally, after updating the screen, call swap() to do this:

    PUB Swap() 'copy working buffer to display buffer
        longmove(@Tiles2,@Tiles,120*68)
        longmove(@TileColors2,@TileColors,120*68)
    
  • RaymanRayman Posts: 12,315

    @Cluso99 Here's a video for you. I'm sure Ken could do better though...

  • That sure is an oddly proportioned playfield though. 12x16... Usually it's 10x18 to 10x20.
    Also, I think you're missing the piece preview, that's kindof important.

  • RaymanRayman Posts: 12,315

    @Wuerfel_21 Thanks for the feedback. Guess it's been so long that I don't remember how it is supposed to be.

    The game author made the playfield size variable, maybe they were just showing that off...
    The playing pieces are also easily modified or extended.

    I'll see if I can fix these two issues.

  • Cluso99Cluso99 Posts: 18,013

    Nice video Ray.
    I, and I think many others, when I see things related to games and other things with moving video, it’s always nice to see a short video of the action. Often the interest is lost before time is available to try it out oneself. We’re certainly living in a different age now!

  • RaymanRayman Posts: 12,315

    I've added a preview window, made the game 10x18 and added a "game over" message.
    Will update above with new zip file.

  • cgraceycgracey Posts: 13,631

    Good video, Rayman.

    I like these 1/2/4-bit modes because they are so memory efficient. Page flipping is no big deal with these small maps.

  • @Rayman said:
    @Cluso99 Here's a video for you. I'm sure Ken could do better though...

    Not really. I need a VGA capture tool (just ordered one). Until then, this is my best:

    Ken Gracey

  • Ahle2Ahle2 Posts: 1,167
    edited 2021-02-15 08:54

    Rayman,

    This is cool! :smile: Nice to see that simpleSound worked so well for you and was easy to use. That tune is not from the real Tetris game though, but from the intro of a Tetris inspired classic Amiga game named Coloris...

    That tune is actually one of my favourite oldschool Amiga tunes, soo eerie and yet when the melody finally starts it's strangely uplifting; But the overall feel of the tune is still dark and omniuos. In truth one of a kind!

    I still think something like this would be a better fit...

    Still it's not the real Tetris game music, but it's used in a clone and it's really catchy!
    Here is a link to that tune: https://modarchive.org/index.php?request=search&query=twintris&submit=Find&search_type=filename_or_songtitle

  • Wuerfel_21Wuerfel_21 Posts: 1,951
    edited 2021-02-15 11:47

    If y'all want I can try to make a MOD version of the Retronitus modules I did for Spintris 2020.
    (if you haven't heard them:

    )

    I've never really messed with sampling trackers though, so I'll have figure out how to make samples. I think the chords need to be baked into one sample each to make it all work in 4 channels.

  • Ahle2Ahle2 Posts: 1,167

    @Wuerfel_21

    That's very nifty. I like your Retronitus versions of the classic Tetris tunes and I love seeing some fiddling around with my beloved child from the past. :wink: The way the sawtooth waves modulates is maybe the best thing about Retronitus; The small footprint of the Retronitus music format is another great thing. The .mod format is soo wasteful in comparison; On the other hand we have "unlimited" resources on the P2 now. By looping really small samples of different waveforms and using the arpeggio command, module makers did great emulations of different sound chips and the music could be kept quite small (like 20 k).

  • Ahle2Ahle2 Posts: 1,167
    edited 2021-02-15 13:44

    I found this online module tracker that can load modules directly from different archives on the web. You litterly have thousands of tunes at your fingertip...

    https://www.stef.be/bassoontracker/

  • RaymanRayman Posts: 12,315

    Interesting... I see there's a newer "XM" format with more channels...

  • Ahle2Ahle2 Posts: 1,167

    Yes, it's based on the mod file format and adds more channels and additional commands. Shouldn't be too hard to make simpleSound play those as well. reSound can handle up to 64 channels, so no problems at the back end.

  • Ken GraceyKen Gracey Posts: 7,336
    edited 2021-02-15 15:41

    Rayman's contribution now has a home as a Quick Byte!

    (https://www.parallax.com/tetris/)

    @Rayman I welcome any edits or changes and can make them myself or give you access. Tag me as you update the code and I'll update this, too. I've linked the Quick Byte back to this discussion forum thread to keep the resources connected. When I receive the VGA/audio to USB video capture device I'll make a proper YouTube version of Tetris, and replace what I've posted.

    Ken Gracey

  • RaymanRayman Posts: 12,315

    Thanks Ken!

    And, thanks to @ersmith for providing FlexSpin C that makes it all work.

  • Ahle2Ahle2 Posts: 1,167
    edited 2021-02-15 19:20

    I agree, @ersmith has done an excellent job of making the P2 useful, even before we had the Official interpreter. Thanks man! :smiley:

  • ersmithersmith Posts: 5,096

    Thanks guys, and thanks for your contributions. The community has really done a lot to make FlexProp better, via suggestions, bug fixes, and documentation.

  • Here's my try at making a MOD of the Korobeiniki theme.
    Took quite some time as I had to learn OpenMPT's ropes, but came out pretty good for a first-timer, I think.
    Tempo is lower than the Retronitus version, that just seems to sound better with the samples I got.

  • cgraceycgracey Posts: 13,631

    That sounds pretty good, Wuerfel_21.

  • Cluso99Cluso99 Posts: 18,013

    @"Ken Gracey" said:
    Rayman's contribution now has a home as a Quick Byte!

    (https://www.parallax.com/tetris/)

    @Rayman I welcome any edits or changes and can make them myself or give you access. Tag me as you update the code and I'll update this, too. I've linked the Quick Byte back to this discussion forum thread to keep the resources connected. When I receive the VGA/audio to USB video capture device I'll make a proper YouTube version of Tetris, and replace what I've posted.

    Ken Gracey

    Nice Quick Byte Ken.
    Thanks Ray, etc

  • RaymanRayman Posts: 12,315

    @Wuerfel_21 You made that mod? I'm impressed. Looks like a lot of work... Music sounds good. Has a Latin flair, I think, right?

  • Wuerfel_21Wuerfel_21 Posts: 1,951
    edited 2021-02-15 22:27

    @Rayman said:
    Looks like a lot of work...

    Not really, but that's because I already had the Retronitus arrangement from Spintris, so I just had to transcribe the notes and, uh... borrow.. and edit some samples. Making those choir chords was a bit more tricky (I created a new module, put the chords in there, rendered that out and then cut out the bits I needed)

    If I had to arrange a new tune or compose one from scratch, that'd be a lot more work.

    Has a Latin flair, I think, right?

    That wasn't necessarily the goal, but now that you say it, it kindof is like that.

  • Ahle2Ahle2 Posts: 1,167
    edited 2021-02-16 08:45

    Good job @Wuerfel_21 :+1:

    For a first Tracker module it was quite advanced, using multiplexing and even some effects. The "normal" way of doing chords, is to have a few samples like major, minor and dim sampled at C2/C3 and then just play those back at different rates. That way you can have "all" variants using just a few samples.

    When I went from Protracker to Digibooster Pro on my Amiga, I was no longer limited to squeeze in everything into 4 channels using chord samples, multiplexing and composite drum samples. But to be honest it wasn't much of a challenge then. :wink:

    I like how this community works... Someone makes a sound engine; Another one thinks, great, that is what I need for my game; And yet another one thinks, oooh I want to try to make my first tracker module and at the same time help out with the game music :smiley:

  • Ahle2Ahle2 Posts: 1,167

    @Wuerfel_21

    Have a look at "banana split" for some 4 channel tracker magic. It uses all the tricks in the book and sounds amazing.

    Click the link and push play...

    https://www.stef.be/bassoontracker/?file=https://www.stef.be/bassoontracker/api/modules.pl/105

  • @Ahle2 said:
    Good job @Wuerfel_21 :+1:

    For a first Tracker module it was quite advanced, using multiplexing and even some effects. The "normal" way of doing chords, is to have a few samples like major, minor and dim sampled at C2/C3 and then just play those back at different rates. That way you can have "all" variants using just a few samples.

    I got that concept, but all the chords here have different intervals in them, so I couldn't re-use any samples...

Sign In or Register to comment.