13 ms·
If you like terminal games, you might be interested in my Bash Arkanoid clone! It's packed with cool text graphics, animations, sound effects, paddle accelerat
by zenojevski 7y ago
If you like terminal games, you might be interested in my Bash Arkanoid clone!
It's packed with cool text graphics, animations, sound effects, paddle acceleration, side spin, and power-ups. Clone, inspect, play with Q and P keys.
https://github.com/zenoamaro/arkanoid.sh https://github.com/zenoamaro/arkanoid.sh
I employed a number of tricks. The ones I am particularly proud of are:
- The title screen, which uses the iconic old-school wavy text effect. To make this fast in Bash, I ended up precomputing the table of sin that determines the offset of each slice:
https://github.com/zenoamaro/arkanoid.sh/blob/master/src/title.sh https://github.com/zenoamaro/arkanoid.sh/blob/master/src/tit...
- The rendering system required to get all this to run a smooth, consistent 60fps on both linux and macs, without blocking key reading. It sends itself an ALRM signal trap to run the game loop in a co-process, much similarly to how it's usually done with `requestAnimationFrame`:
https://github.com/zenoamaro/arkanoid.sh/blob/master/arkanoid.sh#L21 https://github.com/zenoamaro/arkanoid.sh/blob/master/arkanoi...
- The deferred frame-buffer drawing mode:
https://github.com/zenoamaro/arkanoid.sh/blob/master/src/gfx.sh#L25 https://github.com/zenoamaro/arkanoid.sh/blob/master/src/gfx...
Hope you enjoy it :)
- the_jeremy 7y agoRuns at ~5 fps on alacritty. I wouldn't have thought it would be so different on alternate terminals.
- zenojevski 7y agoYes, it's impressive how much difference there is. There are ways to improve each, but this is the best cross-terminal solution I found. Do you have the same results with your other terminal emulators?