Text Gem: Introduction



For a while now I’ve been interested in graphics programming. Rendering 3d objects to build worlds has always been fascinating to me, though I’ve never had time to properly learn how graphics programming works. I’ve also been interested in learning how to design and build games! In order to build games, we need to represent the world that a player is moving through. Using ASCII characters and grids is a very simple way to represent a world, and the simplicity allows for quickly trying different mechanics. This is the beginning of a series of blog posts describing how to build such a world.

Many great games have been built with simple ASCII interfaces, just look at Dwarf Fortress, which until recently did not have an official graphical UI. Also look at the variety of Multi-User Dungeons that have been built, some still being wildly popular today! I want my ASCII worlds to be a bit nicer though, a bit more polished than you can build with ncurses and a terminal. I want to render my worlds onto a beautiful 3d plane, with gorgeous anti-aliased text that has dynamic colors and lighting. I want the world to be a pleasure to look at, a playground for exploring all types of game mechanics, and easily extended with particle systems and other 3d tools used in graphics programming. As with all lofty projects, it needs a name, and so we will call this engine “Text Gem”.

My first thought for Text Gem is to build a grid that looks similar to graph paper and render text characters into the cells. This basic grid layout is used as the basis for many games. I also want to have a camera with an overhead view of the grid that can zoom in and out. While 2d planes with grids can look quite interesting, I also want to be able to add height to the grid to make it more interesting visually and in terms of possible game mechanics. Once all of these components are complete, Text Gem will hopefully be a delightful way to prototype and test out new game designs and mechanics. It could look something like this.

As for the technologies I am going to use to build Text Gem, there are lots of choices. Because this project is a tool for learning, I will choose the tools based on subject areas I want to learn. The programming language will be rust and the graphics engine will be bevy. Bevy is open-source and always will be, which means I will be able to look inside to see how it actually works!

Like any software project, it is helpful to breakdown the problem into a set of small, achievable steps. For the Text Gem prototype, these steps look like:

  1. Get a simple project running with Bevy.
  2. Render a plane in space with graph paper material.
  3. Allow for camera control to zoom in/out of the graph paper and move around.
  4. Render text to the graph paper in the different cells.
  5. Allow for height mapping on the graph paper to produce interesting terrains.

Once these steps are complete, there will most likely be more work and cleanup to do! We’ll figure that out when we get there though. For now, let’s kick it off by creating a simple Bevy project and pointing a camera at it!