ivanseidel / IAMDinosaur

🦄 An Artificial Inteligence to teach Google's Dinosaur to jump cactus
MIT License
2.8k stars 533 forks source link

No sensor value #11

Open Paic opened 8 years ago

Paic commented 8 years ago

Hi,

I cannot get the sensor to work ! Sometimes the value are changing, but it seems like there is a delay on the input, as you said in your video, but there is no screen recording or stuff like that going on.

Sometimes only the distance value is changing (still with a little delay), size and speed are stuck to 0.

I've tried different window size, platform (OS X, Windows), nothing. Could it be a problem with node / robotjs version ?

Edit: the "save genomes" button and the file tree cannot be focused too, something in the configuration of the terminal ?

PS: Sorry for my terrible english, it's not my native language

ivanseidel commented 8 years ago

Hi @Paic ,

Can you verify if the cursos is positioned in the window at the floor where the dinosaur stands, right after starting node program?

If that happens, and the position is right, then your sensor reading is taking too long.

If you are interested, RobotJS has a fork with a current version that will enables pixels to be stored, and then read (instead of reading each pixel separated). This speeds things up to 200x.

But things must be changed in the sensor part. Have you fixed it? Do you want to try to fix it?

Paic commented 8 years ago

Just after launching, it takes ~1 minute to find the game pos, then the mouse is positioned just where you said, at the floor where the dinosaur stands. My computer is pretty decent, so I don't think it's a hardware issue.

I've tried changing the interval of reading but it does not seems to speed up the process

I'm pretty interested in getting it to work, so if you could indicate me the fork name, I'll look into it.

Any idea about the UI not getting clicks event (they seems not in focus)

ivanseidel commented 8 years ago

Awesome!

Here is the lead to the implementation: https://gist.github.com/octalmage/1fe8c1ec2336ac3ba59a

Heres is the benchmarking; http://blog.robotjs.io/post/130786829733/getpixelcolor-vs-colorat

That should be changed in Scanner class: (https://github.com/ivanseidel/IAMDinosaur/blob/master/Scanner.js#L66-L99)

(I think that all calls are using this method, but we must check...)

Paic commented 8 years ago

I've tried changing the code to use the new system, but it seems there is an error in the RobotJS library itself.

colorAt() work for some time, then this error appears.

robotjs error

I will see with the RobotJS dev what can cause this

ivanseidel commented 8 years ago

Hi @Paic, you should post that to the RobotJS issue list! It must be important... Or you can try to dig inside the code and find out the solution...

If I had more time, I would help you. Sorry