Personal Projects

Some of my favorite toy/hobby projects are listed here.

Source code for them is either available on GitHub or Bitbucket.

Debug Draw Library

Debug Draw is an immediate-mode-ish, renderer agnostic, lightweight debug drawing API for C++. It is a single source file Public Domain library that provides simple and fast lines, points and text drawing for visual debugging of 3D scenes and games. Its main goal is to be as easy as possible to integrate with your own code, so it consist of a single header file that can also act as the implementation (when a given preprocessor is defined), so you should be able to just drop the file into your project’s directory, #include it and be done. Integrating with the renderer of your choice should also be easy, all you have to do is implement a small interface class and give the library a pointer to your implementation. The library is designed around a procedural style similar to the old fixed-function OpenGL, but it batches draw calls under the hood for better performance. Memory footprint is also small and configurable by the user code.

Library source is Public Domain and available on GitHub. You’ll also find detailed documentation and usage examples in the source code repository.

Moon Lang - Custom scripting language

Moon is a custom scripting language that borrows some of its syntax from Lua and Rust. It supports functions, structures, enums, ranges, arrays, imports, and all that good stuff you’d expect. It is also much more strongly-typed than Lua, but not as much as Rust. The C++ interface is also meant to be simple and easy to use. The Virtual Machine is stack-based and uses a tiny set of bytecode instructions.

I started this project just to learn how to use Flex and Bison to write a simple compiler font-end, but I ended up taking it to a nearly production-grade stage. The language is fairly complete and usable, but it lacks some basic support libraries as of now.

The name Moon is just a play on the meaning of Lua (Moon in Portuguese). I chose the name on purpose to leave it clear this is a lame rip-off on the syntax of the popular scripting language, even though in the end it turned out into a Lua/Rust hybrid syntax.

Project page on GitHub.

PlayStation 2 Homebrew

Reverse engineering and retro-programming are two areas of interest, so in early 2015 I did some experimenting with homebrew development for the PlayStation 2 Console, using only the freely available tools and software provided by the PS2 DEV community. One of the outcomes of this project was the demo that you can see in the images above, which I call “The Dungeon Game”. It is a third-person action game, inspired by classics like Diablo and Dungeon Siege.

Very far from a complete game, but playable. Source code and other technical details can be found here. I have also written a couple posts about the development process, which you can find in the blog section of this site under the Playstation-2 category.

Gameplay recorded from the PCSX2 Emulator:

WebGL Lightsaber and WebGL demos

To commemorate the announcement of a new Star Wars movie (Episode VII - The Force Awakens), I coded a browser based WebGL Lightsaber app. It features the iconic Lightsaber sounds and mouse/touch interaction. Other technical goodies include: glow effect for the laser blade (AKA Light Bloom), trail rendering with Polyboards, anisotropic shading for the handle (brushed metal shader) and screen space anti-aliasing using FXAA. Since I already had my hands at work with JavaScript and WebGL, I ended up coding a tiny rendering framework and other demos with it, which can all be found at the source code repository.

The live Lightsaber demo can be found here; Other WebGL tests and demos, including a viewer for Doom 3 models, can be found here. Make sure to open them on a WebGL capable Browser, like Chrome, Firefox or an up-to-date version of Safari.

Search the blog section of this site for the WebGL category to read more about this.

Space Sim Game

This project was an assignment from a University class about Game Design and Multiplayer. My inspiration here was in games like Freelancer and Wing Commander. It is playable on PC and Mac, using keyboard/mouse or an Xbox controller. The multiplayer element is in the possibility to play it in split-screen mode with another local player. Initially I intended to also allow for multiplayer over the Internet, but I never got around finishing the net code before submitting the project. The game was written mostly in C++, with a few bits of C and Lua as well.

It uses Core OpenGL 3+ for rendering. The lush backgrounds and planets you can see in the images above are just cubemaps, not actual geometry. The asteroids and props are real 3D models. Never got around implementing sound either, so playing it is a silent, self-reflection experience… This game was written at a time when I was shifting coding styles and still getting used to C++11, so overall, at the end I was not very pleased with the code and that contributed for me not taking the project any further. Project source is available here.

Virtual Texturing on iOS with OpenGL-ES

This was the final project for my Game Development course in Brazil. I implemented a “traditional” Virtual Texturing (VT) system on OpenGL-ES for the iOS/Apple platform. Virtual Texturing, or “MegaTextures” as it was popularized by John Carmack when still working at idSoftware, is an advanced texture atlasing technique that implements a texture streaming setup analogous to Virtual Memory, thus allowing for ridiculously large texture data sets, in the tens of Gigabytes ballpark.

Virtual Texturing is an interesting approach to the management and use of large texture databases for real-time applications, however, it is also very hard to get it right and working fast enough to be shippable, so it is only really worth the trouble for games and applications that need to render a lot of hi-res texture data. I can see some use for it on mobile platforms though. Mobile devices still have limited main memory but fair amounts of offline storage, plus fast Internet connections to allow for on-the-fly downloading of textures…

Source code for the project is available here. I’ve also recorded a short video on the iOS Simulator. It runs with a very low frame-rate on the Sim, but you can get a better idea of how it works from the video. The demos run quite smoothly on an actual device.

Oldschool Space Shooter Game

Or OSSG for short, is a side scrolling space shooter game for iOS. This game was also built as a class assignment for my Game Development course in Brazil. It uses the Objective-C version of the Cocos2D library, plus some raw OpenGL-ES for the 3D elements. The in-game background scene is animated with planets and randomly spawned asteroids. The main game itself is comprised of 2D sprites drawn as overlays on top of the 3D background. This game was my first experience with iOS dev and Objective-C programming. By the end of the iOS programming unit, the game was more or less done but not polished enough to be launched, plus then I didn’t own an Apple Developer license either, so it never got published in the App Store.

You can watch a short gameplay video here. Source code is also available.

Simple 3D scene editor, AKA l3d

This one was an assignment of a Graphics Programming unit I took in the one year Study Abroad scholarship I participated during 2012/13. The goal was to create a simple GUI editor that allows the user to place and perform simple edits in 3D models loaded from file. The program also saves the work and allows loading preexistent scene files to enable incremental edits by the user. The User Interface was built using Qt and the QtCreator tool, which is a very fine GUI framework, IMO. It also uses the ASSIMP model loading library to provide support for a vast number of 3D model file formats. One of the perks of using Qt was being able to deploy the application on Mac, Windows and Linux. As always, source code is available.

First Person Shooter Game and framework

Project done around the third semester of my Game Development course, circa 2011. The assignment was to apply a set of known OOP design patterns to any piece of software you wrote. So I decided to code a tiny framework for first person games to use as test case for the design patterns. The game itself was quite crude, just basically a level where you could move around in first person and shoot at badies. The framework did feature a couple cool things, such as loading and rendering of animated Doom 3 MD5 models (this before the game went Open Source, if I’m not mistaken), procedural terrain generation and some cheesy fire and flame effects done with billboards and Fragment Shader. In implementing the first person camera was when I figured out about the depth hack that is used by all FPS games to avoid the weapon from poking into scene geometry. Quite cleaver, I must say!

Anyway, this project has been forgotten for quite some time, but recently I’ve migrated its source code to here. It was originally developed around the Visual Studio 2008 IDE, using a very Windows-ish style of programming, C++98, fixed function OpenGL and lots of raw pointers. It’s pretty outdated by now and I doubt it would build on a modern compiler as is, but I keep it as a historical piece.

adf2mp3 Command-line tool for GTA Vice City

Grand Theft Auto - Vice City might not be the most famous or fanciest GTA episode, but it certainly has the best sound tracks and radio stations in the whole franchise! Well, at least for me! A while back I did some sniffing around in the game assets and found out that it was quite easy to extract the radio station tracks from the game, so that they could be played on an external media player. Then I wrote a command-line tool to perform the conversion from proprietary ADF format to universally playable MP3. You can access source code as well as a prebuilt Windows binary in the source code repo. Here’s a blog post with more info about it.

Miscellaneous and ancient stuff

Besides what was shown above, I also have several other older and more boring projects that are not worth mentioning here in full. Most were class assignments from diverse units and disciplines of my Games course, such as a simple RayTracer or a network tic-tac-toe game. The ones I have kept because they had some interesting code fragments or solved interesting problems are now available on my Bitbucket page.

This Website!

That’s right, who would ever guess that a low-level coder like me could make a fancy website! To be fair, I started out from the basic blog template provided by Jekyll, the underlying platform used to generate the site. But nevertheless, it was fun to play with CSS and jQuery for a while to design the interface that you see here. Hope it isn’t too bad!

Jekyll was the main tool used here, but there’s also jQuery, Bootstrap, Rouge for code syntax highlighting (previously I was using Highlight.js) and some plain-old HTML and CSS (SASS actually).

Site proudly hosted by GitHub Pages.