people playing: 261, servers online: 85, games played: 95,815,519

  Toribash Community » Toribash » Mods » Lua scripts
Register FAQ Community Calendar Search
Reply
 
Thread Tools Display Modes
Old Apr 22, 2010   #1
gmon
NON-EXISTING!
 
Black Belt
Join Date: Jun 2008
Posts: 97



Python replay reader
I know this is not a lua program. But it is related to helping with writing lua programs. The library is nice if you are reading large sets of replays, like over 10k. (sidenote:if there are lua programmers that can provide a lua example of the library, that would be great)

cget_variables_from_game is a relatively fast library for parsing replay files. the library has one function and is used like this:

Code:
winmovelist,losemovelist=cget_variables_from_game("name_of_replay_file")
and returns a list of winning moves, losing moves and all the joint information (see example).

Code:
#wvl=win dataset, lvl=lose dataset
wvl,lvl=cget_variables_from_game.cget_variables_from_game(game)
#for each data set generated by a turn in the winning data list
for turndata in wvl:
	framenum,pos,vel,avel,jointstate,frac,crush,score=turndata
This program is useful for reading replays and gathering data on best moves, winning replays, etc.

There are three files included:
cget_variables_from_game.so - shared c++ library for reading replays
toribash_reading_example.py - a python program demonstrating the library
test_judo_replay.rpl - sample judo replay file
Attached Files
File Type: zip python_toribash_replay_reader.zip (37.0 KB, 33 views)

Last edited by gmon; Apr 22, 2010 at 01:58 AM..
gmon is offline   Reply With Quote
Old Apr 22, 2010   #2
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,493
Clan: bncy



What defines a "winning move" and a "loosing move"? Is it the whole set of joint movements for each turnframe for whoever wins and whoever loses?
:D
Blam is offline   Reply With Quote
Old Apr 22, 2010   #3
gmon
NON-EXISTING!
 
Black Belt
Join Date: Jun 2008
Posts: 97



Blam, yes I should have said "winning routine" As it is the set of moves for both the winning routine and losing routine. The routine list starts at frame zero and ends with the final move. If you want to figure out which player it is, I just look at the starting y position. If the y-position at the start of the match is negative, the player is uke.

I use this routine for finding new openers. I was also thinking about using the data to render Toribash in POV, Blender or some other animation software. I think that would be a fun project. I would love to see Toribash rendered in POV.
gmon is offline   Reply With Quote
Old Apr 22, 2010   #4
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,493
Clan: bncy



You can already export TB for pov-ray use, people used to do it before shaders came out to make awesome vids.

The screenshot key ( f8 ) takes one single frame and exports it to a pov file and the record toggle key ( ctrl+f7 ) exports the frames it sees (aka you can change replay mid way through) into a single pov file.
: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 04:37 AM.


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