Thursday, March 13, 2008

Changes


So a lot has happened since the last blog. I stumbled onto to some opportunities, one professional, and one personal, and then stumbled right back out of both of them. While they were both quite alluring, and I tried my hardest to make the best of them, I have to admit I felt some relief with they both fell through. The older I get, the more wary I am of big changes.

But they were both interesting and challenging, and the professional one got me pouring over my CLR(S), my operating systems book, and topcoder.com. (That last one should be a good hint ;) ). It was nice to go back and dive into the basics. To overview graph algorithms. To read Ingo Molnar's paper on everything a programmer should know about memory. I even flipped through a few pages of Knuth. And in the end, got tripped up on a pointer accounting question. It was a fine time, and forced me to focus on what I wanted to do next. All the algorithms work made me think about where my limits are, and what really gets me excited.

So, I've started a new phase in the project, with a little different emphasis. The inevitable "dogfood" phase of a software project, where you just get sick of it, and say I want something that I can use! Or more aptly, I want something I could show off to someone, if anyone was even conceivably interested in my project! So I put aside all that stuff about dynamically generating function calls at runtime (since I do have something for making remote requests that currently works, unlike the front end of the project). And decided to focus on two other things:

-Autoconf'ing the source tree, in order to, if nothing else, just be the same as everybody else. You never really want to make building your program a "unique" experience.

-Focusing more effort on the front end, getting more features in the renderer, and tying together all the separate lsystem, physics, and graphics components

I'm very happy to say the autoconf'ing part of the goals are done. Yes, I'm happy that it's all vanilla now. But, no, I didn't have oodles of fun learning all about M4. Still, I like the results, and now that I'm done, they are what matter.


Now the fun part - where I get to see stuff crawling around on the screen (finally), and breeding, and interacting, and... - I'm happy to say is not done, but does have some neat features working. This is always one of the best parts of software, you finally got some features that'll put a smile on your face because they actually work! And you still have a future to be excited about, and features to look forward too.

So about the obligatory screenshots..

The first one (at the top of the article) has no physics enabled, mainly for the sake of generating a pretty screenshot. It shows three trees, all generated from two files. The first containing rules that outline an l-system, it's growth rules, mutation rates, etc:
maxSize 100
minSize 10
options L,R,S
system Y
#mutation rules key
#1)the entry is swapped with one of it's neighbors
#2)the entry is toggled to one of it's possible options
#3)the entry is deleted
#4)the entry is doubled
#it is interesting to note that mutations that occur on
#already interpreted elements are essentially irrelevant during growth
#(but not breeding..)
#probability is in 1/10000th
mutationRules (1,3000) (2,2000) (3,3000) (4,100)
growthRules Y:S,S,BL,BR,S,S,BU,SS,BD,SS.BL:[,L,S,S,Y,].BR:[,R,S,S,Y,].BU:[,U,S,S,Y,].BD:[,D,S,S,Y,]
numSteps 0
numSwaps 0
swappedLeft 0
swappedRight 0
numToggled 0
numDeleted 0
numDoubled 0
currentGene 0
The second file provides information on how the system should be interpreted:
LeftAngle -40
RightAngle 50
UpAngle 30
DownAngle -30
Mesh sphere.mesh
StartDirection 0,1,0.1
AtomicSize 10
These are both read in at start-up, and the first can be a saved snapshot of the lsystem state at any point in time (not, however, the fully interpreted state, that would be saved via a different component). Keep in mind, too, that all the trees (and the bouncing blobs of balls below), are growing over time. About one new ball pops out of a branch every second or so, up to the max size of the system.

Here is one with cubes, which makes rendering and getting the screenshot easier on the integrated graphics of my laptop:


And finally, here's one with physics. It much harder to get this across with a static image, but I haven't figured out how to make a movie yet..
All the balls in each system are joined to their previous ball via a ball joint, and if I could make a movie, you would see all four systems bounce away from each other, loosely staying together, but each arm swiveling here and there as they move away... It's kinda a neat, but will be even better with hinge joints, and best of all.. motors!


On top of all this, I've gotten lasik - totally awesome by the way - I hadn't been able to wear contacts for a year, and suddenly - 20/15 with no glasses!. Plus, they do the whole thing with lasers now, no microkeratome (little knife) to cut the flap. I'm a Tiger! Well, maybe not that far..

I also took a trip out east, and wandered around Detroit, DC, and New York, seeing the sites, and meeting up with old friends. It was really wonderful. It's a quite journey from West LA out to the snow and chill, but friends make it worth it. And after a few years of being single, a girl asked me if I wanted to date. So, while it all started off with some stumbling, I've manged to gradually stumble in the right direction at least. One little change at a time.

PS..
So right after abandoning the dynamic function bit back in Dec/Jan, I finally stumbled across this: libffi. When I found it, it seemed pretty much abandoned - the page hadn't been updated in ten years, no documentation, just an old tarball.

Now, granted, a little digging revealed it's largely maintained by gcc now, and they just updated the site a few days ago (sparking my interest in the whole thing again). However, if you think I'm bad at updating my site, and uploading tarballs - Try no updates for ten years.