weekends are for leisure

Voxeling - Increasing draw distance

Recently I began to optimize voxeling’s usage of WebGL buffers. The goal was to get rid of render performance bottlenecks so I could further increase the draw distance. In real life humans can see about 2+ miles away before the curvature of the earth drops things out of view. The game engine was previously only able to draw out to roughly 700 feet before stuttering, but the latest code can draw to about 1500 feet. It’s not as far as I’d like, but it’s still a big improvement.

Continue reading

Words to code by

What I would like people to do if they’re professional programmers is think about how you can use your skills not just for business. How can you change the world in ways which aren’t necessarily directly correlated to making money? Because, are all the good things in the world directly correlated to money? I don’t think they are. [We] should be thinking about how we can use our amazing, fabulous skills that we all have, that most people don’t yet have, to change the world for the good that we see. And part of that is building new things also part of that is to educate what we know about programming to people who don’t know about it, so they themselves can do the things that we can do.

Continue reading

Refactor as you go

Refactoring – Not on the backlog is a great read, and advises you to improve your code with every feature request you complete, instead of making it worse. The key is to refactor iteratively as you work.

We took this “gradual refactoring” approach at DeviantArt and I highly recommend it. You also get the side-effect of maintaining developer morale since large, long-lived codebases are often soul-crushing things to maintain.

So please, stop plowing through your tickets. Take a look at the code around you. Does it make sense? Can you make it more inviting to future devs or your future self?

Continue reading

Timeouts on third-party API calls

If your web application calls out to third-party APIs, set aside some time to review the timeouts surrounding those requests.

  • Carefully choose a timeout for the initial connection attempt. Choose a low timeout and perhaps add a retry if you really need the call to go through.
  • Carefully choose a timeout for the overall request. How long are you willing to make your users wait for the response?
  • Do not rely on the default timeouts set by your HTTP client library, language runtime, or HTTP server. These defaults may not be sane. If they are sane right now, they may not be in the future. That is how life goes, sometimes.
  • Consider the user experience, application performance, and business requirements.
  • Be able to tell what the timeouts are by looking at your code.
  • Consider how your application should proceed despite having timed out. It would be nice to float on, but sometimes one must show an error message or do something else.
  • While you’re at it, make sure you are correctly handling edge-cases. What if you get an unexpected response from the API call? A new error code? A baby in a basket on your doorstep? What will you do then?
  • Strongly consider logging latency, success count, failure count and timeout count for all API calls. Push the data into something like StatsD+Graphite+Grafana so you can graph it.

If you don’t carefully set timeouts, you are letting someone else control the quality and user experience of your web application. You may also be wasting precious CPU cycles waiting for mis-behaving third-party services. This is not something you should let happen. Program defensively against these things.

Continue reading

A recommendation against being a morning person

I highly recommend against being a morning person. As a morning person, you may consider it a virtue to be able to spring out of bed excited to start your day. The flaw with this approach to life becomes apparent when you spring out of bed too swiftly, bend down to grab your shirt too eagerly and end up pulling your back out.

You have been warned. Please govern yourselves accordingly.

Continue reading

The Last Goddess

My brother-in-law’s making a squad-based point-and-click adventure mystery game set in near-future Florida. If you like point-and-click adventure games, check it out on Kickstarter!

Continue reading

Voxeling - New textures

Wanted to show off the BDcraft textures I’ve been using.

Jump in and build something! Demo world is here

Continue reading

Voxeling - See-through objects, cutouts in WebGL

Cutouts are a way to render objects that are fully transparent in spots, without actually doing alpha-blending or pre-multiplied alpha stuffs. More on those can be found in this article: GPUs prefer premultiplication.

Here’s a great example of cutouts in Minecraft. Notice that the tree is made up of cubes which have a leaf texture applied to them. The texture is transparent within the space surrounding each leaf. No blending occurs; you can simply see through the transparent bits:

Continue reading

Voxeling Optimizations - Growable, object pool

When I started working on this project nearly a year ago, the frame rate rarely stayed consistent as the player moved around the world. The engine was simply allocating and discarding too much memory, resulting in frequent pauses in gameplay as the interpreter ran garbage collection. As I re-wrote more and more of the game engine, I came to understand exactly which types of objects and arrays I needed to allocate, where I could cut down on allocations, and where I might use an “object pool” to stash allocated objects for re-use. The old engine used typedarray-pool, but I’ve decided to create my own object-pool.

Continue reading

Voxeling - Demo is up

I’ve finally rounded out some more features that I felt were necessary for a somewhat-compelling demo.

Open Google Chrome then click here to explore and build: http://voxeling.greaterscope.com

Recent updates include:

  • Updated character model to more closely match the one from voxel-engine
  • Added skins from voxel-engine and other projects
  • Refactorings and optimizations
  • Simple water animation (of sorts)
  • Made jumping less jarring (implemented the Skyrim float)
  • Pause physics until user clicks the world for the first time. This prevents user from falling through the world before it has a chance to load.
  • Trees have leaves now
Continue reading