<![CDATA[David York]]>http://davideyork.comhttp://davideyork.com/content/images/map-decorated-big-1-1.pngDavid Yorkhttp://davideyork.comRSS for NodeSun, 28 Jan 2018 04:02:16 GMT60<![CDATA[GenGam 2016]]>http://davideyork.com/gengam-20167b5d8982-2c3c-4533-8139-074949682280Sat, 26 Nov 2016 11:20:00 GMTOn November 19, 2016 in San Francisco, CA the first annual Gen Jam (procedural generation jam) was hosted at the awesome indie co-working space GameNest. The idea was to spend a Saturday creating an art generator, a "thing that makes a thing" if you will.

I created a thing that made character sprites in the amazing style of Christopher "Oryx" Barrett's awesome Oryx Design Lab 16-bit Sprite Set. Have a look at some of the stuff it created:

Generate Sprites

Master Plan

So essentially I took the character sprites, broke them down into pieces, normalize their color palette, and implemented an algorithm to recombine them to create new unique sprites.

So I broke the source sprites up into pieces - helmets, heads, bodies, feet, weapons, etc and then selected those at random and stuck them back together. Then I changed the colors. Here is the main idea:

Building Sprites

Inputs

The original sprites I used as reference from the 16-bit Sprite Set look like this (the original set of sprites is MASSIVE, this is a small sample of 5):

Original Oryx 16-bit Fantasy Sprites

Then the sprites were broken up into eight groups: the torso, head, helmet, shield, feet, hair, weapon, and bow. Then I used Photoshop to cut out the pieces and place them into separate files like this:

Sprite Components

The idea here is to have a bunch of different heads, a bunch of different weapons, a bunch of different shields, etc and combine them at random.

Palette

I wanted to vary the colors in a way that respects the original care that went into the color palette, but also creates a lot of variety. The trick to this is to identify which colors were used on the different sprites, have them grouped together as a "color ramp," and select color ramps to re-color the sprite pieces at random.

In other words I went through and collected all the colors used for the skin tones, all the shades of green, blue, etc for cloth, all the colors used together for metals, and so on and placed them together in a palette file. A set of color ramps looks like this:

Color ramps

Then I took the sprites themselves and recolored them to use "input colors," colors which could be replaced by colors from a color ramp. So if I had 3 shirts colored blue, green and red what I would do is make them all red, add color ramps for blue, green, and red in the palette file, and have the algorithm replace the reds with colors from a randomly selected color ramp.

Here are some results:

Colors Applied to Sprite

Materials

Materials are substances being drawn such as cloth, leather, metal, flesh, gemstones, etc. I needed different color ramps for different materials because only certain colors looked natural for certain material types. The colors that look good for metal, for example, don't look right for skin tones and vice versa.

Additionally the variation between the colors in a ramp is different for different materials. Metal ramps for example vary a lot from light to dark within a ramp, whereas cloth does not.

The palette ended up having sets of color ramps for the following materials: primary cloth, secondary cloth, hair, skin, metal, wood, leather, gemstone, and dark accent color.

Here is the final palette: Materials

Subject grouping

Grouping is where you take a collection of inputs and declare certain inputs as working well together and others not so much. For example you could have "wizard sprites" and "warrior sprites," groups of sprites for different nations drawn with different aesthetic styles, good and evil groups, rich and poor groups, and so forth. This results in lots of options to generate sprites that are somewhat guided towards the aesthetic you want.

The whole shebang

So, to summarize I did the following:

Broke a large collection of sprites into pieces: weapons, heads, torsos, etc. Changed the input colors to "standard" colors for the materials (5 shades of cloth, 5 shades of metal, 4 shades of skin tone, etc). Wrote an algorithm to select one of each of the pieces and draw them on top of each other Wrote an algorithm to change the "standard" colors to one of several sets of colors (called "color ramps") in the palette. That's it! This creates thousands of unique and interesting sprites.

Github, Conclusion, and Thanks

This was a really fun way to spend a Saturday, and I would like to thank Galaxy Kate (Kate Compton) and Ben Grue (Ben McGraw) for organizing the event and the GameNest co-working space for hosting.

You can download my code which implements this project on Github here. I wrote it in C# and it should be compatible with Unity. Note that I included a full palette and some sample images, but I didn't include all the original sprites or images created from the sprites from the 16-bit Sprite Set. You have to purchase those sprites from Christopher Barrett aka Oryx at Oryx Design Lab. They aren't separated into pieces, I did that myself. It's a massive sprite set and practically free, Oryx spent a ton of time on it and I recommend checking it out (no, I'm not getting paid to say this).

Have fun!

]]>
<![CDATA[Don't Go Out the Airlock (7DRL 2016)]]>http://davideyork.com/dont-go-out-the-airlock-7drl-2016e5663ac3-ebea-4a2a-a94b-7667fbce4246Sun, 13 Mar 2016 14:19:00 GMTThe 7DRL (7 Day Roguelike Challenge) for 2016 has happened, and here is my entry! It was a challenge to create this game in 7 days, but I'm quite proud of it. Of course, I feel I've only scratched the surface of what the game could become with more time, effort and polish.

The premise is you are lost in outer space in an escape pod. You get rescued, and to show your gratitude you offer to upgrade the ship's engines.

Only problem is, you don't know how to do that so everything explodes. You have to get back to your escape pod before getting sucked out a hull breach or burnt alive!

Don't go out the Airlock introDon't go out the Airlock gameplay

The game is completely free and available for dowload for Windows and MacOS:

Download PC version of Don't Go Out The Airlock

Download Mac version of Don't Go Out The Airlock

Have fun trying not to get blown into outer space!

I would love to hear what you think of the game, feel free to contact me via twitter or email.

]]>
<![CDATA[Making Procedural Content Look GREAT]]>http://davideyork.com/making-procedural-content-look-greata9200e44-a4bc-410a-bae8-b201fddaf07fWed, 02 Mar 2016 04:10:36 GMTI'm going to talk about how to get from images like these:

ASCII mapTiled map

to this:

Decorated map

using what I call a Decoration Generator. The awesome tileset shown above was created by Oryx Design Lab and is fantastic, I highly recommend checking it out.

Note: I love ASCII games and this article isn't meant to imply that tile-based games are better than ASCII games. Not at all! Instead this article simply details a method to make tile-based games look great.

Decoration Generator

A Decoration Generator is a generator that takes a level as input, and outputs a good looking version of it. Other procedural content generators do level layout, loot and monster placement, etc. first. After that has been done that output is sent to the Decoration Generator which figures out the cool looking details such as wall corners, alternate tiles, shadows, decorative blood splashes, etc.

Decoration is single stage, multi pass

Decoration is single stage. This means you go through the stages of content generation (determine theme and difficulty, place rooms, place monsters, place items, etc.) before decorating, then do the decoration all at once.

Decoration is generally multi pass. This means the Decoration Generator alters the dungeon in several passes applying a Decoration Algorithm during each pass.

Examples of Decoration Algorithms include placing wall corners, replacing tiles with random alternatives, and placing cosmetic effects.

I personally find implementing each pass individually makes for clean code and gives you the flexibility of turning some passes on and off and running others multiple times as desired.

Decoration Algorithms

Random Replacement

This algorithm is very simple. Each tile has several alternative tiles it could be replaced with. Iterate over every tile and for each one that has alternatives, randomly decide if it should be swapped out with an alternative tile and if so which one. The cracks in the floor in the dungeon room shown above were placed with this method.

Autotiling

This algorithm was used on the walls and water to take care of corners and edges. For these tiles you check a tile's neighbers and you select the final tile based on which of the neighbors are of the same tile type.

For example:

Autotiling

Shadow Casting

This algorithm places shadows on tiles. Essentially every tile type has a true/false state for each of the two questions:

  • Can this tile cast a shadow?
  • Can this tile receive a shadow?

For every tile if it can receive a shadow, and the tile above it can cast a shadow, it's time to place a shadow.

Keyhole modifications

These are small algorithms that scan for certain conditions and then do a small modification if those conditions are met. For example replacing ground with bridges, placing spiderwebs in corners, placing blood spatters and bones, etc. would qualify. There are simple algorithms that should be used only when appropriate - for example an algorithm to place spider webs is great in a crypt but terrible in a king's hall (unless the king is undead of course!) A couple examples of keyhole modifications include:

Bridges

