It is currently Mon Dec 18, 2017 3:34 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: NES Emulator API
PostPosted: Fri Jan 29, 2016 8:45 am 
Offline

Joined: Fri Jan 29, 2016 8:43 am
Posts: 2
Hi!

I was wondering if there was an existing NES emulator with an API exposed that could be called by an external Python program. I’m interested in writing a Python app to try and automatically play an NES game for me (probably Dragon Warrior 1 to start with). I realize this is possible in LUA, but I wanted to use this as a chance to learn Python. I’ve done a fair amount of programming before, but not much where I have to inter-operate with other programs.

If worst comes to worst, I know I can brute-force this with ReadProcessMemory and sending keyboard events, but I was wondering if there was a better option. I’m not looking for anything complex -- just something to let me programmatically read/write memory, press controller buttons, change emulator speed, etc.

Any help is appreciated, and thank you very much!


Top
 Profile  
 
 Post subject: Re: NES Emulator API
PostPosted: Fri Jan 29, 2016 9:09 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19357
Location: NE Indiana, USA (NTSC)
I'm told the NESICIDE emulator has an API, and you could manipulate it with ctypes or cffi.


Top
 Profile  
 
 Post subject: Re: NES Emulator API
PostPosted: Fri Jan 29, 2016 10:15 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 754
Location: New York, NY
FCEUX only supports Lua. However, it is possible to write a small Lua-handler that will enable programs written in any language to communicate with it via a socket connection. A simple RPC protocol could be developed to make remote access straightforward. And, if it's all running within the same box, the overhead should be minimal. In fact, depending on your intentions, it may actually run faster than embedded Lua since the external program could run in parallel with the emulator instead of having to wait for frame rendering to complete for some free execution cycles.


Top
 Profile  
 
 Post subject: Re: NES Emulator API
PostPosted: Fri Jan 29, 2016 10:41 am 
Offline

Joined: Fri Jan 29, 2016 8:43 am
Posts: 2
Tepples -- Thank you very much! I'll definitely check this emulator out. It looks like the Wiki is down at the moment, but it sounds promising!

ZeroOne -- This sounds like it'd be the best possible approach, but I have zero background in socket programming or LUA. How hard do you think it'd be for me to tackle, given those constraints?


Top
 Profile  
 
 Post subject: Re: NES Emulator API
PostPosted: Fri Jan 29, 2016 10:55 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 754
Location: New York, NY
Netbrian wrote:
ZeroOne -- This sounds like it'd be the best possible approach, but I have zero background in socket programming or LUA. How hard do you think it'd be for me to tackle, given those constraints?


You can pick up the basics of Lua in just a few hours. See this tutorial.

If you know how to read and write to files on disk, then you can probably handle sockets in Python and sockets in Lua.


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