[OLPC-Games] KuKu refactor for decreased playtime lag

Julius B. Lucks julius at younglucks.com
Sun Aug 19 14:30:49 EDT 2007



On Aug 19, 2007, at 12:36 PM, Christopher Schmidt <crschmidt at metacarta.com 
 > wrote:

> On Sun, Aug 19, 2007 at 10:29:24AM -0400, Julius B. Lucks wrote:
>> Hey Chris,
>>
>> That's awesome!  I have been refactoring some of the backend of kuku,
>> but have not touched the main event loop yet - hence the current
>> version in the main branch of the git repo is out of date of the xo
>> that is on the wiki.  There is a branch called trial-2 in the git
>> repo which contains code that should be very similar to the posted xo
>> file.  You should be able to see it in the cloned repo by doing 'git
>> checkout -b my-trial-2 origin/trial-2'.  (Also see http://
>> wiki.laptop.org/go/Kuku/Git_Usage)
>>
>> The only changes I have done to the main kuku.py file have to do with
>> import statements and pulling out some class definitions due to my
>> module refactoring.  The best way to create a patch would be to do
>> the following with git (sorry if you know this git stuff already).
>
> I don't, thanks. I'm very much new to git (and, obviously, OLPC in
> general), so this is exactly what I was looking for. I did try the  
> 'Git
> with Kuku' wikipage, but my head was swimming within the first bit :)
>
> There's an untested patch attached which I think is pretty close to  
> what
> I want -- If I use the kuku that comes out of the main kuku repo,  
> should
> it work? And if I patch it there, will it be something yo ucan pull  
> back
> into the other code you're writing without problems?
>

If you use git format-patch with the latest code from the origin/ 
master branch, git should take care of making the patch work.

>> git clone (kuku repo url)
>> git checkout -b kuku_patch_branch
>> (port your patch to kuku.py)
>> git add kuku.py
>> git commit
>
> git commit gave me a message here:
>
> # Changed but not updated:
> #   (use git-update-index to mark for commit)
> #
>
> so I did:
>
> git-update-index --add kuku.py
>
> then committed.
>

Yeah - with git you have to add files to the index first.  An svn-like  
commit is a 2 step process

git add . # add all changed files
git commit

The cool thing is that you can add files individually so you can split  
up your changes over several commits - really cool.

>> git format-patch master..kuku_patch_branch
>>
>> That should create a file called 0001_my-commit-message.patch.  You
>> can send the patch to the list and I'll apply it and check it in.  If
>> you have set your git config variables with your name and email, it
>> will commit it as you when I apply the patch.
>
> I'll play with that later :) For now, I'm just happy to get a patch,
> though don't bother applying the patch attached until I get a chance  
> to
> test it out (since I didn't do any porting, just bunged the code in
> there) -- I'll email the list again when I get there.
>
>> Right now there are no tests for the kuku.py, but there are some for
>> the other modules (like Tile and Grid).
>
> Okay. That's no big deal, just wanted to make sure before I broke  
> tests
> :)
>
>> I'll be on IRC later today (Sunday) around 5 or 6ish sitting in  
>> #olpc-
>> content as jblucks if you want to chat about the patch etc.  Please
>> feel free to keep refactoring away - the next major step will be to
>> add collaboration to kuku which should start with refactoring the
>> State class out of kuku.py.
>
> k. I'm crschmidt there -- I think I'm going to try  to add  
> collaboration
> to Reversi first (since the code feels a bit cleaner/easier to hold in
> my head at the moment) -- hopefully will help me get my bearings. The
> Tubes are slightly... complex to understand to someone who's never
> written anything on the OLPC, or anything using DBUS, or anything  
> not at
> the console. (A browser is my typical GUI -- this whole 'client other
> than the browser' thing is new to me. :))
>

I think the pygame wrapper code has some API built on top of tubes for  
collaboration.  See the wiki page [[pygame_wrapper]].  I was going to  
take  look at this for kuku and just try to pass the State object  
around.

>> And please put your name up on the wiki page as a contributor!
>
> After code gets checked in, I can do that :) For now, I'm just a  
> random
> passerby.
>
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta
> <0001-adding-kuku.py-i-think.txt>


More information about the Games mailing list