If there is a ground tile with another ground above and beneath, but water to the left and right, make the ground tile a north-south bridge. If there is a ground tile with another ground to the left and right, but water above and below, make the ground tile an east-west bridge.

Spiderwebs

If there is a ground tile with wall tiles above and to the right, place a top right corner spiderweb. If there is a ground tile with wall tiles above and to the left, place a top left corner spiderweb.

Blood splatters

Pick a random ground cell. Place a random blood splatter on that cell. Place a random number of blood splatters in nerby cells (e.g. up to 1-3 splatter tiles, each 1-2 cells away).

Bones

Find any large scary monsters. Place several (e.g. 2-5) bones tiles near the monster (e.g. 1-4 tiles away).

Statues (and other stand-alone walls)

Find a wall that is surrounded by ground on all four sides. Replace the wall with a tile that look cool by itself. Examples of good stand-alone walls would be statues, pillars, wells, coffins, altars, tables, tombstones, braziers, thrones, computer consoles, etc.

Final thoughts

Data details

There are many ways of represented decorated cells as data.

Two of my favorites are:

  1. Lots of tiles method: You have a wall tile, a wall2 tile, a wall_northwest tile, a wall2_eastwest_damaged tile, etc. This is a fine approach. In this case the majority of your tiles will never be generated by you level creation code, instead level layout places only wall tiles and the decorator then replaces them with wall2, wall_northwest, etc. tiles.

  2. Tile type and tile image method: Cells in your world have both a tile type and a tile image, but the mapping from types to images is one to many. Thus the type is wall but the image could be wall_grey_alt2_northwest.png or wall_grey_damaged_south.png. In this case your world generation places walls but leaves the images alone, and it is the responsibility of the Decoration Generator to assign out all the images.

Themes

One fun thing to do with Decoration Generators is to create Decoration Themes. A Decoration Theme is essentially a set of Decoraton Algorithms and tiles that look good when used together.

For example a crypt theme would specify which walls are appropreate for a crypt, it would place coffins instead of statues and it would place lots of broken ground tiles, bones and spiderwebs.

There are lots of things you can do here, but my one main piece of advice is to keep the decoration code as separate as possible from the layout / generation code. This keeps the entire procedural content code base cleaner and easier to work with.

Have fun!

]]>
<![CDATA[Fractal Generation with Unity]]>http://davideyork.com/fractal-generation-with-unity22a12878-a272-413c-ac03-72484737f8dbThu, 22 Oct 2015 23:10:00 GMTL-system fractals

A was hanging out with my awesome friend Anatomecha in one of Seattle's new super awesome, super hip, super gentrified edison-bulb-and-a-million-beers-on-tap bars. He showed me a system he had been working on to create l-system fractals with Unity using very simple properties of how Maya and Unity represent 3D models in 3D space.

Best.

Night.

Ever!

I like beer and fractals because they are both awesome, what can I say?

For the uninitiated an L-system fractal is basically where you take a shape, lets call it an "axiom", then you replace the axiom with another shape, let's call that a "generator" which just so happens to be made up of a bunch of axioms.

Rinse and repeat until you have created a self-referential fractal of pure awesomeness. Each rinse and repeat is called an "iteration."

Would you like to know more?

So axiom, and generator:

L-system fractal axiomL-system fractal generator

which, in the cases of these pyramids creates what's called a Sierpinski Pyramid.

For those of you FRACTAL EXPERTS out there there is nothing new yet.

Awesomesauce

Here is the awesomesauce.

Maya will let you create a model which contains named compenents in a hierarchy. Unity can import the model and preserve the hierarchy and the components. If you create a hierarchical model in Maya which is meant to be a generator, and you pick some of the components in that model's hierarchy to be axioms, then when you load it into Unity all you have to do to make an l-system fractal iteration on it is to find the leaf nodes and replace them with freshly instantiated generators.

Piece of cake right?

Essentially, yes.

Note there are always details. The position, scale, and rotation of the models needs to be preserved. Notice how the Sierpinsky Pyramid replaces a large pyramid with four smaller ones at various offsets?

Yes, these offsets and scale factors (and rotation as well) can be encoded in the Maya model trivially which will be explained now.

Maya representation of a generator

So we are going to create this: L-system fractal tree

By creating the following two generators:

