16 Aug, 2006, Justice wrote in the 1st comment:
Votes: 0
As per other posts… I've been working on a crafting system, wanted to see what other people were doing. There are 3 major parts to this system, gather, actions, requirements.

The crafting system is script based. I've mentioned the javascript snippet in the past… Which I'm still testing and adding features to. A key feature of the script system is the ability to store scripts on a vnum that can be included into any script. When crafting is far enough along, I will add the ability to modify objects using scripting.

The gather subsystem allows players to produce objects from a room. It's based on a system Scion implemented at Rogue Winds, and the old AD&D 2nd ed dice tables.

The setgather command can be used to add gather items to a room. Each gather item must have a command, a type, and a weight. For now, the command must be either dig or search, and the type none, object, or script. A type of none is a failed dig, object loads an object, and script executes a script. If the type is not none, the gather item must have a vnum.

When gathering is attempted, the code searches the room for appropriate gather items (ie, check command, etc). As it does this, it sums the weight of each item. After finding all appropriate items, it rolls against the total weight, and then finds the gather item at that value.

By adjusting the weights, a builder can fine-tune how often certain materials appear. The biggest concern I have with the gather system is the tendency for botting/monotony.

The action subsystem is what most people will recognise as crafting, the setcraft command is used to maintain this. Each craft action must have a vnum, a name, and a command. Each vnum must be unique, and each name must be unique for the command. You can then set the succeed and fail vnums for the action, these point at the script which runs. A chance value must be set, or the action always succeeds. While this can be handled within the script, doing it this way allows the fail/success scripts to be separated. The failure script could be identical to the success with a different (worst) result.

Currently the acceptable commands are:
fashion <action>
combine <action> <obj1> <obj2>
forge <action> <material>

Requirements are a general system… because crafting is script based, most of this is handled by scripts. Because of the object grouping in SMAUG, I've added a special toolkit to search for objects.

Each craft action has 5 craft toolkits to use, each toolkit can search for objects by type or vnum in rooms, objects, or characters. You can set the max amount it will find, default is 1. Each search returns the total it found. The toolkits can "extract", "apply", or "clear" it's contents. Extract deletes all objects it's found, apply copies the affects onto a target object, and clear resets the toolkit.

In the works is a "material" system which will allow objects to have categories… "sword blade", "hilt", "helmet visor". Using these categories instead of a vnum or type will allow the actions to be more vague, and combined with the toolkit's apply ability, will allow for players to come up with recipes using multiple actions.

There are new item types in the works for ore, gems, and fabric.

The script system will be able to roll against a player's skills… if the player does not have a skill it fails. This will allow class/racial skills to effect how crafting through bonuses and failure.

Anyway, that's as short of a description as I can manage for now, just trolling for input to see what people think, and to hopefully hear what other people are doing.
19 Sep, 2006, bozimmerman wrote in the 2nd comment:
Votes: 0
Hey there –

Suppose I could mention how we do it, if its any interest or help.

First off, our rooms are divided into types, of which there are about 16 or so that really have never needed to be added to for some reason. They include things like woods, plains, swamps, water, city streets, indoor wooden, etc..

Those types then have some set of resources that they make available potentially. What is actually available in any GIVEN room at any particular time changes about once every 30 mins (the check/change is actually done whenever a demand for resources is made of a room, so there is no actual thread going around maintaining this).

Our skills then are divided, like yours, into gathering and crafting. The gathering skills are divided by the types of things you can gather with them – mining, woodchopping, and so forth (about 10 or so). The crafting skills are divided by real-life skills, and typically require the "raw resources" generated by the gathering skills. We have about 35 or so crafting skills, which rely on text-based "recipe" files, and the skils range from JewelMaking to ScrimShaw, Armorsmithing, and so forth, including advanced and master-level versions of some. Most of the crafting skills allow the items they make to be mended as well.

Couple of recommendations for you to do off the bat that we learned the hard way.
1. Support BUNDLING of raw resources to combine multiples of the same resource objects into one object. Players will end up with thousands of little 1 pound item objects if you don't, and that wreaks havoc with computer resources.

2. Make your crafting recipes span the level-range in usefulness. You WILL have players that do nothing all day but gather resources and craft things – might as well keep them interested into the high levels.

- Bo