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.

noise

http://www.gamedev.net/blog/33/entry-2138456-seamless-noise/

You can use a higher-dimensional noise volume to create a seamless (tileable) noise pattern in a lower dimension, by tracing a path through the higher dimensional space.

cool, huh?

losing weight sucks

I'm back on the Hacker's Diet. I had been below 200 for a while in 2011 and 2012, and then work got stressful and etc. etc., and I got back up to 230ish at the start of this year. But since I lost my job I haven't been eating out for lunch 5 days a week. I'm also feeling so much better about life in general, so that makes it easier to try the diet.

It's working, I'm down to 220 or so. It does hurt though :-)


classic argument

"You're deluded!"
"No, you're diluted!"

Making Legacy sometimes feels like an exercise in hubris. I've had to carefully spin a cocoon of past success, monetary savings, prototypes, and supportive friends and family, in order to be able to give the caterpillar time to reconfigure its tissues into an indie game. I worry that at any time prosaic reality might pierce the protective silk and gobble up the little guy. Just give it time, I keep whispering to myself. Time, and tons of hard work. But I was going to do that anyway.

Reading Ready Player One, reading about the Oculus Rift.. makes me so hungry. I feel very luck to be where I am right now.

tmi time

So I have varicose veins. I thought it was just a cosmetic thing, generally, but it turns out they can lead to nasty side effects like the skin on your foot and ankle breaking down, becoming horribly itchy, and eventually venous ulcers that can spray blood unexpectedly. Yeah I have all that.

I went in today for an outpatient procedure to seal off the incompetent* vein. We had to abort it 2 hours in, before we even got to the part with lasers**, because it turns out my veins are so.. tortuous? twisted? they literally look like a pigs tail?*** So I had a wire in my leg for an hour for nothing..

But it's ok. Rescheduled the procedure at the medical center, with general anaesthesia, and they seem pretty confident they can get the job done at that time. So it's fine. God I hate being special when it comes to medical matters.

* a medical term!
** bummer, right?
*** this is what they told me.

overheard in the shower

"Software Engineering is the study of predictably* achieving acceptable** results with mediocre programmers***."

>> "Nate, no-one cares about your programming snark." <<

>> "...But I have footnotes!" <<

Jared made me read Ready Player One. It was a great read, I really enjoyed it, maybe because I got almost half of the references. It think it's really aimed at people just a bit older than me. Classic Gen Xers. Are we still using that term? Anyway: fast paced, teen-oriented plot, compelling setting, a great gimmick, modern sensibilities, and tons and tons of GenX pop culture references. Good times.

I still have that problem where I can't sleep when I'm reading a book if I want to find out what happens. So I finished it 4:30AM... This is why I don't read anymore.



* predictably: for given classes of problems, standard approaches are developed and encouraged. Knowledge of these patterns means that you can almost always find a way to do what you need to do.

** "Including, but by no means limited to, radical redefinitions of the word 'acceptable'." Ha. But honestly this is fairly important. Much of the history of software engineering and high level languages is the history of making acceptable performance trade offs in the name of readability and maintainability. And then arguing about what is "acceptable."

***The thing is, we are all mediocre programmers, in one way or another.

i can draw too u guys

Sometimes I need to make programmer art for things like UI or whatever. I refuse to pay money to adobe for this purpose, so I'm stuck with what's free.

I really... don't like Gimp. I respect it. I respect its principles and I'm glad it's there. In fact I used to crop the screenshots for this very post. But it's just not very good or easy to use. So every now and then I step off the road and start wading through the marsh, looking for something better.

Paint.NET is a total failure for me. On top of wigging out on my graphics card or something, and having a web site covered with skeezy fake download button ads, it just doesn't draw very well.

I actually am most comfortable in Flash, see: my previous career, even though, I'm told ;-) that Flash sucks for actually drawing stuff. But I've never used Illustrator so I don't know what I'm missing. I used to use Paint Shop Pro, a million (20?) years ago. I like pixels just fine, but modern photo editors just never really clicked for me.

I'm trying out Inkscape now and actually liking it pretty well. It's free and open source, and unlike Gimp it seems to care about how people use it.

It's not perfect, the defaults are a little weird, and the gradient editor tool is.. strange.. but so far I've been able to basically do what I want to do with it, which is astonishingly rare for a free paint program. Actually, astonishing rare for *software*, I'd say. I really appreciate the polystar tool options: 


