Tetris in 1080p VGA with music and sound
Rayman
Posts: 14,754
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.
Comments
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.
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
Can we have a video please?
I’m sure Quick Bytes will be so much better with a vid
@"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...
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:
Then, pointed the VGA scanline assembly driver to these buffers instead of the original.
Finally, after updating the screen, call swap() to do this:
@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.
@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.
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!
I've added a preview window, made the game 10x18 and added a "game over" message.
Will update above with new zip file.
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.
Not really. I need a VGA capture tool (just ordered one). Until then, this is my best:
Ken Gracey
Rayman,
This is cool! 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
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.
@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. 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).
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/
Interesting... I see there's a newer "XM" format with more channels...
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.
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
Thanks Ken!
And, thanks to @ersmith for providing FlexSpin C that makes it all work.
I agree, @ersmith has done an excellent job of making the P2 useful, even before we had the Official interpreter. Thanks man!
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.
That sounds pretty good, Wuerfel_21.
Nice Quick Byte Ken.
Thanks Ray, etc
@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?
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.
That wasn't necessarily the goal, but now that you say it, it kindof is like that.
Good job @Wuerfel_21
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.
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
@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
I got that concept, but all the chords here have different intervals in them, so I couldn't re-use any samples...