Blog

A convenience utility library to take over the mouse cursor ("pointer lock") in the browser with JavaScript

Sun, Aug 23, 2015 - 10:03pm -- Isaac Sukin

Two years ago when I was writing my book about building 3D browser games, I was spending a lot of time writing first person games in JavaScript. First person games in particular involve a lot of fast, precise motion, which makes "pointer lock" essential. "Pointer lock" is when a program takes over the mouse cursor, tracking mouse movement on its own and displaying its own cursor if needed (usually locked to the middle of the screen, hence the name).

Arguments against the threat of artificial superintelligence

Sun, Apr 19, 2015 - 5:26pm -- Isaac Sukin

There are a lot of speculative blog posts out there making arguments both for and against the alleged threat that sufficiently intelligent machines could pose to Homo sapiens sapiens, i.e. modern humans. This is my attempt at explaining why I think that such a threat is extremely unlikely.

A Detailed Explanation of JavaScript Game Loops and Timing

Sat, Jan 17, 2015 - 10:31pm -- Isaac Sukin

The main loop is a core part of any application in which state changes over time. In games, the main loop is often called the game loop, and it is typically responsible for computing physics and AI as well as drawing the result on the screen. Unfortunately, the vast majority of main loops found online - especially those in JavaScript - are written incorrectly due to timing issues. I should know; I've written my fair share of bad ones. This post aims to show you why many main loops need to be fixed, and how to write a main loop correctly.

Reverse data in a Google Spreadsheet array

Mon, Oct 20, 2014 - 4:50am -- Isaac Sukin

I have a spreadsheet of metrics I track every week. I add a new column to the left every week for that week's data, so that I don't have to scroll forever to the right to see recent information. (Yes, it would be easier to add rows, but that's another story.) All was well until I wanted to add sparklines; since the newer data was on the left, it looked like the sparklines were trending down, when actually the data was just backwards. I needed to find a way to reverse an array in Google Spreadsheets.

Advice

Fri, May 2, 2014 - 9:13am -- Isaac Sukin

As I head out from Penn, here are some of the most important things I've learned about life so far. I almost didn't publish this because in some ways offering general advice is pretentious, but I hope that someone will be a little happier for having read this.

  • Be nice to people even when you don't want to. It can take some mental effort, but it's amazing how much it pays off. There are lots of ways you can be nice to people: you can just not be mean, you can listen to people, you can respond quickly when others ask for favors, you can pro-actively look for ways to share your successes with others, you can connect people who can help each other, you can make it known that you're willing to help if an opportunity arises, you can make sure people are included, you can stop other people from being hurtful... just make sure it's genuine and not ingratiating, and don't let people take advantage of you; sometimes being nice means being willing to say No.
  • Pick something and make it special. Find something that gets you excited and make it a top priority. You will get more out than you put in. All that really matters for a group or project to be successful is having people who care about it.
  • Get to know people. I've been the happiest in college when I've had the strongest relationships. Those have happened through dating, "new member education" in my fraternity, activities with other groups I've had a leadership role in, and becoming best friends. I was not expecting this, but I think it's a pretty common pattern. I've been very happy working on side projects too, but it really turned out to be about the people. It's not always easy to find people you enjoy affiliating with, but it's easier when you proactively seek out or create groups for people with similar interests and values. The relationships you can start there build on themselves over time and introduce you to broader networks. It helps if you can find ways to meet your friends' friends. Some ways to do that include organizing private events (dinner parties, outings, trips) where people can invite their friends, asking your friends for introductions to interesting people (especially if they come up in conversation), becoming an expert or gatekeeper so that other people think to refer their friends to you, and staying in touch with people on the edges of your network. The only caveat to all of this is that you should keep your relationships in perspective, and try not to overcommit.
  • Have no fear. Almost always, nobody cares if you fail or look stupid. The few people who do care don't take those risks themselves, and by the time you've taken a few risks you won't care about those people any more. Worst case, it's a funny story. Best case, you learn a lot and accomplish more than you thought you could. The best case happens more often than you'd think.
  • Never let the urgent crowd out the merely important. Most people have trouble seeing beyond their day-to-day struggles. It turns out that most things that seem urgent aren't actually that important, and taking a wider view helps you prioritize better. It's important to maintain a big-picture view to help you do this. That said, don't neglect the details for the things that do matter or you won't be able to get things done effectively. Especially go out of your way to get details right for the people in your life who matter most to you.
  • Weight other people's opinions appropriately and in context, including the ones I've presented here. You know the details of your own situation better than anyone else. Don't let that be an excuse to not act, but don't blindly follow advice either. Instead, try things and adjust. Do seek out information. Do develop your own opinions and become confident in them. Make sure to remain open-minded and to consider different perspectives. Almost nothing is black and white.

Command-line tip: replace a word in all files in a directory

Wed, Jun 26, 2013 - 11:37pm -- Isaac Sukin

I need to use this command every once in awhile and I always forget how to do it off the top of my head.

grep -lr --exclude-dir=".git" -e "oldword" . | xargs sed -i '' -e 's/oldword/newword/g'

If you're on Windows you'll need unix command-line tools installed. The easiest way to do that is with Gow.

Here's what each piece does:

Pages

Subscribe to Front page feed