2016 charity plan

This is our plan for our 2016 charitable giving. Our ongoing goal is to spend 10% of our annual budget on charity (minus big ticket items like house purchase and renovations.) Here is the breakdown:

Charity notes category scope Final %
Wikipedia
education global 1.4
AMF malaria health global 15.2
Cool Earth global warming environment global 6.2
SCI parasites health global 11
Deworm the World parasites health global 9
Give Directly poverty human services global 8.3
Manos De Christo Austin homeless human services local 5.5
Elephant Sactuary tenessee animals national 1.4
Cure Alzheimer's Fund gene mapping -> cure health national 2.1
charity navigator meta! research national 1.4
Meals on Wheels Austin elderly/poverty care human services local 5.5
ACLU civil rights politics national 5.5
Sierra Club environmental environment national 5.5
Southern Poverty Law social justice politics national 4.1
Planned Parenthood reproductive human services national 5.5
represent.us bottom-up anti-corruption politics national 4.1
pro publica journalism non profit politics national 4.1
union of concerned scientists science advocacy politics national 4.1

This year we have greatly increased the share of our giving to national causes. Mostly this is because we no-longer trust the US federal government to do a good job in areas we care about, like civil liberties, social justice, global warming, and education. But a big portion remains focussed on global problems like Malaria.

These are all (technically) non-partisan causes, but in addition I may seek out and support particular politicians and political organizations.

election reaction

I'm overwhelmed.

I see a lot of people struggling to process it, like me. I see some posts trying to tell other people how to feel about it. I don't think this is the right time for that. Here's how I feel.

I feel guilty. I was worried and stressed about this election to the exclusion of work, for a month. But I didn't do anything, other than vote. I could have done more, and I knew it at the time. So I feel guilty. I have friends who feel (reasonably, in my opinion) threatened by the election results. I feel bad that I didn't do more to prevent this outcome.

I am an atheist*, and an elitist. I believe in science, reason, and progress. I subscribe to humanism and feminism and multiculturalism. I believe that intellectual honesty is a prime virtue. In this election, one of the candidates was well aligned with my values, and the other was not, and I didn't do very much about it. I did vote at least.

Elitist?

Yes. I believe that knowledge and experience matter, that science helps us make good decisions, and that people who have studied and practiced subject are better at it. I don't believe that an uninformed opinion is worth as much as an informed one.

There's another meaning of elitist, which is more about judging which people are worthwhile and which are not. I don't identify with that, I try not to act that way, but I can see why people can get that impression of my tribe. Empathy is hard work, and human beings often just skip it.

So, I feel guilty, and I want to start helping move the country forward. I'm not sure what that means yet. Here are a few of organizations I've been interested in:

https://represent.us/
https://www.codeforamerica.org/
http://evonomics.com/

Another idea I've been kicking around is to gamify civic engagement. Basically to take https://www.vote.org/ and smash it together with pokemon go. Here's my angle. I believe that when people are engaged with their government at all levels, they feel invested in the outcome. If you feel like government basically works, then you don't need to flip the table. You can work within the system to address your needs. So let's make civic engagement into an addicting and social experience.

But that's all speculative and distant. For now I am committed to finishing up Legacy. After, I might consider some kind of career pivot. In the meantime we will adjust our charitable giving. I want to write a post on that when we've done our homework and cut our checks.

...

For now, I feel bad when I go out in public. As a straight white man with a good career, I am insulated from basically everything. I likely won't face the consequences of this election personally. I don't know if I should be wearing a safety pin or something. I want to show solidarity with the people who feel personally threatened by America's new direction.


*I try not to push my atheism on other people. I think it's rude to proselytize, and I do believe in multiculturalism. I know lots of religious people who are virtuous, intellectually honest, and thoughtful. I'm not trying to say otherwise. But if you wanna argue we can argue.

iteration fanaticism

One of the bad reputations I inadvertently acquired at my last job, I'm told, was that I'm a technology zealot. The charge is that I care more about how good the tech could be, than about delivering actual value to players.

I understand why people might think that about me, because, I really love thinking about awesome tech, in particular workflow tooling. I might be fanatical about instant feedback and safe iteration.

In order to keep myself in check, I've developed a couple of personal rules.

