project-navigation
Personal tools

Author Topic: UFO 2.5 Dev Production/Market Balance  (Read 10083 times)

Offline andrenal

  • Cannon Fodder
  • **
  • Posts: 9
    • View Profile
UFO 2.5 Dev Production/Market Balance
« on: August 05, 2012, 12:42:33 am »
I am new to forum things and I really would like to contribute with UFO:AI development as a old x-com fan and as a c++ programmer. I analyze the game mechanics I realize that production math was broke. Doesn't make sense to produce anything if you pay the buy price at the end of production.

The production profit is always negative, seems to me the initial balance math ignores the worker cost involved or is unfinished.
So I am working on it here: https://docs.google.com/spreadsheet/ccc?key=0ApJnXtKiBSyMdGVwZWkwZWhyaU5aenY2MTRlT29UWlE#gid=0 to balancing the production values for basic itens, dont know if this work will be usefull or it is already done just waiting some game improvement. I just need to do it to calm down my OCD  :-[. The values I am working on doesn't unbalance the game as you can see and give some production options with a minimal profit.

I have a doubt I can't confirm yet. Does the "Cost per Item" get his value from "price" in /ufos/weapons_human.ufo?

To make this work is necessary a separate value as "production_cost" but I couldn't find where is it yet.
Can someone give me a hand? I don't know the right place to this post too  ;D.

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2547
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #1 on: August 05, 2012, 01:10:59 am »
Hi,

Actually the code for different produce price is there already, I just didn't have time to figure out the right values. Also the designers don't really wanna players make much profit from producing because it's not the aim of the game.

My idea was if I (or someone else) could implement a dynamic market model, that could help here too. -- What I'm speaking about is if the player sells much laser pistols it's sell price go down so after a time it won't worth producing it for money.

Okay, back to the topic: You can set productioncost property for items (which are producible), if it isn't set the (market) price is used.

-geever

Offline andrenal

  • Cannon Fodder
  • **
  • Posts: 9
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #2 on: August 05, 2012, 01:48:37 am »
Actually the code for different produce price is there already, I just didn't have time to figure out the right values. Also the designers don't really wanna players make much profit from producing because it's not the aim of the game.

I imagine that, did you see the spreadsheet? With 30 workers you will make about 27000c per month, it's a little better that get a landed harvester and sell.
I can make a draft of values and time production for all itens, making some itens a little profitable and some dont.
If you could give a look at my numbers and give me a feedback I can take care of this.

My idea was if I (or someone else) could implement a dynamic market model, that could help here too. -- What I'm speaking about is if the player sells much laser pistols it's sell price go down so after a time it won't worth producing it for money.

I think in something like that too, and some changes in interface to improve market experience. There is a draft of that in the second tab in the spreadsheet.

Okay, back to the topic: You can set productioncost property for items (which are producible), if it isn't set the (market) price is used.

Oh =D tyvm for the help! One more thing, where is set the productioncost? research.ufo or weapons.ufo? The producetime is at research.ufo I can put there too?

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2547
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #3 on: August 05, 2012, 02:11:22 am »
I imagine that, did you see the spreadsheet? With 30 workers you will make about 27000c per month, it's a little better that get a landed harvester and sell.
I can make a draft of values and time production for all itens, making some itens a little profitable and some dont.
If you could give a look at my numbers and give me a feedback I can take care of this.

H-Hour did balancing in campaign. I think I'll ask him to check the values.

I think in something like that too, and some changes in interface to improve market experience. There is a draft of that in the second tab in the spreadsheet.

(H-Hour's) Buy/Sell screen on UI2

Oh =D tyvm for the help! One more thing, where is set the productioncost? research.ufo or weapons.ufo? The producetime is at research.ufo I can put there too?

weapons_*.ufo and likes. It's part of the object (objDef_t) data structure not the research (technology_t) one. (These data structures need revising but they're so much core part of the game it's a though scary task).

-geever

Offline andrenal

  • Cannon Fodder
  • **
  • Posts: 9
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #4 on: August 05, 2012, 05:35:52 am »
(H-Hour's) Buy/Sell screen on UI2

Nice work =)
This new UI will be implemented in 2.5?

Offline Crystan

  • Project Artist
  • Captain
  • ***
  • Posts: 572
  • UFO:AI Lead Sound Artist
    • View Profile
    • http://crysea.cr.funpic.de/
Re: UFO 2.5 Dev Production/Market Balance
« Reply #5 on: August 05, 2012, 11:32:16 am »
Nice work =)
This new UI will be implemented in 2.5?
We hope. Theres already a wip version in the 2.5 git version (not featured in the nightly builds) you can try out.

Offline andrenal

  • Cannon Fodder
  • **
  • Posts: 9
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #6 on: August 06, 2012, 04:29:01 am »
Where I can set worker's salary?

Paying 4500c per month it's hard to balance ^^.

I tried find in files "4500" but nothing of workers =/

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2547
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #7 on: August 06, 2012, 11:09:47 am »
Where I can set worker's salary?

Paying 4500c per month it's hard to balance ^^.

I tried find in files "4500" but nothing of workers =/

camnpaign.ufo

-geever

Offline andrenal

  • Cannon Fodder
  • **
  • Posts: 9
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #8 on: August 06, 2012, 02:18:20 pm »
Ok, that is why I couldn't find ^^

Code: [Select]
salary {
soldier_base 1500
soldier_rankbonus 0
worker_base 500
worker_rankbonus 0
scientist_base 1000
scientist_rankbonus 0
pilot_base 1500
pilot_rankbonus 0
robot_base 7500
robot_rankbonus 0
aircraft_factor 1
aircraft_divisor 25
base_upkeep 20000
admin_initial 1000
admin_soldier 75
admin_worker 75
admin_scientist 75
admin_pilot 75
admin_robot 150
debt_interest 0.005
}

