Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [DFHack] Planning: Item Wear  (Read 1733 times)

expwnent

  • Bay Watcher
    • View Profile
[DFHack] Planning: Item Wear
« on: May 07, 2014, 12:10:27 am »

No promises whatsoever on when I'll get it done, but if I have some time I think I'll do item wear next.

What do modders actually want to do with this? Just make armor/weapons/things wear down over time? Just specific items or everything? Is it good enough if they wear down unconditionally or do they have to wear down proportional to usage?

How would modders like the user interface to work? Ideally there should be succinct ways of making many item types work with a small number of commands, but also support just plain old "make this item and this item only decay over time". It would probably have to be at a per-mod dfhack.init file level rather than a raw level like autoSyndrome, but I'll see what I can do.

Obviously it would be difficult to balance and would take a lot of tinkering, but that's an inevitable problem and it's more of a modder problem than a dfhacker problem. You guys are better at that than I am.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DFHack] Planning: Item Wear
« Reply #1 on: May 07, 2014, 01:40:54 am »

Exposing the... settings or whatever to Lua should make it easier. Having something simple like this:

Code: [Select]
local itemWear=require('plugins.item_wear') --whatever you're calling it...
{{'ITEM_WEAPON_SWORD',50},{'ITEM_SHIELD_BUCKLER',30}}

Where the string is the item substring and the number is the number of ticks between wear increment times.

The main problem with that is that it isn't well known by most modders (being something they can't control) just how much a single quantum of wear is.

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: [DFHack] Planning: Item Wear
« Reply #2 on: May 07, 2014, 02:16:16 am »

There was some discussion about adding new folder and putting there our raws. The dfhack would then parse them and expose some sort of API. Maybe this idea would be worth exploring? (though i'm with Putnam: usually having to learn lua helps in the long run :)  )

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DFHack] Planning: Item Wear
« Reply #3 on: May 07, 2014, 03:21:26 am »

I like the idea. I also know that most players will dislike it, because their metsl goes away and that they cant selecr xXitemXx in reactions.

If you want to manipulate item wear, and force players to pay more attention to uniforms and weapons, you must also give them options to save them. A reaction to repair xXarmorXx to armor and sharpen xXweaponXx to weapon would be ideal, but I assume that the AI would have issues with that even if implemented correctly, because the reagents (armor and weapons) are worn by your units.

The bad thoughts for your smith from lost Masterpieces is a problem as well.

My suggestion:
Item quality affects wear-rate. The higher the quality, the slower the wear. Masterpieces get no wear at all, giving players the option to only use their best items without losing them.

Item material affects wear. Bronze wears faster than iron, iron faster then steel and so on. Adamantine has no wear.

Weapons and Armor should only wear from use, if that is possible to implement.

A way to make clothing not wear out would be nice. Metal clothing should wear slower, masterpieces not at all, the same idea. It would be only fair to give the option to save some of the clothing, if you take away some of the armor/weapons.

Artefacts shouldnt wear out.

A reaction to target xXitemXx to either destroy, recycle or repair should be given.

Worn away metal items should leave a "itemcorpse" if you want to call it that. A chunk of that metal type that can be molten down into bars again. Broken swords dont just disappear, its the item that breaks, not the material. A "reforge" reaction could be nice as well: Take broken steel sword, fuel and one steel bar to reforge it, after its broken.

I would absolutely love this for MDF and add it as an option, which probably would be enabled by default. Good luck. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Planning: Item Wear
« Reply #4 on: May 07, 2014, 11:50:16 pm »

If I expose a simple way to experiment with wear amounts, modders will figure out how to balance it. It will be a fair amount of work, but it's possible. I can help by binsearching to see exactly how much wear an item needs to go between each level. Then it's just a matter of subjectively deciding how fast things should decay.

I very strongly agree a dhack "raw" file should eventually happen. The question is whether that should happen now. I think it could be an independent project. The simplest way is to have some sort of XML file system (or similar) parsed in C++ after the first request for its contents since the last load that's exposed to lua and ruby. That way I won't have to change the parser for new plugins. XML is a bit of a pain, but it'll probably be good enough. Once the parser is in place, plugins and lua scripts can just walk through the parse tree as needed.

Making item quality matter is easy enough. The hard part is balancing the modder interface between expressiveness and simplicity. Doing all the monitoring and actual decaying of items will be a bit of a pain to debug and get working but it won't be hard from a design perspective. What's the craziest amount of flexibility a modder could possibly want with this? The less I have to change the user interface over time, the less you have to redo all your raw files. I've definitely broken backwards-compatibility for autoSyndrome a few times, and I stand by the corrections I made, but all else being equal it should be avoided when possible.

It actually might be pretty easy to make clothing not wear out by just periodically iterating through it and resetting the wear timers. I'm not sure whether it makes sense to do that as a part of this plugin or not. If not, I can do that too. It would actually be easier.

Regular clothing doesn't decay unless it's worn, right? It wouldn't make sense for weapons and armor to decay if not used, but then again they might rust, but then again clothing might get slowly eaten by microbes even or whatever causes it to wear out when it isn't being worn, so I dunno. I could see it going either way.

I guess I can always just add more functionality later.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: [DFHack] Planning: Item Wear
« Reply #5 on: May 08, 2014, 12:13:05 am »

Actually there is some info in steam engine plugin. It already uses item wear when you use non magma-safe items in magma powered steam engine.

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Planning: Item Wear
« Reply #6 on: May 08, 2014, 12:23:08 am »

I'll take a look when I get a chance.
Logged