Tag Archives: Swing
Wyrm – 2012 7dRL Entry
What if you mashed up the classic game of Snake with a traditional rogue-like? Wyrm!
You are a mighty feared Wyrm! Or will be one day at any rate. For now you’re kinda small and even kobolds are a threat. Defeat them, eat them, grow bigger!
As you gain length, make sure you don’t accidentally chomp down on your own tail, that would hurt!
The project is 12 hours into the challenge and currently features simple controls, display, and a short tail. The goal for the next 12 hours is to add in dungeon generation and collision detection.
I am using SquidGrid to make a monospaced display in a standard JFrame. This allowed for very easy creation of the display portion, leaving me more time to work with other parts of the code. It also allows for some nice fun colors without having to look up hex values ![]()
You can get version A1 – The Sauce from here: Wyrm A1. This version requires Java 7, although later versions do not.
EmoSquid Lighting
What does light under water look like?
When putting EmoSquid together, I had to decide how to handle this. One of the first things I decided was that the player character was simply going to have a ball of light around it. The terrain is all coral, so it’s acceptable that light goes through it. This was also a gameplay decision, as trying to see in three dimensions is complex enough without having line of site blocked as well.
The light is blue, ignoring the green of actual ocean underwater. This more represents the common idea of light underwater rather than any attempt at reality. One touch that does model reality somewhat is that the deeper one travels, the darker the light gets. In early versions of the game, enemies did not have their reflected light diminished, which looked very strange indeed. The current version of the game lights all objects based on the amount of light reaching them from the player.
Images after the break! (more…)
SquidGrid
And what is a SquidGrid? It’s a collection of rectangular cells of all the same size!
SquidGrid is a set of Java classes for displaying arbitrary image data in a regular grid. It’s based on interfaces, so how it’s displayed and what the images are representing are both up to the implementation. SquidGrid comes with a default implementation for displaying text image, and the system is flexible enough to handle any type of image.
Being a third generation product gives SquidGrid a solid background of real world usage. The experiences learned from creating and using TextAsGraphics and libjcsi have been put into SquidGrid and the included implementation. This allows SquidGrid to more directly meet the needs of both roguelike developers and others who want an easy yet flexible grid layout of images in Java.
While my early games Excitable Digger and EarlSpork used libjcsi and the more recent EmoSquid used TextAsGraphics, Epigon is using SquidGrid. Because it allows for more flexibility in the display of text and graphics, including custom built graphical tiles only requires the additional code to load the tiles and link them to the objects they represent. The actual layout of the tiles can be handled through the same interface the text display used.
SquidGrid is available at it’s GitHub home here.
TextAsGraphics Library
Using my experience working on libjcsi, I created a small Java library which implements a monospaced graphical text area to be used as a swing component.
This library was requested by a fellow graduate student who was having issues ensuring monospace support with a decent looking font in a cross-system application. Having seen what libjcsi could do, but wanting a lighter weight component that could be included in a Swing GUI more easily, he asked me to work on the problem.
Using a graphics pane to render the fonts means that any font can be used and it will become monospaced. Naturally some fonts look better in this configuration than others, but through a combination of intelligently calculating likely character sizes to be used and centering of said characters in their space, the renderings look at least decent for most fonts.


