It is currently Wed Dec 13, 2017 6:19 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Apr 19, 2016 4:49 pm 
Offline

Joined: Tue Apr 19, 2016 4:45 pm
Posts: 2
Hi. I was hoping to try my hand at writing a machine learning bot to play through Super Mario Bros (sort of what SethBling did in his popular video: https://www.youtube.com/watch?v=qv6UVOQ0F44). To do that I need an emulator that has some sort of API that I can access (preferrably C, C++ or Python) to read memory, send input, and control emulation start/pause.

I was looking into BizHawk but it only seems to have Lua support, and I'm totally unfamiliar with the language. I would prefer to work with Python or C or C++. Are there any other emulators our there that have this API I am looking for? Thanks!


Top
 Profile  
 
PostPosted: Tue Apr 19, 2016 4:59 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5893
Location: Canada
FCEUX also has Lua support.

If you want a C++ interface to an emulator, though, why not just get the source code and work with that?


Top
 Profile  
 
PostPosted: Tue Apr 19, 2016 7:32 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
If you can code in C and/or C++, you can code in Lua. The learning curve will not be steep. It's one of a very few number of "recent-ish" programming languages which I actually like and endorse for that exact reason (in addition to it's incredibly small footprint). If you prefer books on PLs, I can personally recommend Programming in Lua by Roberto Ierusalimschy. Other Lua books are so-so compared to this, IMO.

Otherwise, I second rainwarrior's recommendation/question. There are a ridiculous number of NES emulators you could tinker with. There won't be an "API" in most cases though, at least not in the way (I think) you mean; in other words, you get to reverse-engineer the code and modify it to do what you want/need.


Top
 Profile  
 
PostPosted: Wed Apr 20, 2016 7:25 am 
Offline

Joined: Tue Apr 19, 2016 4:45 pm
Posts: 2
Thanks for the suggestions, I've actually been looking into the fceux source code to see if I can put together a more or less nice interface to do what I want. I am very unwilling to use Lua because is slow and not really suited to what I want to do. I would very much rather just program in C++


Top
 Profile  
 
PostPosted: Wed Apr 20, 2016 8:51 am 
Offline

Joined: Sun Mar 27, 2011 10:49 am
Posts: 219
Location: NYC
If you're concerned about speed your desire to use Python over Lua makes exactly zero sense; Lua is in the same general performance class as Python.

Also, if the issue is speed, and you really want to use C/C++, you can write your core logic in it and use Lua to glue it to an emulator with an existing scripting interface. Lua's C interface is incredibly simple; the language was designed to be glue.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group