Episode 8: Items

Let’s take a break from the technical stuff and talk about one of the design aspects of Zyrian: items.

As I mentioned in episode 1, I wanted my game to be inspired by Tyrian, but I also wanted improve on and add to the existing features. One of my favorite things about Tyrian is the item system.

tyrian-shop

Tyrian allows players to shop for items between missions. The player uses money earned from destroying enemies and collecting pickups to buy stuff. The types of items in the game are:

  • Ship: determines the look of the player’s sprite and the amount of life the player has (life doesn’t regenerate)
  • Front Gun: the gun that fires ahead of the player (can be upgraded)
  • Rear Gun: the gun that fires to the side or behind the player (can be upgraded)
  • Shield: protects the player by absorbing damage (shields regenerate)
  • Generator: constantly generates power which is used to fire weapons and such
  • Sidekicks: special weapons that can be used separately from the front and rear guns

There are many kinds of ships, guns, shields, generators, and sidekicks, each with their own cool name, icon, and sprite. These items give the player a reason to kill stuff and collect pickups beyond getting a high score.

Shortcomings

Items are the coolest thing about Tyrian, but there are some problems:

  • It’s often very difficult to tell if one weapon is better than another
  • The same items are always for sale at the same points in the game
  • Once the player has bought the most expensive items, money becomes useless
  • The items do not scale at all during the game
  • Ships, shields and generators only have one stat: capacity
  • The player rarely needs to conserve power
  • Many of the weapons and sidekicks are quite terrible

Changes

I decided that I could fix a lot of these problems by creating randomized items. Each item type (ship, weapon, etc.) would have a number of presets, and the presets would determine the base stats of the item. The item’s stats would then be modified by a number of factors, including its level, rarity and faction (I’ll discuss these things more in future episodes).

Because the weapons were so much more diverse and interesting than the other items in Tyrian, I wanted to make every item in my game interesting. To do this, I added more stats to the other items, and I added engine as a new item type, which would determine the player’s movement speed.

My weapon system ended up being quite a bit different. Instead of choosing a front weapon and a rear weapon, the player has a set of primary weapons and a set of secondary weapons. Both sets are triggered independently and are made up of a number of individual weapons. This adds a huge degree of customization to the weapon system.

I also removed upgrading from the front and rear guns, since the player would be replacing and adding new weapons all the time, I added more weapon stats, and I got rid of sidekicks altogether. To replace sidekicks, I decided to add an accessory-type item called a module, which would give a passive bonus to other items and could also be activated to give an additional temporary boost.

In conclusion, here are the items I ended up with and their stats:

  • Ship
    • Crash damage
    • Hull capacity
    • Primary weapon slots
    • Secondary weapon slots
    • Size
  • Weapon
    • Shield damage
    • Hull damage
    • Rate of fire
    • Projectile speed
    • Projectile size
    • Range
    • Blast radius
    • Efficiency
  • Shield
    • Crash damage
    • Capacity
    • Recharge rate
    • Recharge delay
    • Efficiency
  • Engine
    • Forward acceleration
    • Forward speed
    • Lateral acceleration
    • Lateral speed
    • Efficiency
  • Generator
    • Capacity
    • Recharge rate
  • Module
    • Passive bonus
    • Active bonus
    • Duration
    • Delay

This isn’t exactly how the stats were set up when I first chose them, but it’s more-or-less the same. One significant change I made was letting the ship determine the number of primary and secondary weapon slots. Engines also underwent some redesign, which I’ll discuss another time.

Creating an Item

Once the item factory was complete-ish, I exposed one single function: item. This function lets me get any kind of item from the factory based on the parameters I pass in.

By failing to pass in a parameter, or by passing null or undefined, this will cause function to randomize that parameter. For example, if you don’t ask for a specific type of item, you could get a ship, weapon, shield, engine, generator, or module. Rarity works a little different because its based on the chances each rarity has to drop. I might talk more about rarities another time.

Anyway, now when I need to get an item, I just ask for any kind I like…

Stay tuned for the next episode, when we talk about the entities that use these items.

Leave a Reply