OpenXcom Forum

OpenXcom => Suggestions => Topic started by: myk002 on March 25, 2015, 05:09:21 am

Title: In-game manufacturing profitability view
Post by: myk002 on March 25, 2015, 05:09:21 am
Hi all,

One question that I find myself asking a lot is: "what's the best use of my engineer's time right now?"  There has always been this wiki page (https://www.ufopaedia.org/index.php?title=Manufacturing_Profitability), but it is cumbersome to switch out of the game and go back and forth to consult charts, and now with mods adding items and changing properties of existing items, the wiki's charts can be incomplete and inaccurate.

I decided to try to bring the profitability calculations into the game so it can give you accurate, useful data for exactly the items you can manufacture right now.  Here's a preview for what I've done so far.  The screenshots are of the production items screen (if you don't recognize some of the items, it because they're from the FMP (https://www.openxcom.com/mod/final-mod-pack)).  I've added a third column that shows the net profit (or loss) if you dedicate all the manufacturing resources at this base to the item for one month.  The number will differ for different bases according to their manufacturing capacity.  Of course, most "profit" numbers will be negative, but even this is useful since it informs you of the "opportunity cost" of manufacturing the items that you need.

I also added an additional "category" to the combo box to show only profitable items.  If this is selected, the list is sorted so the most profitable items you can manufacture right now are at the top.

What do you guys think?  Would this be a welcome addition to the game?  My concern is that while it can be very useful for someone who knows what it does, it can also be confusing for newcomers.  Any ideas on how to refine this to be clearer/more useful?
Title: Re: In-game manufacturing profitability view
Post by: Arthanor on March 25, 2015, 05:29:43 am
I'm not 100% sure about the numbers being there all the time, it makes things look a bit messy (but I guess to some extend a modder could take care of that by creating neat numbers). The "Profitable Items" category is great, not only as a user, but also as a modder to review the profitability of what you created.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 25, 2015, 09:52:33 am
Another option is to not have the third column, but keep the "profitable items" category/filter so you can still get an ordered list of items to manufacture for profit.  I could then move the actual profit calculation to the next screen (the ManufactureInfo screen), where you assign a particular number of engineers to the job.

We would lose the ability to compare all possible items at a glance, but gain accuracy for the individual item, since then I can calculate profit based on the actual number of engineers assigned and not just assume that the base's full manufacturing capacity will be dedicated to the job as I currently do.  Of course, I could add the profit info to the ManufactureInfo screen regardless of whether we have the third column in the item list..
Title: Re: In-game manufacturing profitability view
Post by: hellrazor on March 25, 2015, 01:27:37 pm
You only need to produce to items for selling in vanilla game:

Motion Scanners and Laser Canons.
Title: Re: In-game manufacturing profitability view
Post by: yrizoud on March 25, 2015, 04:37:38 pm
It's the bottom line for vanilla game : Even if the game gave you the information directly, after you draw your own conclusions, you would never need this information again.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 27, 2015, 05:18:36 am
Fair enough.  Would it be useful to see how much money you'd make per month for the number of engineers you have assigned?  This probably needs a few more text labels and maybe not put the value on the button itself, but something like:
Title: Re: In-game manufacturing profitability view
Post by: volutar on March 27, 2015, 09:12:11 am
Manufacturing items for sale is not what vanilla xcom about. Literally, it's just side effect of the "selling" feature of the game. AFAIK xcom2012 doen't have that at all. Hell, it's the game about fighting alien invasion, not getting billionaire.
Title: Re: In-game manufacturing profitability view
Post by: x60mmx on March 27, 2015, 09:38:47 am
OP, what hellrazor said. 

Volutar, manufacturing items for sale is not a side effect in vanilla xcom.  The developers were definitely smart enough to know what people would do if the selling cost was significantly higher than the manufacturing cost.  If selling items wasn't meant to be a source of income, it would only be to clear items from your inventory.  In that case the developers would have either made the selling cost the same or very close to the manufacturing cost, or just have an option to give stuff the boot.  It may not be what you feel vanilla xcom is "about", but that is definitely the way it was intended to play.

P.S.  Are you the same Volutar who created MCDedit?  If so, I praise you!  You made my Tactical Lightning mod possible. :)
Title: Re: In-game manufacturing profitability view
Post by: volutar on March 27, 2015, 10:15:28 am
It may not be what you feel vanilla xcom is "about", but that is definitely the way it was intended to play.
Nope. It's not INTENDED to be played like that, but still it CAN be a helper. But paying too much of attention on "profit" would heavily bias the main purpose of the game.
There are dozens of game completion tactics, and that' why THIS one shouldn't be accented like "please use this". There shouldn't be helpers on that.
Quote
P.S.  Are you the same Volutar who created MCDedit?  If so, I praise you!  You made my Tactical Lightning mod possible. :)
Yes it's me. I was just rebuilt Kobalt's MCDView to be runnable under win64, and went slightly further. ;)
Title: Re: In-game manufacturing profitability view
Post by: yrizoud on March 27, 2015, 11:45:55 am
Since profitability is a constant that experienced players (of the game or MOD) don't need in everyday screen, I'd export it to the Ufopedia entry of the relevant item.
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on March 27, 2015, 11:49:44 am
I'm a supporter of a tool outside of the actual game.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 28, 2015, 05:52:45 am
I'm a supporter of a tool outside of the actual game.
yeah, it's starting to look like that's the best option.  Implementing it in game was certainly easiest since all the data (and UI) is there ready to go, but it could go into an external tool and have nice little widgets for tweaking variables.  I wonder if I implement it as a web page it could get included in the wiki (https://www.ufopaedia.org)...
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on March 28, 2015, 11:56:03 am
The Big Sot (I think) made such a tool, it's called Ruleset Viewer and one of its functions is exactly what this thread is about.

It is bundled with the new MapView.
Title: Re: In-game manufacturing profitability view
Post by: redv on March 28, 2015, 02:23:15 pm
Option, when the "sell" button replaced by monthly profit, looks good.
Obviously, if you set the units quantity to infinity, then you want to sell these stuff.
If you want to sell these stuff, then will be good to know something about profit.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 28, 2015, 10:31:07 pm
The Big Sot (I think) made such a tool, it's called Ruleset Viewer and one of its functions is exactly what this thread is about.
It is bundled with the new MapView.
Ah, good point.  I hadn't tried it since we fixed those syntax errors in the requirements lists in the FMP ruleset (which at that time prevented the manufacturing analysis from working).  Ok, so I'll clean up the code for the second version -- the one that adds the information to the sell button -- and leave the external tools to other people :).
Title: Re: In-game manufacturing profitability view
Post by: hellrazor on March 29, 2015, 12:01:00 am
Manufacturing items for sale is not what vanilla xcom about. Literally, it's just side effect of the "selling" feature of the game. AFAIK xcom2012 doen't have that at all. Hell, it's the game about fighting alien invasion, not getting billionaire.

Need more money to hire more personal and setup more bases. Sorry but for a big global game with a lot of bases selling Laser Canons is a must!
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 29, 2015, 03:32:44 am
Ok, so here's the next attempt.  All changes to the NewManufactureList page have been reverted.  Instead, I added two lines to the ManufactureInfo page to track remaining materials cost and net funds change per month.  These values change with the number of allocated engineers and the number of units to produce, so they are always useful, even if the player already knows which items are profitable.  The net value takes into account all the factors on the profitability wiki page and clamp appropriately if the number of items remaining to manufacture is less than the monthly capacity.  I opted to add the text lines instead of replacing the "SELL" text on the button so I could include an explanatory label (and so I could add both items instead of just one).  Also, it was difficult to read a numeric label on a toggle button since the colors get inverted when the button is in the on state. Thoughts?
Title: Re: In-game manufacturing profitability view
Post by: Arthanor on March 29, 2015, 05:46:09 pm
Looks great to me! I am a big fan of more information on the manufacturing pages.

If you want to look into more manufacturing stuff, adding the possibility to list produced items when there are more than 1 would be great, on the same screen where it lists the required items. That would be great for modded manufacture projects that produce more than one item.
Title: Re: In-game manufacturing profitability view
Post by: Jstank on March 29, 2015, 10:44:03 pm
Oh wow I really like that much better. Is there a way to select the denominator, like per unit, per day, per hour.

It would be neat to see the economy of scale factored in and see profitability change when you incorporate how much cost a month engineers have on the overall numbers as you add or subtract engineers. Now i want to see the graphs..... This would make it not as static as one criticism put it.

Something about the last two numbers don't make sense to my feeble brain. If you use 70 engineers to produce 100 shouldnt it output the same number as using 70 engineers to produce infinite? Unless 100 took more than a month?

Also does it take into account facility cost? If there is a monthly cost for running a workshop?

Oh god I'm getting to into this someone stop me.


Jstank
Title: Re: In-game manufacturing profitability view
Post by: redv on March 30, 2015, 12:54:54 am
What mean "Remaining materials cost"?
Title: Re: In-game manufacturing profitability view
Post by: kikimoristan on March 30, 2015, 12:56:20 am
i m into it
Title: Re: In-game manufacturing profitability view
Post by: kikimoristan on March 30, 2015, 12:57:40 am
would be interesting to make it so you somehow let computer autobattle and you just produce items /manage troops . there are a few games like that . is all gonna be just inside the base building things and random things going in and out depending on computer success rate with missions.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 30, 2015, 02:14:49 am
adding the possibility to list produced items when there are more than 1 would be great, on the same screen where it lists the required items.
I'll take a look at that once I get this wrapped up.

Is there a way to select the denominator, like per unit, per day, per hour.
There could be, but I fear it would clutter the UI.  The units are per month since that is how the finances in the rest of the game are measured, and is the most relevant to a player who is trying to figure out whether they will have enough money at the end of the month to cover expenses.

Quote
It would be neat to see the economy of scale factored in and see profitability change when you incorporate how much cost a month engineers have on the overall numbers as you add or subtract engineers. Now i want to see the graphs..... This would make it not as static as one criticism put it.
The numbers do change according to the number of engineers you have assigned, and you can see, for instance, the profit going from negative to positive as you cross the critical theshold for assigned engineers for the (profitable) item you are producing.

Quote
Something about the last two numbers don't make sense to my feeble brain. If you use 70 engineers to produce 100 shouldnt it output the same number as using 70 engineers to produce infinite? Unless 100 took more than a month?

Also does it take into account facility cost? If there is a monthly cost for running a workshop?
What mean "Remaining materials cost"?

The numbers would be the same if the number of units to produce were more than the number of engineers could produce in a month.  For example, if the 70 engineers were producing 1000 motion scanners, the profit number would equal the one where they are producing infinite scanners.

Here are the equations that make up the main business logic of this change:
Code: [Select]
remainingMaterialsCost = (manufactureCost + usedItemsValue) * (amountTotal - amountProduced)
manufactureCost: the number listed in the ruleset that you are charged per item produced.
usedItemsValue: the sale price of any other items required to manufacture this item (like alloys)
amountTotal: the number you specified to manufacture when you started the job
amountProduced: the number of items you've produced so far.  this will be 0 when you first create the job and non-zero when you look at a manufacturing job in progress

Code: [Select]
monthlyNetProfit = (saleValue - (manufactureCost + usedItemsValue)) * itemsPerMonth
    - (salaryCost + livingCost + workshopCost) * capacity
saleValue: the money you get from selling the item.  this is 0 if the "SELL" button is not toggled on
manufactureCost, usedItemsValue: same as above
itemsPerMonth: the number of items specified to produce in the job or the number of items the current number of assigned engineers can produce in one month, whichever is less
salaryCost: the salaries of the assigned engineers
livingCost: the maintenance cost of the living quarters for the assigned engineers
workshopCost: the maintenance cost of all the workshops
capacity: the percentage of one month this job will take.  this is 1 if the job will take one month or longer.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 30, 2015, 02:29:41 am
Adding a new post since the previous post was getting a bit long.

Looking over this, I wonder whether these are the right numbers to report.  Perhaps the real questions the numbers should answer are:
1) at the end of this job, what will be the change in my net worth?
2) during this job, what will be the rate of change of my net worth?

that is, make the numbers net-worth focused, not strictly funds focused.

perhaps the equations should be:
Code: [Select]
remainingNetWorthChange = (producedItemsValue - (manufactureCost + usedItemsValue)) * (amountTotal - amountProduced)

monthlyNetWorthChange = (producedItemsValue - (manufactureCost + usedItemsValue)) * itemsPerMonth
    - (salaryCost + livingCost + workshopCost) * capacity
The main difference being the use of producedItemsValue in the two equations, which is the combined sale value of all the produced items.

What do you guys think?  What is the question *you* would like answered on this page?
Title: Re: In-game manufacturing profitability view
Post by: redv on March 30, 2015, 02:30:17 am
Here are the equations that make up the main business logic of this change:
Code: [Select]
remainingMaterialsCost = (manufactureCost + usedItemsValue) * (amountTotal - amountProduced)
manufactureCost: the number listed in the ruleset that you are charged per item produced.
usedItemsValue: the sale price of any other items required to manufacture this item (like alloys)
amountTotal: the number you specified to manufacture when you started the job
amountProduced: the number of items you've produced so far.  this will be 0 when you first create the job and non-zero when you look at a manufacturing job in progress

Omg! Better to remove the "Remaining Materials Cost" from the screen.
Profit per month - it's all what need for player. :)
Title: Re: In-game manufacturing profitability view
Post by: DoxaLogos (JG) on March 30, 2015, 03:23:49 am
Agreed. I like the idea of this, but net worth relies on too many other assumptions about your finances that would have to be stable to be worthwhile.  All I care about is how much profit I would be generating.  Keep it simple and straightforward.
Title: Re: In-game manufacturing profitability view
Post by: Jstank on March 30, 2015, 04:14:19 am
Could you add the Agragate_Net_Profit for all ongoing base finances to your bottom line on the finances screen? That way it will add your production profits to your final budget total?
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 30, 2015, 05:39:38 am
Could you add the Agragate_Net_Profit for all ongoing base finances to your bottom line on the finances screen? That way it will add your production profits to your final budget total?
that might take some discussion -- changing what one of the chart lines means will undoubtedly cause confusion, but adding a new line might not be very useful.  Anyway, let me run the next version of the manufacturing screen by everyone.

Screen reduced by 15 pixels, net worth delta line removed.   I do think that line had some value (i.e. gives a reference for the opportunity cost of manufacturing a needed item), but I can definitely see how it can cause significant confusion, especially when net worth goes up but net funds go down (like when you manufacture a valuable item but are not selling it).
Title: Re: In-game manufacturing profitability view
Post by: redv on March 30, 2015, 01:13:36 pm
(https://openxcom.org/forum/index.php?action=dlattach;topic=3517.0;attach=14585;image)

Something wrong in formula.
Workshop - maintenance cost: $35,000/month;  50 units of space.
Motion Scanner - manufacturing price: $34,000; space required: 4.

Monthly cost: -35K * (4 / 50) - 34K = -36.8K
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 30, 2015, 02:16:21 pm
Monthly cost: -35K * (4 / 50) - 34K = -36.8K
This brings up a good point.  In order to calculate *manufacturing* profitability (as opposed to isolated *job* profitability), I don't scale the cost of the workshop maintenance to the amount of workshop space that is used.  This is because unlike living space, which is shared among other purposes, there is no other use for workshops.  Even if we're not using some workshop space, we're still paying for it, and it affects the calculation for monthly profit.  The profitability wiki page (https://www.ufopaedia.org/index.php?title=Manufacturing_Profitability) implicitly does the same thing since it assumes all manufacturing capacity is fully utilized.  If I scaled the workshop maintenance, it would give an unrealistically positive view of how much profit you'll be making per month.

in this case, in the initial state, you're paying for the workshop maintenance (35k * 2), but producing no items (engineers = 0), leading to an initial profit of -70K.

Here's the full algorithm for review:
Code: [Select]
int _totalLivingSpace, _totalLivingQuartersMaintenance, _totalWorkshopMaintenance, _producedItemsValue, _usedItemsValue;

void ManufactureInfoState::initProfitInfo ()
{
Ruleset *ruleset = _game->getRuleset();
const RuleManufacture *item = _production->getRules();

_totalLivingSpace               = 0;
_totalLivingQuartersMaintenance = 0;
_totalWorkshopMaintenance       = 0;
for (std::vector<BaseFacility *>::const_iterator i = _base->getFacilities()->begin(); i != _base->getFacilities()->end(); ++i)
{
if (0 != (*i)->getBuildTime())
{
https:// don't count unbuilt facilities
continue;
}

RuleBaseFacility *rbf = (*i)->getRules();
bool costAccountedFor = false;
if (rbf->getWorkshops())
{
_totalWorkshopMaintenance += rbf->getMonthlyCost();
costAccountedFor = true;
}

if (rbf->getPersonnel())
{
_totalLivingSpace += rbf->getPersonnel();
if (!costAccountedFor)
{
https:// don't count the cost twice for facilities that provide
https:// both workshops and living space
_totalLivingQuartersMaintenance += rbf->getMonthlyCost();
}
}
}

_producedItemsValue = 0;
for (std::map<std::string, int>::const_iterator i = item->getProducedItems().begin(); i != item->getProducedItems().end(); ++i)
{
int sellCost = 0;
if (item->getCategory() == "STR_CRAFT")
{
sellCost = ruleset->getCraft(i->first)->getSellCost();
}
else
{
sellCost = ruleset->getItem(i->first)->getSellCost();
}
_producedItemsValue += sellCost * i->second;
}

_usedItemsValue = 0;
for (std::map<std::string, int>::const_iterator i = item->getRequiredItems().begin(); i != item->getRequiredItems().end(); ++i)
{
_usedItemsValue += ruleset->getItem(i->first)->getSellCost() * i->second;
}
}

https:// algorithm based on profitability calculations done on
https:// https://www.ufopaedia.org/index.php?title=Manufacturing_Profitability
int ManufactureInfoState::getMonthlyNetProfit ()
{
Ruleset *ruleset = _game->getRuleset();
const RuleManufacture *item = _production->getRules();

static const int HOURS_PER_MONTH = 24 * 30;
int numEngineers = _production->getAssignedEngineers();
int manHoursPerMonth = HOURS_PER_MONTH * numEngineers;
float itemsPerMonth = (float)manHoursPerMonth / (float)item->getManufactureTime();

float percentUtilized = 1.0;
int itemsRemaining = _production->getAmountTotal() - _production->getAmountProduced();
if (!_production->getInfiniteAmount() && itemsPerMonth > itemsRemaining)
{
https:// less than one month's amount of work left; scale the costs accordingly
percentUtilized = itemsRemaining / itemsPerMonth;
itemsPerMonth = itemsRemaining;
}

int saleValue = _btnSell->getPressed() ? _producedItemsValue : 0;
int salaryCost = ruleset->getEngineerCost() * numEngineers;
int livingCost = (_totalLivingQuartersMaintenance * numEngineers) / _totalLivingSpace;

return (saleValue - (item->getManufactureCost() + _usedItemsValue)) * itemsPerMonth
- (salaryCost + livingCost + _totalWorkshopMaintenance) * percentUtilized;
}
Title: Re: In-game manufacturing profitability view
Post by: redv on March 30, 2015, 02:49:27 pm
In the profitability wiki page (https://www.ufopaedia.org/index.php?title=Manufacturing_Profitability) is assumed that entire workshop placed for manufacturing of the calculated item.
Moreover, assumed that this item will be manufactured whole month.

But this is not true in general case.
Title: Re: In-game manufacturing profitability view
Post by: redv on March 30, 2015, 03:21:38 pm
Fixed version:
Code: [Select]
int ManufactureInfoState::getMonthlyNetProfit()
{
static const int HOURS_PER_MONTH = 365 * 24 / 12; https:// Also you can use HOURS_PER_CURRENT_MONTH instead

const RuleManufacture *item = _production->getRules();
int numEngineers = _production->getAssignedEngineers();

https:// how many manHours will be consumed for this task per average month
int manHoursPerMonth = HOURS_PER_MONTH * numEngineers;
if (!_production->getInfiniteAmount())
{
int manHoursRemainig = item->getManufactureTime() * (_production->getAmountTotal() - _production->getAmountProduced());
manHoursPerMonth = std::min(manHoursPerMonth, manHoursRemainig);
}
https:// how many items will be manufactured in this month
float itemsPerMonth = (float)manHoursPerMonth / (float)item->getManufactureTime();
if (itemsPerMonth < 1.0f) itemsPerMonth = 1.0f;

https:// final calculation
int saleValue = _btnSell->getPressed() ? _producedItemsValue : 0;
int consumedValue = item->getManufactureCost() + _usedItemsValue;
int salaryCost = _game->getRuleset()->getEngineerCost() * numEngineers;
float livingCost = ((float)_totalLivingQuartersMaintenance * numEngineers) / _totalLivingSpace;
float workshopCost = ((float)_totalWorkshopMaintenance * (numEngineers + item->getRequiredSpace()) / _totalWorkshopSpace;

return (saleValue - consumedValue) * itemsPerMonth - (salaryCost + livingCost + workshopCost);
}

Upd: changed to _producedItemsValue
Title: Re: In-game manufacturing profitability view
Post by: pilot00 on March 30, 2015, 11:32:43 pm
Manufacturing items for sale is not what vanilla xcom about. Literally, it's just side effect of the "selling" feature of the game. AFAIK xcom2012 doen't have that at all. Hell, it's the game about fighting alien invasion, not getting billionaire.

I would have agreed if 2012 was not about surviving the first two months on a predetermined build path and then steam roll the game by giving you virtually limitless cash via the battleship dlc. 2012 did more mistakes than the original.

Nope. It's not INTENDED to be played like that, but still it CAN be a helper. But paying too much of attention on "profit" would heavily bias the main purpose of the game.

And who sais that? If you dont manage your income you cannot progress. By your reasoning you should not expand your operations either because lets face it, you dont need more income, merely do the missions till you have enough research to go the final...(according to your logic)

That said, the harder level settings do in fact necessitate a manufacturing base up to a point to speed up your base construction to cover the globe and the salaries of the science team. More so if you lose soldiers and therefore equipment left and right (which happens all the time). I remember many many runs where the only thing that kept me going was having a workshop base chucking out alien aloys (didnt knew that the laser cannon was the most cost effective back there) to keep my finances stable. Dont get 2012 as an example because 2012 is a textbook game with clear steps on what/when/and how to do it to win with things like finances and interceptions been there for no reason at all.

Title: Re: In-game manufacturing profitability view
Post by: volutar on March 31, 2015, 05:48:02 am
And who sais that?
Vanilla says that. There's no automatic selling, nor cheating "profitability".
Quote
If you dont manage your income you cannot progress.
If you can't progress, it's your problem and your failure. Game shouldn't help you to win. It's easy enough already. Most of people were completing this game without manufacturing-selling, just by selling the loot. If I remember correctly, Meridian doesn't do that.
"Autoselling" is cheating enough thing already.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 31, 2015, 09:47:28 am
Keep in mind that this is not just for manufacturing for profit.  It makes clear just how much money you are spending on manufacturing when you make anything at all.  So even if you regard manufacturing for profit as an invalid strategy, information that converts a job specification into a dollar amount is always useful.
Title: Re: In-game manufacturing profitability view
Post by: x60mmx on March 31, 2015, 10:29:25 am
Volutar, considering the fact that the game is easy for people experienced with X-Com, what harm is a purely optional tool for streamlining an aspect of the game?  It's not like people on the forum are using it to win, because they surely have already beaten the game many times over.  I can't say I'm interested in it, but some people are obviously into really working this angle of the game, let em have it.  If it were going to be a core feature implemented in Open X-Com I would be at the front of the picket line with you, but this is far less egregious than many of the OP item/craft mods available in terms of cheating or helping the player win.

I get your dislike for it, I don't care for it either.  I also do not think it deserves the venom.

Respectfully.  ;)
Title: Re: In-game manufacturing profitability view
Post by: myk002 on March 31, 2015, 10:49:36 am
@redv: I like your version of the algorithm -- very clean.  But what does the final number mean to the player?  What are they supposed to do with a value that is scaled by workshop utilization?  That number is not directly related to the actual change in funds the player will see due to manufacturing at the end of the month.

I think the the net change of funds due to all manufacturing-related costs and profits at the current base is what the player really needs to know.  Say you have one living quarters, one workshop, and 10 engineers and are manufacturing (infinite) motion scanners for sale.  In the scaled algorithm you have above, we'd show the profit as $123K.  However, the change in funds due to manufacturing at this base would really be $97K due to the unused workshop space.  Things get worse if you aren't actually allocating all your engineers, or have some engineers assigned to other projects.  If you have 50 engineers but only allocate 10 for this job, the scaled algorithm would still calculate $123K but the actual change in funds at the end of the month (due to manufacturing) would be -$910K!  I think it is important to consider *all* manufacturing resources and liabilities at the base when calculating profit since it really does affect the final result.

I'm willing to be convinced otherwise if people think differently, but don't you want to know whether your actual funds value will increase?
Title: Re: In-game manufacturing profitability view
Post by: pilot00 on March 31, 2015, 01:00:55 pm
Vanilla says that. There's no automatic selling, nor cheating "profitability".If you can't progress, it's your problem and your failure. Game shouldn't help you to win. It's easy enough already. Most of people were completing this game without manufacturing-selling, just by selling the loot. If I remember correctly, Meridian doesn't do that.
"Autoselling" is cheating enough thing already.


And what does a players prefered strategy have to do with how the game is supposed to be played? If I wanted a boxed up game without alternatives id be playing the 2012 version, not sitting here 20 years after playing the original.

Just because there is not a UI button that makes an already (in vanilla) existing action simpler, not easier, simpler, it means that the original doesnt support said function and that the game is easier now....Sorry mate your logic is at fault here. Manufacturing bases have been around x-com since the games release for this exact purpose. How is this not supported?

Whats the difference between having to press the button and do it automatically, than having to do the process of manufacture and sell manually 1 million times?If I want to do it ill do it, the button existing or not is not gonna stop me. And since the game does allow me to do it with or without the button yes it is a supported action and no its not cheating. If they wanted this behaviour out of the game, they would make everything to not generate profit from manufacturing.

If you can't progress, it's your problem and your failure. Game shouldn't help you to win. It's easy enough already. Most of people were completing this game without manufacturing-selling, just by selling the loot. If I remember correctly, Meridian doesn't do that.
"Autoselling" is cheating enough thing already.


It doesnt help you win, but it gives you the avenue to take different paths. Thats what mass production in the game is about. In all three X-Coms actually. Just because people complete in X way it doesnt mean that completing it in Y way is cheating. Especially when the tools to do so are there and established by the developer. Hell people completed the game with alloy armor rifles and explosives only, should using anything else be considered cheating too?

 I think your thinking is a bit one dimensional   ;)
Title: Re: In-game manufacturing profitability view
Post by: redv on March 31, 2015, 01:26:19 pm
@redv: I like your version of the algorithm -- very clean.  But what does the final number mean to the player?  What are they supposed to do with a value that is scaled by workshop utilization?  That number is not directly related to the actual change in funds the player will see due to manufacturing at the end of the month.

I think the the net change of funds due to all manufacturing-related costs and profits at the current base is what the player really needs to know.  Say you have one living quarters, one workshop, and 10 engineers and are manufacturing (infinite) motion scanners for sale.  In the scaled algorithm you have above, we'd show the profit as $123K.  However, the change in funds due to manufacturing at this base would really be $97K due to the unused workshop space.  Things get worse if you aren't actually allocating all your engineers, or have some engineers assigned to other projects.  If you have 50 engineers but only allocate 10 for this job, the scaled algorithm would still calculate $123K but the actual change in funds at the end of the month (due to manufacturing) would be -$910K!  I think it is important to consider *all* manufacturing resources and liabilities at the base when calculating profit since it really does affect the final result.

thanks @myk002
This algorithm calculates profit for this and only for this production task per average month. Therefore takes into account only resources given for this task. Nothing more.
May be i have 1 workshop, may be 10. May be i use all space in workshops, may be the space is wasted. May be executed another production tasks on this base, may be not. May be assigned all engineers, may be engineers are idle.

Who knows? In all cases this algorithm always will be calculate the same profit for this particular task and for this resources.

You want take into account free space in the workshops.
OK. But why not take into account idle engineers, idle soldiers, feree space in research labs and stores, hangars.
Why not? These factors influence on profit per month too. ;)
Title: Re: In-game manufacturing profitability view
Post by: redv on March 31, 2015, 04:46:30 pm
Another example.
What if i start 2, 3, 4 production tasks with 0 assigned engineers. In this case will be many free space in workshops.

(https://openxcom.org/forum/index.php?action=dlattach;topic=3517.0;attach=14585;image)

Question is, how many times you will count the same free space for all tasks?
Title: Re: In-game manufacturing profitability view
Post by: Jstank on March 31, 2015, 05:09:49 pm
Maybe I used the wrong language. I wasn't referring to net worth but only projected net liquid assets.

I agree it would be pretty unstable since your always changing around your production cues. But it might just give you an estimate of your end of month balance assuming you don't change your production.
Title: Re: In-game manufacturing profitability view
Post by: volutar on March 31, 2015, 11:08:44 pm
I think your thinking is a bit one dimensional   ;)
You may think as you want. You also may pervert OpenXcom as you like, by forking and changing it the way your imagination wants.
"Autoselling" button is making life easier already, but making whole new stat screen, with number of consumed resources in a month (including money), is too much.

I would insist on keeping this screen clear from additional data, because adding A, as consequence would need of adding B, and so on. You are free to add all you want in your own version.

And moreover, I would insist on removing manufacture categories from the "add" screen. Not just because it's "not vanilla", but because it clutters the screen, lessen the height of the scrollbox, and needed by rare players with modded game.
Title: Re: In-game manufacturing profitability view
Post by: pilot00 on April 01, 2015, 02:20:47 am
You may think as you want. You also may pervert OpenXcom as you like, by forking and changing it the way your imagination wants.
"A

Well now, I have been in forums for enough ages to recognise a lost cause of a civil and open minded discussion when I see things like the ones in the Italics. Believe what you will then but take note of one thing: This is not a crusade.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 01, 2015, 03:57:01 am
@redv: you're right about the cost being misleading when there are multiple jobs.  Hopefully this will address that concern.  I didn't include other base expenses in the number, though, since the idea here (faithful to the wiki article (https://www.ufopaedia.org/index.php?title=Manufacturing_Profitability)) is to figure out whether your *total manufacturing resources* are turning a profit.

I understand what you are trying to show with the algorithm you have, I just think we're trying to answer slightly different questions.  You're showing whether the *allocated* resources are turning a profit, and I'm showing whether the player's *investment* in manufacturing resources is turning a profit.

Here's a comparison between the two options.  The first screenshot shows a base that is manufacturing items for use -- that is, it's not selling them for profit (not that this particular item would be profitable anyway, but that's not the point.  it's just here to clarify the "all bases" line).  The next two screenshots compare redv's output and my proposed output for 0 allocated engineers, and the next two compare the output for the maximum number of engineers.

You can see that when all resources are allocated, the calculated value is the same for the two algorithms, but they differ more significantly as more workshop space is left empty.

I think both options are confusing for different reasons.  redv's option shows profit that may not actually result in funds at the end of the month.  My proposed option will give you the accurate funds change for the base due to manufacturing, but has to combine the calculations for all jobs at the base for the numbers to be consistent (that's why it's "this base" and not just "this job").
Title: Re: In-game manufacturing profitability view
Post by: redv on April 01, 2015, 05:51:04 am
+8K :D good catch!

(https://openxcom.org/forum/index.php?action=dlattach;topic=3517.0;attach=14617;image)

Yes, the algorithm has a bug.
Because resources consumed always before the beginning of production.
And because often possible situation when this production task cannot be finished in one month.

Fixed fixed variant:
Code: [Select]
int ManufactureInfoState::getMonthlyNetProfit()
{
const int HOURS_PER_MONTH = 365 * 24 / 12; https:// Also you can use HOURS_PER_CURRENT_MONTH instead

const RuleManufacture *item = _production->getRules();
int numEngineers = _production->getAssignedEngineers();

https:// how many manHours will be consumed for this task per average month
int manHoursPerMonth = HOURS_PER_MONTH * numEngineers;
if (!_production->getInfiniteAmount())
{
int manHoursRemainig = item->getManufactureTime() * (_production->getAmountTotal() - _production->getAmountProduced());
manHoursPerMonth = std::min(manHoursPerMonth, manHoursRemainig);
}
https:// how many items will be manufactured in this month
float itemsPerMonth = (float)manHoursPerMonth / (float)item->getManufactureTime();
https:// for how many items will be consumed resources in this month
https:// (because resources consumed always before the beginning of production;
https://  and because possible situation when production task cannot be finished in one month)
float consumedPerMonth = itemsPerMonth;
if (manHoursPerMonth == HOURS_PER_MONTH * numEngineers)
{
consumedPerMonth += 1.0f;
}

https:// final calculation
int saleValue = _btnSell->getPressed() ? _producedItemsValue : 0;
int consumedValue = item->getManufactureCost() + _usedItemsValue;
int salaryCost = _game->getRuleset()->getEngineerCost() * numEngineers;
float livingCost = ((float)_totalLivingQuartersMaintenance * numEngineers) / _totalLivingSpace;
float workshopCost = ((float)_totalWorkshopMaintenance * (numEngineers + item->getRequiredSpace()) / _totalWorkshopSpace;

return saleValue * itemsPerMonth - consumedValue * consumedPerMonth - (salaryCost + livingCost + workshopCost);
}
Title: Re: In-game manufacturing profitability view
Post by: redv on April 01, 2015, 06:22:11 am
We talk about different things.
I talk about profit for current active production task.
You talk about overall profit on the base.

OK
But maybe info about overall profit on the base  better send to the Base Information->Monthly Cost screen?
For calculation of the Base maintenance.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 01, 2015, 07:04:45 am
I'd be interested in hearing opinions from more people out there: what information would you like to see on this screen?
Title: Re: In-game manufacturing profitability view
Post by: Ridаn on April 01, 2015, 10:51:30 am
I would rather have just a straight profit by month (or even hour), not modified by engineer and workshop maintenance and material costs, and not affected by any occupied/nonoccupied space.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 01, 2015, 09:09:22 pm
I'll mock that up too and put it up for comparison.

Edit: but if you're calculating profits, ignoring maintenance factors (which, granted, are already accounted for on the finances graph), wouldn't you want to include the usedItems cost?  They represent lost "profits" from manufacturing.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 01, 2015, 11:44:39 pm
I'm actually in favor of this latest suggestion.  It contains the fewest variables, and therefore has the least danger of confusion.  This number is useful since it can be compared directly to the maintenance line on the finance graph.  I might look into adding a line there too so total aggregates can be compared, but this is a good first step.

int profit = (saleValue - consumedValue) * itemsPerMonth;
Title: Re: In-game manufacturing profitability view
Post by: Ridаn on April 02, 2015, 12:07:03 am
Looking good enough for me :)

For me usedItems cost isnt really that important, if it is elerium (or elerium equivalent) - its market price is quite undervalued, and if its alien alloys than I`m not sure what value should be used - a market one or "to manufacture" one.

So its getting complicated, and I have to put some thought into it. But I just wanted to get information at a glance. :)

And overall you rarely would be able to produce merchandise that requires rare components for a whole month (and you usually dont want to sell those things either).
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 02, 2015, 08:14:42 pm
For me usedItems cost isnt really that important
good point -- it only factors into net worth, not (directly) into the change in monthly funds, which we're trying to highlight here.  I'll clean up the algorithm, do one more set of screenshots, and get ready to submit the pull request.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 03, 2015, 05:03:44 am
Ok, final set of screen shots.  Equation is:
   (saleValue - manufactureCost) * itemsPerMonth
where saleValue is the funds you get from selling the item, or 0 if you are not selling.
Title: Re: In-game manufacturing profitability view
Post by: Jstank on April 03, 2015, 07:06:24 am
Pack it up!
Title: Re: In-game manufacturing profitability view
Post by: hszp on April 03, 2015, 09:22:54 am
Nice!
Title: Re: In-game manufacturing profitability view
Post by: volutar on April 03, 2015, 01:54:55 pm
I agree, this kind of modification is pretty delicate (just single line), doesn't clutter screen (as initial proposal) and still pretty useful.
Title: Re: In-game manufacturing profitability view
Post by: kikimoristan on April 03, 2015, 05:01:47 pm
I'm with the profitability option in manufacturing  showing how much per month  you can make  pretty simple and effective
Title: Re: In-game manufacturing profitability view
Post by: ivandogovich on April 03, 2015, 05:21:05 pm
any chance this will make it into a Nightly soon? ;)
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 03, 2015, 05:56:41 pm
I submitted the pull request: https://github.com/SupSuper/OpenXcom/pull/997
It's up to the committers now : )
Title: Re: In-game manufacturing profitability view
Post by: Ridаn on April 04, 2015, 12:21:45 pm
Sorry for a late reply, but does it display just straight up millions (+$7M), or decimal fractures too (not sure whats the term, probably sounds stupid :) ), like +$7.4M$ or even +$7.44M?
I think it would be useful for easy comparsion of items which are very close profit-wise, and it looks like there is a space for that too.
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 04, 2015, 04:09:30 pm
Sorry for a late reply, but does it display just straight up millions (+$7M), or decimal fractures too (not sure whats the term, probably sounds stupid :) ), like +$7.4M$ or even +$7.44M?
It could, and the PR hasn't been accepted yet, so it' s not too late.  The code currently intentionally simplifies the number to avoid cluttering the UI and to avoid locale formatting concerns.  When I wrote it, I felt the simplified number was appropriate since the numbers on the finance graph aren't exact anyway.  I do like your example though -- precise to two or three significant digits regardless of how many significant digits there are to the left of the decimal point.  I'll have to look into locale formatting, though.  In some locales that would be "+$7,44M".

Edit:  it looks like the locale bits there could get complicated.  I'll keep this pull request as it is (simple and easy to review) and see if I can look into adding the decimal point a bit later.
Title: Re: In-game manufacturing profitability view
Post by: Dioxine on April 06, 2015, 06:39:04 pm
I'm against it, for 2 reasons, both of which were already mentioned here, btw:

1. Uselessness
Why do I need to all the time see something which I need to see only once and then forget about it? "OK, I'm playing XCom first time. Looks like Laser Cannons have the highest profit ratio". Case closed. I won't ever need to see this info again. I won't ever need to check comparisons again, like ex. Avalanche vs. Stingray as there is a single best item and that's it.

2. Wrong emphasis
This game isn't an economic manager. Pushing such info into player's face makes it one. There is no such thing as pure information: each menu item conveys a message. Here the message would be: "Making profit on manufacturing is one of key aspects of this game". It is not a good message. The place for such info is in the Ufopaedia, if anywhere (all you'd need is to slightly modify entries for Laser Cannon & Motion Scanner or whatever sells best).
Title: Re: In-game manufacturing profitability view
Post by: ivandogovich on April 06, 2015, 08:49:29 pm
On the other hand... there are enough total conversions (like PirateZ) that it may be difficult to automatically know what is profitable or not.  I have spreadsheeted a few items by manually crawling the .rul and it is painful, that I can attest.  I would very much like to have this functionality in the game for specifically this reason. ;)
Title: Re: In-game manufacturing profitability view
Post by: yrizoud on April 06, 2015, 09:26:17 pm
Xeno Operations mod solve the issue very nicely by providing dedicated manufacturing topics "Defense Contract Work", then "Laser Weapon Defense Contacts" which gets unlocked at the same time as Laser cannons.
Title: Re: In-game manufacturing profitability view
Post by: Dioxine on April 06, 2015, 09:26:46 pm
On the other hand... there are enough total conversions (like PirateZ) that it may be difficult to automatically know what is profitable or not.  I have spreadsheeted a few items by manually crawling the .rul and it is painful, that I can attest.  I would very much like to have this functionality in the game for specifically this reason. ;)

Grog, $16 per workerhour, Rum, $24 per workerhour, Counterfeit Money, around $32/workerhour net earnings when workshop's at full capacity. See? Case closed :) Compund items, like craft, could be even more profitable, but will such module track all components to their basic costs? Even these that in turn are made from their own components? :) What would be cool, however, is some out-of game tool for making these calculations (or in-game, but only accessible from options menu or sth, or for expanded hi-res GUI).
Title: Re: In-game manufacturing profitability view
Post by: Jstank on April 07, 2015, 02:52:33 am
Couldn't you just pre calculate it and throw it into the UFO Pedia entry?
Title: Re: In-game manufacturing profitability view
Post by: myk002 on April 07, 2015, 03:35:21 am
Grog, $16 per workerhour, Rum, $24 per workerhour, Counterfeit Money, around $32/workerhour net earnings when workshop's at full capacity. See? Case closed :) Compund items, like craft, could be even more profitable, but will such module track all components to their basic costs? Even these that in turn are made from their own components?
We discussed what the calculation should be earlier in this thread.  Originally I did have the number tracking used materials and facility maintenance costs, but we decided it was much clearer and simpler to just answer the question "how much will my available funds change per month if I assign this many engineers to make this many items."  It gives you information regardless of whether you're selling.  I.e. it will tell you how much your funds will change if you manufacture items for use as well.  You can compare the number you see here to the difference between your income and expenditure graph lines to figure out how easily you can afford to make something.  No, not absolutely required, but not useless either.
Title: Re: In-game manufacturing profitability view
Post by: ivandogovich on May 07, 2015, 03:42:54 am
I finally fought with VS2010 for two nights to set myself up to compile my own executables.  This PR was at the top of the list of features that motivated me to do this.  Thanks for putting this together, myk002!  Its a great feature and I really enjoy it!
Title: Re: In-game manufacturing profitability view
Post by: Arthanor on May 07, 2015, 04:41:20 am
Hum.. looks like I need to research that rum distillation process. The info is there, sure, but it can be quite painful to obtain (am I really to trawl through Piratez.rul to find what is most profitable? That's one big ruleset!) when that pain could easily be avoided.

I would agree that the extra info would be welcome and useful. If included in the options, and turned off by default, then there is no message problem: A new user would likely keep the defaults (unless they care and then they would just go to a website like ufopaedia to find the answer) and advanced users are beyond the "message". They already know the game and what they want out of it.

I'll have to look into how to pull different pull requests and add them to my repo before compiling next time..
Title: Re: In-game manufacturing profitability view
Post by: Arthanor on May 19, 2015, 04:29:14 pm
Well, I went and did it, I am now a happy user of this extra little bit of info!

On "issue" I am having though: If I have 60 runts producing rum, it tells me I'll make +$1M. If I have 30 runts, it is actually +$729K. So the rounding is "hiding" 458K from the report, which is almost 50% of the reported value! Similarly, I expect that with a few more runts, it would report +$2M when it is actually +1.5M$, which is a significant overestimate as well.

Would it be possible to display a few more decimals? always showing 3 significant digits, so +$1.XYM, would be great. If the decimal point is an issue (taking up a character?), then rounding at the first decimal would still be quite an improvement. Showing +$1.5M is still not exact (exact values would look ugly) but would be a whole lot more accurate already.
Title: Re: In-game manufacturing profitability view
Post by: Dioxine on May 19, 2015, 05:38:24 pm
After seeing this in work on Ivan's LP, I have to admit the way it's implemented is quite subtle, unlike what I've seen on the first screenshots. After deliberation I think it could be safely implemented in the main build, as a switchable option. Frankly speaking, the code base of these "little helpers" is increasing to a point where too many people have to compile their own .exes. Maybe it's time to move this one into the main branch as an optional feature (maybe along the flashing healthbar when you have Fatal Wounds, which is unobtrusive but IMMENSELY helpful).
Title: Re: In-game manufacturing profitability view
Post by: Arthanor on October 02, 2015, 02:45:52 pm
Well, this is pretty dead but I hope at least a few people still use it as it is a great little feature. As I mentioned above, one has to be aware that the report is rounded down, so "+$1M" could actually be hiding pretty much half of a profit of $1,999,999 or actually be a profit of $1M exactly. It is generally not a problem when manufacturing for up to +$1M, since thousands grow quickly and hundreds are largely irrelevant, but at that turning point of a million, you end up losing a lot of information. Am I producing for +$1.005M or +$1.8M?

So I bring you: My first code contribution to OpenXCom, albeit a tiny one that modifies something that modifies OpenXCom. As you can see in the screenshots below, if your profit is less than 10 thousands/millions/billions, the display will change from +$X to +$X.Y, so you have a bit better idea of what is happening. Like the original, numbers are rounded down, so if it displays +$1.2M, you could be making 1.2 or 1.299,999 millions, but tens of thousands aren't that big a deal here. This keeps the error of the estimate under 9%, instead of under 99%.

The changes are in the patch file. Just type "git am < Patch_MonthlyMfgProfit3.patch" in your git repository (or do whatever your git gui asks for to patch). It is not changing much, so you can also just go in the code to apply them yourself. Not that this modifies what Myk002 did and requires it. It is not a stand-alone feature.
Title: Re: In-game manufacturing profitability view
Post by: Boltgun on October 02, 2015, 05:41:02 pm
Seeing it only when you press the sell button is actually nice. I put grog on repeat in piratez but never bothered to calculate how much of the monthly cost it would fund me.
Title: Re: In-game manufacturing profitability view
Post by: Arthanor on October 02, 2015, 05:58:57 pm
It's on all the time, not just when you sell.

If you don't press the sell button, it tells you how much money you are losing to manufacturing cost. If you press the sell button, it tells you how much your funds will change, from total sell value - total manufacturing cost

Either way, it is quite convenient, as I have been taken aback sometimes by how fast my funds dropped from mass making guns or armors, even though I saw the unit prices when I ordered them.
Title: Re: In-game manufacturing profitability view
Post by: Cristao on December 22, 2015, 02:51:59 pm
I think I would prefer two things (i) straight up profit per item and (ii) length of time to manufacture info e.g. laser cannon: sale price - cost of manufacturing and how many manhours it requires. I can now calculate on my own how much profit i need to make.
Title: Re: In-game manufacturing profitability view
Post by: Arthanor on December 22, 2015, 06:58:08 pm
This gives you monthly profit only for infinite duration projects. If you don't click on infinite production, the profit given will be the total profit of the project given the number of items you selected. And the project length is already given once you have started the project.
Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 23, 2015, 02:58:19 pm
Manufacturing items for sale is not what vanilla xcom about. Literally, it's just side effect of the "selling" feature of the game. AFAIK xcom2012 doen't have that at all. Hell, it's the game about fighting alien invasion, not getting billionaire.
With respect, and recognizing that I'm putting in my two cents several months later, I disagree. One of the things that attracted me to this game 20 years ago was the economic model. If money isn't an obstacle, you buy every scientist, soldier, and weapon you can and wade in to the melee. But because of limited funding, it pays to consider how you can make your research pay off in more ways than just better weapons and armor for your soldiers. Is there anyone who has ever played this game and not wound up in a dead end where they built more than they could support?

On the other hand, in the original game (by my calculations) the Laser Cannon was easily the most profitable item in the game, so once you had researched it, winning was assured. All you had to do was not expand faster than you could produce and sell Laser Cannons.

One of Sun Tsu's maxims was, "Make war support war." May I suggest that an interesting possible extension would be adjusted sale prices based on previous sales? Once you have flooded the market with Laser Cannons, the sell price drops (but recovers over time without any sales) which allows the economic player a chance to manipulate supply and demand, as well as having to think about another profitable item to sell and support his forces.
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on December 23, 2015, 03:38:10 pm
With respect, and recognizing that I'm putting in my two cents several months later, I disagree. One of the things that attracted me to this game 20 years ago was the economic model. If money isn't an obstacle, you buy every scientist, soldier, and weapon you can and wade in to the melee. But because of limited funding, it pays to consider how you can make your research pay off in more ways than just better weapons and armor for your soldiers. Is there anyone who has ever played this game and not wound up in a dead end where they built more than they could support?

Yes, it never happened to me.

No, really, I'm not trying to oppose you on principle, but I can't remember a situation (in vanilla) where I would have financial problems later than the first two months or so. Even when I play pretty badly, I always have way more money than I can spend, no matter what I'm doing. So I agree that manufacturing for cash is pointless (well I do it anyway, but still).

One of Sun Tsu's maxims was, "Make war support war." May I suggest that an interesting possible extension would be adjusted sale prices based on previous sales? Once you have flooded the market with Laser Cannons, the sell price drops (but recovers over time without any sales) which allows the economic player a chance to manipulate supply and demand, as well as having to think about another profitable item to sell and support his forces.

That's how X-Com: Apocalypse works.
That would be nice, but then again, who is buying this stuff? I have my doubts if it'd even be subject to normal laws of economy. Dead aliens or Elerium engines would be extremely attractive to universities and corporations, but we can be pretty sure they don't get any or the secret would be out pretty soon. Hobbes has addressed this issue in his Unknown Menace novel, suggesting that the alien stuff is not as much sold as used as an insurance in dealings with a certain global group of interest that has pretty much unlimited money to throw at X-Com, or something along these lines. So I'm a bit torn on the market saturation idea.
Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 23, 2015, 04:36:45 pm
... but I can't remember a situation (in vanilla) where I would have financial problems later than the first two months or so.
Lucky you, but since you remember financial problems in the first two month, you at least understand the point.

That would be nice, but then again, who is buying this stuff?
I realize personal possession of military arms is almost unheard of outside of the United States (excepting places where only an idiot doesn't have an AK, like Afghanistan) but I think that if Laser Rifles and Laser Pistols were available for purchase, they'd be flying off the shelves.

The power supply for a UFO that can travel a bare minimum of 47 million miles from Mars to Earth (and that's only if the trip were made at the speed of light, and started at the exact moment the two planets were closest) and apparently without refueling or waste product, should easily be able to power a small city. Cruise and container ship lines would also be in competition.

Pharmaceutical companies would probably buy all the dead aliens you can sell, in hopes of finding a cure for death, or at least the common cold.

Alien Alloys might make cars which survive accidents better and preserve lives. They might make lighter aircraft, faster ships, and so on.

Need I go on?

On the other hand, OPEC would probably pay a lot to keep the engines off the market so they can sell their product. So this could be applied to your contention that some faceless corporation or government entity would keep them off the market. But there is still a saturation point. At the actual value of an Elerium engine, just how many can OPEC afford to buy? Is there no one associated with Xcom who is more interested in the good of the planet than in how much money OPEC offers him that he won't leak the news?

But I think this is beyond the topic of what makes the game fun to play. There is selling of items as a way to fund Xcom, and the model is so simplistic that a few minutes with a spreadsheet and you can be convinced that you sell all the Laser Cannons you can manufacture and forget about it. But that doesn't mean that a playable at least somewhat realistic economic model wouldn't add to the game.
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on December 23, 2015, 04:54:23 pm
Lucky you, but since you remember financial problems in the first two month, you at least understand the point.

Well... Yes and no, because in the beginning you don't have much to produce anyway, so the point is kinda moot.

I realize personal possession of military arms is almost unheard of outside of the United States (excepting places where only an idiot doesn't have an AK, like Afghanistan) but I think that if Laser Rifles and Laser Pistols were available for purchase, they'd be flying off the shelves.

The power supply for a UFO that can travel a bare minimum of 47 million miles (...)

*sigh* Have you read my post? I've already explained why exactly all of this is impossible if you want to maintain the alien war a secret.

Besides, even if the US was the only country with personal arms allowed, there are armies in almost every single country in the world, and they would profit much more from the clean, ammo-less, powerful hand weapons. So yes, there would be unimaginable demand for all alien and also X-Com tech, if it was on the market. But I assume it is not, because it's 1999 and everything is secret.
Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 23, 2015, 05:17:08 pm
Well... Yes and no, because in the beginning you don't have much to produce anyway, so the point is kinda moot.

*sigh* Have you read my post? I've already explained why exactly all of this is impossible if you want to maintain the alien war a secret.
Solarius, I don't appreciate the *sigh*. I don't think you would appreciate it if I did it to you.

I don't see where anything from the original Xcom suggests that the war is a PERMANENT secret. Yes, some governments will make secret pacts. Yes, the government would LIKE it kept secret as long as possible, so they don't have to answer impertinent questions. Even so, after the first alien terror mission, it would no longer be a secret. So I think you are quibbling.

We had cell phones and digital cameras in 1999. And even if we didn't, when a UFO lands and aliens start killing people, SOMEONE is going to take a shot with their ancient Brownie camera. That photo will go viral in about 2 seconds.

I've visited Roswell New Mexico. There are people who still believe that there was an alien landing there in 1951, 64 years ago. And that's with no evidence at all. Are you seriously suggesting that an alien landing in a major city and people killed by the dozens can be kept secret?

And I can't make anyone do anything about it, so I don't understand why you are being so defensive. I recognize that this will not be a mod, but will involve changing the basic code. So the question of if it will get done can only be answered by who will do it. OK, let's take it as a given that you want nothing to do with it. Does that mean it cannot be discussed? Does that mean no one else can take it on?

If you have complete veto over anything that is discussed on this board then I am wasting my time. I was hoping for the minimum response of, "That's interesting. I won't do it, but you are welcome to get after it." Because then at least I can discuss with people who are interested and perhaps come up with something that is playable, economically not unrealistic, and adds to the game.
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on December 23, 2015, 06:04:19 pm
Solarius, I don't appreciate the *sigh*. I don't think you would appreciate it if I did it to you.

Right, I wouldn't. Still, I feel justified seeing as I've explained beforehand that the alien war is being kept secret, yet it was ignored.

I don't see where anything from the original Xcom suggests that the war is a PERMANENT secret.

Well... It's not in the actual game, but to my knowledge it's been canon since forever that the war is secret, no matter how pointless it is. Every single X-Com continuity I know confirms this. Sure, you can have a personal version where the war is openly known about, with everything that entails (maybe up to nuclear war), but that would be atypical. (I'm not saying it's a bad idea, it's actually pretty awesome, but it's just different.)

We had cell phones and digital cameras in 1999. And even if we didn't, when a UFO lands and aliens start killing people, SOMEONE is going to take a shot with their ancient Brownie camera. That photo will go viral in about 2 seconds.

I've visited Roswell New Mexico. There are people who still believe that there was an alien landing there in 1951, 64 years ago. And that's with no evidence at all. Are you seriously suggesting that an alien landing in a major city and people killed by the dozens can be kept secret?

These are fair points. I guess it's not my role to explain it, but the people's who came up with it (but they probably didn't care so much, it's just a tactical game after all, not a novel). It's just kind of accepted that these things can be hushed somehow, using whatever nasty methods the Majestic 12 et consortes can use.

And I can't make anyone do anything about it, so I don't understand why you are being so defensive.

I am not being defensive. This is a conversation, maybe even a debate. We do it as entertainment and social interaction, at least I do, so why would I be defensive? And what would I be defensive about? It's not like I have some ideas and you criticize them, it's more the other way around.

I recognize that this will not be a mod, but will involve changing the basic code. So the question of if it will get done can only be answered by who will do it. OK, let's take it as a given that you want nothing to do with it. Does that mean it cannot be discussed? Does that mean no one else can take it on?

No, I forbid anyone to even think about it! Doing this will be punished in the name of the Moon! :P

Seriously, man. What?

If you have complete veto over anything that is discussed on this board then I am wasting my time. I was hoping for the minimum response of, "That's interesting. I won't do it, but you are welcome to get after it."

Now you're just insulting me, because it's obviously not what happened. Moreover, you did this while claiming that I insulted you, which is also untrue but whatever, I don't care. Not cool, man.

Because then at least I can discuss with people who are interested and perhaps come up with something that is playable, economically not unrealistic, and adds to the game.

*shrug* All I did was to point out that it was inconsistent with canon. And if you want to make a non-canon version of X-Com history, then sure, go ahead, that probably will be interesting, but maybe you should say clearly that you're making a non-canon game, so that it would be clear. Because it wasn't, so I assumed I should point out inconsistent stuff. I admit I should have thought that maybe you want an alternative history mod, but it just didn't occur to me.
Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 23, 2015, 06:53:42 pm
Right, I wouldn't. Still, I feel justified seeing as I've explained beforehand that the alien war is being kept secret, yet it was ignored.

Well... It's not in the actual game, but to my knowledge it's been canon since forever that the war is secret, no matter how pointless it is.

Now you're just insulting me, because it's obviously not what happened. Moreover, you did this while claiming that I insulted you, which is also untrue but whatever, I don't care. Not cool, man.
OK, we've managed to trade insults. You agreed you wouldn't like the *sigh* coming your way and I responded as I did because I took it the way you agreed you would take it. Can we stop now?

I had no idea there was any such thing as a "canon." Frankly, I had no idea there were other moding groups or bases. I don't really care about canon, especially when even you agree it's pointless. I'm interested in a fun game, and anything that makes it more fun is fair game. If there's anyone who thinks they have a copyright on it, they are welcome to slap me down. Doesn't seem likely since this "canon" wasn't part of the original game. But what do I know?

I bought the game in 1994 and have enjoyed it ever since. When I learned that OpenXcom existed, I just had to find out if it had gotten better. And it has gotten better, which doesn't mean it can't be improved further.

I don't have the slightest interest in creating an alternate canon. But if something can be added to the game to make the economic aspects more interesting than, "make and sell all the Laser Cannons you can", then maybe someone else will edit the canon. That's how OpenXcom came about, isn't it?

Title: Re: In-game manufacturing profitability view
Post by: mrxian on December 23, 2015, 07:52:49 pm
Well... Yes and no, because in the beginning you don't have much to produce anyway, so the point is kinda moot.

I usually try to invest in quite a bit of extra production capabilities, because why not?

I must admit, though, that by the time they paid off their initial costs, I don't need the money anymore. Setting up a proper manufacturing section in a radar base takes several months, after all.
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on December 24, 2015, 12:05:38 am
OK, we've managed to trade insults. You agreed you wouldn't like the *sigh* coming your way and I responded as I did because I took it the way you agreed you would take it. Can we stop now?

Yeah, just let it drop, please. I didn't want to engage in any sort of argument and still don't.

I had no idea there was any such thing as a "canon." Frankly, I had no idea there were other moding groups or bases. I don't really care about canon, especially when even you agree it's pointless. I'm interested in a fun game, and anything that makes it more fun is fair game. If there's anyone who thinks they have a copyright on it, they are welcome to slap me down. Doesn't seem likely since this "canon" wasn't part of the original game. But what do I know?

Please stop defending yourself from non-existent attacks, nobody says you can't or shouldn't or whatever. I've just stated how things are, not how they "should be", I'm not the fun police here. I'm just trying to clear things up, okay?

I bought the game in 1994 and have enjoyed it ever since. When I learned that OpenXcom existed, I just had to find out if it had gotten better. And it has gotten better, which doesn't mean it can't be improved further.

Sure, the OpenXCom Extended is the best example.

I don't have the slightest interest in creating an alternate canon. But if something can be added to the game to make the economic aspects more interesting than, "make and sell all the Laser Cannons you can", then maybe someone else will edit the canon. That's how OpenXcom came about, isn't it?

Yes, and practically every bigger mod has to tackle this somehow. I guess it started with Robin's Men in Black mod, which was later expanded by myself as part of the Final Mod Pack, and then Hobbes released his Redux which is mostly about this. And then there's the Piratez which has many references to the war in shadows, though they're mostly well-hidden.

I guess real "Alien War" would be a great alternative approach, I'd play that. It would probably require a lot of new mechanics though, like actions undertaken by governments, regular battles and so on. Well maybe not necessarily "require", but they would be cool, no? Because if it's a real war, let's have a real war! (Though not total war, the aliens don't want to destroy us - that much is said in the losing outro.)
Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 24, 2015, 02:22:11 am
I guess real "Alien War" would be a great alternative approach, I'd play that. It would probably require a lot of new mechanics though, like actions undertaken by governments, regular battles and so on. Well maybe not necessarily "require", but they would be cool, no? Because if it's a real war, let's have a real war! (Though not total war, the aliens don't want to destroy us - that much is said in the losing outro.)
I'm not up to that much of a mod. I was a C programmer through most of the late 70's to early 90's, but Carpal Tunnel Syndrome did me in. Since 1994, the only programming I have done has been in scripting languages, with the exception of teaching myself Python a few years ago. I know nothing at all about GIT, YAML, SDL, or even the "canon."

On the other hand, I've been thinking about "canon" since it is apparently important. Hang on while I write some fiction and see if we have something worth working on:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Faceless Government Bureaucrat: Now that you have your bases, we'd like you to build some equipment for the government, strictly on the QT. We'll pay you for them at the posted rate. Here's the list.

Xcom Commander: [scans the list] Great, we can make a lot of profit off Laser Cannons. You'll be getting about 1000 per month from now on.

FGB: What about the other items on the list?

CDR: Oh, that's on you. The Laser Cannon makes the most profit, so that's what we will make the most of. I need to run the bases.

FGB: We are paying you a stipend every month to run bases. You should build us what we want.

CDR: No, you are paying me to fight off the aliens and keep it quiet. Anything we need that exceeds the amount you give us we have to figure out how to get on our own.

FGB: But we don't need 12,000 Laser Cannons next year. We need maybe 1000 for the Presidential Guard. We need other items too, like the Mind Scanners so we can find out who learns about the alien invasion and wipe their memories.

CDR: Hey, I appreciate your problem, but the price list is yours. As long as you are paying the most for Laser Cannons, that's what you are going to get.

FGB: [Gawdammit! I thought the government had a monopoly on money-grubbing, rulebook quoting, feather-bedding, self-interested people!]
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Ok, so how should this be designed? What makes prices high? Newness and Scarcity. What makes prices low? Old technology and Oversupply. So how could this be implemented?

First, we need a base price level for each item that can be manufactured. Suggestion: Calculate how many engineers could work on something using a single workshop, producing as many of those something as possible for a month. Total up all the costs of production. Divide by the number of items produced in a month. Multiply by 1.2. That's your Base Sale Price for the item. It's fixed and never changed.

Second, the month research gives a new item to be produced and sold:
Current Sale Price = Base Sale Price * (3 + .2 * random number) 

Next each month the actual sale price of an item is recalculated as follows:
Current Sale Price = Current Sale Price * .95 * .95 for each time the item was sold during that month.

So what happens? A newly discovered item is worth a lot of money, but that price degrades by 5% each month, and by 5% more each time the item is sold. It will eventually drop below the value of other items which can be manufactured and sold.

Now, if you don't use economics, you can ignore it and nothing changes.
If you do use economics, you have to pay more attention, because you can't just make Laser Cannons and never worry about it. And because of the randomness, you can't depend on a spreadsheet to give you the quick answer.

Of course, it would be nice if there was an indicator on the production screen, perhaps writing the item in yellow when it's sale price is less than 130% of production cost, and red when it drops below production cost.

Well, it's an idea. And I don't think it would be difficult to code. I'll do it myself, although I'd appreciate it if someone could point me at the file(s) that need changes, so I don't have to go hunting.
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on December 24, 2015, 10:51:16 am
Sure, it'd be interesting. I can't really say much at this point, because I didn't have the time to think about it at all yet, but I'm sure this sort of mechanics would be good to have - not only for X-Com, but also other mods like the Piratez.
Title: Re: In-game manufacturing profitability view
Post by: yrizoud on December 24, 2015, 03:07:40 pm
My opinion on variable prices :
- The random variation (The one which doesn't reflect player's sales) could be applied once every month : This should be frequent enough to have an effect, without the player having to re-check prices every 3 days in case what he's building has suddenly dropped price without warning.
- The effect of player's sales should probably be applied on each unit (sell 1: 100$, sell 3: 100$+98$+97$), otherwise the player would be encouraged to hoard items and sell large amounts at a time.
- The items which can be bought could also have prices affected by player's demand. If the price of large rockets rises every time you buy one, you are rewarded if you adapt, rather than stick to all-rocket equipment.
- This could also apply to recruitment costs : This would create a situation of diminishing returns, where the more scientists you recruit, the more expensive it is to recruit more.
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on December 24, 2015, 03:19:16 pm
I usually try to invest in quite a bit of extra production capabilities, because why not?

I must admit, though, that by the time they paid off their initial costs, I don't need the money anymore. Setting up a proper manufacturing section in a radar base takes several months, after all.

Yeah, that's exactly my thought. Which is a bit of a shame, since the game could be a bit deeper with more financial management. But it's really hard to do; Piratez are built to present such a challenge, but it's completely different from the vanilla game.

- The random variation (The one which doesn't reflect player's sales) could be applied once every month: This should be frequent enough to have an effect, without the player having to re-check prices every 3 days in case what he's building has suddenly dropped price without warning.
- The effect of player's sales should probably be applied on each unit (sell 1: 100$, sell 3: 100$+98$+97$), otherwise the player would be encouraged to hoard items and sell large amounts at a time.
- The items which can be bought could also have prices affected by player's demand. If the price of large rockets rises every time you buy one, you are rewarded if you adapt, rather than stick to all-rocket equipment.
- This could also apply to recruitment costs: This would create a situation of diminishing returns, where the more scientists you recruit, the more expensive it is to recruit more.


Yeah, seems convincing to me. Not sure about the salaries though; I think it would make things overcomplicated. Salaries usually don't fluctuate like that, as opposed to material goods, and I have a strong feel it would be a headache. But I agree with your other points.
Title: Re: In-game manufacturing profitability view
Post by: yrizoud on December 24, 2015, 03:38:36 pm
About salaries, I mean only the initial hiring cost. It keeps things simple for the monthly costs, and still reflects the increasing difficulty of hiring rookie soldiers if you have a high "turnover".
Title: Re: In-game manufacturing profitability view
Post by: 7Saturn on December 24, 2015, 04:48:03 pm
Well, for one thing, it shouldn't get out of hand with pricing. Let's face it: If you wanna produce just one Avenger for each base (meaning 8 Avengers), you're gonna have a hard time doing that in decent time, if you have to pay horribly for 100 engineers. Or Research (which really is key in this game). With 50 scientists, it feels like taking forever, to get all the fancy (but necessary) stuff researched. If it doesn't cost double, to have 100 of them working for you, but, let's say, 10 times, it will get unfair really soon.

[Edit:] It's like with Dungeon Keeper. Every new imp costs 150 gold more, than the last one. If one get's killed, the price drops by 150 gold. However, it's getting quite expensive to actually get an increase in working capacity, once you reach a certain level. That can block you quite a lot. It's the question, if that would be an intention. At this point, it's not about money any more. As said before: Once you reach this level of development in Openxcom, you mostly don't need the production capacity to make money, any more. You simply sell that stuff, the aliens »leave behind« and produce what you need (Avengers, armor, Psi-amps, hwps, ...).
Title: Re: In-game manufacturing profitability view
Post by: yrizoud on December 24, 2015, 05:18:25 pm
I actually agree, the scale I had in mind is rather the first scientist costing -10% (compared to the theoric price), and the 150th costing +25%.
For soldiers, the scale can be harsher, to dissuade meat shield tactics. Dead soldiers can't be put back on the market, so the offer/demand system will make it more and more expensive to replace your casualties.
Title: Re: In-game manufacturing profitability view
Post by: Solarius Scorch on December 24, 2015, 05:25:35 pm
For soldiers, the scale can be harsher, to dissuade meat shield tactics. Dead soldiers can't be put back on the market, so the offer/demand system will make it more and more expensive to replace your casualties.

But what if you don't lose many soldiers, only increase their numbers? Having 8 bases, each one protected by a squad of at least 10 soldiers, means 80 soldiers at minimum, but in reality it's more like 120 for me. I'm not saying it shouldn't be expensive, but why would you pay more per soldier when you hire more of them?
Title: Re: In-game manufacturing profitability view
Post by: yrizoud on December 24, 2015, 05:45:10 pm
I don't find it irrealistic : The recruitment can be cheap at the very beginning when people volunteer to join XCOM, but when you need more people, it becomes more expensive to print the nice XCOM recruitment posters, locate possible candidates and get them to defect from their current engagement/job to work for you.
Title: Re: In-game manufacturing profitability view
Post by: Dioxine on December 24, 2015, 06:33:19 pm
I find it funny, these attempts to paint X-Com as something which is affected by free markets in the slightest... Especially since the project has all the cash it needs (as opposed to wants - resources are limited so the commander won't go completely crazy, also because that's how Western government organizations work). However, free markets can be fun for a modder... If someone programmed them, that is :)

Faceless Government Bureaucrat: Now that you have your bases, we'd like you to build some equipment for the government, strictly on the QT. We'll pay you for them at the posted rate. Here's the list.

Xcom Commander: [scans the list] Great, we can make a lot of profit off Laser Cannons. You'll be getting about 1000 per month from now on.

Implying they didn't want to get Laser Cannons in the first place... After all, this might be the most useful weapon in the x-com repertoire... (lasguns are cool, but you can't shoot at nuclear missiles or fighter jets with 'em; and Elerium stuff has little future, as it needs a rare resource). You really need to work on your paranoia, dude :)

First, we need a base price level for each item that can be manufactured. Suggestion: Calculate how many engineers could work on something using a single workshop, producing as many of those something as possible for a month. Total up all the costs of production. Divide by the number of items produced in a month. Multiply by 1.2. That's your Base Sale Price for the item. It's fixed and never changed.

Second, the month research gives a new item to be produced and sold:
Current Sale Price = Base Sale Price * (3 + .2 * random number) 

Next each month the actual sale price of an item is recalculated as follows:
Current Sale Price = Current Sale Price * .95 * .95 for each time the item was sold during that month.

So what happens? A newly discovered item is worth a lot of money, but that price degrades by 5% each month, and by 5% more each time the item is sold. It will eventually drop below the value of other items which can be manufactured and sold.

That's IPhoney economy. Loses value so you need to make a new model every year (here! buy! a new Laser Cannon i8 Cherry Cupcake! Totally not a cash grab!). An item could be risen in sell value through marketing, but marketing is a separate topic.
Marketing apart, goods with real value will always find buyers, so the price has to be dynamic (it drops if you're selling more than they're willing to buy, and goes up if your stock doesn't meet demand). NOT drop all the time.

- The effect of player's sales should probably be applied on each unit (sell 1: 100$, sell 3: 100$+98$+97$), otherwise the player would be encouraged to hoard items and sell large amounts at a time.

If we talk about real economy, that's precisely how you speculate. I think the limiting factor should be the capacity of the buyer; you cannot sell more than people are willing to buy (more bases = more simultaneous buyers?). So drop in price not on item-per-item basis, but on buyer-per-buyer basis. The price drops only when the word of big sales gets out, not immediately. Big-scale merchants always had huge storage capacity for precisely that purpose.
Title: Re: In-game manufacturing profitability view
Post by: Arthanor on December 24, 2015, 10:56:24 pm
If we look at things through offer and demand, it makes little sense for things to vary much.

XCom is tiny compared to the military of any country. It's demand on large rockets should have no bearing on their prices. I can't see a reason it would be particularly difficult to recruit scientists or engineers either. There should be a lot of people who would like to work with super secret alien tech. Soldiers.. that's a bit different since casualties can be high..

Similarly, demand for laser or plasma weapons, or tank like personal armor, especially in the context of an alien invasion, should be in very high demands and not really within the capacity of XCOM to overcome. Except maybe if you make thousands of plasma cannons.. but I bet that as an aircraft and tank weapon that doesn't need ammo, it'd be quite popular.

What might make more sense are random changes to the prices, to represent variations of the market globally instead of pretending that xcom is the main driver. But that's not really what the thread is about any ways. If you'd like varying prices, that's a great suggestion, in another topic where the details can be discussed...
Title: Re: In-game manufacturing profitability view
Post by: Dioxine on December 24, 2015, 11:27:48 pm
Soldiers.. that's a bit different since casualties can be high..

While I completely agree with your post, this gave me an idea. Why rookies' stats are so poor (and the salary rather modest)? Because they're not the elite - the risk is just too damn high for real pros, so you're basically hiring what comes through the door - either those with an obsession with killing aliens, or those who really want the cash (if you're lower class citizen, especially in a country like Philipines or Bulgaria, $20k/month (in 1999 dollars!) minus tax & insurance sounds really like something worth the risk...
Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 28, 2015, 06:48:18 pm
I am gratified that something I found interesting has generated so much discussion.

But someone has to do the work, so anything that is done has to be reasonable in terms of the effort required. That means that a full scale economically accurate pricing model is not appropriate. What is needed is something that is a reasonable simulation of real world economy that makes the game more fun and retains playability.

My opinion on variable prices :
- The random variation (The one which doesn't reflect player's sales) could be applied once every month : This should be frequent enough to have an effect, without the player having to re-check prices every 3 days in case what he's building has suddenly dropped price without warning.
- The effect of player's sales should probably be applied on each unit (sell 1: 100$, sell 3: 100$+98$+97$), otherwise the player would be encouraged to hoard items and sell large amounts at a time.

That's approximately what I intended. The price of an item would be set when the item is available to be produced. It would decline by 5% per month thereafter, plus 5% more in a month where any of the item had been sold. (In other words, there is no recalculation with every sale, but simply a boolean flag set which says the item was sold in that month.)

Let's consider an example. The Motion Scanner requires 4 spaces to build, plus 1 for every engineer working on them. 220 engineer hours are required to make a Motion Scanner. $34,000 in supplies are required per scanner.

How COULD we set a base cost for the scanner? Let's suppose a Manufacturing base which has 8 Workshops, 8 Living Quarters, and 200 Engineers. (Not that it can't have other things, but this is for establishing a base cost.)

With this setup, 196 Engineers could work on scanners at the same time. That gives you 141,120 Engineer hours per month. (720 hours * 196 Engineers.) At 220 hours per scanner, this group would make 641 scanners every month. That costs $34,000 * 641 or $21,794,000 for supplies plus $5,000,000 for engineer salaries, plus $360,000 maintenance on the Workshops and Living Quarters, or $27,154,000. Dividing that by 641 means it costs you an average of $42,362 to make a Motion Scanner.

Now, based on my earlier suggestion, in the month the Motion Scanner is available for manufacture, it's sale price is set at 3 times the base cost + a random value between 0 and .2 times the base cost. In this case, let's say that value is $130,000. Each month after that, the sale price drops by 5%, or $121,600, $115,500, $109,700, $104,300, $99,000 ... and so on (rounded to nearest 100.) If any Motion Scanners are sold in a month, and additional 5% is knocked off at the end of that month. (Which is unrealistic, but it make it easier to account for increasing supply and helps encourage the player to manufacture other things.) Even without sales, the price of a newly researched item to be produced would drop below production cost in 2 years. If you add in monthly sales, that would drop to a single year.

Hoarding would not be an issue because any sale, from 1 to 100000 is going to trigger an additional drop in price at the beginning of next month. Therefore if you sell whatever you are going to sell as soon as possible.

Why do this? First, it would mean that instead of initially having financial problems, but after a few months you have more than you can possibly spend, the opposite becomes true. A year after you can produce something, it's no longer a viable product for financing. Why? Because surely someone in the government, even with secrecy being a requirement, is going to want a piece of the money you are raking in and is going to set up production in a secret factory and cash in.

- The items which can be bought could also have prices affected by player's demand. If the price of large rockets rises every time you buy one, you are rewarded if you adapt, rather than stick to all-rocket equipment.

I think the purchase price represents the cost of items currently in use by the world's militaries. The effect on supply and demand of sending even hundreds of these items to XCom would be negligible compared to worldwide requirements.

-
The recruitment can be cheap at the very beginning when people volunteer to join XCOM, but when you need more people, it becomes more expensive to print the nice XCOM recruitment posters, locate possible candidates and get them to defect from their current engagement/job to work for you.

I find it funny, these attempts to paint X-Com as something which is affected by free markets in the slightest... Especially since the project has all the cash it needs (as opposed to wants - resources are limited so the commander won't go completely crazy, also because that's how Western government organizations work).

Solarius says that according to canon, the XCom operations and the existence of aliens is a secret. So no recruiting posters, and no free market, but that doesn't mean the XCom commander is an idiot. He needs funds beyond what is allocated to him by the 13 governments which are in the know. If he's not smart enough to build the most profitable item, then he's not smart enough to be the XCom commander.

Let's take an even simpler example. An Alloy Cannon takes 20 spaces to build plus 1 per engineer, and $95,000 in supplies, plus an Alien Alloy which is built at a loss. The sale price is $45,000, which means you lose $50,000 per cannon you build, not counting losses on quarters, workshops, and alien alloy. Just how many would you build?

Implying they didn't want to get Laser Cannons in the first place...

Au contraire, in the piece of fiction I wrote, the FGB said he wanted 1000 for the Presidential Guard, but didn't need 12,000 per year in perpetuity. But it does bring up an interesting point. SOMEONE in the 13 governments which fund XCom knows about the aliens, knows about the invasions, and wants everything hushed up. So no public sales. But what about these Faceless Government Bureaucrats? Do you think they don't want their personal asses protected? With each and every item that XCom can produce, the FGBs are going to want anywhere from a few to several hundred for their personal guard forces. In the immortal words of Rosie O'Donnell, "No one should have a gun, but I am a celebrity and I need protection."

Basically, what I am suggesting is there is no free market, no recruiting posters, no competition for new technology, but there still is a semi-free black market for these same items, and such a market makes more sense for the limited quantity of items which XCom can produce.


Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 28, 2015, 07:16:05 pm
What might make more sense are random changes to the prices, to represent variations of the market globally instead of pretending that xcom is the main driver. But that's not really what the thread is about any ways. If you'd like varying prices, that's a great suggestion, in another topic where the details can be discussed...

It would be possible to have some kind of variable pricing that's not too difficult to program and make some kind of sense within the XCom world. Again, because the alien invasion is a big secret, accounting for the entire world isn't necessary, and makes XCom's effect on pricing more reasonable.

I would suggest a Monthly Support Level for each product. If that level or more are produced and sold, the price goes down faster. If less than the support level are sold, the price goes up, or at least down slower.

Calculating a support level would be a guess based on how many would the FGBs want per month. Their personal guard forces can't be too large, but more than just the FGBs need protecting. The FGBs have to know that aliens will try to make deals, or assassinate opposing FGBs, or kidnap relatives of the FGBs, or otherwise blackmail them into cooperation. Items do break and no FGB in the know is going to accept, "We just broke the last Laser Cannon, so we can't protect you against being kidnapped." FGB houses, the private schools their children go to, their favorite golf course, and so on have to be protected discretely. 

Given that the whole thing is a big secret, almost anything produced by XCom would have to have a built in self destruct. If FGBs guard is questioned by the police, he would flip a switch and his laser rifle melts to slag, which is still better than the police getting their hands on a functional laser rifle. And the support level for ammunition is a lot higher. The FGB will want his guard force to be very proficient and this requires expending ammunition for practice. So there will be items expended at least monthly.

Monthly support level for Motion Scanners = 39 ?
Monthly support level for Laser Rifles = 260 ?
Monthly support level for Alloy Cannon Ammunition = 10,000 ?
... and so on.
Title: Re: In-game manufacturing profitability view
Post by: DeltaEpsilon on December 28, 2015, 11:54:04 pm
I must remind everyone here.
UFO: EU does not care about extra hours. It's a problem caused by truncating floating part in a number.

Quote
With this setup, 196 Engineers could work on scanners at the same time. That gives you 141,120 Engineer hours per month. (720 hours * 196 Engineers.) At 220 hours per scanner, this group would make 641 scanners every month. That costs $34,000 * 641 or $21,794,000 for supplies plus $5,000,000 for engineer salaries, plus $360,000 maintenance on the Workshops and Living Quarters, or $27,154,000. Dividing that by 641 means it costs you an average of $42,362 to make a Motion Scanner.
Unfortunately these engineers will only be able to produce only 360 motion scanner. Why? Because 196 engineers is less than 220 and that means you'll need 2 hours to produce one motion scanner.
This is one specific reason here (https://openxcom.org/forum/index.php/topic,4194.msg56922.html#new) because of which I used simulation instead of direct calculation.
In short: the most profitable thing is to assign a divisor of man hours needed of engineers. In this case the most profitable is 110 engineers, not 196 and thus 3 and 3 living quarters and workshops. Until you get 220 engineers, assigning more to that project is a waste.
Title: Re: In-game manufacturing profitability view
Post by: Dioxine on December 29, 2015, 08:56:39 am
I must remind everyone here.
UFO: EU does not care about extra hours. It's a problem caused by truncating floating part in a number.

True but the 'TFTD manufacturing formula' is freely available as an option and most people turn it on for sheer convenience (however, in that particular case, the formula indeed changes nothing - it only comes into play when you have more engineers than required workhours to produced a single item, so 440 engineers would be able to make 2 scanners/hour). Hmm, this gives me another idea - maybe there should be an option to add 'maxSpace' requirement for an item production (max number of engineers/project allowed). Probably an option fo Extended.
Title: Re: In-game manufacturing profitability view
Post by: DeltaEpsilon on December 29, 2015, 09:58:58 am
Quote
however, in that particular case, the formula indeed changes nothing - it only comes into play when you have more engineers than required workhours to produced a single item, so 440 engineers would be able to make 2 scanners/hour
Incorrect. It changes many things.
As I said before - extra hours are wasted

Here's what's happening.
Imagine we have 196 engineers assigned on 220 hours project.
First hour: 196 / 220 done
Second hour: 392 / 220. If you play without TFTD rules, there will be created exactly one item and the timer will revert back to 0 / 220. Therefore you are wasting 172 extra hours. I need not remind you that's a lot. If you DO play with TFTD rules, the timer will revert to 172 / 220 as it is supposed to be.

Therefore you need to waste no hours (therefore engineers) and in order to do that you should only assign a divisor of man hours on a project.
Divisors of 220 are: 220, 110, 55, 44, 22, 20, 11, 10, 5, 4, 2, 1. That will ensure you'll get exactly one item in 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110, 220 hours respectively without losing hours. Since the game is discrete you must do that.
Title: Re: In-game manufacturing profitability view
Post by: Dioxine on December 29, 2015, 11:43:30 am
Oh, so that's how TFTD formula works. So it actually helps a lot and if you're producing in bulk, losses in manhours should be minimal, regardless of the number of engineers (on the last item only); certainly not a constant 40% efficiency drop like in your example. I see that as a straight improvement and there is little point in not enabling this option.
Title: Re: In-game manufacturing profitability view
Post by: DeltaEpsilon on December 29, 2015, 07:32:01 pm
Yes, but in this case the only thing left which matters is ratio between profit and man-hours. Salaries, maintenance all come to background. If something is profitable with one engineer - it will always be profitable however you setup your base.
Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 30, 2015, 02:41:17 am
I must remind everyone here.
UFO: EU does not care about extra hours. It's a problem caused by truncating floating part in a number.
Unfortunately these engineers will only be able to produce only 360 motion scanner. Why? Because 196 engineers is less than 220 and that means you'll need 2 hours to produce one motion scanner.
This is one specific reason here (https://openxcom.org/forum/index.php/topic,4194.msg56922.html#new) because of which I used simulation instead of direct calculation.
In short: the most profitable thing is to assign a divisor of man hours needed of engineers. In this case the most profitable is 110 engineers, not 196 and thus 3 and 3 living quarters and workshops. Until you get 220 engineers, assigning more to that project is a waste.

I read the post you linked to, and downloaded your excellent tools. And while I am playing from an XCom: UFO Defense base and have never seen this issue, that doesn't mean it shouldn't be looked into. The first obvious choice is to turn on TFTD economics. But an alternative is to just do a recalculation based on smaller number of engineers.

The Motion Scanner requires 4 spaces to build, plus 1 for every engineer working on them. 220 engineer hours are required to make a Motion Scanner. $34,000 in supplies are required per scanner.

Let's consider 1 Workshop, 1 Living Quarters, and 50 Engineers. 46 Engineers could work on scanners at the same time. That gives you 33,120 Engineer hours per month. At 220 hours per scanner, this group would make 150 scanners every month. That costs $34,000 * 150 or $5,100,000 for supplies plus $1,250,000 for engineer salaries, plus $45,000 maintenance on the Workshop and Living Quarters, or $6,395,000. Dividing that by 150 means it costs you an average of $42,633 to make a Motion Scanner. This isn't a whole lot larger than the earlier calculation. There is, of course, some loss due to math issues, but less than when having 196 engineers working. (After the 5th hour, 230 engineer hours were used, and 10 of those were wasted.)

Title: Re: In-game manufacturing profitability view
Post by: DeltaEpsilon on December 30, 2015, 11:53:12 am
Quote
But an alternative is to just do a recalculation based on smaller number of engineers.
Yeah, well, that's natural. If you perform const / X, result becomes less and less different from last as you increase X.

Quote
Let's consider 1 Workshop, 1 Living Quarters, and 50 Engineers. 46 Engineers could work on scanners at the same time. That gives you 33,120 Engineer hours per month. At 220 hours per scanner, this group would make 150 scanners every month. That costs $34,000 * 150 or $5,100,000 for supplies plus $1,250,000 for engineer salaries, plus $45,000 maintenance on the Workshop and Living Quarters, or $6,395,000. Dividing that by 150 means it costs you an average of $42,633 to make a Motion Scanner. This isn't a whole lot larger than the earlier calculation. There is, of course, some loss due to math issues, but less than when having 196 engineers working. (After the 5th hour, 230 engineer hours were used, and 10 of those were wasted.)
Quote
would make 150 scanners every month
Your calculations are not done properly. If you want to account for wasted hours, you are going to do this:
Product_made = max(floor(720 / (ceil(man_hours/engineers_assigned))), 1)
Floor - rounding to zero (5.4 ==> 5)
Ceil   - rounding to one  (5.1 ==> 6)
Max  - maximum, duh. (0.5, 1 ==> 1)
720  - amount of hours in an average month (24 * 30). It's 744 in case of 31 day month.
Title: Re: In-game manufacturing profitability view
Post by: Leprechaun on December 30, 2015, 02:26:22 pm
Your calculations are not done properly. If you want to account for wasted hours, you are going to do this:
Product_made = max(floor(720 / (ceil(man_hours/engineers_assigned))), 1)
Floor - rounding to zero (5.4 ==> 5)
Ceil   - rounding to one  (5.1 ==> 6)
Max  - maximum, duh. (0.5, 1 ==> 1)
720  - amount of hours in an average month (24 * 30). It's 744 in case of 31 day month.
I'm not sure just how your calculations produce a significantly different result. Yes, I recognize the functions and the purpose is to simulate the odd math that XCom: EU is using. But I don't think the "max" function is valid, because it guarantees you will make at least 1 product, even if the number of hours assigned isn't sufficient to make one.

As far as number of days in a month, who wants to do 3 different calculations? February is 672 hours. If you want absolute accuracy, you calculate based on a 365 day year.

But the point of the calculations was not absolute accuracy, but to produce something reasonable as the basis for setting an initial sales price for a new items, which will then be reduced over time in simulation of normal economic forces.  It's grossly simplified, but I think the idea behind it remains valid.