random dungeon generation

I’ve been researching different methods of random dungeon generation. After reading about a few different methods, I decided to try to use binary space partitioning (BSP) to generate dungeons for my game. BSP trees are frequency used in games, perhaps most notably in Quake, there they are used to determine visibility.

I implemented a recursive node structure in Swift, where each node can have children nodes that contain rooms. Each parent node links it’s children nodes with hallways. Repeating this process creates a traversable dungeon. Tonight I’ve finally worked out most of the bugs, so the dungeon is reasonably presentable.

In this screenshot is my current build, developed using Apple’s SpriteKit game framework.

SpriteKit experiments

I started exploring development with SpriteKit. I found a perlin noise library on github and implemented a simple tile map using SKTileMap. I made it make some  procedurally generated islands with trees. A few days later I discovered Apple’s GKNoiseMap, which can be configured using perlin noise or a few other types of noise.

I randomly scattered some characters in the game world, and start using the pathfinder utilities to plot courses around the level. Initially I had problems getting my characters to avoid the trees. After many trials with different configurations of trees, I concluded that maybe there are some bugs in the pathfinding if the level has too many paths.

I animated the characters using a chained sequence of SKActions that move and rotate. Next maybe I’ll add some on screen controls for player movement.

Screen Shot 2017-01-30 at 11.04.42 PM.png

TilemapKit

The other day I discovered TilemapKit, a new library for iOS/Mac game development. TilemapKit can load tile maps from the Tiled editor, and manages rendering and other tasks related to tile maps. I’ve been implementing some of this stuff myself, and I’m excited to see a tool that handles it for me. I’m hoping it will support the things I’d like to do with procedural generation. TilemapKit supports SpriteKit and Cocos2D.

Platformer progress

platformer screenshotHere is a screenshot from my platformer game in development. I’m developing it using Cocos2d. In this screen shot, I have generated a random world using perlin noise. The character can travel in any direction and new chunks of the world are generated. There is some simple shading, and a distortion shader in this screenshot.

Cocos2d 3.2 was released recently, and it contains all sorts of awesome effects I want to check out. I think I’m going to use SpriteBuilder to create a new project and port my code into it, because the structure of the default project has changed quite a bit since I started working on this game.

The graphics seen here are from Kenney,  who makes some awesome graphics for use in game for a small donation.