akuli / catris Goto Github PK
View Code? Open in Web Editor NEWThe classic game of falling blocks, but with online multiplayer
Home Page: https://catris.net
License: MIT License
The classic game of falling blocks, but with online multiplayer
Home Page: https://catris.net
License: MIT License
Potential bug:
Currently game over view has 3 options: New Game, Choose a different game, Quit. I think we only need "Choose a different game", because once you select that, you can do a new game of the same kind or quit the whole catris.
Being able to clear only rings makes the game too difficult and unintuitive. Clearing lines as in traditional mode should also work on each side of the middle area.
I think it would make sense to expand this to be not just a tetris clone, but a collection of classic text-based games. I could add at least minesweeper. Solitaire probably doesn't work very well as multiplayer, but other card games might.
bytes
object. (But entering it will be very slow, because new bytes are appended to it in a slow O(n^2)
way.) #26It is currently not possible to fill up the disk too badly with the high scores file. No matter what you do, it takes a few seconds to end the game, and then only about 50 bytes are written to the high scores file.
Should be only available for single player games, like the view flip in ring mode
If I play for 15min, pause the game for 30min and play for 5min, the game duration shows up as 50min in high scores. It should probably be 20min.
Line 50 in 8d3366b
If games of the same kind end at the same time in two different lobbies, both will try to read and write the same file.
[22:26] ThePhilgrim the firewall command, is that linux specific? I've never used "sudo" on mac
[22:27] Akuli i should emphasize that you likely won't need it at all
[22:27] ThePhilgrim okay
When pressing a key, the currently moving block would go away, and it would be replaced by a new block. If you press the key for the second time, instead of a new block it would get swapped with the block that was put away earlier.
If you have two bombs next to each other and one of them explodes, the other bomb is just removed. I think it should explode too, ideally so that the user sees how the explosions are chained.
would be fun
If catris will some day run on a public server, it would be nice to:
With the code I have now, neither would be possible, because max 8 people can be connected and the server would always be full.
White text on white background. Not nice.
Currently logging is achieved with print statements, and it isn't clear which logging messages belong to which connection.
Previously I didn't do this because there wasn't much room in the UI. I think it will fit.
If a client sends a lot of data to server, server will take 100% CPU usage to process that. Not great, if it is also serving a bunch of other things too and not just catris.
Clients who send more than maybe 1kB/sec should probably be disconnected. It should be possible to disable this while fuzzing though.
If someone has slow internet, others shouldn't need to suffer from it. But currently the game sometimes sends data in a loop, e.g. when flashing. If sending to someone takes a couple seconds, everyone after them will have to wait too, and that's not good.
I looked at asyncio docs, and it's much less shitty than it was back in Python 3.5 when everyone hated it. I don't like the mess of threads and locking I currently have.
If you resize the window while playing, everything starts to look bad. That's fine, but at least it should fix itself as you go to a different view...
Should disconnect clients that have been connected for a long time (e.g. 1 minute) without sending anything. This doesn't interfere with playing, but prevents the server from thinking it has active connections when it doesn't have. Protocols like IRC already do this.
a more familiar key binding to some people
It's unintuitive how the moving blocks stop at an invisible horizontal line in the middle of the view. Would be better if they would just keep falling forever and possibly never land anywhere. If your block falls off the other side, you'll just get a new block.
Lines 350 to 354 in d04c6c9
This code has a couple bugs:
keep_moving_block_between_walls()
only moves sideways, never up.Should mention:
Other tetris clones often have this feature. It would make the gameplay easier, and wouldn't be very hard to implement.
[22:26] ThePhilgrim Ran catris.py, nothing happens. Will it only start when it gets a connection to it?
[22:26] ThePhilgrim a second connection*
[22:26] Akuli yeah, you have to connect to it with netcat
[22:26] ThePhilgrim ok
It would be nice if you could play catris without installing anything. Ideally the connection to the server would be over ssh or similar, because unencrypted tcp connections are bad.
A friend has a server that could be used for this, but I don't want to bother him if I need to e.g. deal with badly behaving users or update catris running on the server.
If client connects for a very long time and never receives, filling up the server's send buffer could fill up the server computer's memory. I don't think calling drain()
helps, because re-renders are done from many places by many tasks.
I think the problem is that arrow key presses are 3 bytes (e.g. \x1b[A
for arrow up), so you end up sending something like this:
\x1b[A\x1b[A\x1b[A\x1b[A\x1b[A
And if received in chunks of 10 bytes (server ends up calling recv(10)
), this becomes:
\x1b[A\x1b[A\x1b[A\x1b
[A\x1b[A
and the server doesn't know what to do with this.
Just a small code cleanness nit I noticed
Line 589 in e646f5a
blank_y
is never used so enumerate()
is not needed.
In traditional mode, if player A moves their block to where player B's block is supposed to spawn, the blocks overlap and cause assert self.is_valid()
to fail.
Lines 928 to 936 in dc47220
This runs once when the game starts, but I intended it to run every 0.5sec. The check terminal size views still seem to work fine without it though, at least on linux.
I imagine when a game is over, I would get:
Would be nice if when you press "r" and start a new game, the blocks would still rotate clockwise
I don't think there's any error handling. There really should be.
The following python script makes catris error:
import socket
s = socket.create_connection(('localhost', 12345))
s.sendall(b'My Name\r\r')
Once #90 is done, someone might want to stream a game of catris and prevent the stream's viewers from joining the lobby. To make this possible, there should be a way to hide the lobby ID once you have joined a lobby.
Should have 3 distinct sections:
Also, using telnet on windows shouldn't be on readme at all, because you have to install something anyway to play catris so you might as well install a good client software.
After connecting to catris and disconnecting with Ctrl+C randomly a few times, at random points (menus and gameplay itself), socket.send() raised exception.
gets printed on the terminal at what looks like exactly every 500ms.
People seem to have different preferences about which direction rotation should work. Maybe enter should rotate in opposite direction than arrow up?
With just one player, it would be nice if traditional mode was 10 squares wide instead of 7 squares wide. It can shrink to 7 squares per player as more players are added.
I like the new bomb feature, but bombs are too rare :(
When asking name, should mention that name will be visible in high scores list.
Instead of having a part of an escape sequence show up, it would be better to just ignore arrow key presses
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.