1 2
8 9
Editor
Joined: 3/31/2010
Posts: 1466
Location: Not playing Puyo Tetris
Since MarI/O is using BizHawk, and we will get questions about it, this thread is meant to be a catch-all thread for issues.
Mothrayas wrote:
Please use pastebin or something similar to link to your scripts instead of pasting whole near-thousand-line scripts. You are making topics practically unreadable otherwise.
FAQ and Common Problems: Q: Why does the script say, "Loadstate error" constantly? A1: This is due to how the script asks for the path. Your savestate should be in the same folder as the BizHawk exe file. A2: The save state from the prepackaged archive is meant for the Performance Core of BSNES not the Compatibility core. A future version of BizHawk will notify you more clearly on this issue. Please make sure your save state is for the right core. Q: Where can I get the Emulator and other files? A: http://fceux.com/mario-evolve.zip Q: How do I run this? A: http://pastebin.com/NbeiibxT Q: I get the error message: "LuaInterface.LuaScriptException: [string "main"]:829: A .NET exception occured in user-code" How do I fix this? A: Use BizHawk 1.10.0 http://sourceforge.net/projects/bizhawk/files/BizHawk/BizHawk-1.10.0.zip/download Q: My RAM Usage is out of control! A: This has been corrected in 1.10.0 of BizHawk. Q: When I try and run the script I get a message about "Value cannot be null" and it mentions BitmapBuffer. A: This is due to you running BizHawk in GDI+ mode. Q: How do I get BizHawk into OpenGL Mode? A: Start BizHawk. Go to Config then Click on Display. Display Configuration should appear. Select the Display Mode Tab. Click on the Circle that says OpenGL and restart BizHawk. Q: I did try and get BizHawk into OpenGL mode but it reverted back to GDI+. What's wrong? A: Your video card doesn't support OpenGL 2.0 That means your video card needs newer drivers or you need a better video card. If you are trying to run BizHawk in a Virtual Machine, Some Virtual Machines do not support OpenGL 2.0
When TAS does Quake 1, SDA will declare war. The Prince doth arrive he doth please.
Post subject: Re: MarI/O thread
Arie2002
He/Him
Joined: 1/4/2015
Posts: 7
hegyak wrote:
Since MarI/O is using BizHawk, and we will get questions about it, this thread is meant to be a catch-all thread for issues. FAQ and Common Problems: Q: Why does the script say, "Loadstate error" constantly? A: This is due to how the script asks for the path. Your savestate should be in the same folder as the BizHawk exe file.
New question: I get an error when I try to load a backup.
LuaInterface.LuaScriptException: C:\Users\User\Desktop\neatEvolve\neatevolve.lua:1054: attempt to index local 'file' (a nil value)
(I think this is the best topic to ask this question?)
Post subject: Re: MarI/O thread
Amaraticando
It/Its
Editor, Player (159)
Joined: 1/10/2012
Posts: 673
Location: Brazil
Arie2002 wrote:
New question: I get an error when I try to load a backup.
LuaInterface.LuaScriptException: C:\Users\User\Desktop\neatEvolve\neatevolve.lua:1054: attempt to index local 'file' (a nil value)
(I think this is the best topic to ask this question?)
This happens because the file from line 1099 doesn't exist/can't be opened.
Editor, Expert player (2072)
Joined: 6/15/2005
Posts: 3282
For reference: MarI/O is a neural network/genetic algorithm program that completes a Super Mario World level, even when given nothing more than the location of objects within the level and how far Mario is to the right. Youtube video: https://www.youtube.com/watch?v=qv6UVOQ0F44
Amaraticando
It/Its
Editor, Player (159)
Joined: 1/10/2012
Posts: 673
Location: Brazil
I wrote a small tutorial for those having problem with MarI/O bot. http://pastebin.com/NbeiibxT
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
This zip is 100% ready-to-go http://fceux.com/mario-evolve.zip
Joined: 6/14/2015
Posts: 19
deleted post - new bizhawk version fixed the problem
Joined: 6/14/2015
Posts: 19
ok zeromus. yours works fine. so I just copied over your DPI.state file and it works. So for my own education, how can I figure out why I could not save a DPI.state file? or even get to a condition when I could save a working one? If I remove the DPI.state file from your mario-evolve folder, I reproduce my problem-the script will not start and hitting restart gives an 829 dot net error.
Amaraticando
It/Its
Editor, Player (159)
Joined: 1/10/2012
Posts: 673
Location: Brazil
skypickle wrote:
OK, I can start the MarIO script and get a dialog window named Fitness. When I hit the restart btn, I get an 'unhandled exception' A .Net exception occured in user code' LuaInterface.LuaScriptException: [string "main"]:829: A .NET exception occured in user-code
The same as before: there's no 'DP1.state' file in the same folder of the script. By the way, while testing, I saw that if you get an error and then fix the conditions that cause this error, then restarting the emulator isn't enough. So, I had to restart BizHawk. EDIT: even so, clicking on "restart" is causing problems, but the bot is working.
Editor
Joined: 3/31/2010
Posts: 1466
Location: Not playing Puyo Tetris
skypickle wrote:
OK, I can start the MarIO script and get a dialog window named Fitness. When I hit the restart btn, I get an 'unhandled exception' A .Net exception occured in user code' LuaInterface.LuaScriptException: [string "main"]:829: A .NET exception occured in user-code
This will be fixed in Version 1.10.0
When TAS does Quake 1, SDA will declare war. The Prince doth arrive he doth please.
Joined: 6/14/2015
Posts: 19
ok, leaving aside this bug with DPI.state, maybe someone can explain what DPI.state.pool is? Also, as the sim proceeds, I am accumulating multiple files in the root dir that are backup.0.DP1.state.pool, backup.1.DP1.state.pool, backup.3.DP1.state.pool, etc. They gradually increase in size and the time separation between them also increases. I tried renaming one of them to DP1.state to use it as a 'savegame' file to reinitiate the sim from that point-but that did not work. Loading the unaltered filename(backup.3.DP1.state.pool) restores the game but not to the most recent state-just the state the sim was in when the file was written. However if i click save, a new DP1.state gets written (newer time stamp ). Reloading THAT file gets me to the most recent state. What determines when the pool files are written? Also, when Mario frees Yoshi (by bumping into the cube that holds him) a dialog pops up thanking MArio for freeing him. This causes a delay which the script interprets as a failure and it restarts with the next iteration. The script needs to be tweaked to allow for these delays.
Joined: 6/14/2015
Posts: 19
hegyak wrote:
skypickle wrote:
OK, I can start the MarIO script and get a dialog window named Fitness. When I hit the restart btn, I get an 'unhandled exception' A .Net exception occured in user code' LuaInterface.LuaScriptException: [string "main"]:829: A .NET exception occured in user-code
This will be fixed in Version 1.10.0
Do you have any suggestions for how I can figure out why MY system is misbehaving? Clearly, some people can run evolve.lua without difficulty and save a DP1.state file. I am running Win 7 Pro 64 bit with .NET 4.5.2
Amaraticando
It/Its
Editor, Player (159)
Joined: 1/10/2012
Posts: 673
Location: Brazil
Well, those are questions that only SethBling can answer for now, because no one here has read the whole script carefully (I guess). The Yoshi thing in an imperfection. And some levels require waiting for a platform or a layer, so the bot won't be able to complete them.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
file > savestate > save named state > c:\mario-evolve\dpi.state where c:\mario-evolve contains evolve.lua how much experience do you have with emulators? The .state is a savestate file. You make it the same way you make any savestate, and the evolve script starts from there.
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
Amaraticando wrote:
Well, those are questions that only SethBling can answer for now, because no one here has read the whole script carefully (I guess). The Yoshi thing in an imperfection. And some levels require waiting for a platform or a layer, so the bot won't be able to complete them.
If the fitness condition is "distance traveled rightward", then vertical levels would also be an issue.
Adventures in Lua When did I get a vest?
Editor
Joined: 3/10/2010
Posts: 899
Location: Sweden
I did some tweaks on the code: http://pastebin.com/juRnkyEf
  • No support for SMB, only SMW, so all the filename checks are gone.
  • Path for where the files should go.
  • Expose mario's speed and a few more state details as inputs
  • Expose the actual id of the tiles and objects
