View unanswered posts | View active topics It is currently Tue Sep 17, 2019 2:58 am



Reply to topic  [ 13 posts ] 
Write a Bot/AI that can play SNES 
Author Message
Rookie

Joined: Sat Mar 20, 2010 5:27 am
Posts: 19
Reply with quote
Post Write a Bot/AI that can play SNES
Hi,

i am interessting if anything like that has been tried before, search came up with no results :(

Is there any know method to read the game state out of ZSNES?

Per Example we want the AI to play Tetris. How can we get the position of each block?
Best option would be to directly read it out of the memory, but where?
Sending input to ZSNES is not that hard.


Thu Jan 19, 2012 3:25 pm
Profile
ZSNES Shake Shake Prinny
User avatar

Joined: Wed Jul 28, 2004 4:15 pm
Posts: 5615
Location: PAL50, dood !
Reply with quote
Post Re: Write a Bot/AI that can play SNES
SNES9x has lua scripting support that lets you do something like that. ZSNES currently has no support for it.
As to writing the bot itself, it's game-dependant. If noone already did the work for you, you'll have to read the game code yourself to see what's where and so on.

_________________
皆黙って俺について来い!!
Code:
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)

Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54


Thu Jan 19, 2012 8:28 pm
Profile
Rookie

Joined: Sat Mar 20, 2010 5:27 am
Posts: 19
Reply with quote
Post Re: Write a Bot/AI that can play SNES
ah ok thats good news! thank you ;)

what i found so far:

http://tasvideos.org/forum/viewtopic.php?t=6539 Snex9X v1.43+ v11 beta + lua 0.06
http://dehacked.2y.net/snes9x-lua.html function library for Snex9X
should me get starting ;)

but is there a unix version with lua? or best multi platform?


Thu Jan 19, 2012 9:32 pm
Profile
Rookie
User avatar

Joined: Sun Aug 05, 2007 9:18 pm
Posts: 21
Location: Argentina
Reply with quote
Post Re: Write a Bot/AI that can play SNES
bugger wrote:
http://tasvideos.org/forum/viewtopic.php?t=6539 Snex9X v1.43+ v11 beta + lua 0.06
http://dehacked.2y.net/snes9x-lua.html function library for Snex9X

That version is really, really old. Get it from here instead: http://code.google.com/p/snes9x-rr/

You may want to read this too: http://code.google.com/p/snes9x-rr/wiki ... gFunctions


Fri Jan 20, 2012 4:48 am
Profile WWW
Zealot
User avatar

Joined: Sat Jul 02, 2005 2:01 am
Posts: 1076
Reply with quote
Post Re: Write a Bot/AI that can play SNES
Wouldn't you want an AI to visually inspect the screen?

_________________
Maybe these people were born without that part of their brain that lets you try different things to see if they work better. --Retsupurae


Fri Jan 20, 2012 11:01 am
Profile WWW
Official tech support dood

Joined: Wed Jan 25, 2006 7:57 am
Posts: 2086
Reply with quote
Post Re: Write a Bot/AI that can play SNES
bugger wrote:
Best option would be to directly read it out of the memory
OP said it best.

_________________
Why yes, my shift key *IS* broken.


Fri Jan 20, 2012 2:46 pm
Profile
ZSNES Shake Shake Prinny
User avatar

Joined: Wed Jul 28, 2004 4:15 pm
Posts: 5615
Location: PAL50, dood !
Reply with quote
Post Re: Write a Bot/AI that can play SNES
paulguy wrote:
Wouldn't you want an AI to visually inspect the screen?

Clunky and slow as hell, and will still require game-specific code. If you have to do some custom source reading, better work on the internal arrays representing the layouts, not their video result (guaranteed horror to work with).

_________________
皆黙って俺について来い!!
Code:
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)

Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54


Sat Jan 21, 2012 11:00 am
Profile
Zealot
User avatar

Joined: Sat Jul 02, 2005 2:01 am
Posts: 1076
Reply with quote
Post Re: Write a Bot/AI that can play SNES
That's true, I just think that if you're making an AI for a specific game, it would be interesting to try to figure it out visually, as a human wouldd do.

If one is to write a bot for tetris, though, why build off of an emulatedd version? May as well work off an open source tetris source. Maybe take one that could use a vs computer mode and add an AI to that.

_________________
Maybe these people were born without that part of their brain that lets you try different things to see if they work better. --Retsupurae


Sat Jan 21, 2012 12:27 pm
Profile WWW
Starzinger Addict
User avatar

Joined: Tue Aug 17, 2004 1:14 pm
Posts: 998
Location: Sweden
Reply with quote
Post Re: Write a Bot/AI that can play SNES
Relevant

_________________
- Oskar's chiptunes -


Sat Jan 21, 2012 1:48 pm
Profile WWW
Rookie

Joined: Sat Mar 20, 2010 5:27 am
Posts: 19
Reply with quote
Post Re: Write a Bot/AI that can play SNES
mz wrote:
bugger wrote:
http://tasvideos.org/forum/viewtopic.php?t=6539 Snex9X v1.43+ v11 beta + lua 0.06
http://dehacked.2y.net/snes9x-lua.html function library for Snex9X

That version is really, really old. Get it from here instead: http://code.google.com/p/snes9x-rr/

You may want to read this too: http://code.google.com/p/snes9x-rr/wiki ... gFunctions


yeah :) thats good! thanks mz

Lets see if i get anything done.
Gonna let u guys know, thx so far!


Sat Jan 21, 2012 3:07 pm
Profile
Zealot
User avatar

Joined: Sat Jul 02, 2005 2:01 am
Posts: 1076
Reply with quote
Post Re: Write a Bot/AI that can play SNES
Johan_H wrote:

I had the live wallpaper on my phone for that one. It killed my battery pretty good, though.

_________________
Maybe these people were born without that part of their brain that lets you try different things to see if they work better. --Retsupurae


Sun Jan 22, 2012 1:36 am
Profile WWW
Rookie

Joined: Sat Mar 20, 2010 5:27 am
Posts: 19
Reply with quote
Post Re: Write a Bot/AI that can play SNES
Quote:
Whats the easiest way to analyze the memory?
I tried Cheat Engine... Opened the snes9x.exe and looked at RAM addresses 0x7e0000-0x7fffff but only zeros :(


ok snes9x has a ram watcher ;) pretty nice! but somehow snes9x crashes sometimes really annoying...
The OS (Windows 7) protects the memory from being read by other processes?!. ;(


Last edited by bugger on Tue Jan 24, 2012 11:33 pm, edited 3 times in total.



Tue Jan 24, 2012 10:22 pm
Profile
Rookie

Joined: Sat Mar 20, 2010 5:27 am
Posts: 19
Reply with quote
Post Re: Write a Bot/AI that can play SNES
Also is there a way to open snex9x with some parameters that it runs the game and loads saved game state in slot 1?!


Tue Jan 24, 2012 10:24 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.