Units.csv & cargo import

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
Silverain
Expert Mercenary
Expert Mercenary
Posts: 984
Joined: Thu Aug 07, 2003 5:35 am
Location: Brisbane, Land of Oz
Contact:

Units.csv & cargo import

Post by Silverain »

Use this example:

At a MiningBase, Cargo Import has {Raw Materials/Metals/Radioactives;0;0;0;0}. My understanding is that this is 0% price, 0% standard deviation on price, 0% number available, 0% standard deviation on number.

So this entry should give me the result that there are no radioactives for sale at MiningBase, and if I had some for sale, price on sale should be zero credits (price x 0%). Instead, I get a price of $642.86.

What am I missing?
THOUGHT CRIME! [points finger] THOUGHT CRIME!
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

not sure--that looks like a bug!
are you sure that's not just the price displayed--when you sell you get cash!?
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

not a bug, a FEATURE

static float aveweight = fabs(XMLSupport::parse_float (vs_config->getVariable ("cargo","price_recenter_factor","0")));

in the cargo category of vegastrike.config is the
price_recenter_factor

setting it to 0 will respect your imports...
setting it to anything else will draw it closer to the average price.....
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
Silverain
Expert Mercenary
Expert Mercenary
Posts: 984
Joined: Thu Aug 07, 2003 5:35 am
Location: Brisbane, Land of Oz
Contact:

Post by Silverain »

<section name="cargo">
<var name="price_recenter_factor" value=".75"/>
<var name="max_price_quant_adj" value="5"/>
<var name="min_price_quant_adj" value="1"/>
<var name="price_quant_adj_pow" value="1"/>
OK, that's the section.

Am playing with the new cargos, editing the MPL and units.csv and may come up with a new economy within the old limitations.

Since I don't understand the background programming, could someone explain to me what the four variables are, history (why they were introduced) and what they do - be much appreciated. That way I can understand what was being done in the original version.

Possible related questions (apologies if the answers are already 'out there':
1. Is it possible to correlate the number of cargo available and price movements? I.e. more cargo available, price goes down?
2. The economy is based on categories i.e. base information set at Materials/Metals/Crude category. Is it possible (currently or via programming) to set it as the cargo level (Materials/Metals/Crude/Iron)?
THOUGHT CRIME! [points finger] THOUGHT CRIME!
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

the cargo is based on category
that's so that each base may import similar goods with just importing the category

price_recenter_factor is how much it ignores your saying and makes it closer to the "average price" listed in the mpl
if you didn't screw up this could be zero

max_price_quant_adj: well I don't remember what it does...but it should be pretty easy to read through the code that does it below :-)

static float aveweight = "price_recenter_factor"
c.quantity=quantity-quantdev;
float baseprice=c.price;
c.price*=price-pricedev;

//stupid way
c.quantity+=(quantdev*2+1)*((double)rand())/(((double)RAND_MAX)+1);
c.price+=pricedev*2*((float)rand())/RAND_MAX;
c.price=fabs(c.price);
c.price=(c.price +(baseprice*aveweight))/ (aveweight+1);
if (c.quantity<=0) {
c.quantity=0;
}else {
//quantity more than zero
if (maxprice>minprice+.01) {
float renormprice = (baseprice-minprice)/(maxprice-minprice);
static float maxpricequantadj = "max_price_quant_adj"
static float minpricequantadj = "min_price_quant_adj"
static float powah = "price_quant_adj_power"
renormprice = pow(renormprice,powah);
renormprice *= (maxpricequantadj-minpricequantadj);
renormprice+=1;
if (renormprice>.001) {
c.quantity/=renormprice;
if (c.quantity<1)
c.quantity=1;
}
}
}
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
Silverain
Expert Mercenary
Expert Mercenary
Posts: 984
Joined: Thu Aug 07, 2003 5:35 am
Location: Brisbane, Land of Oz
Contact:

Post by Silverain »

hellcatv wrote:the cargo is based on category
that's so that each base may import similar goods with just importing the category
1. Mmm... got that point, but can we influence on a cargo item level? I'd like to be able to determine on a cargo by cargo, rather than category by category basis? (As a makeshift, I can make each cargo in its own category)
price_recenter_factor is how much it ignores your saying and makes it closer to the "average price" listed in the mpl
if you didn't screw up this could be zero
2. Didn't screw it up :D . BUT, where its set to zero, and the category is ;0;0;0;0, and I try to sell that category, it still comes up with a price of .01 credit. Or, I set it up that there is no category (either way intended that you cannot sell that good there), I still get a default price of 10 credits, no matter what the category.

Also, I had category which was to be base buying only e.g. mining equipment at a mining base, with category ;1.5;.1;0;0 (i.e. price with variation, but no volume available) such that I would get a price, but the base has no cargo for sale. Instead I keep getting one cargo available for sale. Is this because of the max/min price quant settings?

EDIT: I think the 'Stupid Way' answered this 2nd question.
THOUGHT CRIME! [points finger] THOUGHT CRIME!
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

I think I'll go ahead and hack the interface to detect a single cargo per category and then bump it up a level
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
peteyg
Elite
Elite
Posts: 1465
Joined: Thu Jan 02, 2003 12:01 pm
Location: Seattle, WA
Contact:

Post by peteyg »

That would be sweet.
Silverain
Expert Mercenary
Expert Mercenary
Posts: 984
Joined: Thu Aug 07, 2003 5:35 am
Location: Brisbane, Land of Oz
Contact:

Post by Silverain »

hellcatv wrote:I think I'll go ahead and hack the interface to detect a single cargo per category and then bump it up a level
I knew I'd seen this somewhere! Boss, did you ever get around to this?
THOUGHT CRIME! [points finger] THOUGHT CRIME!
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

Actually the plans changed
we're allowing an alternative category to be placed within the cargo description--this will be used instead of the listed category when displaying it in the base--this can make it so you can use the game category for imports and usually for display--but when you have something with unnecessary subcategories for pricing then you can change the place it's displayed...this also allows some contraband items to be inserted into "Natural products"
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
Post Reply