I'm new to programming in blender game engine. I want to investigate the Q-learning AI using blender game engine. For this purpose I want to make 3d pong. It will look something like this:
The game will contain two boards and one ball. I want to capture data from two cameras and feed it into the Convolutional network and find an optimal actions (Q-values) according them:
I was faced with the problem of obtaining images from cameras in blender game engine. Can anyone help me with this?
Ideally I need transform images to arrays and transfer data using sockets. But, as a last resort, I'll be happy with the option of saving images into folders.
I will not satisfied with the screenshots, using bge.render.makeScreenshot(filename), because I need multiple cameras.
If I succeed in this, I promise to make a tutorial in Youtube about it and share all source files ;)
ADDITION: I've tried to use script from this link:
from bge import logic, render camList = logic.getCurrentScene().cameras cont = logic.getCurrentController() own = cont.owner cam1 = camList['Camera_LEFT'] cam2 = camList['Camera_RIGHT'] width = render.getWindowWidth() height = render.getWindowHeight() cam1.setViewport(0, 0, int(width/2), height) cam2.setViewport(int(width/2), 0, width, height) cam1.useViewport = True cam2.useViewport = True folder = '//image-#.png' render.makeScreenshot(folder)
It gives me right view in viewport:
But, screenshot in my directory is still from 3d view (((: