The wannabe graphics engine

After recently getting an Ouya device, I got inspired to make a game.  Then I realized two things: I don’t have any skill with 3d, and I learn by doing.

Here’s a quick guide to what I’ve done so far: wannabe, a multiplatform 3d engine, for losers, by losers.

The image above is generated by the Swing version of wannabe.  The only version so far, but I hope to port to Android soon.

Code

Right now, this is simply a collection of little classes.

  • A Position holds x, y, and z locations.
  • A Voxel is a Position and a color.
  • A Grid is a collection of Voxels

Then there’s how to display these:

  • A Camera keeps track of where we’re looking.
  • A Projection converts a Position to a pixel location, given a Camera and a “pixel” size.  There’s Flat, Isometric, and (still-in-progress) Perspective Projections.
  • A UI keeps track of the Grid, the Camera, and the Projection, and actually renders the result.

Right now, you can run SwingWannabe, a java-AWT and Swing implementation that I’m using as my testbed.  It loads a heightmap and displays the resulting Grid.  I went ahead and implemented 8 different render modes (shown here with the Isometric projection).

Samples

Original heightmap:

example-heightmap

wannabe rendering the upper-left 50×50 pixels or so.  Render modes: circles, rounded-squares, squares, and “3d” squares.

fillCirclefillRoundRect fillRect fill3dRect

And there’s non-filled versions of the same shapes:

circle roundRect rect 3drect

The filled 3d squares effect is quite nice, I must say, but I haven’t looked to see if Android supports that natively.  It’d be possible to do fairly easily on other platforms, though, if need be.

Of course there’s tons more work to be done.  Next thing on my list is a simple cube-like structure that will help me implement a perspective Projection.

Limitations

As you can see from the samples, this isn’t really meant to be a photorealistic engine. It’s geared more for pixel-art and retro-style games, but allows for some nifty things.

My expectation is that the camera will always be looking down the z-axis. The position of the camera may change, but not the direction.

Why?

I don’t have a better answer here than what I’ve said. This is a way to learn some little bits about 3d graphics while working in a simple space. And potentially it can be a good platform from which to develop, perhaps, one or more small games.

This entry was posted in Wannabe and tagged , , , . Bookmark the permalink.

One Response to The wannabe graphics engine

  1. Pingback: Even a wannabe needs goals | MuddyHorse Farm and Tech

Leave a Reply

Your email address will not be published. Required fields are marked *