BizHawk
BizHawk copied to clipboard
Python support?
tl;dr for future humans: There is no change to Python scripting support, it's still not planned. You have the choice of Lua scripting or compiling C# to CIL which you then add into EmuHawk dynamically. That said, the community have created ways to use Python scripting with a C# shim.
On the subject of ML specifically, don't bother with Lua, either use ML.NET, or exfiltrate the data to something like TensorFlow (Python). There are a few ML hackers in the ApiHawk Discord server if you're interested in the latest and greatest.
Original inquiry follows.
Hello guys, I have a question about the emulator. I am trying to learn Machine Learning and want to apply it to video games, however I only know Python2.7 as a programming language and I was wondering if BizHawk will ever have Python scripting support in the near future?
Thanks.
Clearly not in the "near future". Dunno about "ever" - maybe?
@twoATOMS You might want to check out Nintaco (http://nintaco.com/api.html). It provides programmatic control using C, C#, Java, Lua and Python.
maybe first you may try Man Learning? maybe learn lua or something to begin with learning the machines lol
see also previous rejection of Python #707
Right, recently we had a talk, and if someone makes a PR, we'll most likely accept it.
To actually throw something on the table, here's the approach that looks very promising: http://tasvideos.org/Feos/CallingCSharpMethodsFromPython.html You expose the methods from C#, have a C# Python interpreter, and then Python scripts just call those methods dynamically. Bonus points if it can be done using the newly updated APIHawk.
It's not very hard to implement lua server, and connect to it from ANY language via sockets. Example for fceux emulator: https://github.com/spiiin/fceux_luaserver
Yeah, this dynamic approach should also allow any language with C# bindings to use those functions.
Clarification, the PythonNET module is a module for the python interpreter which allows for calling dynamic-exposed objects in C#.
Which means that in theory, you should be able to use any interpreter you want, as long as the interpreter can load aforementioned module.
+1 on Python websocket support for Machine Learning. Then with Dockerfile
will be great!
I will make an article for building this. Can anyone here guide me through this?
Several people have suggested and ML project using BizHawk, so I'm writing this out to save repeating myself: The easiest way to get memory access and playback controls is with an external tool. You could use Lua to bridge to another process, but it'll be slower. External tools need to be in C# (or, maybe, F# or VB). The library you'll use will probably be ML.NET what with Microsoft throwing money at it. For completeness, you could use C# instead of Lua to bridge to another process. ~~I imagine that even calling into C from C# would be slower than a pure C# solution.~~ edit: Less sure about this, especially if you're running under Mono.
I'm personally willing to help anyone with the implementation of an external tool (I don't know much about ML, sorry). So, @elcolie, if you know that it's going to be annoying and still want to try, I'm on IRC and Matrix.
Thank you @YoshiRulz I will learn the material and when I am ready I will contact you 🙏
Time to be annoying and necro a thread: https://github.com/magnusjjj/FakeControllerDesu
Rudimentary python support, at least for the restart function ;). I am looking for testers, to make sure that it's reasonably stable for other people to, well, I guess toy with.