How worker_base 500 become 4500 and scientist_base 1000 become 3000? Can you help me?

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2547
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #9 on: August 06, 2012, 05:16:08 pm »
How worker_base 500 become 4500 and scientist_base 1000 become 3000? Can you help me?

You have 9 workers and 3 scientists? From where you get these values (4500 and 3000) ?

-geever

Offline andrenal

  • Cannon Fodder
  • **
  • Posts: 9
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #10 on: August 06, 2012, 05:45:00 pm »
You have 9 workers and 3 scientists? From where you get these values (4500 and 3000) ?

I calculate from the statistics employees costs, I check costs in statistics, hire one worker, check statistics again to see the diference on value.
Like this:
Statistics -> Total Employees = 253000 with 20 workers, 16 scientists, 16 soldiers and 2 pilots
Hire 1 worker
Statistics -> Total Employees = 257500 with 21 workers, 16 scientists, 16 soldiers and 2 pilots

Don't remember the exact numbers of each type, but something pretty close to this.
I will check it again with prints when I come home.

When I said 4500, this is a salary of 1 month of a worker and 3000 is a salary of an scientist in standart and easy dificults tests. Thats why I look for 4500 on files.

My question was about some recalc on that base, because I cant understand relation with my values.

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2547
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #11 on: August 06, 2012, 07:18:04 pm »
Ookay, it is buggy. Thanks!

You are playing on a different difficulty level than normal probably on one worker_base is not set. In this case the game using defaults hardcoded in cp_parse.cpp:
Code: [Select]
/* some default values */
s = &cp->salaries;
s->base[EMPL_SOLDIER] = 3000;
s->rankBonus[EMPL_SOLDIER] = 500;
s->base[EMPL_WORKER] = 3000;
s->rankBonus[EMPL_WORKER] = 500;
s->base[EMPL_SCIENTIST] = 3000;
s->rankBonus[EMPL_SCIENTIST] = 500;
s->base[EMPL_PILOT] = 3000;
s->rankBonus[EMPL_PILOT] = 500;
s->base[EMPL_ROBOT] = 7500;
s->rankBonus[EMPL_ROBOT] = 1500;
...

it's still not 4500 but 3000. What is that +1500? It's rank bonus. Well, workers shouldn't have ranks, but technically have one. That one should still not increase the salary, but it's buggy.

medals.ufo has the rank definitions:
Code: [Select]
rank scientist
...
rank pilot
...
rank ugv
...
rank worker
...
rank rifleman
...

... as they get indexed from zero, rank worker is IDX=3 which is the rest of that 4500 salary ( 3 * 500 = 1500 ).

What we should do is:
1. Eliminate those hardcoded defaults. My idea is to set them to -1 in the code and check the values after the parser and drop campaign definitions which don't have the necessary values set. (for this we need to set reasonable values to campaign.ufo for other difficulty levels too)

2. Fix the Rankbonus logic, it's completely broken. Rankbonus shouldn't rely on the order of the definitions in the ufo file, rather use it's factor property or so.


Would you like to take these easy bug fixes? It's good for a newcomer who yet learns UFO:AI code.

-geever

Offline andrenal

  • Cannon Fodder
  • **
  • Posts: 9
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #12 on: August 07, 2012, 06:12:32 am »
Ookay, it is buggy. Thanks!

Now I dont know if I am glad to help or if I get sad for stopping my Production's Balancing ...

You are playing on a different difficulty level than normal probably on one worker_base is not set. In this case the game using defaults hardcoded in cp_parse.cpp:

it's still not 4500 but 3000. What is that +1500? It's rank bonus. Well, workers shouldn't have ranks, but technically have one. That one should still not increase the salary, but it's buggy.

... as they get indexed from zero, rank worker is IDX=3 which is the rest of that 4500 salary ( 3 * 500 = 1500 ).

Are u a professor? ^^
Your explanation and didactics are very nice. =)

What we should do is:
1. Eliminate those hardcoded defaults. My idea is to set them to -1 in the code and check the values after the parser and drop campaign definitions which don't have the necessary values set. (for this we need to set reasonable values to campaign.ufo for other difficulty levels too)
2. Fix the Rankbonus logic, it's completely broken. Rankbonus shouldn't rely on the order of the definitions in the ufo file, rather use it's factor property or so.

Would you like to take these easy bug fixes? It's good for a newcomer who yet learns UFO:AI code.
-geever

YES! =D but ... there are some considerations, I dont have too much free time to dive in the project this month cause I have to finish a home reform by myself.  =/
This will be my first contact with opensource development team work paradigm. So I have to be prepared to dont shame myself. =)

I am concerned about the salary variation over difficulty. I think there are more ways to set things harder than change salarys, cause once production is balanced, change salarys will invalidate the work for other dificult levels.
For example, the sell value and Nations payment can be diminished instead. Because a worker salary is a production cost variable.




Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #13 on: August 07, 2012, 11:57:38 am »
I believe campaigns now have a producerate variable, which can be used to make production quicker or slower across all items.

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2547
    • View Profile
Re: UFO 2.5 Dev Production/Market Balance
« Reply #14 on: August 07, 2012, 12:43:01 pm »
I believe campaigns now have a producerate variable, which can be used to make production quicker or slower across all items.

H-Hour, could you set up salaries for all difficulty levels? As I see it's missing at almost every but main. Probably someone thought "it will be the same as main if not set" but it's not true.

-geever