CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: neural network

  1. #1
    Join Date
    Jan 2012
    Posts
    7

    neural network

    hi, im trying to make a kind of classic 2D arcade-shooter but played by an AI controlled by a neural network with a genetic algorithm, but I think my approach of the neural network is flawed as my AI doesnt learn very fast and sometimes just doesnt learn right..

    for now the only inputs are the distance of the ship from the top of the screen , the distance from the bottom of the screen, the distance from the enemy ship and the top of the screen and the distance from the enemy ship and the bottom. (4 floats)

    the 2 output are how much the ships goes UP and how much it goes DOWN. (2 floats)
    the player ship always shoots lasers at a constant rate (fast)

    there is only 1 enemy at a time on the screen, if the enemy goes all the way to the left the "player" lose. Everytime the "player" shoots at an enemy it gets 1 score. there is 10 different tries at first with 10 random neural network and then the 10 ships are copy of the one with the best score with plus some mutations making it better and better (in theory..)

    here is how my neural network goes:
    the inputs are set, than they add their value multiplied by the synapse "strenght" to each hidden neuron. then if the hidden neuron's value goes beyond the threshold it adds its value multiplied by the synapse strenght to the output neurons.

    what am I doing wrong ?

  2. #2
    Join Date
    Apr 2008
    Posts
    725

    Re: neural network

    Could be anything. Could be that your code doesnt do what you say. Could be that you wrote '1' instead of '2' somewhere....

  3. #3
    Join Date
    Jan 2009
    Posts
    596

    Re: neural network

    Quote Originally Posted by zhaDe View Post
    for now the only inputs are the distance of the ship from the top of the screen , the distance from the bottom of the screen, the distance from the enemy ship and the top of the screen and the distance from the enemy ship and the bottom. (4 floats)

    the 2 output are how much the ships goes UP and how much it goes DOWN. (2 floats)
    You have made this problem more complicated than it needs to be. Why are you telling the neural network the distances of the ships from both the bottom and top of the screen? These are not independent variables, as you will always have
    Code:
    distance from bottom + distance from top = height of screen
    Similarly, you have too many outputs. You don't need to output how much the ship should go up and how much it should go down - these options are mutually exclusive. You only need one output. This can either signify how much to go up (with negative values allowed, meaning to go down), or signify the new position of the ship.

    Doing this will simplify the neural network, and make it work better (and faster).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured