OpenXcom Forum

Modding => Tools => Topic started by: DeltaEpsilon on December 23, 2015, 01:16:17 am

Title: Scripts : Profit calculator & Weapon efficacy calculator
Post by: DeltaEpsilon on December 23, 2015, 01:16:17 am
Maint_sim.py

https://www.dropbox.com/s/yy3dntjxth2g6lu/maint_sim.zip?dl=0
https://pastebin.com/bA5ijfjs - just source code. More stable than version in the archive but no new functional.

First version of maint_sim.py devoted to calculate the ideal setup and profit of any manufacturable item possible. You punch in all the values and get what needed. Be aware that TFTD rules for most part follow easy rule: more engineers = more profit, so you might be using it just to evaluate your average profit.
(https://i.imgur.com/PkfNMdu.png)


UFOEnemy.py

https://www.dropbox.com/s/2jnt7shtt2c0d63/UFOEnemy.zip?dl=0
https://pastebin.com/7ZJS5eHZ - just source code and nothing else. It is far more readable than one in archive but I am not going to bother with reuploading solely because source code is better.

Advanced version of older UFOEnemy.py. It is supposed to evaluate efficiency of any given weapon against any given enemy.
Now it supports mass evaluation and can easily and quite reliably be used by modders who want to balance things out. Or by common players seeking to know what weapon deals with what enemy best.
(https://i.imgur.com/4kMCKLT.png)



Each archive contains two folders: bin and src. bin has executable file for windows users (I am not sure if it works in 64-bit Windows, but it should) and src contains the actual py script which lies, well, "compiled" in bin folder. You can use any script however you want.
It simulates the whole process of manufacturing throughout a virtual month. The reason of that is because UFO: EU uses a very weird system of manufacturing and calculating it mathematically would require using some special means. Simulating is just overall easier to implement.
It also simulates the whole process of killing virtual enemies. It collects statistical data and outputs it in readable form.
The tab in the screenshot consists of three values: first is average amount of shots needed to kill some enemy, second is standard deviation and third is the absolute minimum of shots needed to kill an enemy
It appears if there were more than 1/100 of TRIES without killing that particular enemy (100 shots at default). It used to have actual determinating of immunity to some weapon, but I faced a problem that made numbers meaningless. I don't think anyone would truly consider firing 3500 +- 1250 times at some enemy and not think he's not dying. It's a trade-off between common sense and accuracy.

If there are any bugs, you can post them here.
Title: Re: Scripts : Profit calculator & Weapon efficancy calculator
Post by: DeltaEpsilon on December 29, 2015, 12:14:51 am
0. As promised UFOEnemy.py got updated.
1. I uploaded both source code files to pastebin with slight improvements.
Title: Re: Scripts : Profit calculator & Weapon efficancy calculator
Post by: Bloax on December 29, 2015, 02:00:49 am
Very cool!
Title: Re: Scripts : Profit calculator & Weapon efficacy calculator
Post by: DeltaEpsilon on January 02, 2016, 05:14:55 pm
Update:
Both scripts were moved to permanent storage Dropbox.
UFOEnemy.py:
  Fixed bug with division by zero
  Performance improvement: 20% more faster.
maint_sim.py:
  Nothing changed
Title: Re: Scripts : Profit calculator & Weapon efficacy calculator
Post by: hellrazor on April 16, 2016, 11:05:10 am
Thx dude that really helped balancing some stuff out.
Title: Re: Scripts : Profit calculator & Weapon efficacy calculator
Post by: DeltaEpsilon on April 16, 2016, 05:30:10 pm
I already mentioned you should use these scripts for your mod in the chat like 3 months ago.
Title: Re: Scripts : Profit calculator & Weapon efficacy calculator
Post by: hellrazor on April 16, 2016, 08:19:43 pm
I already mentioned you should use these scripts for your mod in the chat like 3 months ago.

Jeah i was first hesitent towards it, but i actually used them for some new units and the heavy laser rebalances.
Title: Re: Scripts : Profit calculator & Weapon efficacy calculator
Post by: DeltaEpsilon on April 19, 2016, 05:42:29 am
I am thinking of adding a new modding tool to the script.

The idea is simple: slow change of one chosen variable for balancing purpose.

Here is an example:
You define an enemy with constant stats then a weapon with variable damage [or in reverse].
You define it's damage as 15+20 ! 10 which means it will add in increments of 20 ten times -> 15, 35, 55, 75, 95, 105... 215.
Each of that damage value will be tested.

I think that should help a great deal.
Title: Re: Scripts : Profit calculator & Weapon efficacy calculator
Post by: wolfreal on January 26, 2017, 02:06:02 am
Hello  EditorRUS

Can I use your script for some experiments I want to do? Maybe I reach / do nothing, but I want to know what license your script have and if I can torn apart / reuse / embed in another code / etc / your codes, giving you all the credit you deserve obviously.

Thanks in advance.

Edit 1: Sorry for bumping an old thread. I should write a DM to EditorRUS. But I thought about that too late.
Title: Re: Scripts : Profit calculator & Weapon efficacy calculator
Post by: DeltaEpsilon on April 04, 2017, 05:22:11 am
I was kinda dead here, waiting for another time to dive into OpenXCom again.

Yeah, go wild. I don't particularly care about all that legal stuff too much. If I absolutely have to, then the MIT License, but who cares, it's not like this script is of any real value.