
Show HN: Aim and Shoot – A game where your opponents are neural networks - atum47
https://github.com/victorqribeiro/aimAndShoot
======
StonyRhetoric
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.

~~~
mos_basik
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](https://i.imgur.com/dx7sVXj.jpg)

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

------
atum47
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.

~~~
Buttons840
> 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.

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

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

------
AgentME
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.

------
drusepth
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).

------
atum47
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)

~~~
afiori
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

~~~
atum47
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

~~~
afiori
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.

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

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

~~~
moron4hire
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.

------
Kinrany
A fork with infinite health:
[https://kinrany.github.io/aimAndShoot/](https://kinrany.github.io/aimAndShoot/)

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

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

------
crazypython
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.

~~~
atum47
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](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.

------
atum47
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.

------
simlevesque
such a great idea !

