Hacker News new | past | comments | ask | show | jobs | submit login

Here's a faster way to get a frame using PyGTK:

https://www.pastery.net/xafjmn/

Takes around 5ms per frame for me, rather than 50.

Slightly shorter code (still using the same method): https://askubuntu.com/a/400384/73044




Thanks for sharing this, will definitely look into it. With the ever improving FPS, this AI's reflexes are going to be insane.


No problem, glad to have helped!


Thank you so much for sharing this! I'm working on something similar right now (a framework to build game agents using computer vision tools) and I just went from capturing at 10-15fps with ImageGrabber, to 15-25fps with FFMpeg and finally 70-80 fps with this technique. Insane!


You're quite welcome! I used it to capture a single pixel for my Super Hexagon LED strip (https://www.stavros.io/posts/wifi-enabled-rgb-led-strip-cont...) and it works really well.


Really nice and can see why you needed the performance for this project. Funny that you mention Super Hexagon because it's the game I'm using for my POCs!


Oh cool, what are you doing with it? I was thinking of doing the same, I'm really interested in reading about it.


Is there a cross platform way to do this? I'd like to be able to do this on a Mac, but would prefer not to have to set up GTK (if it even works).




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: