Giter VIP home page Giter VIP logo

catris's People

Contributors

akuli avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

arrinao

catris's Issues

flip during flashing

Potential bug:

  1. Join ring game as single player
  2. Fill a row (not a ring)
  3. Press f while the full row is flashing

Game over view no longer makes sense

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.

ring mode: more ways to clear

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.

More game modes

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.

Potential ddos vulnerabilities

  • The name has a maximum length, but it's checked after you have entered it. If you enter a name that is 2 gigabytes long, it will go into a bytes object. (But entering it will be very slow, because new bytes are appended to it in a slow O(n^2) way.) #26
  • There is no limit on the number of concurrent connections, even though only 4 clients can play at a time. #25

It 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.

pause

Should be only available for single player games, like the view flip in ring mode

Game time includes pauses

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.

README: firewall instructions are confusing

[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

Put away block that you don't want to use right away

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.

Exploding bomb should trigger other bombs

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.

More than one of each type of game?

If catris will some day run on a public server, it would be nice to:

  1. Invite friends to play with some kind of ID
  2. Play with randomly chosen people

With the code I have now, neither would be possible, because max 8 people can be connected and the server would always be full.

proper logging

Currently logging is achieved with print statements, and it isn't clear which logging messages belong to which connection.

Show next block

Previously I didn't do this because there wasn't much room in the UI. I think it will fit.

Max receive speed

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.

Send queues, in case someone has slow internet

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.

rewrite in asyncio?

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.

Clear terminal when switching views

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...

Connection timeout

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.

ring mode: allow block to go to other side

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.

Code for removing a player is buggy

catris/catris.py

Lines 350 to 354 in d04c6c9

for client_on_right in self.server.playing_clients[i:]:
client_on_right.moving_block_x -= WIDTH_PER_PLAYER
for other_client in self.server.playing_clients:
other_client.keep_moving_block_between_walls()

This code has a couple bugs:

  • Moving blocks on the left side of the client being removed shouldn't move sideways.
  • Moving blocks can end up overlapping each other or landed blocks, because keep_moving_block_between_walls() only moves sideways, never up.

README: document the gameplay a bit

Should mention:

  • You play with other people, not against them; there's only one total score
  • Once the game is over on your part, you can join back, and the score won't reset

show where block will land

Other tetris clones often have this feature. It would make the gameplay easier, and wouldn't be very hard to implement.

Print something when server is starting

[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

Host this on a server?

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.

send buffer fill attack?

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.

Holding down arrow keys left/right doesn't work very well if internet is slow

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.

_refresh_check_terminal_size_views broken

catris/catris.py

Lines 928 to 936 in dc47220

self.server_tasks.append(
asyncio.create_task(self._refresh_check_terminal_size_views())
)
async def _refresh_check_terminal_size_views(self) -> None:
for client in self.clients:
if isinstance(client.view, CheckTerminalSizeView):
client.render()
await asyncio.sleep(0.5)

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.

MacOS compatibility issues

  • Arrow keys don't work
  • Netcat seems to buffer things too much. Return press after entering name doesn't get sent, until you hit Ctrl+C a bunch of times

High scores view

I imagine when a game is over, I would get:

  • A list of high scores and their players, highlighting the game that just ended if it made it to the list
  • Menu that lets you choose new game or quit

race condition

The following python script makes catris error:

import socket
s = socket.create_connection(('localhost', 12345))
s.sendall(b'My Name\r\r')

Hiding lobby id

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.

readme needs improving

Should have 3 distinct sections:

  • Server setup
  • Client setup, for Windows
  • Client setup, for non-Windows

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.

socket.send() raised exception.

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.

rotating direction

People seem to have different preferences about which direction rotation should work. Maybe enter should rotate in opposite direction than arrow up?

Name warning

When asking name, should mention that name will be visible in high scores list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.