THIS IS PROBABLY PRETTY OUTDATED AND ALSO MISSING A LOT






watch this vid it's cool https://www.youtube.com/watch?v=N3tRFayqVtk

disclaimer: idk what i'm doing


Person

Each person is an actor in it's world. It can do a variety of actions, driven by the computations in it's brain. The may reproduce given they survive long enough to, influencing the genome of it's children.


Brain

A person's brain is a simple recurrent neural network (RNN), with one input layer, one hidden layer, and one output layer. Each layer has exactly 128 neurons, though most of them go unused. The input and output neurons are treated the same for every person regardless of their birth circumstance.


Input Neurons (Senses)

Input neurons have their value set according to the neuron's state in the world at the start of each simulation step. All input neurons contain a float value 0-1. They may transfer value to hidden and output neurons via connections.

Input neuron map:

0: X Position (pX)
The person's position along the X axis.
0 being the furthest left position (ie. x position = 0).
1 being the furthest right posiion (ie. x position = world width).

1: Y Position (pY)
The person's position along the Y axis.
0 being the furthest top position (ie. y position = 0).
1 being the furthest bottom posiion (ie. y position = world height).

2: Age (age)
The generation's age according to the world's step count and limit.
0 being the start of the simulation (ie. current step = 0).
1 being the end of the simulation (ie. current step = generation step limit).

3: Radiation Level (rad)
The level of radiation the person has accumulated.
0 being no radiation accumulated.
1 being the amount of radiation that kills a person.


Hidden Neurons

Hidden neurons are used purely for internal computation. They have no inherent value to themselves, so they rely on neurons to feed value into them. They may recieve value from input and hidden neurons via connections. They may transfer their value to hidden and output neurons via connections.


Output Neurons (Actions)

Output neurons are used to determine what action a neuron takes on any given step. The may recieve value from input and hidden neurons via connections. They do not transfer any value outward, their value is reset to 0 at the start of each step.

Movement actions may be attempted in a situation where the person cannot move in the desired direction, in which case the neuron will stay in it's current position.

Output neuron map:

0: Do Nothing (non)
The person takes no action.

1: Move North (mN)
The person moves one position North.

2: Move North East (mNE)
The person moves one position North East.

3: Move East (mE)
The person moves one position East.

4: Move South East (mSE)
The person moves one position South East.

5: Move South (mS)
The person moves one position South.

6: Move South West (mSW)
The person moves one position South West.

7: Move West (mW)
The person moves one position West.

8: Move North West (mNW)
The person moves one position North West.

9: Move Forwards (mF)
The person moves one position in the direction last traveled.

10: Move Backwards (mB)
The person moves one position in the opposite of the direction last traveled.

11: Move Random (mR)
The person moves one position in a random direction.


Neural Connections

A person's neural connections are what makes it unique from the others. Without neural connections, the person's brain would not compute anything. A neural connection fascilitates the transfer of a weighted value from one neuron to another.

Connections are determined by the person's genome at birth. A person can not create new connections or destroy connections as an individual, only through reproduction (and thus altering of the genome)can neural connections be "changed".

Neural connections can exist going from an input neuron to either a hidden neuron or an output neuron, or from a hidden neuron to another hidden neuron (including itself) or an output neuron.

Each connection has a weight, a float from -1 to 1, determining how the value being sent through it will be modified. Sending a value of 1 through a connection with weight 0.5 would result in the target neuron recieving a value of 0.5 from that connection.


Genome

A person's genome is represented by some collection of 4-byte long hex strings. Each piece in this collection defines a connection between two neurons.

The first byte defines the origin neuron's type and id. The second byte defines the target neuron's type and id. The final 2 bytes define the weight of the connection.

Here is a breakdown of an example genome of length 4:

84a64a29 558345e2 c4412e0f 018bbc43

10000100
1: Origin neuron layer (0 = input, 1 = hidden).
0000100: Origin neuron id (number 0-127, in this case 4)

10100110
1: Target neuron layer (0 = input, 1 = hidden).
0100110: Origin neuron id (number 0-127, in this case 38)

0100101000101001
0: Weight value sign (0 = negative, 1 = positive)
100101000101001: Number in [-16383:16383] (converted to a float (-1:1))

84a64a29
10000100101001100100101000101001
Hidden-layer neuron 4 connects to output-layer neuron 38 with weight -0.579376220703125

558345e2
01010101100000110100010111100010
Input-layer neuron 85 connects to output-layer neuron 3 with weight -0.54595947265625

c4412e0f
11000100010000010010111000001111
Hidden-layer neuron 68 connects to hidden-layer neuron 65 with weight -0.359832763671875

018bbc43
00000001100010111011110001000011
Input-layer neuron 1 connects to output-layer neuron 11 with weight 0.470794677734375

Radiation

todo


Reproduction

todo


World


Generation

The world's timeline is split into generational chunks. At the start of each generation, people are initiatilized and sent to do whatever they feel like doing until the generation's time runs out. Each generation has a set number of steps to compute before it ends and any people outside the survival conditions are culled. The survivors then reproduce, and the next generation is filled with their children.


Step

The world processes one step at a time. Every person's brain is computed each step.

1: Record all people's positions for collision calculations.

2: Compute all people's brains

2a: Set input neuron values.

2b: All neurons send their current values forwards through their connections.

2c: All neurons replace their current values with the accumulated sum of all their recieved values, which is fed through a tanh function, leaving their new current value as a float value in -1 to 1.

2d: If there are any output neurons with a value above 0, they are collected into a list and one will get randomly chosen (each with a chance exactly weighted according to all potential neurons' values) to be the action to be performed. If there are none with value above 0, but there are some with a value of 0, they are collected and one is chosen randomly as the action to perform. If there are no output neurons, or all of their values are below 0, the action to be performed defaults to action 0 (no action).

3: Blast out radiation from any radiation sources and kill any people that are too irradiated to live.