people playing: 160, servers online: 48, games played: 132,788,527 Top Player: Wounder

  Toribash Community » Toribash » Mods » Lua scripts
Register FAQ General Rules Community
Reply
 
Thread Tools Display Modes
Old Mar 18, 2010   #11
SC501
Senior Member
 
Brown Belt
Join Date: Nov 2008
Posts: 879



^agreed. i would rather see it do some epic madman, ect. than just get points
[ESSENCE]
SC501 is offline   Reply With Quote
Old Mar 18, 2010   #12
lilezek
Junior Member
 
Blue Belt
Join Date: Mar 2010



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.
lilezek is offline   Reply With Quote
Old Mar 18, 2010   #13
SC501
Senior Member
 
Brown Belt
Join Date: Nov 2008
Posts: 879



wow, mine just literally stole one of uke's breasts!
[ESSENCE]
SC501 is offline   Reply With Quote
Old Mar 18, 2010   #14
Blam
Now I know my abc's!
This user title is the property of SkulFuk.
 
4th Dan Black Belt
Join Date: Apr 2007
Posts: 5,506
Clan: bncy



Code:
--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)
   end
   fitness = (tori_score + uke_dismember_frac) - (uke_score + tori_dismember_frac)
end
It would be something like that (cba to check it)
:D
Blam is offline   Reply With Quote
Old Mar 18, 2010   #15
lilezek
Junior Member
 
Blue Belt
Join Date: Mar 2010



Tested and working. Add at the start of the script:

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

Code:
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
        end
        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
        end
   end
   return (tori_score) - (uke_score)
end
lilezek is offline   Reply With Quote
Old Mar 18, 2010   #16
lilezek
Junior Member
 
Blue Belt
Join Date: Mar 2010



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 07:44 PM..
lilezek is offline   Reply With Quote
Old Mar 18, 2010   #17
squeakus
Junior Member
 
Join Date: Feb 2010



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.
squeakus is offline   Reply With Quote
Old Mar 18, 2010   #18
SC501
Senior Member
 
Brown Belt
Join Date: Nov 2008
Posts: 879



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
[ESSENCE]
SC501 is offline   Reply With Quote
Old Mar 19, 2010   #19
squeakus
Junior Member
 
Join Date: Feb 2010



Hey Bishop1,
Thanks for all those options, thats doubled the speed for me. Your help is much appreciated!
squeakus is offline   Reply With Quote
Old Mar 20, 2010   #20
Blam
Now I know my abc's!
This user title is the property of SkulFuk.
 
4th Dan Black Belt
Join Date: Apr 2007
Posts: 5,506
Clan: bncy



you can also put your res low and "unfix" the framerate. (/re 10 10, /opt fixedframerate 0)
:D
Blam is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:44 PM.




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
ragdoll fighting game physics fighting game ragdoll fighting physics funmotion joints martial arts karate pc mac free game turn based game