Calculate unit price in scripts

For AI and campaign script related discussions and questions
Post Reply
crab_
Trained
Trained
Posts: 349
Joined: 29 Jul 2013, 18:09

Calculate unit price in scripts

Post by crab_ »

Hello.
What you think about idea: move unit price calculation into scripts?
Price can be stored somewhere in droid template data and made open for modifications from scripts.


Not sure if someone asked this already.
Last edited by crab_ on 07 Aug 2013, 08:36, edited 2 times in total.
Warzone2100 Guide - http://betaguide.wz2100.net/
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Calculate unit price in scripts

Post by Per »

But why?
crab_
Trained
Trained
Posts: 349
Joined: 29 Jul 2013, 18:09

Re: Calculate unit price in scripts

Post by crab_ »

Per wrote:But why?
1. This part of game can be made moddable. Price calculated not in every frame. I mean: this should not damage FPS.
2. Current price formula is not flexible.
[price of body]*[propulsion modifier] + [price_of_weapon]
better to change price formula to following:
[price of body]*[propulsion modifier] *[weapon modifier]+ [price_of_weapon]

2.1. Example: if you set very low price for some weapon then later in game this weapon can be used with heavy body. Later in game low priced weapons make you able to produce very cheap heavy tanks and use them to increase total HP of your army.
2.2. With more flexible price formula some overpowered tanks designs can be easily balanced by adjusting their price.
2.3 Ability to adjust unit price modifiers as result of research.


Well, i just see current price formula disallows some things.
Warzone2100 Guide - http://betaguide.wz2100.net/
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Calculate unit price in scripts

Post by Per »

crab_ wrote:can be made moddable
I was more looking for a use case for it.

There is some cost to doing this. It is an extra round trip to establish something that is already mod-able (the price for each component), and when the design screen is up, this value is indeed calculated every frame. Not impossible to change, of course. But as I said not sure why.
crab_
Trained
Trained
Posts: 349
Joined: 29 Jul 2013, 18:09

Re: Calculate unit price in scripts

Post by crab_ »

Per wrote:
crab_ wrote:can be made moddable
But as I said not sure why.
Another variant - just make price formula more complex?
As i mentioned in previous post,
price = [price of body] * [propulsion modifier] * [weapon modifier] + [price_of_weapon]

may a bit more complex?
price = [price of body] * [propulsion modifier] * [weapon modifier] + [price_of_weapon] + [price_of_propulsion]
So need add one or two fields in weapon.ini and propulsion.ini

I want to experiment with prices and other tank parameters, so it can be interesting to have this formulas moddable.

Thank you for answering :)

Per, what you think about idea to have moddable tank design screen? List of aviable components for each design can be processed in scripts. I like this.
Warzone2100 Guide - http://betaguide.wz2100.net/
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Calculate unit price in scripts

Post by Per »

I'd be happy to have price and price modifier on every component, since this just generalizes what we have already.

The list of components for design screen is already moddable through the .ini files, so again I do not quite see why you want to have it be processed by scripts.
crab_
Trained
Trained
Posts: 349
Joined: 29 Jul 2013, 18:09

Re: Calculate unit price in scripts

Post by crab_ »

Per wrote:I'd be happy to have price and price modifier on every component, since this just generalizes what we have already.
Nice.
Per wrote:The list of components for design screen is already moddable through the .ini files
not sure, i cannot understand you. Do you saying about "designable=1" in .ini?
see. Why i cant use VTOL weapon with tracked propulsion?
In scripts some logic can be added in design screen. For example: forbid apply heavy weapons for light bodies.
Example: If player places Plasma Cannon on viper body then such tank becomes very slow, that design plasma+viper simply cannot move.
So i suggest to process in scripts list of available components for each body, propulsion, weapon.
Per wrote:so again I do not quite see why you want to have it be processed by scripts.
I want see price in scripts to be able to change price of some tank designs during game (e.g. as result of research "Dedicated cheapening of army")
I want to see price formula in scripts to be able change price formula as i want (e.g. add factory price modifies).

Does it possible to change prices of components in scripts?
As far as i understand, in current version of game price cannot be modified in scripts?
I'd suggest just change price formula in c-code but i'm afraid it is impossible as it happening with accuracy.
Warzone2100 Guide - http://betaguide.wz2100.net/
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Calculate unit price in scripts

Post by Per »

It should be easy to add price modifications to the script "upgrades" system. But I have not looked at this.
crab_
Trained
Trained
Posts: 349
Joined: 29 Jul 2013, 18:09

Re: Calculate unit price in scripts

Post by crab_ »

Per wrote:It should be easy to add price modifications to the script "upgrades" system. But I have not looked at this.
Does you mean add "price upgrade value" to upgrade data scructures?
Warzone2100 Guide - http://betaguide.wz2100.net/
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Calculate unit price in scripts

Post by Per »

crab_ wrote:Does you mean add "price upgrade value" to upgrade data scructures?
In qtscriptfuncs.cpp, yes.
Post Reply