Writing an AI: screen capture and input

I'm considering a pet project to write an AI for a simple game on Windows (C++/python preferred). Can you instruct me on what is the way to go for grabbing simple screen captures, so that I can do some very simple object recognition/find out what is such and such pixel color basically.

And also I'd need to manage input (moving mouse, click etc)? I'm mostly a linux guy, so I bet here I'd need to use some DirectX API to inject events?

Thanks


I once did that for breaking the record for Bejeweled Blitz. Turns out computers are much faster than all humans who don't use cheats.

Since the game I created a robot for was a flash game running inside a browser a few years ago, I only needed to use ordinary Win32 API calls to grab the screen content and to send mouse events.

You can start reading here a little bit about grabbing screen content, and here about simulating mouse input.

I think you'd be better off using .NET instead of C++. If you're really fond of Python, try IronPython, since it's .NET based, it'll make interfacing with the Windows APIs a lot easier.

链接地址: http://www.djcxy.com/p/81004.html

上一篇: 在Linux上进行屏幕截图的最快方法

下一篇: 编写一个AI:屏幕截图和输入