L-system fractal end branch generatorL-system fractal middle branch generator

Left: end branch, right: middle branch.

We then load them up in Unity and create a script that iterates n times over a GameObject looking for leaf nodes with a name that corresponds to the name of a generator.

Then when you find one, you Destroy it and replace it with a newly Instantiated instance of the generator of that name.

So have a look at what this looks like in Unity, with an attached script:

L-system fractal tree setup in Unity

Notice the Transform in the Inspector. It contains the relative position, rotation and scale of an axiom. This means when you replace that axiom with a newly instantiated generator you will need to set the generator's Local Scale, Local Rotation and Local Position to these values so it will be in the right spot.

Note the script has two generators listed, the end_branch_generator and middle_branch_generator. These are references to the models in the project, so during an iteration when a node is found with a name like end_branch__0 the LSystem.cs script knows to replace it with a end_branch instance.

You may notice the leaf nodes have names like end_branch__0 with a double underscore - this is because Maya requires unique names for it's scene nodes so the script simply discards the __ and everything after it during the iteration process.

So....

So there is a lot you can do with this.

Essentially you can build a model in Maya, name nodes, and then replace those nodes with other models that have the same name (or, if you prefer, by any more sophisticated replacement algorithm you choose) to recursively create and define a more interesting creation.

Use your imagination and think on that for a minute, it's pretty huge.

L-system fractal tree iteration 0L-system fractal tree iteration 1L-system fractal tree iteration 2

Have fun!

]]>
<![CDATA[Procedural Generation: Drunken Walk]]>http://davideyork.com/drunken-walk-procedural-algorithm3c2590a6-2d03-477d-8eab-05ccf3052c68Mon, 09 Feb 2015 04:10:36 GMTThis is a procedural generation technique that places open spaces on a grid. It can be used for generating dungeons, castles, and other environments for video games.

Start with a solid grid, such as a 2D array of walls. Pick a starting point and mark that as open/empty. Move in a random direction if and only if the next cell in that direction is solid. Mark that as empty.

Repeat until you are no longer able to move, or you have a large enough area that has been marked as empty that you are satisfied with the walk.

Drunken walkDrunken walk

You can use multiple walks to generate a more interesting area. The additional walks can start from an open cell, or they can start from a closed cell and be allowed to "merge" into an existing cell if they would intersect with the cell.

Drunken walks with 10 stepsDrunken walks with 10 steps

Note that this technique works well for generating areas that have open cells and wall cells as shown above, but it also works for generating an area with areas with clear adjoining exits (e.g.: rooms). Simply place an area in each visited cell and a connection leading from this cell the the previous one.

Drunken walks with adjoining areas

Multiple drunken walks with adjoining areas requires an extra step for each subsequent walk to join the walks together. One option is to start walks after the first in one of the previously visited rooms (shown below).

Drunken walks with adjoining areasDrunken walks with 15 steps

That is the drunken walk. There are many ways to tweak it worth experimenting with. For example when determining the random direction you can give a bias towards choosing the direction of forward making the generated area have more long corridors. Another tweak is to randomly determine how many steps each walk will take, or to have the likelihood that a walk should end be determined by the distance from the starting point.

Have fun with it!

]]>
<![CDATA[Blocksworld]]>http://davideyork.com/blocksworld626c9962-344a-463c-8a3e-ea654ac05886Sat, 23 Aug 2014 20:10:36 GMT

Download from the Apple App Store here!

I worked as a full-stack iOS + backend engineer on Bocksworld, creative block-based building game for kids by Linden Lab. This was is created with C# in Unity3D, Objective-C, Ruby and MySQL. I have contributed to all technical aspects of it's development.

Blocksworld has been enjoyed by millions of users who have created and shared millions of creations! Blocksworld is available on the Apple app store.

Blocksworld is a free app with in-app purchases.

Popular creative block-based building gamePopular creative block-based building game Popular creative block-based building gamePopular creative block-based building game

]]>
<![CDATA[Patterns]]>http://davideyork.com/patternsb57ea215-852c-47f2-9f5a-aa627d8f86f9Sat, 23 Aug 2014 19:10:36 GMT

Click here to play Patterns now with Steam Early Access!

I was an engineer on Patterns, a multi-player open sandbox building game game made by Free Range Games and Linden Lab. This was a project created with Unity3D for Mac and Windows PCs.