MOD EDIT: Pastebinned lengthy code segment. -Mothrayas
Active player (475)
Joined: 2/1/2014
Posts: 928
Does the lua script from the original look at P-speed and use the genomes that received both best fitness and best speed?
Editor
Joined: 3/10/2010
Posts: 899
Location: Sweden
local fitness = rightmost - pool.currentFrame / 2
Nah, it just checks the consumed time.
Post subject: Custom Modifications
F9Alejandro
He/Him
Joined: 6/15/2015
Posts: 2
Location: Robot Mind
I have 2 modified versions of MarI/O, One that has a restart/death counter and is saved to the pool data, and one that only shows it and doesn't save it. Death/Restart data saved to pool file: http://pastebin.com/1G5mNyN6 Death/Restart not saved only shown: http://pastebin.com/0N7CicT8 The modification that saves the amount of deaths/restarts will not be able to load the default pool files created by the unmodified version of marI/O, however the modified version that just shows graphically from when the code has started can load the pool data without a problem. How ever if you do get a problem follow the below information. If there are any problems with the usage of this code please pm me with the stacktrace, and I will be sure to reply with a fix. MOD EDIT: Pastebinned lengthy code segments. -Mothrayas
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
omg use pastebin or something
Active player (475)
Joined: 2/1/2014
Posts: 928
zeromus wrote:
omg use pastebin or something
haha yeah that would be preferred. By the way, Donut Plains 4 was cancelled, it almost got to the first checkpoint but it was past a tall pipe which you need to jump on the floating platform that has a guy on it throwing hammers at you.
Noxxa
They/Them
Moderator, Expert player (4108)
Joined: 8/14/2009
Posts: 4089
Location: The Netherlands
I pastebinned all the long code posts. Please use pastebin or something similar to link to your scripts instead of pasting whole near-thousand-line scripts. You are making topics practically unreadable otherwise.
http://www.youtube.com/Noxxa <dwangoAC> This is a TAS (...). Not suitable for all audiences. May cause undesirable side-effects. May contain emulator abuse. Emulator may be abusive. This product contains glitches known to the state of California to cause egg defects. <Masterjun> I'm just a guy arranging bits in a sequence which could potentially amuse other people looking at these bits <adelikat> In Oregon Trail, I sacrificed my own family to save time. In Star trek, I killed helpless comrades in escape pods to save time. Here, I kill my allies to save time. I think I need help.
Joined: 6/14/2015
Posts: 19
@Henke trying to learn from your code. 1) TimeoutConstant=20 (line 41) Is that 20 millisec? It seems the game waits longer than that when Mario is against a wall or just stopped. More like3 sec. Obviously I am missing something. 2) What is going on in this loop (line 532 in your code)
 for s = 1,#pool.species do 
      local species = pool.species[s] 
      for g = 1,#species.genomes do 
         table.insert(global, species.genomes[g]) 
      end 
I do not understand the syntax of using the number sign in a for loop. Why not use getn function? This discussion about the '#' suggests there is more depth to the choice of using this syntax: https://stackoverflow.com/questions/2705793/how-to-get-number-of-entries-in-a-lua-table Do you have any words of wisdom? 3) I am wondering what you did to the mutate genome function. see pastebin for relevant code http://pastebin.com/raw.php?i=WtZa1Jc3 You both start by randomly picking a hi or lo mutation rate. The original looks in the array genome.mutationRates and randomly either enables or disables a property. His syntax is curious- he uses a while loop that is designed to only execute once. Why bother with a while loop and a local p variable? Your syntax is even more confusing. What does this do:
if math.random() <genome> 0
and then why are there a bunch of sequential if statements? and finally you set p to a negative number though it isnt used?
Amaraticando
It/Its
Editor, Player (159)
Joined: 1/10/2012
Posts: 673
Location: Brazil
MarI/O bot partially adapted for the Snes9x rerecording emulator. Test it yourself! http://pastebin.com/YbL3zGd1 Start it slightly before Mario can move in a level.
1) TimeoutConstant=20 (line 41) Is that 20 millisec? It seems the game waits longer than that when Mario is against a wall or just stopped. More like3 sec. Obviously I am missing something.
Seems more like a number of frames, the decrements itself when Mario is not advancing.
I do not understand the syntax of using the number sign in a for loop. Why not use getn function? This discussion about the '#' suggests there is more depth to the choice of using this syntax: https://stackoverflow.com/questions/2705793/how-to-get-number-of-entries-in-a-lua-table
If this table is an array, the # is enough to get the size. In other cases, one would need to iterate over the whole table.
Editor
Joined: 3/10/2010
Posts: 899
Location: Sweden
I did not touch the actual evolution code. I don't like LUA and in fact dislike it even more after my experiences with it today.
1 2
8 9