Toribash
Originally Posted by squeakus View Post
So! The next step is to make one that does a combo, I hope to have it out this week. Also if anyone knows how to speed up the game (i've tried messing with reaction_time but with no success) because normally a GA works by evaluating 100's of moves per second, not one every 5 seconds, any help would be greatly appreciated!

Use:
/set tf 100

To set the turnframes/clock to 100 per movement period. This looks like it'll end up really well. Hope it advances to recognizing DQ. Also, if you need anything else /fh shows the full help commands.

(>^_^)>
I do not understand this at all and I don't see a best.txt
my tori just does one move and falls after i press the space bar.
it does repeat the rounds and do different moves but i dont understand how it can do 3 dm moves. please explain how to set it up.
OLDA | Fr3styL | RL | T3AL
R.I.P [Pure] 356 Threads, 19,000 Posts.
This is really good, tough at one stage my tori started to dismember himself heavily during his attacks while still causing a lot of damage to uke.

hey guys, I'd just like to say thanks for all the feedback, its been really helpful. I'm still ironing out a couple of bugs and should have another version by next week which will work a lot better. One big one is if no-one in the first population gets a fitness better than 0, then it will crash and go to replay, so it works best with classic mod because it almost always scores a hit. the best.txt and population.txt are stored in ./toribash/data/scripts in linux, cprogram_files\toribash_386 in windows and /Applications/Toribash on mac. thanks again!
Originally Posted by squeakus View Post
this technique means that it could learn how to play any mod out there, so long as the fitness function is good enough (it doesn't understand disqualification... yet). I left it running over the weekend and it got pretty damn good, 151510 in damage in 1 hit, paste this in to best.txt if you want to see it (151510:4,3,1,2,3,2,3,2,2,1,2,3,2,3,3,3,3,2,3,3,1, 1,0). Compare that to the 20,000 I got from purely random search over last weekend.

So! The next step is to make one that does a combo, I hope to have it out this week. Also if anyone knows how to speed up the game (i've tried messing with reaction_time but with no success) because normally a GA works by evaluating 100's of moves per second, not one every 5 seconds, any help would be greatly appreciated!

Also all the settings described above are completely configurable, the variables are at the top of openerGA.lua and all of them have explanations beside them. If you have any more questions do not hesitate to ask me!

/opt fixedframerate 0

Type that.

Also guys, don't forgot that the focus of this script is getting the highest score. Not most DMs or whatever.
Very nice script!

I also like Fatesights idea for DQ detection
It would be nice if it was possible to set an opener for Uke and consider own dismemberments and fractures in the fitness ranking. That would turn this script into a counter-move finder! Yeah, that would be cool!

PS: some functions I wrote that may be helpfull for you too:
matrix = {
	E = function(d)
			d = d or 4
			local m = {}
			for i=1,d do
				m[i]={}
				for j=1,d do
					if i==j then
						m[i][j]=1
					else
						m[i][j]=0
					end
				end
			end
			return m
		end,
	fromR = function(rot)
			local m = {{},{},{},{}}
			m[1][1]=rot.r0
			m[1][2]=rot.r1
			m[1][3]=rot.r2
			m[1][4]=rot.r3
			m[2][1]=rot.r4
			m[2][2]=rot.r5
			m[2][3]=rot.r6
			m[2][4]=rot.r7
			m[3][1]=rot.r8
			m[3][2]=rot.r9
			m[3][3]=rot.r10
			m[3][4]=rot.r11
			m[4][1]=rot.r12
			m[4][2]=rot.r13
			m[4][3]=rot.r14
			m[4][4]=rot.r15
			return m
		end,
	dup = function(n)
			local m = {}
			for i=1,#n do
				m[i] = {}
				for j=1,#n[1] do
					m[i][j]=n[i][j] or 0
				end
			end
			return m
		end,
	trans = function(n)
			local m = {}
			for i=1,#n do
				m[i] = {}
				for j=1,#n[1] do
					m[i][j]=n[j][i]
				end
			end
			return m
		end,
	add = function(m,n)
			local a = {}
			for i=1,#n do
				a[i] = {}
				for j=1,#n[1] do
					a[i][j] = m[i][j]+n[i][j]
				end
			end
			return a
		end,
	smul = function(m,n)
			local a = {}
			for i=1,#m do
				a[i] = {}
				for j=1,#m[1] do
					a[i][j] = m[i][j]*n
				end
			end
			return a
		end,
	mmul = function(m,n)
			local a = {}
			for i=1,#n do
				a[i] = {}
				for j=1,#n[1] do
					a[i][j] = m[i][1]*n[1][j] +m[i][2]*n[2][j] +m[i][3]*n[3][j] +m[i][4]*n[4][j]
				end
			end
			return a
		end,
	inv = function(mat)
			local m = matrix.dup(mat)
			local e = matrix.E(#m)
			local function chRow(r1,r2)
				local t=0
				for j=1,#m do
					t=m[r1][j]
					m[r1][j]=m[r2][j]
					m[r2][j]=t
					t=e[r1][j]
					e[r1][j]=e[r2][j]
					e[r2][j]=t
				end
			end
			local function mulRow(r)
				local f = m[r][r]
				for j=1,#m do
					m[r][j]=m[r][j]/f
					e[r][j]=e[r][j]/f
				end
			end
			local function calcRow(rT,rS)
				local f = m[rT][rS]
				for j=1,#m do
					m[rT][j]=m[rT][j] - f*m[rS][j]
					e[rT][j]=e[rT][j] - f*e[rS][j]
				end
			end
			--==
			for i=1,#m do
				if m[i][i]==0 then
					for j=i+1,#m do
						if m[j][i]~=0 then
							chRow(i,j)
							break
						end
					end
				end
				mulRow(i)
				for j=i+1,#m do
					calcRow(j,i)
				end
			end
			for i=1,#m-1 do
				for j=i+1,#m do
					calcRow(i,j)
				end
			end
			return e
		end,
}

local jc = {
        NECK		={0,1},
        CHEST		={1,2},
        LUMBAR		={2,3},
        ABS			={3,4},
        R_PECS		={1,5},
        R_SHOULDER	={5,6},
        R_ELBOW		={6,7},
        L_PECS		={1,8},
        L_SHOULDER	={8,9},
        L_ELBOW		={9,10},
        R_WRIST		={7,11},
        L_WRIST		={10,12},
        R_GLUTE		={4,13},
        L_GLUTE		={4,14},
        R_HIP		={13,15},
        L_HIP		={14,16},
        R_KNEE		={15,18},
        L_KNEE		={16,17},
        R_ANKLE		={18,19},
        L_ANKLE		={17,20},
}

local function get_stance(player)
	if (player<0) then
		return
	end
	local tbl = {}
	for d,n in pairs(JOINTS) do
		if not get_joint_dismember(player,n) then
			local rb1 = matrix.fromR(get_body_info(player,jc[d][1]).rot)
			local rb2 = matrix.fromR(get_body_info(player,jc[d][2]).rot)
			local rd = matrix.mmul(matrix.inv(rb1),rb2)
			tbl[d]=math.round(math.asin(rd[3][2])/math.pi*12)
					+math.round(math.asin(rd[1][3])/math.pi*12)
					+math.round(math.asin(rd[2][1])/math.pi*12)
		end
	end
	return tbl
end

local function get_lobody(pl)
    local lo = 100000
    for i=0,10 do
        local bi = get_body_info(pl,i)
        lo = math.min(lo, bi.pos.z-bi.sides.z)
    end
    for i=13,18 do
        local bi = get_body_info(pl,i)
        lo = math.min(lo, bi.pos.z-bi.sides.z)
    end
    for i=0,17 do
        local jx,jy,jz = get_joint_pos(pl,i)
        lo = math.min(lo, jz-get_joint_radius(pl,i))
    end
    return lo
end
the matrix table contains functions for matrix calculations
get_stance(player) returns a table with the joint positions (the angle in 15А steps)
get_lobody(player) returns the height of the lowest bodypart, that can dq

(maybe the weighted diff of the 2 lobodys in the fitness ranking can lead to good results for no dq moves)
"Wenn Sensei Tanaka sein Shodushi ist, dann soll er hingehen und uns den Dimak zeigen!"
Why did noone continue this? This is a fantastic start to create an UKE you could train with, we could create an AI that would be a fantastic teacher just for us!

Oooh great modders in toribash, please continue this awesome work!
Last edited by Zockinator; Feb 26, 2014 at 05:12 PM.
Cause it's very hard to code an AI that can do something in 3D world. Especially in lua.
Last edited by dainiusb; Mar 9, 2014 at 04:59 PM.