Patterns is a large and ambitious project where users could build complex creations with dozens of different types of shapes. Players could add Lua scripts to their creations to create gamification mechanics and achieve high levels of customization. Patterns is available on Steam.

Creative sandbox buildingCreative sandbox building Creative sandbox buildingCreative sandbox building

]]>
<![CDATA[Roblox]]>http://davideyork.com/roblox8551f81a-c435-4bb2-ac8f-25d0a7188554Fri, 20 Jun 2014 00:00:00 GMT

Download from the Google Play Store here! Download from the Apple App Store here!

I was the mobile lead engineer on Roblox. I lead a five person which created the mobile version of Roblox, an extremely popular game that has spent time in the top-100 grossing apps on the iOS app store. Roblox mobile was created with Objective-C and C++.

Roblox has been enjoyed by millions of kids and has over 30 million monthly active users! Roblox is available on the Apple app store and Google Play store.

Roblox is free with in-app purchases and premium subscriptions.

Popular creative block-based building gamePopular creative block-based building game Popular creative block-based building gamePopular creative block-based building game

]]>
<![CDATA[Mindless Dungeon Crawl]]>http://davideyork.com/mindless-dungeon-crawla9cc41b9-8fcf-41a2-ad2f-a7ceba1f838dThu, 28 Feb 2013 10:53:14 GMTDownload from the Apple App Store here!

I have a tradition of teaching myself a new programming language or technology by writing yet-another-version of “Mindless Dungeon Crawl (MDC).” This tradition started when I was procrastinating my grad school compilers homework. I have written MDC in Python, JavaScript, C++, C# with WinForms, Objective-C with iOS, C++ & Objective-C on iOS with Cocos2D, C# with MonoTouch and finally Unity3D which is the version you see here. Each time it’s a different game with graphics (sometimes it’s a text game) and different mechanics but it never takes itself seriously.

This game was downloaded 800 times on its first day, was favorably reviewed by Touch Arcade and gets a modest number of downloads daily.

Creature artwork was licensed from Joe Calkins of Cerberus Art. Send him all your money, he earned it. UI, backgrounds and fonts were me.

Mindless Dungeon Crawl: mindless adventure awaits!Mindless Dungeon Crawl: endless mindless exploration! Mindless Dungeon Crawl: LOOOOOOOT!Mindless Dungeon Crawl: hilarious opponents galore!

]]>
<![CDATA[Hack & Quest]]>http://davideyork.com/hack-and-questbdd018da-c047-412d-b096-805197fd016fWed, 27 Feb 2013 00:00:00 GMTDownload from the Apple App Store here!

Ambitious iPad rogue-like inspired by the Game Monetization Challenge.

I created combinatorial loot using a scheme inspired by Might and Magic 3: Isles of Terra. More powerful and flexible where it can select which type of leather your leather armor is made from, or what type of steel is in your chain mail, plus add adjectives and modifiers all of which change the stats and gold value of the items.

Art was commissioned from Team LePixelists. They were awesome, did great work very quickly. Treat them professionally and pay them well, you won’t regret it.

Highlights include:

  • Massive world with over 4 billion regions (same world, different starting locations each game)
  • Climate and temperature with appropriate tilesets (snow, light snow, lighter snow, desert, etc)
  • Hundreds of dungeons with increasing difficulty as you descend
  • Several overland and dungeon generators (placing monsters in climate-appropriate areas)
  • Procedurally generated loot (adjective, noun, construction material, etc). Similar to Might & Magic 3 but more depth. So you can have an expertly-crafted flaming steel longsword or just an iron longsword.
  • Procedurally generated monsters (which also level up as necessary for deeper dungeon levels)
  • RPG stats, chests, leveling system, combat mechanics
  • Stack-based UI menu system

Hack & Quest "You got loot!"Hack & Quest Player stats Hack & Quest "Mad loot!"Hack & Quest desert landscape Hack & Quest tundra landscapeHack & Quest "Death sucks!"

]]>
<![CDATA[Morty the Mole]]>http://davideyork.com/morty-the-mole78505655-354f-4d68-94b3-55717609ef18Tue, 26 Feb 2013 16:53:14 GMTCommercially downloadable semi-casual puzzle game based loosely on Broderbund’s amazing Boulderdash. I removed the monsters and added lots more puzzle elements (keys and doors, breakable walls, moveable breakable vases, vines that can hold up moveable objects, etc). I felt this made it more appropriate for a semi-casual audience (all the rage at the time) and played more to the strengths of the game. I did the design, programming, and project management. Art and music was commissioned and licensed.

