Armor and Icons – Roguelike Design part 7 1


In the last post, I talked about there being some special cases for armor, shield, and trinket generation. I think this only applies to armor and shields, but for this post, I’ve only finished the shield routine. So we’ll talk about that.

Oh, and pretty icons.

I drew pretty icons!

Armor Attributes

When I first started on armor, I thought I was going to use the same 6 attributes I used for weapons, but tweak them to be more defensive… having a vorpal breastplate doesn’t make much sense. As I started to look at this problem, however, I also discovered another problem: not all armor will be made of metal. A rusted tunic? A chipped hide jerkin? That won’t do at all!

After realizing this flaw, I decided to split my armor into two categories: soft and hard. This would allow me to assign attributes that made sense to these different armor types. I also decided that I wanted to keep armor a bit more simple than weapons. I dropped the enchantment slot… wearing a Flaming Steel Curiass just sounds painful… and the additional adjective slot and kept it simple.

The four armor elements: material, armor type, abstract noun, and bonus.

I very heavily considered just doing the joining of material and armor type manually. This would let me skip worrying about the different material types. I’d just add individual entries: Cloth Tunic, Leather Tunic, Hide Tunic, etc. This might have been the simplest solution, but it also removed some of the fun of having a procedural system for creating items… and I was just being lazy.

I must have built and rebuilt the armor tables a half dozen times trying to figure this out. The problem was that I was trying to fit the armor generation procedures into the same model I developed for weapons… and they are entirely different things. With armor, you have two things that make up the effectiveness of the piece: material and type. A jerkin is not as protective as a curiass and cloth armor is not as protective as steel. So, I split things up.

Armor Type

Table of armor types

I decided that I wanted to keep armor types to a very short list. As part of the potential game design this will all fit into, your player character will have a very limited inventory and only one “slot” for armor. In other words, I’m not breaking this out into Head/Arms/Gloves/Chest/Legs/Boots like most RPGs. You simply have one armor slot. So, these are the eight types I came up with. Like weapons, the armor type holds the base stats that everything builds off of. Again, A jerkin should not provide as much protection as a full suit of armor.

You can also see in the image that I added that make column and assigned one of… wait… THREE… types. Yes, in addition to soft and hard, I added any as a type. This is for general purpose stuff. For armor types, the “armor” entry is intended to represent a full suit of armor and I’ll allow that to be from any material.

Armor Materials

Table of armor materials

These are the starting materials I came up with. This table will hopefully be expanded in the future, but the thing that should be most notable is that material of the armor is what decides the tier. If you remember when I added tiers to weapons, the base weapon type determined that. That was because the base weapon is a large foundation for the weapon generator and attributes like prefix and abstract nouns adjust those numbers only slightly.

With armor, the material has a much larger effect on the outcome of the stats. Because of this, I decided to start with material and go from there, which is entirely different from the weapon generator.

Prefix First

  //////////////////////////////////////////////////////////////////////////////
  // armor prefix
  // we check this first to determine if this is hard or soft armor.
  //////////////////////////////////////////////////////////////////////////////
  if(!empty($args['attribute']) && array_key_exists('prefix', $args['attribute'])) { // try to fetch the requested armor type
    $armor_prefix = dbQuery("SELECT * FROM armor_prefix WHERE word = ? LIMIT 1", [$args['attribute']['prefix']]);
  }

  if(!empty($args['attribute']) && array_key_exists('make', $args['attribute'])) { // try to fetch the requested make of armor
    $armor_prefix = dbQuery("SELECT * FROM armor_prefix WHERE make = ? LIMIT 1", [$args['attribute']['make']]);
  }

  if(empty($armor_prefix)) {
    if ($args['tier'] == 0) {  // select from a specific tier or range of tiers
      $armor_prefix = dbQuery("SELECT * FROM armor_prefix WHERE active = 1 ORDER BY RAND() LIMIT 1");
    } else {
      if(!empty($args['tier-variance']) && $args['tier-variance'] > 0) {  // tier may be higher or lower
        $swing = rand(0,100);
        switch (true) {  // determine how much variance
          case ($swing >= 95):
            $variance = 2; // occasionally, tier will be adjusted by 2 levels
            break;
          case ($swing >= 40):
            $variance = 1;
            break;
          default:
            $variance = 0;
        }
        $min_tier = $args['tier'] - $variance;
        $max_tier = $args['tier'] + $variance;
        $armor_prefix = dbQuery("SELECT * FROM armor_prefix WHERE active = 1 AND tier >= ? AND tier <= ? ORDER BY RAND() LIMIT 1", [$min_tier, $max_tier]);
      } else {
        $armor_prefix = dbQuery("SELECT * FROM armor_prefix WHERE active = 1 AND tier = ? ORDER BY RAND() LIMIT 1", [$args['tier']]);
      }
    }
  }

When we start building our armor, we first figure out what material it will be made out of. This gives us 2 more levels of granularity we can request from the generator: make and tier. After checking to see if you requested a specific material, we check to see if you requested a make array_key_exists('make', $args['attribute']). If so, this will completely skip the tier request and I’m okay with that. The make category is like a broader tier anyways. The soft armors aren’t going to provide the level of protection that hard armors will, but they also have other benefits like insulation from cold, or more effective sneaking abilities.

Now that we have our armor material, we can select the armor_type based on the $armor['make'] from the material.

$armor_type = dbQuery("SELECT * FROM armor_type WHERE active = 1 AND (make = ? OR make = 'any') ORDER BY RAND() LIMIT 1", [$armor_prefix[0]['make']]);

Now when we select something from the armor_type table, we have to choose entries that match our prefix $armor_prefix[0]['make']] or any.

For now, this only applies to the armor_prefix and armor_type tables. I haven’t added it to the armor_abstract table because I haven’t come up with any reason to restrict an abstract noun to a particular material type. If needed, I’ll add that in a future update.

Speaking of, this is all live now. You can now choose to generate weapons or armor from the site or leave it set to ANY to generate a random item. Weapons will generate roughly 75% of the time because I intend for armor to be more rare in the final game engine. Remember, this is all for statistics modelling in the future game! In fact, the more you go play with the tool, the more data I store to help me tweak the game engine later on.

https://noroguesallowed.com

Drawing Icons

While I was working through all this in my head, I decided to tinker with some graphics to liven the page up a bit. So I stayed up one night drawing a bunch of graphics for each of the weapon and armor types. If you notice in the table examples above, there is an icon column that defines what will be used to represent that item. When an item gets displayed in the browser, I use some CSS tricks to render a scalable vector (SVG) as a quick visual representation. Most things in the final game will work this way… hopefully with better art.

Weapon icons
armor icons

This is all just placeholder art. I’d like for it to be a bit more hand-drawn in the final game but the nice part about scalable graphics is that I can fiddle with the shapes and sizes on my prototype until I figure out what I actually need. Then maybe I can hire someone to draw better things. We shall see!


Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

One thought on “Armor and Icons – Roguelike Design part 7