Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Live demo here: https://victorribeiro.com/invaderz/

I'm finding that I can barely last 7 generations to be able to see it 'evolving'. Handicapping the player by waiting for the previous shot to hit before firing again and making the move speed ridiculously slow makes this game too hard even before the genetic algorithm makes an impact.

Also, because the player's move speed is so slow, the easy tactic for the algorithm to head towards is to simply push each enemy to opposite ends of the screen -- ie: hug the wall. If you're clearing one side, the player won't be able to reach the other end of the board even if you move as fast as possible.

TLDR: Interesting concept but to really demo this concept you need to make the game a little easier for the player / don't handicap so much.



Agreed, this is a very cool concept but it's too hard for the player. As a workaround, run this in the console to double the player's speed and allow you to re-shoot the bullet while it's in motion.

    Player.prototype.shoot = function shoot() { this.bullet = {x: this.x+this.s/2, y: this.y, s: 3}; this.isShooting = true }; Player.prototype.update = function update() { if (this.x > 0 && this.isMovingLeft) { this.x -= 0.02 * dt; }; if (this.x < w/4-this.s && this.isMovingRight) { this.x += 0.02 * dt; }; if (this.isShooting) { this.bullet.y -= 0.1 * dt; if (this.bullet.y < 0) { this.isShooting = false; this.bullet = {}; } } }


Nice, haha.


I'm confused, I was able to get to generation 9 in my first go and that was with it taking me 2 rounds before I figured out I could use the keyboard to move and shoot instead of the mouse...


I will put a welcome informing the controls


I had no trouble getting to wave 30+, and I certainly didn't grow up with this kind of game. Using PC keyboard though - are you on mobile?

In any case, the real problem here is that either the player is good enough to last a long time (in which case most waves are probably killed very quickly, thus randomness dominating the fitness function and you won't see evolution) or the game won't last long enough to see a lot of evolution happening.


The author made the speed of the player much faster a few hours after my comment was posted so my concerns regarding speed/difficulty are no longer relevant. The max speed of the player was barely the speed of the enemies before the change.

I’ve also tried it on my iPhone and it’s easily playable too.


They evolve each generation. What happens after the 7 generation is that if no one could kill you until now, make a new wave of Invaders while keeping the best one from past generations.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: