Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Aim and Shoot – A game where your opponents are neural networks (github.com/victorqribeiro)
118 points by atum47 on Oct 25, 2019 | hide | past | favorite | 33 comments



Played three times, made it to gen 23 on the third time. Fun game.

Without knowing much about game mechanics, a "domestication" strategy seems to work well.

1. Pick a corner. Bottom-right was what I chose.

2. Move there without getting shot.

3. Shoot first at the robots shooting at your direction, then those with guns pointed in your direction. Then shoot the robots that are shooting. Save the robots that are pointed the other way, not shooting for last.

4. After a few generations, all the robots will be pointing the other way, not shooting. Kill the ones that twitch first.

5. There seem to be randomization events, and some of your domestication will be lost. Try to survive those and re-domesticate.

6. Eventually you run out of non-replenishable HP and die.


Reminds me of the creepypasta about the guy who left a quake server running for years and his bots learned not to shoot each other [0].

That was only in 2011. At the time it was solidly in "this feels like it could happen, but definitely didn't" territory. Now we're in "Let's see if I can induce this in this guy's browser game" land. Feels strange.

0: https://i.imgur.com/dx7sVXj.jpg


I remember that! I loved the story (albeit it was just a story). Kind of cool to see that this is a possibility soon.


Basically act as an artificial force for selecting poorly fit agents. Just like what we're doing to ourselves right now??


Natural selection still happens for humans. Natural selection just applies for our current environment, not some ancestral environment. It's not longer selecting for the ability to outrun lions. It's selecting for the ability to attract a partner, to want kids, and to secure a place to raise kids in.


Citation needed. The ability to survive doesn't seem tied to anything you mentioned except maybe to working genitalia, for example if you are born in a country with good health care (e.g. Canada) you are more likely to survive than a country with bad or mediocre health care -regardless of any other criteria-; wanting kids and having kids are not as correlated as expected, is easy to see that in the tons of unwanted teenage pregnancies, "attract a partner" is so subjective that it doesn't lean to any population in particular, you can see that when even male meth-heads living in SUVs have a girlfriend with similar issues; in general healthcare has improved so much that now lifespans are pretty much leveraged regardless of most other variables meaning is likely natural selection no longer plays such a major role as it did in previous generations.


> Natural selection still happens for humans.

Does it really? Humanity is very very keen on keeping alive every individual, even the most disfunctional ones. Not only that, but also try really hard to let even the disfuntional individuals procreate. To me it looks more like the opposite of natural selection. After all natural selection is not only about the best and most fit individuals but also about the pool of genes of the species also.


Yea, but money is a hugely effective ability for attracting mates and with the way wealth is past down generationally...


I managed to train most of them to run into the walls. Just gotta make sure the ones that do are the last to die.


the randomization on the topic 5 you mention is the mutation. there's a 25% chance of mutation at each reproduction. The mutants have alterations on their color and their behavior.


On this project each enemy have a "brain", which is a never trained neural network. The training process comes from the genetic algorithm: at the end of each round the GA calculate the fitness score for each individual, the higher the fitness The more likely to reproduce. The fitness score is based on a lot of things: total of shots fired, number of times it hits the player, number of times it hurt itself... I also punish the one who doesn't do nothing and the ones who shoots it's allies, so they have less chance to reproduce next round.

As a request, I'm giving the player 15% of their health back at the end of each round.


> I'm giving the player 15% of their health back at the end of each round.

Don't be stingy with health. The fun of this game is watching the opponents evolve. Keeping your health to stay alive is more of a chore, and isn't that fun IMO.

Giving players 100% of their health back will allow them to give more attention to the interesting aspect of the game, and less attention to the annoying chore of staying alive.

And personally, it was my assumption that I would recover my health every round, just like the AIs do. It took me a few rounds to realize that was not the case.


I'm inclined to give the player all it's health back, since you're the second one to suggest that


I'll third it. Health should recover fully with every round.


I've found the "hack": focus on killing the guys who are shooting and stand around, letting the lazy guys live for as long as possible. By gen 8 or so, I didn't even need to interact with the browser to win, they all suicided.


I'm punishing the ones who do nothing, but you way of thinking might work


This is what excites me the most about machine learning: the ability for software to adapt and learn at runtime. I've been disappointed that ML is almost exclusively talked about as something that is trained by the developer and then deployed as a static artifact to users.


Wish there were some kind of scoreboard at the end after you died that showed what level you got to; I made it to somewhere between 25-30 and was waiting to take a screenshot until afterwards.

I did well by only ever firing upward +/- 45 degrees (except the occasional horizontal shot for enemies stuck on the bottom), and then staying near the bottom of the screen and moving myself into position before accurately firing (rather than spraying and praying everywhere).


I took some liberties with the genetic algorithm so it fit the game. The game itself it's pretty basic: simple physics with circle to circle collision. The enemy could spawn on top of you and drag you around, my suggestion is to move the opposite direction so you can break free.

different from my other experiments, I tried to give this one a proper game look, with an artwork when you start and sound when you shoot (which becomes hell once the neural network figure out that shooting a lot is a very good thing)


personally I believe it would be more interesting if the player was overpowered compared to the enemies.

In a few runs I just played the game quickly ended as there were too many bots shooting randomly.

A couple of variations in increasing level of expected difficulty to implement would be:

- Heal the player after each turn (you propose 15%, I would say 100%)

- Do not increase the number of bots until much later rounds. We want to see smart bots, not monkeys and typewriters.

- Give the player more health/bullet resistance

- Give the player 3-4 seconds at the beginning to move away from the random starting location

- Give the player an immunity cooldown after each hit so that each round lasts at least a few seconds


some times it took a while to the bot to start doing something interesting. if I put just two bots against the player and they don't attack or move it would be very frustrating to some players. in the short time I tested the settings, this one worked the best. since out of 7 enemies the probability of one being a shooting maniac would be higher. but I as I said, I encourage agressiveness but I took away points if they hit a fellow bot, so just shoot isn't enough


A midway solution that could work nicely would be to have obstacles to hide behind. Even something as simple as a ]-[ would do wonders.

(It could mess up the training though as that would require the concept of obstruction...)

These are just my feedback for possible improvements, I need to say this looks quite impressive and definitely more complex than anything I have done to date.


It crossed my mind to implement hiding spots, can't remember why I didn't.


I just moved my player to a corner, and sat there for several rounds, like 20+. Minimizes the vectors where new spawns can occur.


the three times I played, the bots were all focusing on the upper left corner, so staying in the lower right was safe for about 20 rounds.


maybe I should add a timer to the rounds...


A fork with infinite health: https://kinrany.github.io/aimAndShoot/


Really cool! But I had to play with the sound off, the sound for the bullets firing is quite jarring :(


Very fun game, played it just once and only managed to make it to gen 14!


Hey! I helped run and have the source code to a MMO Browser game, Arras.io. Hit me up if you want to use my engine or add AI bots to my game.


I have a project (that's in slow development) where I plan to use AI bots so they act like the player is in a MMO.

https://github.com/victorqribeiro/gaia

I just need to finish my final thesys first. When I get home I'll take a look at your game.


sorry, there was a big rain where I live, the light and communication went out since yesterday. I'll read the comments and the pull requests as soon as I can.


such a great idea !




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: