How to use Python to make Minecraft Java Deep Learning bots - python

Okay I have an idea that make be theoretical. I was looking at this paper, and I saw that they used something called Malmo to interact with Minecraft. I took a quick look at this and I saw this was a offline thing. I want to make a program to directly interact with Minecraft Java. I thought about using some library to read pixel data and using the keyboard library for input. This would work of course but I want to also fetch things like player position, inventory, and other things. I would ideally want this to work client side. So my final question is how would I be able to test neural network Minecraft bots with python on pure Minecraft Java? Would I need to make a Forge or Fabric client?

I don't think this is possible in Python but maybe in JavaScript/ Node.js with a library called Mineflayer. you can't directly send keystrokes and mouse input from Python because Minecraft will receive it as a digital input and simply won't respond properly. here is the Mineflayer Github where you can find how to use it and various addons to MineFlayer such as MineFlayer-pathfinder or MineFlayer-navigate.

Related

Demo a CLI program without a notebook

A client has asked that I put together a Python program to demonstrate some core concepts of a possible ML app. We agreed I would make a CLI for now just to show how it would work and later we would make a web interface.
I wrote up a proposal and he read it and agreed. I'm now 100% done with this project and would like to collection the 2nd 1/2 of the payment.
Originally he said a video of the functionality was fine, now he is saying it's not and he wants to 'play with it'.
I don't want to give him the code, and I really don't want to do any more work for this client until he pays the rest of the money.
Here's my question: Is there a way to publish a Python CLI online without:
Doing a lot more work (like making a web interface).
Exposing the source code.
If he had to SSH into somewhere that might work.

Right tools to make a GUI / web interface app

What I want to create is a music player that can interact with YouTube using its Data API.
I actually have already developed my application (only for Windows, multi-platform is not a priority at the moment) using AutoIt and it's working properly. For now I createad a GUI to simply execute mpv.io, send commands to it and get its STDOUT to manage informations/errors.
Now I wanted to create a web interface to control this application using my smartphone in particular. I tried to look into TCP implementation and also WebSockets to send real time information like the playback position, but I'm not too sure what to look into.
As you probably can understand, I don't have much experience especially in network stuff so a help would be much appreciated. In the past I've fiddled with HTML,CSS,JavaScript so the web interface should not be a problem but for the communication part I don't have many ideas.
Since I created some very basic application with Python in the past, someone already suggested me to use a web framework like Flask, and so I started to properly learn Python but I find difficulties with GUIs...
So, to do a little summary I'm currently asking what can be a proper method to develop this application, also starting from scratch and changing programming language, since I'm always open to learn something new.

How do python scripts work?

I just learned how to read and send emails using python and I read that you can create a python script that can read someone's twitter or facebook and send you an email whenever a specific person posts something on twitter or facebook, but how does this work?
What is the difference between a script and just a regular program? I don't think that if someone is doing something like this that they would need to have their computer on at all times and have the python program running in the background, or is that what is happening?
A python script is a kind of program.
To make what you're talking about, you'd need to either have some kind of notification when someone tweets or something to check constantly for new content.
Either way, the computer will have to be on at all times (for that, you could use a Raspberry Pi for example, so you don't take that much power). (EDIT : you can of course also have a server doing that for you, but it's still a computer running at all times.)
You'll need to get your hand onto the Twitter API documentation. There is probably a python wrapper.
(EDIT:Tweepy - Would be the aforementioned python wrapper)

Dim a display with a raspberry

I'm using the Pi3 and the last jessie-lite OS, and I want to manage the brightness of the screen like Kodi does with the dim screensaver.
After some google searching I found some tips but nothing works.
I'll be using an external light sensor and I want to manage the brightness proportionally at the value sent by the light sensor.
For the moment, I develop in Python2.7 but the issue can use another language or by shell.
Thank you very much!
ideally what you want would have been for the Kodi json api to support setting the screensaver, from what I understand it doesn't.
that said if your familiar with Python, and I'm not, you can develop a plug in that opens a socket (or communicates otherwise) with your program running on your pi, because from what I understand plugins have the ability to set the screensaver.
in other words, make a plug in that sends and receives message to and from the pi.
this is not really an answer because im not familiar with creating Kodi plugins, but I know it's possible because there are other plugins that do it...

Can I "embed" a Python back-end in an AIR application?

I'm trying to find out if there is a way I could embed a Python back-end into an AIR application? I'm looking to employ an approach similar to the one outlined here to implement the business logic for my application, but additionally, I would like to provide the user with a single binary which they can load. I don't want the user to have to fire up a seperate server process to make this work. Is this possible in some way or am I out of luck?
You cannot embed your Python server in an AIR application. So basically you are out of luck.
The simplest solution probably is to run a server on a central location that all your users can connect to from their AIR apps. That means that all/most of the data will be on your server, and not on the users computer, I don't know if that is a big issue but I guess it is.
Also depending on your target systems you could create the program you want yourself without (fully) depending on AIR. You can generate executables for windows and osx from Flash CS3/4 or you can use a special (commercial) executable-maker that provides some more functionality. Wrapping this exe and your python program in a meta-executable that launches both should be possible with some work. Of course you won't have the benefits if the AIR installer etc in this case.
OK, so since it didn't seem possible to go that way around, I came up with an alternative that seems to work for what I want.
Instead of trying to embed Python inside AIR, I've gone the other way around: I'm building my Python code into a stand-alone executable using PyInstaller and bundling the AIR application as a resource. The Python code then starts up it's webserver and fires off the AIR app which can then connect to the (local) remote services as required.
Probably. We are using a J2EE server side which uses SOAP webservices to talk to our AIR application on the frontend. You should be able to do the same because soap doesn't care which technology sits on either side of it.
You can always have the application launch from a single binary which first fires up the server, then the client, if both are expected to sit on the users system. Also it gives you flexibility to have a more service oriented model later, if you want to. Without knowing what your app does, it is hard to know if that makes sense or not.
For setting up the python side of SOAP webservices, here's a useful link to a diveintopython article. Then, if you have your server running with the wsdl, FlexBuilder can generate the AIR side of the webservices for you.

Categories