I moved to a new URL! Check it out!

posts dated from: september 2014

Game Jam Procedural Generation Part III

Game Jam Procedural Generation Part III
In the last episode of Game Jam Procedural Generation I talked a lot about generating the base of the platforming level in Starforger II, and carving out rooms into the ground of the level.

Image


So now we have a basic level that with a bunch of empty rooms below the ground. The next step is going to be connecting those rooms together. To do this I built a quick class called a TunnelSnake (tunnel snakes rule) to dig tunnels from any point on the map to any other point. Here's the full source of that class:
class TunnelSnake {
public int X;
public int Y;
public int Width = 1;
public int Height = 2;

public int EndX;
public int EndY;

int verticalSteps;
int verticalStepMax = 4;
int forceHorizontal = 0;
int forceHDirection = 1;

public TunnelSnake(int x, int y, int endX, int endY) {
X = x;
Y = y;
EndX = endX;
EndY = endY;
}

public void Dig(GridCollider grid) {
while (X != EndX || Y != EndY) {
grid.SetRect(X, Y, Width, Height, false);

if (Rand.Chance(50) || forceHorizontal > 0) {

if (forceHorizontal > 0) {
X += forceHDirection;
Height = 2;
X = (int)Util.Clamp(X, 2, grid.TileColumns - 2);
}
else {
X += Math.Sign(EndX - X);
}

forceHorizontal--;
if (forceHorizontal == 0) {
verticalSteps = 0;
}
}
else {
verticalSteps++;

Y += Math.Sign(EndY - Y);

if (verticalSteps == verticalStepMax) {
forceHorizontal = Rand.Int(3, 15);
forceHDirection = Rand.Sign;
}
}

if (Rand.Chance(50)) {
if (Rand.Chance(50)) {
Width += Rand.Sign;
Width = (int)Util.Clamp(Width, 1, 5);
}
if (Rand.Chance(50)) {
Height += Rand.Sign;
Height = (int)Util.Clamp(Height, 2, 6);
}
}
}
}
}

Doodle Post

Image

Starforger II

Starforger II
A few weeks ago I went to a local game jam in Phoenix! The them was discovery and I set out to make some kind of space exploration procedural thing. The final result was a game I named Starforger II. There is no Starforger I, but maybe I can make a prequel someday.

Download


Starforger II v1.0 - Windows (92mb)

Whoa what's with the file size? Well this game has a lot of weird sounds in it, and maybe I can figure out how to get them more compressed, but right now they take up a lot of space.

The game uses Enter, X, C, and the arrow keys, or a USB game controller (although the game is designed around the 360 controller, so using one of those would be ideal.)

Screenshots


Image


Image


Image


Image

Otter Updates

Otter Updates
There's been some recent happenings in the development branch of Otter. I've been busy fixing and polishing up some stuff, and also adding some of the last features I really want to get in before I can call it version 1.0. Here's some of the recent updates that can be seen in the commit log:

* Added LoadGridAutoTile() to the Tilemaps
In an effort to make game jam coding even faster I added auto tiling support to the Tilemap class. This is similar to the LoadGrid functions of Tilemap but now each tile will be placed depending on the neighboring tiles. I'll talk about this more when I merge it into the main branch, but for now it's usable and you should be able to figure out what's going on by checking out the source.

* Added SetAutoTileData() to Tilemap
If you're not using the default data set for auto tiling you can load your own data through this function. Calling this before using LoadGridAutoTile will let you use your own data. There's an example of how this data looks in the source for Tilemap.

* Added GetPowerSet() to Util
This is a handy function that can be used to get every possible combination of any amount of members of a list. Say you have a list of values {1, 2, 3}. GetPowerSet can return a list of lists that is every possible combination. So you would get {}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}. This is useful for the auto tiling algorithm, and maybe other stuff.

* Fixed Text OutlineColor and ShadowColor
I think I fixed a bug where OutlineColor and ShadowColor were ignoring the alpha of the Text's main color which lead to some wacky stuff.

* Fixed window scaling bug
Fixed a bug where if you used SetWindowScale() or SetWindow() with only a width parameter you would get a slightly messed up window. Basically what was happening is that the height of the window was off by 1 pixel. This should now be working properly.

That's all of the major changes lately. If you're using Otter you can post questions or your projects on the forums! It's awesome to see what people are making using the engine.

Otter Nap



I recently was in Seattle for PAX 2014 so obviously I had to make a stop at the Seattle Aquarium to hang out with some otters. These otters were just chilling out after a hectic day of otter stuff and I was able to get some super cute video of it. I added some random Youtube public domain music to the video since the original video just had waterfall noise.

Game Jam Procedural Generation Part II

Game Jam Procedural Generation Part II
In the last episode of Game Jam Procedural Generation I talked about the "outer layer" of my procedural generation code for my yet to be released game jam game. After the outer layer of stuff has been generated, that can be used to inform the "inner layer" of the procedural generation. So the outer layer in this case is the galaxy that the player can explore in their ship, and the inner layer is the actual side scrolling platformer level that they will explore.

Image


Where do we even begin? First keep in mind that I'm using Otter for all of this stuff, so if you see functions and code that looks totally unfamiliar, it's probably an Otter thing. Also keep in mind that all of this code was written during a 48 hour game jam, so it ain't pretty. I'm just going to be sharing big snippets of code and hopefully try to explain what is happening in each one.

In the last step I talked about how I create a config object to hold all of the possible fields that will be used to generate the level. Here's what that looks like:
class ScenePlatformingConfig {
public int Width;
public int Height;

public int ShipStartOffset;

public int TreasureDirection;
public int TreasureDistanceOffset;

public int GroundLevelOffset;

public bool Explored;
public bool Pillaged;

public int Jagginess;

public int Platforms;

public int DecaySpots;
public int DecayChance;

public int IslandSpots;
public int IslandSize;

public int Rooms;

public string Name;

public int BreakableChance;

public int CreatureChance;
}

Pretty straight forward. Just a simple class that will hold a bunch of values that can be then passed to the classes that generate the platforming level.