8

A couple of days ago, this discussion about the difficulty of getting an AI to play Mario Kart started up on a post I made. I decided to start doing some research into gaming/speedrunning AI and it has ultimately led to me staring at a screen watching an AI try to complete 1-1 in Super Mario Bros for the past two days.

The AI is a simple Lua script that runs in an emulator, but it was designed specifically for Super Mario World. There are some issues I would like to straighten out with it, as it can not complete 1-1 yet. Basically, the AI presses random buttons until it starts to move to the right. Moving to the right will give it a progressively higher score, and if it stops or dies, it will reset and try again. It then takes the best attempts and expands on them.

I've been observing some of the intricacies of how the AI functions, and I think that with some tweaks, it could actually learn to complete quite a few of the levels in Mario.

The source code is here. It runs in the FCEUX emulator and is very easy to set up. It'd be cool to turn this into a little project and expand on it, because it really is fascinating to watch and I don't think it will be that difficult to do.

A couple of days ago, [this discussion about the difficulty of getting an AI to play Mario Kart](https://phuks.co/s/Speedrun/31965/5d278ffe-8fc0-47d5-aa1b-135e2571863f) started up on a post I made. I decided to start doing some research into gaming/speedrunning AI and it has ultimately led to me staring at a screen watching an AI try to complete 1-1 in Super Mario Bros for the past two days. The AI is a simple Lua script that runs in an emulator, but it was designed specifically for Super Mario World. There are some issues I would like to straighten out with it, as it can not complete 1-1 yet. Basically, the AI presses random buttons until it starts to move to the right. Moving to the right will give it a progressively higher score, and if it stops or dies, it will reset and try again. It then takes the best attempts and expands on them. I've been observing some of the intricacies of how the AI functions, and I think that with some tweaks, it could actually learn to complete quite a few of the levels in Mario. [The source code is here.](https://github.com/juvester/mari-o-fceux) It runs in the FCEUX emulator and is very easy to set up. It'd be cool to turn this into a little project and expand on it, because it really is fascinating to watch and I don't think it will be that difficult to do.

13 comments

[–] PMYA [OP] 1 points (+1|-0)

trained neural nets for image processing

That's kind of what this thing is, just a very basic version of it. Some emulators have tools for reading all of the RAM values in a game in real time. The AI looks at this and puts all of the objects in the level into two categories - enemies and platforms. It will learn to jump over enemies and either walk along or jump over blocks depending on their formation (I think, I'm basing this on what I've seen it do).

This does cause some issues and is the reason it has ended up getting itself stuck twice now. It got to a part where there are some steps it needs to jump up, but it recognises the top of each block as being a platform it needs to run along. The result is that it just lands somewhere on the steps and then runs into the block in front of it.

[–] smallpond 1 points (+1|-0)

I can see why you're getting interested in it. Does it have any sort of memory? That is, any capacity to sense the movement of an enemy (or platform) relative to the background?

[–] PMYA [OP] 1 points (+1|-0)

If an enemy moves, the position of its hitbox will be updated in the AI's "vision". I don't think it has any concept of what the background is.

[–] smallpond 0 points (+0|-0)

Ok, I had a look at the SMW video posted above, I see the AI's vision is always centered on itself at the current time step (unless neurons have a time-delay effect).

The "memory" I was talking about above might be achieved by extending the AIs 'vision' to the previous time step in addition to just the current one. I think then it would be possible to get conditions like if <enemy is at some position> and <enemy was at some position a little further from me before> then jump.