Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
new library for communicating with other programs via Lua #1080
A library which allows easier communication between Emuhawk and other programs via Lua
All new functions are written in C# and exposed in Lua.
All Lua functions have "unit tests".
New Lua functions
Run EmuHawk.exe from the command line
Fantastic job!!! Thanks a lot! Probably netplay will ever become possible with all these functions.
Why do the socket functions start from a capital letter though? What do you think of making them, for example,
Netplay is VERY complicated, it has so much to be done to make everything perfect, no emulator has perfect netplay so far. Here's the detailed break down, to give you some insight:
EDIT: Sorry, wrong button.
This is great. I'm going to merge it, but here's my feedback
Mar 13, 2018
1 check passed
Thanks @zeromus for resolving the conflicts!
I'll start working on the suggested changes when I find some time. 1 and 2 should be probably doable but 3 would require some more input from other developers because it will surely break some other workflows.
Well, nobody's using this feature yet but you, so it won't break anyone's workflow but yours. It's up to you. But I can tell you, from my perspective, there is a high level of interest in doing AI things with bizhawk that take a bunch of horsepower. Supporting multiple compute nodes (maybe even have some kind of workload manager done in lua or c#) would probably be useful to many people, even if it was a very canned solution, and could unlock a lot of interesting things.
I'm giving you commit permissions which you're free to use to iterate on your communication framework in this repository directly. Please see us on IRC at #bizhawk before tackling any other topics.
I tried that, HTTP Unit test and MMF test all work fine (i changed the order in PyEmuHawk.py to get any output):
but the socket test throws the following error:
Interestingly i didnt select NLua in options, i selected Lua+LuaInterface yet it throws NLua exceptions?
When i change to NLua it throws the following:
I am Using Python 3.6, running Windows 10 and i used the latest developer build released about 2h ago. same errors when i use the latest stable build :( should i try installing Python 3.6 instead? i manage to get a socket connection when using the lua socket library but i want to use the socketServerScreenshot function
EDIT: i also tried the release where the feature was initially implemented, same results sadly...
Did you get the same error with the other Lua socket functions or just with the screenshot function? Did you load any roms? I don't think it is a Python version issue, looks more like a problem in the Emuhawk code.…
On Sun, Feb 24, 2019, 22:05 Janu ***@***.***> wrote: I am Using Python 3.6, running Windows 10 and i used the latest developer build released about 2h ago. same errors when i use the latest stable build :( should i try installing Python 3.6 instead? i manage to get a socket connection when using the lua socket library but i want to use the socketServerScreenshot function — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1080 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AOXv6HNNlgxPBRSVuxdlVZ4ygYwRfiBRks5vQv6VgaJpZM4RLyhZ> .
When i try console.log(socketServerSend("test")) instead, it prints "Sent : -1 bytes" and the socket server is stuck at "waiting for connection". i did indeed load a rom, to be exact, "F1 World Grand Prix (U)" for the N64. i tried running the script while no rom is loaded and i get the same results
I like the idea of communicating from Lua to other programs but is there currently a way to send data from f.e a python server to Lua?I tried the luasocket extention before to create a server on the Lua side but there seems to be a problem with the socket core dll. It would be nice to have a way to control the emulator with a python script.
@yannickbrandt : Yes, the Lua communications module supports it. You can send data from a Lua script in Emuhawk to a Python server and receive data coming from a Python (or any other) server.
e.g. in Lua the following command would take a screenshot, send it to the socket server and wait for a response:
or just to send string
The Lua scripts in this commit (e.g. https://raw.githubusercontent.com/TASVideos/BizHawk/4d063f6061542921e66e8aeb23426d501fa0a7e1/Assets/Lua/UnitTests/TestCommunication_All.lua) and https://github.com/Ashafix/PyEmuHawk/blob/master/PyEmuhawk.py give some examples of how it could be done.
@yannickbrandt : The way the PyEmuhawk is currently set-up it looks for the last byte of an image or a windows line feed
Hope that helps a little bit!
Try the following steps: