Java BBCode Parser

For a project I am working on, I wanted to add a light-weight markup language the could be parsed into one of Java’s AttributedString (a class used to display formatted strings). This would allow me to right human readable text, but display on the screen in various colors and fonts. I decided to use BBCode as it fit my needs and was relatively simple (although HTML was a close second).

I did not find any existing code that did the job so I wrote up my own parser. Below is the source code. It is not the most robust parser in the world, but it handles properly formatted strings just fine. Not all of the common BBCode tags are supported, although adding additional tags is usually just a matter of adding another if statement to the openTag method.

Continue reading

Choosing a Programming Language

One of the first questions that a beginning video game programmer asks is which language should I use? There is really no single answer to this question. Any language can be used to make any type of game. That’s not to say all languages are created equally for all tasks. In this post I am going to discuss most of the major programming languages and how they fit in to game programming.

In order, the languages that will be covered are:

  • Python
  • Java
  • C++
  • C#

Continue reading

Planet Rendering

Galaxy Tactics currently has only a single planet sprite. Obviously, that is quite boring, so I set about creating several new ones. Being a programmer, I have to make due with “coder art”, but that is no reason for bad looking game assets. There are plenty of resources on the web for rendering planets. For example, I took most of my inspiration from this tutorial. Here is an example planet rendering.

An example planet rendering.

The primary tool I use for my art is GIMP. The method I used to make my planet renderings is a bit of a variation from the previously mentioned tutorial. For most planets, the majority of the steps are exactly the same. GIMP, fortunately, has extensive scripting capabilities. Being a programmer, it was only natural to utilize this to automate the more repetitive and boring tasks. At the end of this post are the two scripts I created to create my planets.

Continue reading

Hex Grids

For Galaxy Tactics, I have been working with hex grids quite a bit. I found them to be a flexible system for tile based movement. I thought I would share some of my experiences, so that others may find hex grids a bit easier to work with. So, why use a hex grid? First of all, there are only three regular polygons that can be tessellated (placed on a flat surface so that they completely cover a surface without gaps). They are triangles, squares, and hexagons, each with its own advantages and disadvantages.

Continue reading

Galaxy Tactics – Rules (Draft)

This is a draft of the current rules for Galaxy Tactics. If you have any comment or suggestions please make them. These rules have not been extensively play tested and are likely to change to some extent.

Press read more for the full rules.

Continue reading

Galaxy Tactics – A New Project

I am currently working on a new video game project, “Galaxy Tactics” (working title). The game is turn-based space conquest video game intended to play like a digital board game. The rules are simple, but hopefully will allow for complex strategy. It is still a work in progress, so comments and suggestions are welcome. I will post the current rules soon. As the game progresses, I will also post some of the source code that is in a more finished state. Here’s a screen shot to provide a small taste of what the game will look like.

Galaxy Tactics - Screenshot

-Eric

Site Update

It has been I long time since I last updated this site. For various reasons, I did not have the time to provide updates. After a while, this lead to a general loss in motivation. I have come to the realization that I will never complete enough tutorials to finish an entire game engine.

That is, however, no reason not to continue posting useful information. Over the next few weeks, I will be updating the previous tutorials so that they are stand-alone. Those should be more useful in the long run anyways. I will also begin posting some material on my new project, “Galaxy Tactics”.

-Eric

GJK Algorithm

The Gilbert-Johnson-Keerthi (GJK) algorithm is an efficient method for computing the distance between two convex shapes. It has become a popular method for real-time 3D collision detection. While less commonly used for 2D collision detection, the GJK algorithm still maintains several of its advantages. Its biggest disadvantage is that the algorithm can be conceptually difficult to understand (although it is easy to implement). This tutorial will explain how the GJK algorithm works in detail and demonstrate how to apply it to 2D collision detection.

Continue reading

GJK Algorithm Demo

The Gilbert-Johnson-Keerthi (GJK) algorithm is a method that can be used to find the minimum distance between two convex objects. The algorithm is often used for 3D collision detection in video games. I decided to write up a 2D implementation to try it out. So far, I have been very happy with the results. I am now planning on replacing the existing collision detection in the Entropy Engine (line-line intersection testing), with the GJK algorithm. I will also write a tutorial on the algorithm in the next week or so. In the mean time, you can see it in action here.

Entropy Engine – Basics

Entropy Engine provides several classes to simplify the creation of Java based games. This tutorial will describe how to use those classes. Included is how to create a game, how to control the game loop, and how to use the input system. More information on the Entropy Engine can be found on the Entropy Engine page.

Continue reading