Units.csv & cargo import
-
- Expert Mercenary
- Posts: 984
- Joined: Thu Aug 07, 2003 5:35 am
- Location: Brisbane, Land of Oz
- Contact:
Units.csv & cargo import
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?
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!
-
- Developer
- Posts: 3980
- Joined: Fri Jan 03, 2003 4:53 am
- Location: Stanford, CA
- Contact:
not sure--that looks like a bug!
are you sure that's not just the price displayed--when you sell you get cash!?
are you sure that's not just the price displayed--when you sell you get cash!?
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
http://vegastrike.sourceforge.net/
-
- Developer
- Posts: 3980
- Joined: Fri Jan 03, 2003 4:53 am
- Location: Stanford, CA
- Contact:
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.....
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/
http://vegastrike.sourceforge.net/
-
- Expert Mercenary
- Posts: 984
- Joined: Thu Aug 07, 2003 5:35 am
- Location: Brisbane, Land of Oz
- Contact:
OK, that's the section.<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"/>
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!
-
- Developer
- Posts: 3980
- Joined: Fri Jan 03, 2003 4:53 am
- Location: Stanford, CA
- Contact:
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;
}
}
}
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/
http://vegastrike.sourceforge.net/
-
- Expert Mercenary
- Posts: 984
- Joined: Thu Aug 07, 2003 5:35 am
- Location: Brisbane, Land of Oz
- Contact:
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)hellcatv wrote:the cargo is based on category
that's so that each base may import similar goods with just importing the category
2. Didn't screw it up . 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.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
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!
-
- Developer
- Posts: 3980
- Joined: Fri Jan 03, 2003 4:53 am
- Location: Stanford, CA
- Contact:
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/
http://vegastrike.sourceforge.net/
-
- Elite
- Posts: 1465
- Joined: Thu Jan 02, 2003 12:01 pm
- Location: Seattle, WA
- Contact:
-
- Expert Mercenary
- Posts: 984
- Joined: Thu Aug 07, 2003 5:35 am
- Location: Brisbane, Land of Oz
- Contact:
-
- Developer
- Posts: 3980
- Joined: Fri Jan 03, 2003 4:53 am
- Location: Stanford, CA
- Contact:
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"
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/
http://vegastrike.sourceforge.net/