It lets you deform the hell out of the path in several ways that, honestly, they didn't have to support. But they did and it warms my heart.

And then you can mess with it further by grabbing that handle and...
Yeah.
Then there's this thing:
with which you may choose to:
 I dig it. It suits my purposes.

we eat like kings

This is something I believe in general. Living in the US, with a low amount of effort you can eat food made with ingredients from around the world. Spices, meats, fruits, grains, cheeses, wines, breads, noodles, you name it. Actual kings never had that kind of choice. Or, by the time they could have, they had mostly all abdicated.

*bragging alert*

And more specifically, Annie and I eat like kings. :-) We find that with a moderate amount of effort (still way less than most people used to spend preparing and processing their food), we can make ourselves quite happy. Over the last couple months we've been aiming to do it all on a $1k/month food allowance, and so far we seem to be coming in under budget. It makes for a fun mini-game at the supermarket, but to be honest it's not that big a dent in our habits. If anything it's made us more adventurous; we're more likely to bake bread and roast chickens, and generally work more from scratch and less from pre-prepared food.

I've been feeling much better lately, compared to when I had a job. I still work all the time, but now when I'm thinking something over I walk around in the backyard. Now when I take a break I play with Benjamin or take him on a walk to give Annie time to work. It's funny that it feels like a little glimmer of how we'd like retirement to be: still engaged with our passions, but with time to cook food and hang out with friends and family built into the days.

I feel very, very lucky to have this opportunity, and I am working hard to make the most of it.

i'm an old man

When I was your age, computers had 2 colors: green and black! One day my dad brought home a fancy new computer that had 16 colors, and we thought were living in the future.

What the hell is this crap?
*These are the available OpenGL color formats. What's a snorm?

legacy

Nick and I will be working together on Legacy. Legacy has been a side project for a while, something we worked on at home for fun. Annie's done a lot of art for it, Doug has written a lot of lore for it, Isaac and Katie even helped a bit! I've been steadily chipping away at it for a long time.

We're going to be rewriting the code from the ground up in Java. Then, we're going to make it fun. I'm excited.

why so serious

I think one of the reasons I drifted away from Riot over the last couple years is my aversion to seriousness. This personality trait comes up again and again in my internal account of my life, and I'm sometimes conflicted about it. It certainly gives me something to prove.

One of the things I'm most relieved about is that I can leave Riot's inevitable transition to seriousness* behind me. I don't think it's because I can't compete technically, on the merits. I think it's much more that I find it tiresome to worry about every little thing. My style is much more "deal with it when it's a problem" than "figure it out upfront."

In my long term dream, the castle, I live the life of a gentleman-artist. I dabble in whatever interests me. I continue to work hard and learn. But the things I want to build are zeppelins, submarines, secret passages, towers on islands in lakes, underwater fortresses, aquaponics, tropical greenhouses in the snow..

It's difficult to tie that kind of whimsical vision to a big company. I often experience seriousness as a one way street. It's easy to get more serious, hard to get less serious. It takes real discipline, optimism, and trust in order to maintain a fun, creative working culture where mistakes are celebrated. I think it's extremely difficult to have that environment at a big company, for reasons of human psychology**.

If I'm willing to accept that I have the mentality of an artist but the skills of an engineer, then it seems that software engineering at a big company isn't really for me. Developing little games is the closest thing I've found to being paid to do what I want. Making my own game seems like an inevitable path.


*I don't think it will stop being fun to work at Riot, more that it's gotten so difficult to push stuff live. When I arrived, associate engineers could push code live without any real process at all. I'm more comfortable in that kind of environment, even though it may not be appropriate for a product the size of LoL.

**monkeysphere.

so long,

suckers!*

I'm no longer at Riot. It was a good place to work and I really enjoyed many things about it, but ultimately my career is going in a different direction, and I'll have to figure that out.

I don't yet know what I'll be doing with my time, but Annie has her job and we have enough funds for the moment. Which means that all sorts of exciting possibilities are spread before us.

I'm really looking forward to figuring out what's next. Also if anyone want to talk about anything, hit me up. Real estate, stock, babies, restaurants, games, tech, cheese, whatever.


* "so long, suckers!" is a traditional farewell among my people. It carries no ill-will.