-
Notifications
You must be signed in to change notification settings - Fork 70
Add a pyxel viewer
#898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a pyxel viewer
#898
Conversation
|
@Debilski could you have a look at the |
|
Ah, nice. Now if only pyxel could have a high def output. :) For zmq it kind of depends how that update loop works. Ideally, you do not want to call this unconditionally every fraction of a second as it will just eat CPU when idle. In the best case, pyxel comes with a mechanism to wake up the main loop from a different thread via a signal [*]. You’d need to have all the zmq stuff in the other thread then, and pass the messages to the main loop. If pyxel can do asyncio, it might also be an option to asyncify the zmq calls. If neither is possible, you probably want to increase the poll timout slightly when no more messages are incoming. Apart from that, I think for a viewer there is not so much to know about zmq. If it works, it works. It gets more interesting once you are trying to send stuff. :) [*] This is possible for example in the test Qt6 viewer ( https://github.com/ASPP/pelita/pull/756/files#diff-5d901d396173bb6a2fb825d926ad8db0d366708fe769c45d45f7066b12adf137R44 ) although in this specific implementation it is still somewhat simplified. |
|
I highly appreciate your explanation! I will check CPU usage then.
I guess you mean that the resolution is too low, that is, sprites and walls are too blocky?
|
I meant it half as a joke, because I understand that this is what pyxel does best. But OTOH, if it doesn’t have a high resolution, the question is what makes it better/different from Tk. It kind of looks like that already on Linux (unfortunately in my opinion). (+ I really would like to have a high-res SVG canvas viewer that can be built from a few lines of Python and I feel that pyxel almost could be it) |
To me this is a big improvement from Tk:
There are of course downsides too, here the ones concerning me the most:
From the aesthetic point of view, I like pyxel's retro look. It fits with the mock pacman idea of pelita. And it makes the GUI something recognizable immediately instead of something that seems to work but often fails in the little details. Pyxel looks like it got buttons, game controls, sprites and fonts right from the beginning, instead of the manual retro-fitting with have to do with Tk. If the "debug" mode looks good I would be almost convinced to risk a move to pyxel. We don't have to throw away the Tk viewer, and if we keep it around indefinitely and keep on testing it once in a while, we may be able to switch back to it if pyxel dies a terrible death. |
|
@jbdyn : could you add to the list of features to be implemented something along the lines of
|
Pros of
Personal Pros of
|
|
@otizonaizit Whoops, didn't know you also answered. 😅 |
@otizonaizit Are you thinking of chamber tile visualization? |
well, that was one use of that. But I am thinking to a feature that gets asked over and over again: a way for the client to mark tiles, for example to display a heatmap. This should be supported during development and of course be ignored when playing a standard game. |
as far as I know @Debilski is having this already in his own web-based tournament repo somewhere. On the other hand I am very much against having a web-based client as the default GUI. Very much against. Pelita should be educational grade code, we want students to get excited about it and we want them to be able to contribute code. Ergo, it must be written in Python and runnable from the CLI. The web-client would need constant care and a paid developer to be maintained properly. And we would start having browser compatibility issues from day 1. |
Sure but in a pixel font. We could have consistent appearance on Tk too (minus some anti-aliasing on Linux/Windows) if we put all the buttons into the canvas as well. I don’t see the different button designs as an absolute minus though.
Not sure which ‘game engine framework’ features are needed or used other than having a canvas. Structurally, it looks pretty similar to the Tk code right now. (Likely that this will also become messier once more features are implemented.)
Even bot.say might be a problem …
My strongest opinion here: I think it looks cute and fun as a gimmick but it looks like a generic retro Pacman clone of which there are probably hundreds and not at all recognisable as Pelita. Not really a fan of it as the default UI.
I might even agree but I am not sure what you mean exactly.
You should have opened an issue here, I think no-one really tested it with tiling WMs that willingly ignore our But it is solvable in Tk. A small problem is that you have to add the header and footer part to the aspect ratio. (And you have to take into consideration absurdly ‘deformed’ mazes – they shouldn’t make the window manager unmanageable, so it is still a bit messy to fine-tune.)
That’s nice of course. (Not sure if needed anymore; we can now export the tournament – or at least all matches – to a website https://aspp.uber.space/tournament.html and don’t even have to carry the overhead of having to include videos anymore.)
Not having sound is a plus here maybe :)
If we only have a 7x7 bitmap font (means we can fit four letters in a 16x16 cell) then there aren’t so many different designs possible anyway I guess.
Hmm, ok, but then we need to write the same wrappers for things as we would in Tk. Just for different things.
I’d imagine we’d have less browser compat issues than we currently have issues with wayland/x11 and wrongly linked Python UI libraries. [*] The main points against a browser-based UI as a default are:
So yes, this is likely not happening. [*] I also looked into https://flet.dev as an alternative to Tk but unfortunately I immediately ran into this on Linux flet-dev/flet#2823 It remains to be seen if pyxel is more stable here. |

This PR adds a pelita viewer based on the retro game engine
pyxel.It shall have the same feature set as the Tk viewer and more:
zmqcontrollerThings to discuss:
pyxresresource file with sprites or define sprites via Python API?