Post subject: Simulation on BizHawk
Joined: 3/28/2016
Posts: 2
Hello! Been looking around this forum for a little while now. Now I'm making a post, hoping someone perhaps has some tips. Me and a small group are making a project for a course on Evolutionary Algorithms, where we basically want to develop an agent that can run a game. (Think MarI/O) To evolve this, you'd have to run MANY generations of attempts. What would be the fastest way of doing this? We're planning on doing the whole thing in Lua. I see that you can speed up the emulator, and that you can turn off stuff like display and sound. Can we do more? Thank you!
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
lua is not the fastest way to do anything. you could do more by choosing a game and platform which can be emulated at light speed (nes or gameboy using quicknes or gambatte for instance) and then going back to the original c++ sources and hacking them up. just by getting bizhawk out of the equation you could speed up by 50% at least I would guess. By further hacking the emulator (removing or conditionally bypassing all rendering logic and disabling the sound generation) you could speed up by a few times more. You should be able to run 100x faster than mari/o at least.
Joined: 3/28/2016
Posts: 2
Thanks for the response. We are not planning on using any SNES games though, because of the same reason. (speed) We are more likely to use a NES game. Sadly, while hacking the emulator is a good idea, it's kinda out of the scope of our project, time wise.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
Whatever you say. It isn't very hard. Guess you only need A FEW generations. I told you how to get MANY.
Skilled player (1741)
Joined: 9/17/2009
Posts: 4981
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Well, I'm reminded of this:
Most input was generated by writing essentially a Java port of the game which simulates most aspects of the game's logic and uses a bot strategy to solve it and spit out a BizHawk movie (technical details at bottom, for those interested). Looks like BizHawk didn't like when I attempted to enter a re-record total of approx 1.3 trillion, but that is my estimate of the number of frames simulated making this...give or take several hundred billion. :)
From the Atari River Raid TAS. I'm not sure how feasible it may be for whatever game idea you have, but at least this means most "unnecessary" things like graphics, sound, etc are all ignored. (Maybe)
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
To be fair, if you go the mod-an-emulator route, you will have to put some kind of user interface on it. With bizhawk at least you do get some automatic UI. What I'd do is take a look at the bizhawk quicknes core and put your logic entirely in there. like add an api called "do_custom_simulation_logic()". That could run 1000s of frames and take 1000s of savestates before returning. Then bizhawk could display the frame it's on as usual, and you can add visualization in lua. (the work to remove rendering (harder) and audio (easier) would be an additional step)