Sunday, October 31, 2010

Items, Templates, and code

So I finally sat down and completed the item code. Templates are now built and items are generated from them. This is the beginning of the crafting and loot table generator.

My co-designer completed our initial combat calculator and I created the first monster template. So far we are leaning toward random battles much like RPGs of the past. This will allow us to keep players from specifically targeting just one mob in order to hunt for loot. In the future we may move this back to created mobs, we might not.

Now that We have mobs, an item, and a player I need to build up the equipment screen to allow players to change their equipment. Once that is done, the combat code will be written and a button to test killing a rat will need to be built. The beginning is always fun. I'm already looking into jQuery and I have purchased Pro PHP and jQuery to help on the way.

The joys of development.

Thursday, October 28, 2010

Items, Templates, and tables. Oh my.

So, after sitting down I worked through all the things I want to see in loot tables, item generation, templates, and vendors. With this I believe I have covered everything I want in the game.

Classes:
Item
Weapon : Item
Armor : Item
Consumable : Item
ItemTemplate
WeaponTemplate : ItemTemplate
ArmorTemplate : ItemTemplate
ConsumableTemplate : ItemTemplate

class Item
{
   ID
   Name
   Description
   Value
   Quality
   Condition
   Durability
   IsUsable //denotes if there are spells or other effects on this item
   Weight
   Volume
   IsStackable
   IsEquippable
}


class ItemTemplate
{
   ID
   Name
   DisplayName // denotes a difference in name for multiple items with the same name but different templates
   Description
   low_Value
   high_Value
   low_Quality
   high_Quality
   low_Condition
   high_Condition
   low_Durability
   high_Durability
   IsUsable //denotes if there are spells or other effects on this item //
   low_Weight
   high_Weight
   low_Volume
   high_volume
   IsStackable
   IsEquippable
   low_NumEffects // the total number of effects that can be applied to this item during creation
   high_NumEffects
}

These 2 classes form the base from which all other items are listed. Due to the nature of the API I am using, I can use concrete inheritance for the templates, but the items have to use a composite inheritance, otherwise functions just don't work right. 

With these 2 classes in place, we can code a couple of functions such as Item.generateItemFromTemplate(ItemTemplate);

This will take the template, determine any effects the item will have, quality, condition, durability, and any other stats and generate an item. So already this gives us a the setup we need for a few things: Loot Tables, Crafting Tables, and Vendor tables.

This is a quick and easy way to have all of our items defined and generated at any time. The only tables left out are Effect, ItemEffect, and ItemTemplateEffect. These define what effects are available, what effects an item has, and what effects an item could have.

Falling back to posts last year, we have an effective way to give players unique loot with stats that can vary but won't provide a piece of loot that everyone will want no matter what.

Friday, October 22, 2010

Item decay

So after my lengthy rants about dynamic items and decay and proper crafter progression, I sat down to implement it myself. At first i started with just the usual, a static item. Its extremely simple for a web game, just a matter of putting it in the DB, creating a player and putting the item in his inventory. Because of it's simplicity and low database usage, its quick, easy to use, and doesn't take up alot of space.

So what if we try and add item decay to it. To do this, I started from my simple models of:

  • Inventory
  • Item
  • Weapon : Item

From these classes i moved to:

  • Inventory
  • ItemTemplate
  • WeaponTemplate : ItemTemplate
  • Item
  • Weapon : Item

Item has a reference to the ItemTemplate. ItemTemplate is exactly how Item used to be, it has static information about items. Item has additional fields ala DAoC. That is it has Durability, Condition, and Quality. The quality is a flat reduction from the max while condition is a increasing reduction through use.

So now I have an item that has values for decay through use, a quality, and we still aren't taking up a ton of data because it has a reference to the static value items.

So that covers some of what I talked about previously. The last change that I would like to make is to have varying values with quality. In this fashion you can have crafters that get better stats with lesser quality and lesser stats with better quality and a truly unique masterwork item which will have 100% quality and the highest stats for that item.

To do this, I would use the same tables, but the template tables would have 2x as many fields and each weapon would be unique. It takes up the most amount of database space but allows for as close to unique values as possible. In this fashion you can begin to implement skills such as Weapon smithing mastery which increases your quality chance and Weapon Smithing Theory which can increase stats or any number of other ways to let players begin to specialize.

Thursday, October 21, 2010

More progress

So, since this time last week I have been slowly working on pieces of the game. It took some time, but I was able to learn to build forms with the API I am using. With this new knowledge I now have character creation complete and the new character gets a rusty sword as his/her first item.

I also began giving the characters some stats. I am currently working on the derived stats. Things like Armor, hit points, and to-hit rolls.

I also began the inventory management portion. My current code has it set so that an item can be made stacking or non-stacking. If it is non-stacking adding another item will cause a new stack of 1 to be created. I still need to add a remove portion from it so that as things like arrows or potions get used they decrement appropriately.

Currently the game looks hideous. No formatting, no color, just black text on white background. I had to limit myself to this so I wouldn't get wrapped around the axle about how it looked. If I focus too much on how it looks, I never make any progress. This is especially true when I do graphics. They never look good to me so i tweak them or modify them and never progress in the code.

This time it will be different. I will work on the game first, then the looks afterwards. I think too many games do the opposite and thats why we have games that look fantastic, but only last 10 hours.

Goals: Inventory Management - remove item, Character Management - stats, Character Management - inventory.

Thursday, October 14, 2010

User Registration and Login

So I had been losing the battle of functionality vs looks recently. I was so busy drawing up what i wanted the game to look like, i was getting nothing done in terms of actual functionality. So today I took a step back and decided that it was time to work on some functionality.

So far I have a great API and I'm using a nice plugin for security. I can move on to the next set of pages - the character select and creation screens.

Tuesday, October 12, 2010

A new beginning

Yesterday it was decided that we should focus on a web game. It will be an RPG with quests, equipment, and monsters.

I updated the blog name to reflect this new purpose.

Today I want to start off on the right foot. Game design has started and we are piecing together the small stuff. I am starting from the user creation into creating a character and inventory. I am having trouble sticking just to design as I want to write out the initial login page and get the initial graphics started up.

I'm working with PHP and likely jQuery. As such I have started reading tutorials from tutsplus.com on the topic of jQuery. I've worked with PHP long enough now that I can efficiently write code that works and is easily maintainable.

Today's goal: Make generic graphics I can use as place holders for the real thing as the game gets built.

Secondary goal: get the registration and login pages up and running.