Rule 1. Never make a tool for a user who does not exist. This means I need to figure out who, exactly, will be using the tool, and make it work for that real person. This keeps me from getting lost in tool usability land. If I'm the user, and I know how to edit a json file, great!

Rule 2. Prefer viewers to editors. Editing a text file is actually a pretty rich experience these days. If you can edit a text file, press save, and see instant feedback, that's pretty good. You don't necessarily need or want to drag boxes across the screen. This rule alone has saved me hundreds, maybe thousands of tool programming hours while working on Legacy.

In-place runtime iteration is the gold standard. You should be able to modify source files to edit any number or string value you care about, and instantly see it updated in the game. If you can do that, you don't need a dedicated editor, in-game or otherwise. JSON is a pretty good data format. In particular, it's a good data format when you're editing it inside an IDE with live syntax feedback and domain validation.

education, culture

http://slatestarcodex.com/2016/05/19/teachers-much-more-than-you-wanted-to-know/

I read this thing and I want to talk about it.

The question is, why do some students do better than others? Are there good teachers and bad teachers? (There must be, right?) How can we measure teacher quality? The essay reviews a lot of literature on the subject and ends up with a big shrug. It seems like teachers have a small but non-zero affect on students' long-term achievement.

Anyway what I want to say is:

It's the culture. It's the culture of the kids in the class. That's why one disruptive student can have such a big measured impact. They can swing the whole classroom culture away from the subject and toward scatology, or whatever. But I think there must be a hundred effects more subtle than just the presence or absence of disruption. What do kids talk about with eachother? Do they cheat, and how much? What do they think of their teachers, their school, their parents, their community? How do they feel about their own futures?

Really great, standout teachers don't just cover the material, they're not just "more engaging." They actually hijack the culture of the classroom and bend it towards academic achievement. Every great teacher I've had did this, either via a naturally contagious enthusiasm for the subject, or by literally terrifying the class and commanding their respect. (Ideally both.)

When you join the military (I'm led to believe), you go through basic training. In all the montages I've ever seen, a mean old drill sergeant will break you down, put you through hell, and you'll come out the other side a completely different person. But what's happening at the cultural level of the platoon?

You start as a group of civilian strangers with a weak shared culture based on national identity, and a wide variety of problem solving and interpersonal approaches. Take that culture and hand them guns and tell them to take a hill, what do you get?

At the end of basic, you have a different (and -importantly- shared) culture. One that values teamwork, physicality, toughness, aggressiveness, hierarchy. Now hand the second group guns. Right?

The drill sergeant's main job is not to whip the recruits into physical shape. That's important, but their main job is to wipe away civilian culture and replace it with military culture, because that's the culture you need to be an effective soldier.

Back to education. Kids learn from eachother. Maybe not academic subjects so much, but behavior. Disruptive, studious, creative, serious, cynical, whatever. The culture of the class determines how the student interacts with the teacher's lessons. Will she sink her teeth into the big project and learn a ton? Or will she half-ass it, collude, cheat, and end up with little to show (academically) for her time? The classroom culture determines the outcome.

Kids in school have a really strong culture all their own. This culture is molded by their previous school experience. Teachers influence this culture. Standout teachers can hijack it in a way a drill sergeant does. But this is difficult to replicate. Kids are cynical, and their culture is resistant to "inspirational teachers."

Ok that's what I wanted to say. I don't have any citations, this is just my 20 minutes of thought.

blend modes, alpha compositing

I'm learning graphics! (BORING!)

Ok, so for Legacy, I want to be able to programmatically compose 2d art using the same blend modes that Photoshop uses. This allows us to just specify some hex values, and automatically generate all the nicely colored images. I'm talking about stuff like overlay, screen, multiply, hard light, all that.

It turns out that photoshop blend modes are fairly subtle. In particular, they perform math and logic on the underlying color. This is something that a standard pixel shader can't do, because you just don't know what color the destination is until you get to the fixed function step, after your shader is done. The fixed function step can do some basic addition and multiplication, and that's not enough to give you the fancier stuff like screen, overlay etc..

So what you gotta do is use the underlying layer as an input to the shader that's doing the blend. This is kindof annoying because it means you need two texture targets, and you need to ping-pong between them, and then you also need to do image copying at each step, or do a whole framebuffer pass at each step. But whatever, for Legacy we don't need this in the realtime pipe, so that's fine.

I was gonna build all this myself but then I found this blog post and shader file that has it all, and it also answered my question about whether the blend logic should be per-component or on a pixel "value."  (per-component is the answer.) Sweet. So now I have a little utility class to compose images using photoshop blend styles.

Once you have the rgb value correct, you also need to get the alpha right. This is something that I had always kinda glossed over. I never quite understood how the fixed function blending handled alpha, and why alpha premultiplication is necessary. So I made some bad assumptions. But I figured it out!

If you care about the alpha value in the final image - i.e. you are rendering an intermediate texture that will later be rendered into the scene and it's alpha must be correct - then you cannot use the standard alpha blend function:

source.rgba*source.a + dest.rgba*(1-source.a)

because - although it will get the rgb values right, it will cause your image to be too transparent. To see this, plug in 1.0 for dest.a and 0.5 for source.a. The final a value is (0.5*0.5)+1.0*(1-0.5) = 0.75.
But it should be 1, because the underlying layer is opaque. Basically this blend function treats alpha like a color component, instead of compositing it separately. This is the part I failed to realize, I thought there was special handling of the alpha component, for some reason.

What you need instead is, inside the shader, multiply your rgb components by your alpha component, and then use:

source.rgba*1 + dest.rgba*(1-source.a)

which expands to:

vec4(source.rgb*source.a, source.a) + dest,rgba*(1-source.a)

so, now plugging in 1.0 for dest.a and 0.5 for source.a, we can see that the rgb values are the same as before, but the alpha value is now correctly calculated as 1.0.

So this is why alpha premultiplication is sometimes important. It's important if you need the alpha values in your final image to be accurate.


freedom is scary

phase 1: get money.
phase 2: build.
phase 3: victory points.

We've got a lot of freedom in our life right now. Almost a terrifying amount, in some ways. Benjamin is getting older and much more capable. Legacy is floating along nicely. We're starting to talk about where to buy a house, and what we want our days to look like.

I don't think it's quite castle time yet, for a couple reasons. One, we don't really have enough money to support full-time construction-kind of activities, and the stress that would create is not worth it. Two, the kid is not really going to be safe around an active construction site, for a few more years. And we might have another kid? So, maybe we put off the active construction lifestyle for bit.

But otherwise, we have a ridiculous amount of freedom. As long as we can bring in a bit of money here or there, we can pretty much do what we want with our days. So, we're working on figuring out what that means. Travel? Treehouse Village? Other projects?

Seriously if anyone wants to pitch a project, this is a good time for it. The thing I miss the most these days is working with other people, my friends in particular. I'd kindof love to take on a project for someone, report progress, get feedback, all that good stuff. For now Legacy still has to come first, but let me know if you have an idea, and we could start estimating and planning at least.

What else. We've also been getting interested in effective altruism, and we did a big year-end charity spend this year, which is something that I always thought rich people did to get tax write-offs and feel good about themselves. Turns out it works great.

On those lines I've been reading a lot about macro economics, global development, and the way the world works. It's pretty crazy. One insight is that the human world has been getting much, much better over the past several decades, and it seems like the trend can continue. Climate change is a real challenge, but a solvable one, and the human world seems to be getting its shit together overall. I'm not calling the end of history, politics, tragedy, or any of that, but I think it's a pretty great time to be alive, compared with any time that's come before.

That's the dream, anyway. :-) Happy new year!

are we human?

Anyone still play StepMania? I dusted off my dance pad the other week 'cause it was cold and I wanted to warm up. Then I went looking online for more* cool songs to play. Guess what I couldn't find? So I stepped up (so to speak) to the challenge and authored it myself. I think it came out pretty good.


 I didn't do anything above medium because that's about my skill level right now and I don't think I'd do a good job with hard steps if I can't dance 'em myself.


Anyway if you want it let me know.

*Oh yeah of course I still have the awesome Death Star vintage collection. And I still have some other works in progress from that era, mostly JoCo songs, that I could polish up.

shader validation in intellij using glslangValidator

tech post, feel free to ignore.

If you're like me and you're writing shaders in glsl using IntelliJ  as your IDE*, you probably have noticed a few things:

1. The glsl plugin for IntelliJ sucks. It just doesn't work well or do what you want. I uninstalled it.
2. Different graphics cards support different features, and can be more strict or less strict.
3. The shader version you select has a sweeping impact on how you need to write your shaders. I go back and forth between writing for GLES 2.0 (version 100) and desktop OpenGL 3.0 (version 130) so I get confused a lot.
4. The lack of validation or simple IDE features means that I spend a lot of time editing, running my app to see the shader compile errors, and then fixing them.

Ok so that's terrible. But you can have really good glsl validation right in your IDE in just a few easy steps. Thanks Nick for helping me out with the File Watcher step!

1. Khronos maintains a glsl reference compiler. You can get it here. Download it and put it somewhere safe.

2. IntelliJ has a plugin called File Watchers, that will wait for a file to be modified and then run an external tool on that file. Install that plugin (you will have to hit the "browse repositories" button to find it. You'll need to restart IntelliJ.



3. Create a file type for your shaders. Make sure to include the *.vert and *.frag line endings (and whatever else if you use tessellation shaders, etc.. The glslangValidator tool expects your files to be named canonically.


Bonus, you can add in a bunch of keywords. I have the OpenGL Shading Language Reference Cards for the OpenGL versions I'm targetting (ES 2.0, ES 3.0) printed out, so I added all of the preprocessor directives, data types, and the builtin functions to the keyword tabs. Yeah!


4. Setup a file watcher by going to the File Watchers section that should now be present under project settings.


Tell it to track the shader file type you set up in step 3. Tell it to run the glslangValidator program that you downloaded in step 1. Set the input and working directory. You could also play around with conf files and other command line options if you want of course.


Then you should get some awesome feedback on your shaders!
 


*Haha so a couple people? Maybe?

three years, perspective and philosophy

Happy Anniversary Annie! It's been great so far. <3 p="">
~

I've been struggling a lot with perspective these days. Because I work from home, I'm out of the day-to-day crush of urgency that offices tend to develop into, and instead I have a lot more time to get lost in my own head.

We've been trying to sell the Hawthorne house. That's been disappointing so we might have to hang on to it for a while. We were pretty upset about that for a couple of weeks, but, not with good reason. We're doing well enough that we have no right to complain. :-)

Working from home is tremendous. I get more actual code accomplished in one good day than I did in a good week at Riot. And I get to hang out with my baby and my wife! I definitely miss the people though, and the sense of urgency and importance that comes with working on a live product. I hope I can get some of that back when Legacy goes live.

It looks like we'll be trying to rent a place in Austin until we can get our money lined up to buy. That's slightly inconvenient but I'm sure it'll turn out fine. I'm excited to leave Los Angeles. I don't think we take advantage of the place, we don't eat out or go clubbing or have fancy jobs that tie us here (anymore). So we'll be better off living somewhere with a low cost of living and great culture.

A friend and former colleague committed suicide last week. I don't have a lot to say about it but I wanted to mark it here. The main lesson I'm drawing is to practice gratefulness every day. My life is truly blessed -- I'm not spiritual but I have no better word for the abundance of good fortune that surrounds me every day.

I've been reading a lot about stoicism and there's a lot that I like about it. The central point, to me, is to separate what you can control (your own actions, mostly) and what you can't control (other people's actions, nature, your genetics, etc..) and focus only on the things you can control. The philosophy emphasizes rationality and virtue over pleasure and passion. That's sometimes tough medicine for me.

We've been watching a lot of nature documentaries on Netflix and we recently picked up the new Cosmos. Zooming in and out all the time is good for breaking you out of your everyday cares and concerns. I've had an incredibly wonderful last few years! I'm looking forward to many many more.

financial independence dreams

Yesterday I discovered this dude, and I spent much of  the day reading through his blog archives.
Mr. Money Mustache is a radical anti-consumerism, pro-frugality advocate. He retired comfortably at age 30 or so on a normal (combined) income. Now he blogs about it.

As a man with a dream* myself, one that isn't going to to wait until I'm 65, I found this extremely interesting. I've always secretly believed that your optimism could be strong enough to conquer seemingly unrealistic challenges with ease. Simultaneously I've always felt kinda silly and childish for believing I could beat the system.

Well it's refreshing to hear from someone who has beaten it and feels great about the result. What I like is that he systematically unpacks the factors that keep people spending more than they need to on stuff that doesn't make them happy, and then offers alternatives. He talks about the billions spent on advertising to convince us that we need to buy manufactured goods and overpriced services. And he frames it in an amusing call to man up and grow a money mustache.

It is in fact exactly the kind of advice that you CANNOT find in the mainstream media, because it challenges the underlying assumptions of the entire framework of consumerism. Little ideas like, what if we took our enormous collective wealth and spent it on more leisure time with our families, instead of on more stuff? Anyway he's kindof a zealot but I'm really enjoying the perspective.

Many of his goals and conclusions are familiar to Annie and I, since we started our financial adventure together years ago: a) rental properties are a great deal for the landlord right now b) fancy houses and cars are a cash drain c) Vanguard index funds FTW, d) cable television, and fancy furniture are not for us. e) restaurants are expensive so use them for special occasions. f) cooking is awesome. g) walking/biking as much as you can is awesome. h) time with family is really important. i) some things ARE worth splurging on. Just pick them carefully.

It's good to hear from someone further down the trail. This is going to become my default money advice destination. Financial independence is a touchy subject I think. It's full of inherent implied or inferred lifestyle judgments that I generally try to avoid, and that makes the whole topic a bit taboo. But it's also crucially important! So finding a way to talk about it is important to me.


*I want to retire with $2M+ net worth around age 40, and then spend the rest of my time building a castle** with my own hands (and power tools).
** modern, castle-inspired structure, ideal for multiple families and guests to live harmoniously, close to the land, with awesome amenities like secret passages, aquaponics operations, and a full shop.

theta* pathfinding

An algorithm for the any-angle pathfinding problem:

http://idm-lab.org/bib/abstracts/papers/jair10b.pdf

For the Legacy world map I'd like to be able to find natural looking paths that avoid obstacles. I've got a lot of terrain and it's easy to turn that terrain into a potential field (bitmap) which can be used as a cost lookup for a pathfinding algorithm.. but.. there are some issues. In particular I don't want the paths to look like they are constrained to a grid. And if I make the grid cells small enough so that I get naturalish results, then the algorithm runs slowly. Theta* seems to be an interesting candidate; close to the speed of a grid-based A* but with more natural resulting paths, similar to results you'd get from path smoothing. I'd possible still want to round off the corners with post processing.. I don't know.

Assumedly, another approach would be based on steering, or a hybrid coarse grid A* with steering for local control. That sounds like it could take a long time to tune, but might give very good results. For the non-player actors, efficient paths are less important, and some kind of wandering/pheremone trail combination could be interesting. In particular, if you had such an emergent system, then you could use it to mark local paths, which then could become your nav grid. A lot of preprocessing I guess, but maybe that's ok.

You know what else sounds cool? Probabilistic roadmaps.

a dumb problem I had today

This is a technical post.

Today VisualVM stopped profiling my applications. No apps showed up in the bar on the left. After many false leads involving rival jvms and 32/64 bit confusion, I tracked this down to "not able to read the temp folder," which it turns out, is because my temp folder is now pointing to C:\Windows\Temp instead of the usual location under Users. Honestly no idea how that changed, perhaps an installer did it at some point? Who would do such a thing. Why.

Anyway by navigating to that folder in windows explorer it prompted me to elevate privileges for it, and that resolved the issue with VisualVM.

I still hate VisualVM. I don't know, an error message with the folder it was trying to access might have been nice. Would have saved me 3 or 4 hours today. Still, I'm reluctant to spend $500 for a professional profiler.

sigh.

I'm making a lot of great progress on Legacy though. It's great fun most of the time. :-)

whoops

I accidentally looked up Celtic knots last night. Don't do that. It's a pretty amazing graphic design (and math?) rabbit hole. Also hey, Insular Art, the Book of Kells (the movie Secret of Kells is about a real book, I did not realize that), and the Picts, who seem to have directly inspired both Skyrim's Forsworn and Terry Pratchett's Nac Mac Feegle.

I found this software http://knotter.mattbas.org/Knotter which is actually a really good starting point for the more regular knots. Where it appears to fall down is that the curves are not smoothed, so you can get a rough circle out of it, just not a smooth one, and getting to do complicated things with mixed weights sounds more difficult than drawing it myself. But it's very strong as a playground and as a place to sketch your design, from there bring it into illustrator or draw it by hand...

By taking the output and slicing it up into a tile and putting it into a mesh I was able to get what I was looking for.


(need a better bg tile obv)

...and I think I better just call it a win and stop right there. I don't want to get lost. To that end I've decided that every time I see the word "Gaelic", I'll shift a letter and internally read it as "Garlic." That should help things.

java development = the desert

Profiling java applications for free seems to be just barely possible. VisualVM is buggy, hard to use, and has the smallest feature set I've seen in a profiler. It's considerably worse than the tools that Adobe provides for actionscript. (?!)

Anyway if you have a memory leak and you're all "dag yo, what could be hanging on to that reference?" and you refuse to pay for a good profiler, then here's how you can do it with VisualVM:

http://visualvm.java.net/heapdump.html

fun with ai

http://en.wikipedia.org/wiki/Monte-Carlo_tree_search
or, how to be mostly right most of the time.

http://en.wikipedia.org/wiki/Flocking_(behavior)

http://www.red3d.com/cwr/steer/

oh dear oh dear.

people must be using openCL for this sort of thing these days?

mm juices flowing. After Legacy, maybe something with a ton of realtime AI is next..

ide supported refactoring has changed my mind

Modern IDEs can do some really crazy stuff.

For example, I just executed an automatic refactoring to extract a parameter object for a method in IntelliJ. It automatically created an inner class with the required fields, and a constructor to support them, and then found all usages of the method and converted them to create new instances of the parameter object.

The point is that I modified 3 or 4 files with one command, and I've gotten used to being able to do so safely and quickly, for a pretty good variety of transforms. I have a button on my sidecar dedicated to "rename."

The 'safely' part is amazing to me; it's a game changer in my opinion. Software engineering, and programming languages even, have evolved around the idea of localizing information as much as possible, and separating concerns as a discipline because it isolates the system from cascading changes.

But.. when my tools support safely and easily cascading changes across my project, those design concerns may become less important, and it raises the question* of what we could gain if we eased those constraints a bit.. Perhaps some conceptual clarity, conciseness, or readability?

Which reminds me, when I have all the money, I want to start or fund tiny little non-profits to write excellent free and open-source software. It's a form of philanthropy that appeals to me.


*I refuse to use the term "begs the question" because I think that phrase is simply bait for people to tell you that you're using it wrong. Kindof like I refuse to use the word "ironic."

baby bubbles

Here's a little side project I did a couple weeks ago.

http://worldwalkergames.com/apps-for-babies.html

https://play.google.com/store/apps/details?id=austin.baby.bubbles.android

It's an app for babies that shows a lot of bubbles that you can pop, and they make some musical noise. I made it because we were unable to find one that we liked.

If you have a baby and an android tablet, I'd love to get your feedback! I'm charging a dollar for the app, but if you don't want to pay me let me know and I'll add you to the beta.

I'm totally open to suggestions and feature creep. This was really easy to make and pretty fun, so let me know if you'd like to see something/else.

18 million indices

Just solved a performance issue in Legacy where I was basically squaring the size of the index buffer for the wall mesh, which was allocating space for about 6 million triangles instead of a couple thousand. When this happened the framerate dropped from 60 to 55, and CPU usage went up to 12%. So I learned two things:

1) I have a lot of performance headroom.*
2) Nothing is stopping me from making stupid mistakes like that, and I might not ever notice them if they don't cause problems, so I'd better develop some better techniques.

I feel pretty good about it though. And I'll post some progress on the Legacy blog soon.

*I'd better, I'm not drawing very much yet.. This is one of my persistent boogeymen with game programming; I'm not a graphics expert, in fact I honestly have very little idea of what the machine can do, what I can throw at it, etc.. Basically it's like learning to jump when you're afraid you might hit the ceiling. I should get over that.

libgdx fonts

Use gdx-fontpack instead of Heiro for higher-quality fonts. You have to be a little careful to export the font .png with the exact same name as the .fnt file, and only use one font face and size per file, so that the libgdx skinning works with it.

(This screenshot shows multiple fonts and sizes, which I just told you not to do, if you want to use the libgdx skin system.)

It uses FreeType instead of java default font rendering, so the output is much nicer.

I'm interested in upgrading to distance field fonts as well, but it doesn't seem that the built in UI actors support custom font shaders, and I don't particularly want to muck around with them at the moment.