Original fully playable prototype was written in Python, later a C++ port was created. Currently it is not available for download as I am porting it to a Steam + iOS re-release.

Highlights include:

  • 101 levels
  • Multiple level themes (ice, desert, jungle, etc)
  • Animated tiles, particle effects, sfx galore!
  • Rewards for completing levels in a small number of moves
  • Hundreds of unique tiles

Over 100 levelsTutorial levels guide the player early on Many themes existComplex puzzle components keep the player interested

]]>
<![CDATA[Real-time Voxel Heightmap Engine]]>http://davideyork.com/real-time-voxel-heightmap-engine4acff39c-1b7b-4ca6-a415-968e0fa7fa97Mon, 25 Feb 2013 23:53:14 GMTVoxel-based graphics engine. Written in C++ and x86 assembly. High-performance “fly-through” engine created just for fun during college.

I thought it would be cool to play with voxel heightmaps so I created a voxel heightmap renderer in C++. Uses raycasting, sorta. Ground-traversal raycasting where you drop a ray directly to the ground from the viewer, then move it forward along the ground from the viewer. Each time it “moves up” (intersects with higher elevation) it draws the appropriate pixels on the screen as determined by a colormap that accompanied the voxel heightmap.

Note this was long before Minecraft, before Delver and certainly before Voxels were cool.

Real-time voxel heightmapMy voxels are smaller than Minecraft :)

]]>
<![CDATA[Rogue-like in Unity3D]]>http://davideyork.com/roguelike-in-unityce06a874-04ee-429e-a34b-524080f005efSun, 24 Feb 2013 08:53:14 GMTI love Unity! One of my favorite aspects of Unity is my ability to work collaboratively with my Maya friends on creative projects. This is one such example. We were just screwing around in Unity for the hell of it. I wrote the code, my friend created hundreds of assets and animations in a single weekend. We made a 3D Rogue-like. Highlights include:

  • Multiple character classes
  • Unlockable prestige classes
  • Mad loot galore! Equippable to different equip targets (e.g. hands, head, body, finger, etc)
  • Pretty standard RPG stats and progression
  • Spells with areas of effects and complex behavior
  • Randomly generated levels using several different generators
  • Dynamic line of sight

It was just two friends creating something for the moment, it was never publicly released.

Unity 3D rogue-like

]]>
<![CDATA[KumaX (University Computer Game Design Group Project)]]>http://davideyork.com/kumax832c87b9-9bd5-41a4-81c4-ae357e6774daSat, 23 Feb 2013 21:53:14 GMTWhile at college I founded (with my awesome friend Mike Williams who now works at Bungie) the Computer Game Design Group which at its peak had around 30 members. During our first year we tried to make the MOST AMBITIOUS GAME EVER ™ which resulted in a whole lot of talking about the MOST AMBITIOUS GAME EVER ™ but not a lot of actually making the MOST AMBITIOUS GAME EVER ™. We learned from this experience so during the second year we split into 3 teams and created small simpler games. I worked with a team of four on a game called KumaX which is based on the old boardgame Twixt. It was implemented in DirectX and works with hotseat or over a network.

KumaX: a college interpretation of TwixT

]]>
<![CDATA[Lode Runner (3D Interpretation)]]>http://davideyork.com/lode-runner-3d-interpretation8c7c4a70-076f-43a1-befe-ce5931184cd4Fri, 22 Feb 2013 22:53:14 GMTI used to play the amazing Broderbund game Lode Runner when I was a wee lad. The best part – you could make your own levels using their level editor. Endless hours of fun creating really entertaining platform puzzles.

During college for a programming class which covered, amongst other things, Win32 programming I developed a 3D Lode Runner game with my friend Ryan Triplett. Well, okay, it’s more of a 2.5D game. Uses Win32, Windows GDI.

LodeRunner gameplayLodeRunner gameplay

]]>