2.5D Dungeon Exploration in WebGL


About two months ago I created this little WebGL game (and a smaller version here) for a graphics course at school. The code can be found here on GitHub and the documentation here.

The course was mostly OpenGL, and I figured I should try making a project in WebGL, since it’s similar but more easily accessible (i.e., anyone with a capable web browser can play it). Decided it’d be cool to try a 2.5D game, and while brainstorming ideas, stumbled upon Bitworld, which seemed like the kind of environment I wanted to try making. So after looking up a bunch of tutorials on WebGL, javascript libraries, lighting methods, and billboarding, I came up with this.

Advertisement

3D room mapping with sonar (Final)

Here is the completed room mapping final project! Since last time, I’ve added a very useful smoothing option that makes the plot look less like a bunch of random jagged edges and more like a recognizable shape. There’s also an option to choose different types of shapes to plot with, which makes for some pretty artsy-looking results. It is surprisingly fun to play around with the smoothing options, textures, and shape types, as you can see me doing in the video.

The Arduino/Processing source code can be found here, and if you just want to play around with the plotting program (I’ve included some sample files), you can download an exe file here. You’ll need the ControlP5 library if you want to modify/run the Processing code (not necessary for the exe).

3D room mapping with sonar

My final project for the Arduno microcontroller class is this 3D room mapping thing. It still needs some work but here’s basically what it looks like. An ultrasonic distance sensor is mounted on a servo (which is mounted on another servo), and records the distance of objects located at various angles. Two angles and a distance from the center make up a spherical coordinate system, and those coordinates can be plotted.

Continue reading “3D room mapping with sonar”

Arduino softpot potentiometer game


Made a cave-navigation game using a Spectra Symbol softpot. The resistance of the softpot changes depending on where you press it, so you can do an Arduino analogRead() on the voltage output to determine where the circle goes on the screen. You have to make sure to add a resistor (I think I used a 100k resistor) going from the middle pin to ground (or power), or else the output floats.

Code available in the full post.

Continue reading “Arduino softpot potentiometer game”

Messing around with servos

This semester I’m taking a course about Arduino microcontrollers. One of the things included in the materials we got was a servo, and the first thing I did on the first day was looking up how servos worked. I didn’t know there was a servo library for the Arduino, so I ended up writing my own program to change the duration of the pulse sent to the servo based on some serial input (which I also had to look up, since we hadn’t learned it yet). I thought it was really neat and I ended up just playing around with it a lot.

Continue reading “Messing around with servos”

Summer course – Diff EQ Wars

Diff EQ Wars title screen
Diff EQ Wars title screen

My final project for the Python summer course was “Diff EQ Wars”, a game/simulation of units on a battlefield using graphics from Advance Wars. It uses ordinary differential equations for the motion and health of the units, with terms based on certain conditions (i.e. is the unit near an enemy? / is the unit near a base? / is the unit in a forest? / etc).

You can find it here, along with the other programs I wrote for that class. It was written in Python 3.1 and requires pygame.

Continue reading “Summer course – Diff EQ Wars”

Summer course – Physics simulations in Python

Gravity simulation
Simulation of gravitational motion of objects in Python

During summer 2010, I took a course where we learned how to program in python; specifically for finding numerical solutions for ordinary differential equations using Runge-Kutta. Most of the things we did were physics-related, though for the final project it didn’t have to be.

Bead on Wire
Bead on a wire, under the effect of gravity

I learned quite a bit from this course; Python is really easy to use and understand. Before this, the only things I knew how to program were the things we learned in CS102 (not very much; our hardest assignment for that class was to write a program that converted formatted data to a more readable format), and some really simple ActionScript things for Flash.

If you’d like to see the programs I wrote for this class, you can find them here. It was written in Python 3.1 (I think) and requires pygame. The final project is in that zip file as well, but I think I’ll make a separate post for that.

Also important note: the code is incredibly inefficient because this was before I learned “proper” programming methods and efficiency, I kinda just did what worked and disregarded time complexity and the overhead associated with making and filling huge multidimensional arrays.

DLD dice project

Starting off with the oldest thing I can find, here’s a video of a digital logic design project last semester. Using a shift register, 7-segment display (and driver), some LEDs a push-button and some NAND gates (I think it was NAND, I don’t remember exactly; might have been NOR gates), we had to simulate a dice roll. It’s pretty much just cycling through 1-6 in a non-linear order really quickly, so what you get depends on how long you hold the button down. It changes really fast so you can’t really time your presses to get the desired number (I mean, unless you have super fast reflexes).