Skip to content
Eli Dupree's avatar, a smiling face with a wizard's hat as a broken version of the 'male' and 'female' symbols.
Welcome to Eli Dupree's website! Eli Dupree is a human who writes stories, games, music, and art. Ze blogs about everything from feminism and neurodiversity to math and computer programming.
Home | Index | Feed iconAtom feed
You can contact Eli by email at:
eli(AT sign)elidupree.com
You will be able to register an account and log in here if your browser supports JavaScript and some form of local data storage. You appear to be using a browser that does not support JavaScript.

You are not logged in.

You will be able to register an account and log in here if your browser supports JavaScript and some form of local data storage. You appear to be using a browser that does not support JavaScript.

Username:
Password:
Duration:
Usernames must be between 3 and 32 characters, and can only contain letters, numbers, and underscores. Passwords must be at least 8 characters long.
Username:
Password:
Retype password:
Write "I am not a bot":
Login duration:
Posted at UTC 2011-08-20 03:44:19
Eli_Dupree says:
Eli_Dupree's avatar

A little update

I still haven't been doing much for a while - mostly playing online games, watching videos, and so forth. Oh, and running a quirky Mafia variant on an internet forum - you can check it out over here on the XKCD forums if you're into that sort of thing. My inactivity has a lot to do with the fact that it's late in the summer, it's hot all the time, and I haven't been talking to other people too much. (Getting at least a little interaction with other people helps me, because it stimulates my mind and gives me new ideas.) I'm going to be going back to college relatively soon, too, and that's discouraging me from getting into projects a bit, even though I still have about three weeks left.

That said, I've still got a couple of projects running. I'm working on them occasionally, it's just that they're not taking the majority of my time.

One of them is that I'm learning more Javascript, so that I can make cool online games and utilities. Check out this extremely-unfinished game for an example of what I'm messing with. (EDIT: That's a link to the version that I wrote at the time of this post. This is a link to the current version, which I will keep messing with.)

The other is this: Since I'm blocked on the graphics editing software project, I've started just drawing stuff in an existing graphics program (namely GIMP). Here's something I randomly sketched a few days ago:

Image [see below]

(That's an image hosted on an external site. Tell me if it breaks. A transcript is in a footnote.1)

I've also started sketching characters for a fairly absurd short comic (3-4 pages, probably). I might end up drawing that in the next week or two.

Speaking of posting comics here on this website, that's yet another thing that I'm going to need to do programming work for. It's not a problem if I just stick them in blog posts for the moment, but it'd be nice to have a more formal way of presenting them. I'm still planning to post that novella, too – I've edited it as much as I need to, and now the only thing stopping me from posting it is that I haven't been feeling like doing the technical end of things (and, again, I want it to be presented more nicely than just sticking it in a blog post).

Anyway, there's an update for you. Things will probably get more interesting when I head back to college – I'll try not to get so busy that I don't have time to blog, heh heh.

– Eli

Footnotes:
  1. Transcript of the above image:

    Text: What shall I draw? thought I.

    Picture: A cartoon of myself, with an excessively cheerful expression, thinking: Maybe something DARK & DISTURBING?

    Picture: A gaunt face drawn in white on a black background, surrounded by orange streaks. Its thoughts are written messily: I DON'T KNOW WHY I'VE BECOME LIKE THIS. I AM SO COLD, COLD!! I DON'T NEED ANY HELP!!

    Text: What sex is our friend the pyromaniac? I find it easier to read zem as male, but is the face actually characteristically male or is it just that I'm more familiar with that exaggerated gauntness on male characters, while our society makes people draw female people in pristine condition always?

    back
Tagged in posts about gender, posts about visual art, posts about computer programming.
Direct link to this post | You could reply if you had Javascript and local storage ("cookies") enabled
Posted at UTC 2011-07-17 20:06:01
Eli_Dupree says:
Eli_Dupree's avatar

Tired of coding

Blargh.

I'm ready to post the novella that I mentioned in my first post here. I did some last editing earlier today. But before I can post it, I have to make some changes to the website, because I don't want to just copy the text into a blog post. And I can't make those changes right away because I'm tired of doing computer programming (colloquially, coding).

I don't know why it happened. It's not because I'd been doing a lot of it, because I can sometimes code for weeks on end without getting tired. And it's not because I was failing to make progress, because I had been making progress on my drawing program when the tiredness hit me a week and a half ago. I suppose I could make an analogy to the poet's so-called muse – a force of inspiration that seems to come and go at its own whim, without the poet/writer/coder/whatever being able to control it. On the other hand, I don't actually believe that there are things in this world that we can't understand.

Annoyingly enough, essentially all of my current projects require me to do some coding before they can proceed. So this is a bit of a lull in my activity. Which makes me think of the concept of idea producers vs. idea consumers1 – for example, people who write popular songs vs. people who listen to them. Obviously, each individual person sometimes produces ideas and sometimes consumes ideas, but some produce more than others, and some consume more than others.

Anyway, I described that concept so that I could say this: I've been taking a break from idea production, and consumed some ideas instead, by spending a week playing the computer role-playing game Planescape: Torment.

The way I see it, Planescape: Torment is more like a novel than like a video game. Computer role-playing games (CRPGs) usually have fairly simple plots, like You're a bunch of heroes; go save the world from the Dark Lord!. They have a bunch of dialogue, so you need to be able to read, but the main point is to do battle with foul monsters. Planescape: Torment is the opposite: You need to be able to fight monsters, but the main point is to explore the intriguing dialogue and plot of the game. I'm not going to talk about it too much, because (1) it has enough social problems that it isn't up to my standards for recommended websites, and (2) even if it didn't, it's not readily available (since it's a commercial, non-Free, Windows-only game). But it did make me think about a bunch of ideas, which is cool.

I suppose I could write something here about why I, as a writer, find it valuable to read other people's work, or about why exchanging stories is a good thing even when they sometimes teach problematic lessons, or about the value of cariacture and other unrealistic elements in writing, but I'm not sure my ideas about those things are organized enough right now. Oh well.

– Eli

Footnotes:
  1. I got those terms from somewhere; I don't remember where. It might have been from Edward de Bono's writing. back
Tagged in posts about writing, posts about computer programming.
Direct link to this post | You could reply if you had Javascript and local storage ("cookies") enabled
Posted at UTC 2011-06-22 17:59:42
Eli_Dupree says:
Eli_Dupree's avatar

Two days later: EVERYTHING IS A PIECE OF SHIT

(This post is mostly a long rant about my computing woes. Feel free to skim over it.)

The linuxwacom project website says most modern Linux distributions come with Wacom tablet input drivers already enabled. Ubuntu is supposed to be included in this. So I look around on my system, and sure enough, there's already a package installed that's called xserver-xorg-input-wacom. So I plug in my tablet and try using it. Does it work? Nope!

So I download the linuxwacom drivers manually. I have to install a lot new stuff that they rely on. That's pretty normal. One of the things they need is the latest version of xorg-macros. I check on my system, and I have 1.3. I check my package manager, and sure enough, there's an update available, so I update to 1.5. Wait a minute... linuxwacom needs 1.8! And Ubuntu's current version is 1.5!

PIECES OF SHIT COUNTER

  1. Ubuntu

So I download and install that, manually, which isn't very difficult, just annoying. And I finish installing linuxwacom, and then restart my computer and... YES! The tablet actually works at giving input equivalent to mouse cursor input. So I go and open up some graphics-editing programs that I know are supposed to accept tablet input – GIMP and Inkscape – and sure enough, they also accept tablet input for themselves. Nice!

ACTUALLY DECENT SOFTWARE COUNTER

  1. linuxwacom

And then I spend about 15 minutes messing around in GIMP.

A stylized drawing of a person charging with a sword or something, out of a bright, open doorway.

(That's an image hosted on an external image-sharing site. Tell me if it breaks.)

Messing around in GIMP is pretty nice. GIMP is a bit like a canvas: You can draw on it with a variety of tools, and you have the extra advantage of being able to undo your actions, but the internal substance is just that: The pixels on the screen. Inkscape is different: Inkscape records ideal approximations of the paths you draw, and you can go back and edit those paths later. So, essentially, GIMP is for drawing pictures and Inkscape is for designing pictures. But I want to be able to draw and design pictures, so neither really has the feature-set that I want, and since I'm probably going to be using this medium a lot, for a long time, I want to have absolute control over my own abilities; both Inkscape and GIMP have a lot of configuration options, but they aren't nearly as versatile as they could be if I had direct control at the source level. I need to write my own programs.

So I look at the source code of GIMP and Inkscape, to see how they use tablet input. Their source code is incredibly complicated and confusing, and doesn't have good documentation. Both of them are built using GTK, a graphical-user-interface library. I ask the Internet about GTK tablet input, and it says that GTK has some long-standing, significant bugs relating to tablet input, which haven't been fixed for some reason. Plus, what I want to do (for the moment) is just add tablet input to an existing program, and using GTK for that would be like buying a giant toolbox just to use a screwdriver.

PIECES OF SHIT COUNTER

  1. Ubuntu
  2. GTK

So I go to Google and search for information about how to use tablet input in C++ programs. I use a lot of combinations of the following search terms: tablet, wacom, input, c++, programming, linux... But if you search for tablet you get information about tablet PCs, and if you don't search for linux then you only get info about how to do it on Windows, and if you do search for linux then you only get information about linuxwacom, which is just the driver. And if you search for c or c++ then you get information about parts of linuxwacom that are written in C, and if you search for input then you get lots of pages about how to set up Wacom tablet input from the user-end perspective, which I've already done, but if you don't search for input then you don't get the right information! I did discover that there's, apparently, a fairly simple system for getting tablet input in Haskell, but I don't want to use Haskell for this stage of the project; I'll be saying Go screw with this and Haskell will say Excuse me, I'm sure you mean 'Please show me the results of executing this list of screwing operations'. Haskell just isn't a good language for doing stupid stuff in!

You know what's another interesting thing about a Google search for Haskell tablet input? This website is in the first page of Google results. Which is... kinda flattering, but completely useless to me!

PIECES OF SHIT COUNTER

  1. Ubuntu
  2. GTK
  3. Google

Okay, so I've been using SDL. SDL has its own event system, which gives you mouse and keyboard input and stuff; let's see if it has a way to get tablet input. So I go to Google again and ask it about SDL tablet input. Turns out, SDL has no built-in way of accepting tablet input. Yuck! On the other hand, it is supposed to have a way to ask the X Window Manager for its own events. And I know X is receiving my tablet events, because X is the entity that makes it function as a mouse. (Also I checked with the utility program xev.) So I spend another few hours looking up what X events are and how they're stored, and I finally find some convenient example code that reads the X events directly. And so I compile that code, and IT WORKS. YES!

So then I go back and try to include that in my SDL code, by using SDL's SYSWMEVENT construct (short for system window manager event; it is supposed to cover every kind of event that SDL doesn't cover by default). I successfully enable SYSWMEVENTS... but it doesn't work at all, because SDL only reports MOUSEMOTION events for my tablet input, not any SYSWMEVENTS.

PIECES OF SHIT COUNTER

  1. Ubuntu
  2. GTK
  3. Google
  4. SDL

Okay, that doesn't seem like TOO much of a setback, because I already have this code that takes the input, so I can just use it and SDL, even if that seems kind of stupid. So I try that. It seems to work pretty well! The only problem is, the position of the cursor in the window isn't the same as the coordinates that the tablet gives. SDL mouse motion events give you coordinates based in the window – the top left corner of the window is (0, 0) – but X events give you coordinates based on the screen size, where the top left corner of the screen is (0, 0). That shouldn't be too hard to deal with, though, because all I have to do is subtract the window's position within the screen, and then I get the position I want.

It turns out that SDL has no way of knowing where its window is.

PIECES OF SHIT COUNTER

  1. Ubuntu
  2. GTK
  3. Google
  4. SDL
  5. SDL

(And I can't compute it based on the difference between the SDL event coordinates and the X event coordinates, because the events don't come at exactly the same times.)

I guess I'm gonna ditch SDL. But first, I think I'm going to take a break. I've spent the better part of two days trying to work around the fact that I have to deal with shitty, badly documented systems, and that's pretty stressful, so I should probably take a break from it. (Be glad it didn't take you two days to read this rant!)

Maybe I'll work on my little game some more, or start cutting into my TODO list for this website.

– Eli

Tagged in posts about computer programming, posts about the graphics editing project.
Direct link to this post | You could reply if you had Javascript and local storage ("cookies") enabled
Posted at UTC 2011-06-20 18:37:56
Eli_Dupree says:
Eli_Dupree's avatar

Title: C++ vs. Haskell: ROUND TWO: But I want it to be fast!

In the last two days, I've entirely rewritten my game from Haskell into C++! As much as I love the expressive power of Haskell, it just isn't a suitable language for writing things that need to push the boundaries of computers' processing power. This is partially because of the way the languages are designed, and partially because a lot more work has gone into optimizing C++ compilers because it's a more popular language. On the plus side, by writing my game in Haskell first, I feel like I understand the structure of the program a lot better.

On my computer, this version runs smoothly at 100 frames per second, even when you have hundreds of bullets (laser bullets?) flying around in the infinite(!) world.

I've also added a few new features - there's now an infinite, randomly generated cave system, and the bullets last forever instead of disappearing when they leave the screen. I'd post a new screenshot, but it doesn't look much different than before... it's just that it's FIVE TIMES AS AWESOME when you play it.

As before, you can download the C++ source code, or a Linux binary.

Tagged in games, posts about computer programming.
Direct link to this post | You could reply if you had Javascript and local storage ("cookies") enabled
Posted at UTC 2011-06-18 21:50:07
Eli_Dupree says:
Eli_Dupree's avatar

Release early, release often

Yesterday, I spent all day working hard on my Haskell game – I was so busy that I didn't have time to blog about it!

Luckily, this has been very productive. If you can compile Haskell code, check out the current version of my game! I've also put up a Linux executable, but that'll only work if your computer is sufficiently similar to mine (Ubuntu Linux on a Pentium T3400, although I don't know anything about binary compatibility...). The Linux executable is here (3MB). If you can compile Haskell and you're running a different operating system, could you upload your binaries somewhere so that I can link to them for the other people?

Right now, the game is about flying around as a green circle in an infinitely large world, and shooting out the walls. Use the arrow keys to move, and click (and hold) the mouse to shoot lasers.

A screenshot of the Haskell game: a green circle drilling a hole in green walls with green lasers

So far, the trickiest part of this project was making an infinite world that would remember all the changes you made to it, without making the game get really slow as the world got bigger.

Amusingly, after I said I wasn't going to keep working on my collision detection stuff, most of the work of this project has been on collision detection stuff. There's a lot of things that could be improved about it (like the fact that I've duplicated a lot of work between ZOrderCollisions.hs and ZTree.hs), but there you go; I'm going to make those improvements next, anyway!

I've released the game under the GNU General Public License (GPL), which means that you can freely copy it, modify it, and release modified versions, as long as you make all the code you add to it available under the same license.

– Eli

Tagged in games, posts about computer programming.
Direct link to this post | You could reply if you had Javascript and local storage ("cookies") enabled
Posted at UTC 2011-06-15 21:08:53
Eli_Dupree says:
Eli_Dupree's avatar

C++ vs. Haskell: ROUND ONE: What's a programming language, anyway?

This post is intended to be accessible to people who don't know anything about computer programming. If you already know a lot about computer programming, you might want to skip to the last section of this post where I talk about what I'm doing now.

Computers calculate things. They're very good at it. But to get a computer to calculate something, you need to know how to control the computer. If you're a computer programmer, that means having a program called a compiler or interpreter that takes things you write in programming languages and converts them into a form that the computer can use. C++ and Haskell are both programming languages, but they work in significantly different ways.

I can't just say Computer, tell me all the prime numbers between 2 and 100, because the computer doesn't understand English. But I CAN open up a Haskell prompt and say:

[x | x <- [2..100], not . any (\y -> x `mod` y == 0) $ [2..(x-1)]]

That's valid Haskell code. It says Get me the list of all numbers between 2 and 100 which are not divisible by any of the numbers less than them, and it pretty much says it in that order, too. This is a really short program because Haskell is designed to be a very high level language. I'll get to what that means in the next paragraph. But first, let's look at how I could do the same thing in C++:

std::vector<int> primes;
for (int x = 2; x <= 100; ++x) {
  bool x_is_prime = true;
  for (int y = 2; y < x; ++y) {
    if ((x % y) == 0) {
      x_is_prime = false;
      break;
    }
  }
  if (x_is_prime) {
    primes.push_back(x);
  }
}
return primes;

Augh! It's fourteen lines instead of one! It's more than three times as long even if you only count letters in the most generous way! At this point you should be saying WTF? Why would anyone use C++?.

Well, C++ is a low level language. There's a low-to-high continuum, with different languages falling in different places; Haskell is at the extreme high end, and C++ is mid-to-low. High level languages are designed to be a lot like human languages; they're supposed to be natural ways to express ideas. Low level languages, on the other hand, are designed to be a lot like the underlying machine code; they're supposed to give you better control over how the computer processes the information. That's very important if you're writing a program that's going to take a lot of processing power, because if you write high-level code that doesn't consider how it's going to be computed, then you may end up doing things in a very inefficient way. So it makes sense that the code I've written is more verbose in C++; when I compile either of those pieces of code into the underlying machine language, the Haskell code becomes just as long as the C++ code – I could write it more concisely, at the cost of having less control over exactly what it became.

On the other hand, what if I don't care? In the last ten years, computers have gotten ridiculously fast. Like, RIDICULOUSLY fast. I feel like as long as I don't write an advanced physics simulator, or graphics code, or pointlessly waste calculations, then everything I write will execute in less than a millisecond without me having to do anything about it.

There's another important difference between C++ and Haskell: C++ is an imperative language and Haskell is a functional language. Imperative languages are essentially a series of commands for the computer: Go here, add these numbers together, stop, display it on the screen, go back and compute some more numbers. This makes sense for low-level languages because that's exactly how a computer works: It has a processing unit that executes simple commands, one after the other.1 (There are also some high-level imperative languages, but in general, imperative languages are lower-level than functional languages.)

Functional languages like Haskell are different: They don't say Do this to that. They say This is that. If you want to put it in English terms, my C++ code says Compute the list of all primes from 2 to 100 and return it, while the Haskell code just says The list of all primes from 2 to 100. Of course, that can be kind of confusing because, hey, the computer does stuff, doesn't it? Like, right now, your computer is showing you this blog post. It hadn't always showed you this blog post, so if I never told the computer to do something, then how would you ever see anything? I mean, C++ can say Draw a window, then display stuff until the user quits, then close the window, but what can Haskell do?

Well, the answer is that a Haskell program says something like The output of this program is to draw a window on the screen and display the input the user asks for until the user quits. And I think that's pretty awesome. I don't have to worry Do these commands make the computer do what I want it to do? because in Haskell, I didn't write do these commands, I wrote this is what I want. And that's in addition to the fact that Haskell code is so much shorter, which makes it easier to read and makes there be fewer opportunities to mess up.

Into the personal...

A while ago, I wrote a 2D collision detection library in C++. That's a piece of code that simulates a bunch of objects moving around, and detects when they crash into each other. This is an important thing for computer games. Unfortunately, there's no simple way of doing it that doesn't waste lots of processor power when there are a lot of objects. So, without going into too much detail for the moment – this piece of code was really complicated.

In the last couple of days, I've been trying to rewrite it in Haskell, with varied success. Some parts of it translate over really easily and are much, much more readable in Haskell than they were in C++. Other parts aren't so easy to deal with. Because writing in Haskell is so much about getting your conceptual understanding right, and the C++ version really was too complicated for me to get a good conceptual understanding, I'm having trouble rebuilding it. And it would take a huge, epic blog post just to explain how it works, much less explain the issues with rewriting it. I'm not even sure if it would have the speed it needs if I wrote it in Haskell; I was mainly doing it as an exercise, and it was a good exercise, even if I got stuck on it.

Well, not to worry. I've only ever written one complete program in Haskell, or in any functional language, and it takes a lot of practice to get into functional programming when you're only familiar with imperative programming. I was lucky to have written this website in Python, which has a bunch of functional-programming-like features, even some that it borrows directly from Haskell. That made me familiar with some of the concepts before I jumped in, but still, it's not really that easy to write an extremely sophisticated program after only a few days!

So, for the moment, I'm going to step back and write a cute little game in Haskell instead.

– Eli

Footnotes:
  1. Well, modern computers often have multiple processors that work in parallel. And the computers of the future will probably embrace parallel processing even more. But the basic idea is still pretty similar. back
Tagged in posts about computer programming.
Direct link to this post | You could reply if you had Javascript and local storage ("cookies") enabled
Posted at UTC 2011-06-13 23:54:43
Eli_Dupree says:
Eli_Dupree's avatar

I've been sleepy all day. Maybe I shouldn't have stayed up until 4:00 AM last night to write my last post? Heh heh.

Also, I should have mentioned this yesterday: I did go on to rewrite my little exercise in Haskell. The exercise takes an image, messes with it, saves it to a file, draws it on the screen thirty times over the course of fifteen seconds, and exits. You can look at my C++ source code and Haskell source code. They're almost exactly the same. Both consist of a quick wrapper around the SDL_Surface manipulation and a list of SDL commands to execute. Neither does much error checking. The Haskell one has significantly fewer lines, but they're about the same in file size. When I ran them, I used my avatar image from this site as the image to mess with. It looked pretty cool.

I was a little surprised at how easily I could write the Haskell code, although maybe I shouldn't have been so surprised, since I've been studying it for a while (not to mention that I'm a very fast learner). Since I love Haskell so much, I'm probably going to stick to it.

Sometime when I'm not so tired, I'm going to write a programming-101 post about C++, Haskell, and why Haskell is so much more awesome. When I say programming 101, I mean that I hope it will be accessible to people who don't do computer programming – but as with my posts about gender, I believe that introducing basic concepts before expanding on them is also the most effective way to communicate even with people who are already feminists / computer programmers. It makes what I'm saying be more grounded, more clear, and more precise.

Oh, and also – I have shipping information on my tablet now. The best estimate is that it will arrive June 21, which gives me an entire week to get used to Haskell programming. I think I'm going to try to port my 2D collision-detection library from C++ to Haskell. Or maybe write a cute Haskell/OpenGL game. Or both. Watch me.

– Eli

Tagged in posts about computer programming, posts about the graphics editing project.
Direct link to this post | You could reply if you had Javascript and local storage ("cookies") enabled
Posted at UTC 2011-06-12 06:22:31
Eli_Dupree says:
Eli_Dupree's avatar

I just finished the task from my last post - I wrote a C++ program to open, modify, display, and save an image file. I'm using SDL for all the image operations, which means that I can only save in .bmp format, but that doesn't really matter, and I can always go and find a better image-file-handling library later.

Now that I know I can do that, I don't really have any immediate tasks left for before I receive the tablet. Maybe tomorrow I'll figure out how to write a Haskell program that does the same thing.

While I'm talking about programming, here's a question for all you present-day readers: I know some of you are pretty tech-savvy and know exactly what I'm talking about, while some of you are not tech-savvy at all and haven't a clue what I'm talking about. I haven't really decided how much knowledge I'm going to assume. So the question is this: If you're not tech-savvy, would you be interested in me writing posts that break this stuff down into the basic concepts so you can follow along? And if you are tech-savvy, would you be interested in me writing posts that get into the details of what I'm doing?

Tagged in posts about computer programming, posts about the graphics editing project.
Direct link to this post | You could reply if you had Javascript and local storage ("cookies") enabled