Budgeted Randart Generation

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Hachem_Muche
Uruivellas
Posts: 744
Joined: Thu Nov 18, 2010 6:42 pm

Budgeted Randart Generation

#1 Post by Hachem_Muche »

As many on these forums have pointed out, current Random Artifact (randart) generation still needs some work. Randarts don’t scale well with level, resulting in inferior items by the late game, some properties are inappropriate (like putting melee damage on a bow), and the items lack focus with the random abilities thrown together with little or no coherence. This proposal is intended to address these issues.

In most respects, the following system is an enhancement of that proposed by Susramanian (http://forums.te4.org//viewtopic.php?f=39&t=23105).

The main features of this system are:

A budget based on power level that is used to allocate powers to a randart
A list of cost and rarity factors for all random characteristics
A single and easily tunable randomness factor (RF) to set how focused the powers are
A system to base randarts on currently generated egos that ensures that competitive randarts are generated


I’m not a LUA programmer, so I’ll present this algorithm in pseudocode. The main tuning parameters in this algorithm are the database of costs and rarity factors, the budget calculation, and the randomness factor.

Code: Select all

Pregame set up:
Set up a database of cost and rarity values for powers that can be added to randarts.  (Susramanian has a good starting point in his post). To this add fields that specify the amount of the power to be added, and a classification for the power (stats, resists, melee, ranged, etc.)

For example:
	Abbreviation	Cost	Rarity	Amount	Classification
	STR		          1.0 	10	1d3	stats
	ColdResist:    	0.03, 	8 	1d5	resists
	StunResist:     	0.1, 	4 	1d10	resists
	MeleeFire	       0.5  	5	1d5	melee
	etc....

Where rarity ranges from 1 to 10, with 10 being common and 1 being very rare.
Set up a Budget adjustment per slot (BAL):
	
Weapons   	1.0
Shields	   0.8
Rings	 	 0.8
Amulets   	0.5
Lights		 0.4
Body armor	1.0
Cloak	  	0.7
Helms	  	0.9
Belt	   	0.7
Gloves    	0.6
Footwear  	0.7
Tools	  	0.4

Probability of any power is its rarity/sum of all the rarities in the database. (Compute this during game startup)
	
Set RF: Randomness factor (0-1.0, 0= totally random, 1=totally focused, suggest 0.5)
Set MBGT =15 the minimum budget for an artifact on level 1 (This depends heavily on the cost factors)

MAIN MODULE
Inputs:
APL: Artifact power level ~= equivalent dungeon level (i.e. a level 40 monster should have an artifact of APL=40)

PROCEDURE:
A:	Compute the item budget:
	BGT = MBGT*BAL*(1+APL/15)*(1+rand(0:0.5))
(i.e ~4.5x as many points at level 50 as at level 1, based on massacre going from 8% to 33%, and then multiplied by a random factor from 1 to 1.5)

B:	Adjust the budget down for material quality (optional):
	x1 for voratun
	x0.9 for strilite
	x0.8 for dwarven steel
	x0.7 for steel
	x0.6 for iron

C:	With probability RF, Randomly generate an ego drop as a base item.  Otherwise start out with a plain item.
D:	Compute the budget already allocated to the item and subtract it from BGT.

MAIN LOOP (Minimum once through; don’t stop adding powers until the budget is exceeded.)

E:	With probability RF, select one of the powers the item already has. Otherwise select a random power from the database. [POWER SELECTION]
F:	Add the power to the item and subtract its cost from BGT.
G:	If BGT > 0 return to step E

END MAIN LOOP

Set appropriate variables, etc. to finish generating the object.

POWER SELECTION:
a1:	Compute IDX =rand(0-1)*table size.
a2:	Select the power from the database table such that sum(powers (1:index) <= IDX
a3:	Check power against restrictions (Melee only, No resists etc) and fall through to regular stat generation if it's not allowed.)
a4:	Compute the quantity of the power to add (i.e. STR is added in chunks of 1d3 points) and the budget required.
Return the power and its budget cost.
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

Lailoken
Higher
Posts: 76
Joined: Wed May 19, 2010 4:11 pm

Re: Budgeted Randart Generation

#2 Post by Lailoken »

Cool idea! I have something quick to add though. Maybe add in some rare powers that are penalties, and that add to the budget remaining. I really like the idea of randarts that force you to consider tradeoffs. Keeping them rare compared to positive powers would stop you from just having budgeting loops that run way too long and generate huge lists of powers.

Post Reply