Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  
Liza Shulyayeva


After finishing yesterday's post about generating images for user-combined substrate items I realized that I never really provided an explanation about how items work in general (or how they work for now, anyway).

We have a few different item-associated models in Gastropoda. They are (model followed by associated table in parinetheses)

  • ItemType (item_types)
  • ItemTemplate (item_templates)
  • ItemUserTemplate (item_user_templates)
  • ItemNutrition (item_nutrition)
  • ItemUserNutrition (item_user_nutrition)
  • Item (items)

    Item types are very generic. Right now I have the following item types:

    • consumable
    • decorative
    • substrate
    • jar
    • breeding
    • terrain
    • training
    • misc

      ItemTemplates are pregenerated item...templates that can exist in the world. Note that these are not the existing items in the world, they are just things that could be instantiated into in-world items. Each item template is associated with an item type. Right now they are (template name, item type):

      • Lettuce Leaf (consumable)
      • Medium Sweet Potato (consumable)
      • Spark (decorative)
      • Basic Small Jar (jar)
      • Enthusiast Small Jar (jar)
      • 7-Day Fertility Spray (breeding)
      • Grooved Glass 2mm (terrain)
      • Attractor (training)
      • Garden Dirt (substrate)
      • 1kg Pure Fine Sand (substrate)
      • 1kg Dry Oak Leaves (substrate)

        ItemTemplates _can_ have an associated nutrition template. All consumables and substrate items have their own entries in the `item_nutrition` table.

        Items are the actual instances of these item templates existing in the world. They are usually created when stores are restocked or when users mix their own substrate. An item entry consists of basic information about the instance, like:

        • itemID
        • templateID
        • ownerID
        • jarID
        • bitesTaken
        • posX
        • posY
        • isUserTemplate

          Which brings me to user templates. Any mixing of substrate creates a new item template, or rather an ItemUserTemplate, and saves it in the [font='courier new']item_user_templates[/font] table. Substrate also gets its own nutrition entry, in [font='courier new']item_user_nutrition[/font]. This allows us to easily distinguish user generated items from basic items in the simulation and treat them differently. Then on an instance of an item, if [font='courier new']isUserTemplate[/font] is true, we know to look for associated templates in the user tables and not the regular tables.

          That's pretty much it. The most annoying part about this setup is that there are so many inter-table dependencies. An item without a template entry is a broken item. A consumable without a template that has an associated nutrition record is broken. Etc...
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!