programming

Sockets, CLOSE_WAIT, and You

I found this discussion about TCP sockets in Linux sitting around half-finished in Google Drive. It was dated 2012-10-23. I have no memory of writing it. I cleaned it up and am posting it here in case anyone finds it useful. A ‘socket’ is an abstraction for a network connection. Each machine has a socket it is communicating with; from an application’s perspective, sockets make it possible to treat a network connection much like a file on the local system, and just read from and write to it like any other file.
Read more

The Orange Box: A custom USB Flight Control Panel

I play a lot of Elite: Dangerous. And while I use a reasonably nice HOTAS, I’ve long wanted a flight panel: a bank of toggle switches with LED indicators that would act as a USB joystick. I can only find one company selling such a thing, and their solution leaves exposed wiring. (a no-no when you live with cats) Also, their website looks like it is from the 90s and just feels kind of sketchy.
Read more

pygo - a go game client

If I have anything like ‘regular readers’ (I’m not certain from the traffic patterns on the blog whether or not that’s true), you’re probably wondering where I’ve been. The answer is, basically, the same as it ever is: writing code.I’ve also been playing a lot of Go, and doing some tabletop roleplaying. My latest programming projects are related to those hobbies. Today I want to talk about pygo, my new Go game client.
Read more

Project Treewars: Going in Circles

It’s been quite a while since I actually worked on TreeWars. Various things have distracted me, including some other programming projects. But I actually made some progress way back in July, before I shelved the project temporarily. So, let’s talk about circles.OpenGL gives us a few different ways to draw things, which I’ve talked about before. When we were using the fixed-pipeline functions (glBegin(), glEnd(), etc), I could draw a circle the same way I drew it in SDL: draw a bunch of same-sized rectangles, shifting the coordinates around a central point so that they overlap.
Read more

dmr

K&R is a book that has had a profound influence on my life. And I’m not just talking about the influence of it and the C language on computing in general; the direct course of my life has hinged on the language.I didn’t read K&R while I was in college (I did read it after, and it’s a great reference. Anyone who wants to understand C better should have a copy).
Read more

Project TreeWars: How Anna got her Title Screen back

In my last post, I re-implemented all of my rendering code to take advantage of Shaders. After doing this, nothing rendered. Despite the fact that I was following a tutorial, more or less. I have been modifying it to fit my project, which has a lot of code around the rendering code already and is in C++ instead of C, and also modifying it to do something that will actually be useful for me down the line.
Read more

Project TreeWars: When is an OpenGL not an OpenGL?

So, I was playing around with the ‘sparks’ feature on Google+. Since I’ve been working with OpenGL lately, I made a spark for it. On that spark, I came across this thread, which gave me this advice:A general rule of thumb is that if a tutorial contains calls to glBegin, glEnd and/or any of the glTexEnv functions then it’s old and you should avoid it.Now, I wouldn’t generally trust a single person on the Internet with nothing to recommend them, but I’m seeing this advice repeated in several places now that I know to look.
Read more

Project TreeWars: the road to OpenGL

Over on Shamus Young’s blog, he recently said this when talking about a programming project of his:One of the things I like about this project is that it is uncluttered by goofy, awkwardly-designed libraries.Shamus is working on a procedurally-generated 3D world using OpenGL. Now, I know what he means. He is trying to avoid relying on things like graphics and physics engines, or 3D model importers, or any of a number of other tools that often have asinine and byzantine APIs.
Read more

Project TreeWars: How to write bad code

The TreeWars project is a week and a half old (at the time of this writing). It’s come a long way; in its current form, it actually looks pretty neat:There are now stats, and hit points, and the basic gameplay mechanic is in place. I’ve also laid the groundwork for some more complex gameplay, as well. Of course, I haven’t talked about gameplay all that much yet - we’ll get to that at some point, I’m sure.
Read more

Project TreeWars: The Beginning

My goal is two posts a week - typically, one on Wednesday and one on the weekend. This is usually a pretty easy goal to obtain - it doesn’t take too much of my free time to churn out two posts between 750 and 1500 words. And yet, there almost wasn’t a post this weekend. Was I playing Minecraft? Nope.I was writing code.Programming is something I’ve always wanted to do professionally, but somehow I managed to end up doing enterprise technical support instead.
Read more