Space Invaders Update

Don’t worry, there will be more blog postings to come. That’s a good thing – right?

Sorry for the lack of posts, I’ve been otherwise distracted working on my new FinTech product every hour on top of my day job.

A while after posting, I made some observations about my Space Invaders. The main thing that concerned me was after watching the recorded play. There were some instances where bombs/missiles that were dropped on the player seemed to get “shaken off”. Some instances may be attributed to being blasted out of the sky before impact, but some clearly looked dubious.

It turns out to be the result of some sloppy coding/testing… oops.

Part of the reason I hadn’t noticed is that bullets/missiles don’t have a delay when colliding with objects… That I guess was my punishment for not honouring the game correctly. The original pauses when the bullet hits the top, or upon shooting the aliens. That pause changes the dynamics of the game slightly.

Not being content with making such a trivial change, I also aligned the look and feel to the ROM image positions. Previously I based everything on YouTube videos, which had aesthetic issues which are now fixed.

It turns out that despite using just 3 neurons it couldn’t care less about the changes. After the fix for not killing the player, it took a little longer to train but did so nonetheless. The latest GitHub code demonstrates using internal data to win.

Yes, you read that right. Just knowing the position of the reference alien, which of the 55 are alive (not their position), plus the position of the alien bombs is enough for it to learn the game. It scores infinity!

It’ll do the same with the radar, which I used previously to get infinity.

Due to a lack of time, I have yet to train all the levels via the video screen input. But it can do that too with sufficient time/fast CPU.

The craziest thing I learnt from all this (aside from that occasionally I miss something!), is the insane way you can turn a problem into data that somehow just 3 neurons can provide the correct answer (action/fire). It does it despite having no concept of what it is doing or where the shields are.

The link below is the AI using “internal-data” to play the first 12 levels (38mb), after which level 13 onwards is no harder, and hence why it will reach infinity. The movie below is the AI having reached 150k.

https://aimlfun.com/wp-content/uploads/2023/09/Space-Invaders-AI-using-internal-data.mp4

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *