aliens

Author Topic: Scripts : Profit calculator & Weapon efficacy calculator  (Read 7464 times)

Offline DeltaEpsilon

  • Captain
  • ***
  • Posts: 86
    • View Profile
Scripts : Profit calculator & Weapon efficacy calculator
« 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.



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.




Spoilersrc directory:
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.
SpoilerInformation on maint_sim.py:
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.
SpoilerInformation on UFOEnemy.py:
It also simulates the whole process of killing virtual enemies. It collects statistical data and outputs it in readable form.
SpoilerNote on UFOEnemy.py:
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
SpoilerNote on INVINCIBLE status:
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.
« Last Edit: March 28, 2016, 02:56:08 pm by EditorRUS »

Offline DeltaEpsilon

  • Captain
  • ***
  • Posts: 86
    • View Profile
Re: Scripts : Profit calculator & Weapon efficancy calculator
« Reply #1 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.
« Last Edit: December 29, 2015, 08:11:22 pm by EditorRUS »

Offline Bloax

  • Colonel
  • ****
  • Posts: 322
  • do you want to be any of those things
    • View Profile
Re: Scripts : Profit calculator & Weapon efficancy calculator
« Reply #2 on: December 29, 2015, 02:00:49 am »
Very cool!

Offline DeltaEpsilon

  • Captain
  • ***
  • Posts: 86
    • View Profile
Re: Scripts : Profit calculator & Weapon efficacy calculator
« Reply #3 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

Offline hellrazor

  • Commander
  • *****
  • Posts: 2013
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: Scripts : Profit calculator & Weapon efficacy calculator
« Reply #4 on: April 16, 2016, 11:05:10 am »
Thx dude that really helped balancing some stuff out.

Offline DeltaEpsilon

  • Captain
  • ***
  • Posts: 86
    • View Profile
Re: Scripts : Profit calculator & Weapon efficacy calculator
« Reply #5 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.

Offline hellrazor

  • Commander
  • *****
  • Posts: 2013
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: Scripts : Profit calculator & Weapon efficacy calculator
« Reply #6 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.

Offline DeltaEpsilon

  • Captain
  • ***
  • Posts: 86
    • View Profile
Re: Scripts : Profit calculator & Weapon efficacy calculator
« Reply #7 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.
« Last Edit: April 19, 2016, 05:44:56 am by EditorRUS »

Offline wolfreal

  • Colonel
  • ****
  • Posts: 298
    • View Profile
Re: Scripts : Profit calculator & Weapon efficacy calculator
« Reply #8 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.

Offline DeltaEpsilon

  • Captain
  • ***
  • Posts: 86
    • View Profile
Re: Scripts : Profit calculator & Weapon efficacy calculator
« Reply #9 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.
« Last Edit: April 04, 2017, 05:28:48 am by EditorRUS »