SP Cup 2022
^agreed. i would rather see it do some epic madman, ect. than just get points
Plus I know lua. I could help you. Just tell me how to detect dismemberment/fracture and where is placed the fitness calc, and I will do myself.
--get_joint_dismember (integer player_index, integer joint_index)
--get_joint_fracture (integer player_index, integer joint_index)

local function get_fitness()
   tori_score = math.floor(get_player_info(1).injury)
   uke_score = math.floor(get_player_info(0).injury)
   tori_dismember_frac = 0
   uke_dismember_frac = 0
   for i = 0,19 do
       tori_dismember_frac = tori_dismember_frac + get_joint_dismember(0,i)
       tori_dismember_frac = tori_dismember_frac + get_joint_fracture(0,i)
       uke_dismember_frac = uke_dismember_frac + get_joint_dismember(1,i)
       uke_dismember_frac = uke_dismember_frac + get_joint_fracture(1,i)
   fitness = (tori_score + uke_dismember_frac) - (uke_score + tori_dismember_frac)
It would be something like that (cba to check it)
Tested and working. Add at the start of the script:

local dismember_value = 10000 -- Dismembered points value
local fracture_value = 7000 -- Fracture points value
And overwrite original function with:

local function get_fitness()
   tori_score = math.floor(get_player_info(1).injury)
   uke_score = math.floor(get_player_info(0).injury)
   for i = 0,19 do
        if (get_joint_dismember(0,i)) then
            uke_score = uke_score + dismember_value
        elseif (get_joint_fracture(0,i)) then
            uke_score = uke_score + fracture_value
        if (get_joint_dismember(1,i)) then
            tori_score = tori_score + dismember_value
        elseif (get_joint_fracture(1,i)) then
            tori_score = tori_score + fracture_value
   return (tori_score) - (uke_score)
Well, testing my fitness calculation, this happens:

No lua errors (it works).
Only it makes 2 good movements, I think elite movements.
The rest of movmenets are totally absurd, like totally random.

I think if it gets better is because better movements are saved exactly (elite movements), but crossovered movements seems to be absurd always. I guess it happens with default fitness calculation, so I suggest you to find a better way to crossover the movements. If I find an idea, I will post here.

By the way, good script.

Edit: What about:
Aument the population to 20
Calculate average of 20
Only keep those are beyond the average.

Or just remove those that points are less than 0.

Or crossover only elite movements.

Edit 2: I've found a bug. In comboGA.lua change elite to 3, then try to fulfil the population with 10 new movements. Game will fall in an infinite loop (or crash, I don't know).
Last edited by lilezek; Mar 18, 2010 at 08:44 PM.
thanks for all the great feedback, i'll add the new fitness function to the next release. I'm going to start adding in moves for Uke, should I base it on the ukebot or the wushu trainer?

Lilezek, you can increase the population size in the top of the file by changing the popSize attribute and you can also change how much of the population is kept by changing the truncSize attribute. In truth I just guestimated the initial settings, its notoriously difficult to tune a GA for a particular problem. as for the crossover operator, its been shown to work from some problems and not for others so maybe you just want to try it with mutation and see if you get better results.
well its been running for 2 hours, its at 2000 now, and doing decaps and multi dismembers. im gonna let it go for about 2-3 more hours
you can also put your res low and "unfix" the framerate. (/re 10 10, /opt fixedframerate 0)