I have noticed that when playing randarts, there are a ton of OK midgame weapons, but a dearth of endgame weapons. (Currently the best weapon I've seen for taking on M is a Scythe +2 attacks doing 386 dam/turn, closely followed by a Scythe (Holy Avenger) doing 369 vs. Evil. The best artifact so far does a paltry 360. The trouble is essentially all the weapons look like fancy Defender or Westernesse weapons, but with the special BRAND_ALL and SLAY_ALL flags. And Defender and Westernesse are intended for the midgame.

(Randart bows are much better.)
So some analysis. The most powerful weapons in the randart list do roughly 37-45 damage per blow, with no extra attacks. There is one exception:

Now that's a weapon worthy of the original: 46 damage vs. evil, +2 attacks. (But why slay trolls and orcs? Fewer slays but with a brand would look more normal.)

Usual rule: At most one *Slay* on a weapon. At most 4 slays (with one being evil.) At most 2 brands. At most 6 points of stats, total.
And powerful weapons should be biased towards slay evil, since that is what counts when it really matters.

Its true that for the endgame, more often than not youll end up using an ego rather than an artifact, but thats already a feature of the standart set, so having randarts display the same tendency is not horrible ?

And I dont understand, are you suggesting to limit *slays* to 1 ? If so, I dont see why that would be better; I fondly remember a game where the only decent endgame artifact was a MoD with all 3 *slays* but not much else. I used it exclusively up to the final 2, and the playstyle was akin to a ranger in that the character could murder if he was selective, but random trash gave him pause.

Anyway, Nick has threatened to apply a flamethrower to the randart generator next time he enters.

Estiie, the randart code is designed to make all weapons average. First it calculates weapon power. Then it averages to_d and to_h across all the weapons, and uses that as a starting point for weapon damage. It also picks a pretty random weapon as the base weapon, so it is quite possible to get a MoD for a weak weapon, then end up with essentially an enchanted MoD instead of something useful. Then it makes up the difference in power by throwing in a bunch of perqs. But that doesn't actually turn the weapon into something useful except possibly as a swap. There are a number of fixes that have to be made. First, the different slots are normalized to distinct levels, so Thorin in the shield slot is phenomenal, while the same features in the weapon slot are not very valuable without correspondingly high damage. When the max power artifacts are distributed across all slots, you end up with a more powerful possible combination, so you can have The equivalent of Aule, Ringil, Bladeturner, Razorback, etc all equiped at the same time. Of course, this is necessary to some extent, since the base artifacts are mostly specifically designed to be useful, and the randarts are useful in a more haphazard way. But it still is a whole lot easier to get all the resists and 18/200 in all three combat slots. (Of course, ego balance DSM can help here too, since it shows up in a majority of games. Dwarven PDSM, of course, is insane.)

So: balance damage output on artifact power and depth.
Normalize power by slot. Value +4 stat bonus more more than 4x more than +1, since it provides more flexibility in other slots. Value CON a bit more in power calcs.

Also, yes, there are two ego items that compete well with the most artifacts: MoD +attacks and Holy Avenger, and to a lesser extent Gondolin. BoC Avenger is almost as good. But do the calculation. While it loses .8 blows to weight, the HA gets 5d8*2 +20 = 65 damage per blow, and another 5-10 from criticals. That is not quite as good as the best base artifacts. It is noticeably betrer than the very best randarts, unless there happens to be a good one with extra blows.

The last point is that it is not just speed or damage that scales non-linearly. Looking at item power, Paur* is worth roughly 1/5 of Thorin. In fact, the two are utterly incommensurate in power: Thorin is best in the game, while Paur* has almost no value even at level 20.

I am still not sure what youre after. In the midgame, chances are very high that some randart beats all available egos. So making randarts better in this phase wouldnt make sense. Improving randarts in the endgame would make sense, but it would mean that randart weapons in that phase were strictly better than standarts, which was not the intention. The situation is the same whether you pick stan- or randarts.

How exactly the code generates the weapons doesnt matter all that much. I might end up with a weapon better than Deathwreaker which is based on Isildur, or find a crappy weapon based on Deathwreaker.
All that matters is the average value and the spread, and those seem to be in about the right place, no ? (with average value slightly lower and spread slightly higher for randarts)

What happens is the midgame ones are pretty good but the endgame ones often do not exist. I am trying to figure out a way to get better variation in the randarts. Getting so many slays and brands makes for kind of dull gameplay.

I haven't looked at the randart code in ages, but as I recall it largely involves taking a standart (which may not be a weapon to begin with), computing the power of the standart (as a single scalar number), and then building a randart by assigning powers to it until its power level roughly matches the standart. There's some heuristics for which powers to assign -- e.g. ESP is more common on helmets, speed on boots, etc. Maybe what is needed is an additional heuristic when building weapon randarts that says "a weapon with power level X should dedicate roughly Y% of its powers towards raw damage" (damage dice or +to-dam).

@derakon--
That is correct. I am planning to do a least squares fit on the artifacts by level, and the top 1/level of ego weapons by level, which is an order of magnitude estimate on the number of weapons that are actually worth using. (So an ego weapon on level one is roughly 100% usable, and level 100 is 1% likely to be useful. It's obviously wrong for levels 2-5 or so, but after that it is close enough.)

I like to include vs. Evil in estimates of final usefulness. (It is good against a majority of difficult monsters, and there are only a small number of really dangerous uniques without it. But that is about what I was guessing.
Edit: Now I need to make a similar table for randarts.