I just found this GIF on my hard drive. I was working on this for real-time strategy games in Octorber 2011. It kinda simulates mobs of people or birds in formation. I apparently made some algorithm that chooses the best spot for each unit to go to.
Jan
23
Jan
19
Jan
19
Jan
05
OpenGL Planet Flood
By now, you’ve probably noticed that I really like space.
Anyway, I’ve been playing around with some shaders, and this is the result.
Make sure to watch it in 720p.
Dec
30
Java Applets
I believe Java applets should work with WordPress, with the appropriate plugin.
Yeah, that works. Cool. Hmm. It would appear that scrolling up or down makes the applet dirty. That’s an easy fix, though.
Dec
11
Procedurally Generated Galaxy
This is a galaxy with a million stars. It’s rendered with OpenGL.
Obviously, I didn’t put each star in the correct place, by hand. I made a program to do it for me. Nifty. In the black places there are still hundreds of thousands of stars, it’s just so much more dense near the arms and core that they are outshined.
Nov
29
Pathfinding
Another thing I did (while I was bored, of course) was some A* pathfinding. The problem is, given a world with obstacles, and two points, what is the shortest path between the two points that doesn’t run into any obstacles? I programmed an implementation of the A* search algorithm, and here’s its results. An exact search through a level looks like this:
Click to make it larger.
The blue dots all represent grid squares that have been searched by the algorithm. The more that are searched, the slower the search will be. However, generally, if the search is slow enough, it will always find the exact fastest path. That’s what it’s doing in the picture. However, in this next picture, it’s doing what’s called a ‘greedy’ search, where it doesn’t care how good the path is as long as it finds one.
As you can see, the path is longer, but the number of squares searched is miniscule in comparison. As such, this search is much faster. In video games, which need to run in real time, the speed of the search is very important. The accuracy, however, is not as important. That’s why, in most video games, a greedy search is the preferred option.
Later on, I implemented A* in a world comprised of arbitrary rectangles.
This was just for fun. I had always had this idea, that putting nodes on the corners of rectangles could give a perfect map for pathfinding around the rectangles. Turns out, this idea is mathematically sound. Yay.
Nov
29
Brownian Trees
A while ago, I got bored and made a diffusion-limited aggregation simulator. Here’s a video of the finished product.
Nov
29
My Big Lighting Engine
This one will be a Whopper®. This is my largest project to date. It’s taken everything I’ve learned to pull it off. It all started with an epiphany on how to do extremely accurate, efficient ambient occlusion on a grid world. Ambient occlusion is a special effect used in video games to give visual depth and realism to a game world. I won’t bother you with the details. Here’s a picture of my first prototype, in action:
I was so excited to get this working, but that’s just the start. I then implemented the 2D dynamic shadows I made a while ago.
The more observant of you will notice that the ambient occlusion is occluding some direct light. A fellow at Facepunch Studios pointed this out to me. I fixed it, and added outlines to the obstacles.
At this point I had basically reached an impasse. All of this was done with smoke and mirrors. I hadn’t used a single shader to do any of this. This was good for a while, because it was simple to debug, but my functionality was limited. I committed to learn how to make shaders, one of the most important tools in computer graphics. I figured it out in a day or so. My first shader was simple 2D bump-mapping.
This was an extremely important step for me. Ever since I had started doing programming and computer graphics, this was the kind of thing I wanted to do. In this picture, the bricks appear to have depth because of the shadows they are casting. This is an effect done with a normal map and some simple equations.
I was satisfied with the bump-mapping, so I decided to bite the bullet and dig into one of the hardest problems I could imagine: soft shadows. Up until now, all of the shadows in these pictures have been hard shadows. This means that they have no falloff. The boundary between shadow and light is simply a straight line. This wasn’t good enough for me–it had too much contrast, and didn’t look good.
I’m just going to show the video of the finished product.
Everything had come together. I had textures, ambient occlusion, soft shadows, and bump mapping. The soft shadows are, honestly, the coolest thing here. I had put together everything I had learned to make them. Anyway, I don’t have too much time to write this. I might go into depth about how I made the soft shadows some time later.
Nov
29
LWJGL Proportional Text
I’m always making my own tools for making games. This is a picture of a text renderer I wrote for LWJGL. I hadn’t found anything like it on the internet, so I just made it myself. I also coded some simple GUI stuff. The box is a button.
It loads fonts from square image files, with 16 rows and columns of ASCII characters. The character width data is stored on comma-separated value files. I generate these two files with Codehead’s Bitmap Font Generator.











