Author Topic: SMACX Thinker Mod  (Read 43202 times)

EmpathCrawler and 1 Guest are viewing this topic.

Offline tnevolin

Re: SMACX Thinker Mod
« Reply #405 on: October 31, 2019, 12:09:54 AM »
Ah, one more thing I wanted to ask. Sorry, if I asked this already.

Did you tweaked unit cost calculation? There is one rule in unit cost calculation that sets attack value to 1/2 of armor value for cost calculation purposes only. I understand it stems from previous civilization versions where all defensive units have attack value at least half of their defense. I guess AC designers wanted to encourage players to follow the same unit design. However, cost formula multiplies attack and defense. Thus making defensive unit cost growing quadratically by its defensive value even if you don't invest in their attack value. And there is no way to make it less expensive!!! Whereas attack unit cost with minimal defense growths linearly proportionally to their attack value (as anyone would expect).

Would you mind dropping this rule if you are able and willing to? Thank you.
Tim

Offline tnevolin

Re: SMACX Thinker Mod
« Reply #406 on: November 01, 2019, 08:03:59 PM »
Actually, Induktio,
I am up to modify in game unit cost calculator myself if you let me be a co-author. I can do it either in stand-alone fashion to provide you the modified code or you can share yours with me so I can build on top of it if you prefer this more. Either way I'm eager to contribute. In game cost calculator annoys me so much and long already that I don't see other choice to deal with is besides code modification.
Tim

Offline Induktio

Re: SMACX Thinker Mod
« Reply #407 on: November 02, 2019, 10:32:22 AM »
> Did you tweaked unit cost calculation?

I don't know if you had some reason to think there were some differences, but Thinker should not include any kind of changes to vanilla cost mechanics unless the documentation says so. For the most part, my priorities weren't in rebalancing existing mechanics since that tends to be an endless endeavor, and some players would not like to see the game diverge too much from the original settings.

> In game cost calculator annoys me so much and long already that I don't see other choice to deal with is besides code modification.

Have you looked at how the calculation works in the binary level? Using Scient's IDA database it seems there are mainly two functions dealing with this, consider_designs and proto_cost. They are very closely linked to another when the AI uses them to design units. Just saying I am not actively developing any changes to this part. I would say fixing the orbital attack bug would be a priority before next release, but dunno about adding any new stuff that requires extensive reverse engineering and then more testing to make sure it doesn't break any existing game logic.

Offline tnevolin

Re: SMACX Thinker Mod
« Reply #408 on: November 02, 2019, 03:07:14 PM »
No worries. I won't include this logic into your mod if you don't like to. It this case I'll ask permission to fork your mod and add these changes on top of it. Or maybe I will be able to patch the original executable that your mod uses. Then there won't be need for forking. Don't know yet.

I don't understand "not altering game mechanics" while designing mod(ifications). You are altering something anyway. It may be not in line of your mod targeted changes, though. That's another story.

Thank you for sharing functions names.
Tim

Offline Induktio

Re: SMACX Thinker Mod
« Reply #409 on: November 02, 2019, 04:19:22 PM »
No worries. I won't include this logic into your mod if you don't like to. It this case I'll ask permission to fork your mod and add these changes on top of it. Or maybe I will be able to patch the original executable that your mod uses. Then there won't be need for forking. Don't know yet.

I think the word you're looking for here is "pull request". You might rebase the changes on top of the master branch and then submit a pull request. Something along the usual procedures for accepting external contributions on git projects. Then we can evaluate how it might work. I doubt you would want to maintain a fork of Thinker with divergent features over long term. And then any forks would have to be renamed to something else.

About patching the binary directly, it's a serious problem for maintenance and mostly unnecessary. Nobody wants to maintain patches that are described only on a binary level. For several releases now, Thnker has not featured any changes to the game binary because the patches are loaded dynamically at startup.

Offline tnevolin

Unit cost calculation formula
« Reply #410 on: November 18, 2019, 02:31:50 PM »
I am planning to mod unit cost calculation. Here is the formula I currently programmed. I focused mostly on chassis, weapon, armor, reactor involvement. Abilities were secondary concern. However, since I've rewrote a complete function I had to include them too.

Formula
==============================================================

UC = ([max(WC, AC) + (WC + AC)] / 2) * (CC / 2) * (1 + PAC / 4) + FAC

UC = unit cost
WC = weapon cost * reactor level (for weapons), module cost (for modules)
AC = armor cost * reactor level
CC = chassis cost, it is divided by 2 to allow 50% step increase in unit cost
PAC = proportional ability cost (positive ability cost value)
FAC = flat ability cost (negative ability cost value)

Tim

Offline tnevolin

Unit cost calculation formula - description
« Reply #411 on: November 18, 2019, 02:32:47 PM »
And here is the complete readme for the unit cost formula. Just in case anyone is asking questions.

Modification to SMACX unit cost calculation
==============================================================

Unit cost plays a role in economics of the war. However, slight modifications to unit cost does not change war outcome that much comparing to other factors like overall economics advantage, aliances, technology advantage, terrain, prepared defense, etc. Therefore, I din't bother balancing unit cost with utmost precision. Such fine grained tuning is not required. Rather I just fixed major SMAX unit cost problems by revising basic principles.

I based these principles mostly on Civ 1 and 2 unit pricing model since they seem to be quite nicely balanced already.

Chassis and movement speed
--------------------------------------------------------------

Movement speed privides two major advantages: shorter relocation time accross the globe and tactical advantage. With faster unit you have flexibility of choosing between attack/chase or retreat/escape. It also gives you longer reach range protecing more territory around your bases. All the above multiplies unit value regardless of its battle statistics (weapon and armor). Therefore, speed and chassis type should be a simple multiplier to unit value. The exact chassis value can be set in text configuration.

Weapon vs. armor cost
--------------------------------------------------------------

In Civ 1 offensive units are 50% stronger than same speed and cost defensive ones. That is probably because Civ 1 and 2 have large number of defensive bonuses starting from fortification - a free defense multiplier available for all units. Since SMACX doesn't have such bonus I propose to treat same weapon and armor values equally.

Technology advantage
--------------------------------------------------------------

Naturally attack and defense rating grows exponentially in such games so that each next gadget is proportionally stronger than its predecessor. Even when cost should follows the rating increase there is no strict need for it to grow equally fast. In fact, Civ 1 and 2 unit cost grows slightly slower than its strength. This pattern gives slight economical advantage to more advanced faction. In Civ 1 more advanced units have about 20% reduction in price. I think such reduction can be implemented by assigning costs to individual weapon and armor types. Such costs do not need to be equal to weapon/armor rating but can progress somewhat slower toward higher end of the spectrum.

Mixed units
--------------------------------------------------------------

Units fitted with both weapon and armor provide definitive tactical advantage. They are versatile and are more survivable then pure attackers and defenders. Obviously, they should be valued more than single purposed unit with same primary battle statistics. They should not be priced higher than combined price of two single purposed attacker and defender with same primary statistics. Otherwise, it would be cheaper to build single purposed units only as in vanilla SMACX. I decided to price them exactly half way between max(weapon value, armor value) and sum(weapon value, armor value). As I pointed earlier unit pricing fine tuning is not needed as long as it makes generic sense.

Reactor
--------------------------------------------------------------

Reactor increases unit attack and defense values proportionally. So it should do to the cost. Even proportionally more expensive stronger unit has an advantage due to increased survival rate and later healing.
Reactor should not increase cost of non combat moudles as they do not benefit from increased health.

Abilities
--------------------------------------------------------------

Some abilities normally improve battle statistics. Those should proportionally increase unit price as they are now. Others provide benefit unrelated to unit statictics and should be priced flat. I'll implement those as negative values.

Formula
==============================================================

UC = ([max(WC, AC) + (WC + AC)] / 2) * (CC / 2) * (1 + PAC / 4) + FAC

UC = unit cost
WC = weapon cost * reactor level (for weapons), module cost (for modules)
AC = armor cost * reactor level
CC = chassis cost, it is divided by 2 to allow 50% step increase in unit cost
PAC = proportional ability cost (positive ability cost value)
FAC = flat ability cost (negative ability cost value)

Unanswered questions
--------------------------------------------------------------

Any special treatment of chassis for speicial units: colonies, formers, supply, probe. They all have different usage and differently benefit from chassis speed. Should their speeder version be more expensive than infantry? Should their foil version be same as infantry or more expensive?
This is all very subjective and can be done either way without much game impact. However, there is still small impact on playing style and tactics.

I personally don't see point in pricing worker vehicles (colony, former, supply) sea versions higher than their land counterparts. What significant point does it achieves? Naturally land bases build land units and sea bases build sea units. It is not like there is much choice. Therefore, such units are not directly comparable and should not be priced differently. I'd say foil units at sea are same as infantry on land. Whereas cruiser units should be logically priced higher. Same way as speeder units do comparing to infantry.

Moreover, generally I think we should not increase unit cost without compelling reason. Otherwise, game becomes unit poor and, therefore, tactically poor as well.

Probe teams are special case. Their speed is an important quality that factors into their primary performance rate. That is why they are created on speeder chassis by default. Does it make sense to create infantry probe teams for defensive purposes? Should it be cheaper? What about foil probe team - should it be priced same as speeder or infantry one?

Tim

Offline tnevolin

Unit cost calculation formula - abilities
« Reply #412 on: November 18, 2019, 02:51:16 PM »
Yitzi introduced different formulas for abilities as proportions between different statistics. Personally, I don't believe we should go into such complication as exceptionally fine tuning game parameters is not needed. It is much better to give player a clear and uncomplicated picture of rules and let them decide what is good for them.
I prefer to keep either a vanilla simple cost multiplier only or to add a flat row cost as an additional option. However, I am open for discussion and ready to listen to opinions if any.
Tim

Offline T-hawk

Re: SMACX Thinker Mod
« Reply #413 on: November 18, 2019, 03:52:56 PM »
Sea units do cost more for significant reasons.  A base founded by a sea colony pod includes a pressure dome facility for free, which counts as recycling tanks for 1-1-1 production.  A sea former is more productive than a land former, both because it doesn't consume a turn moving into a new space, and because sea improvements (kelp and tidals) yield more per former-turn of labor than equivalent land improvements.  A sea crawler is slightly better than a land one also because of the mobility, in consuming fewer turns of movement to reach the tile it wants.  Same goes for sea probe teams; they are more similar to a rover-chassis land probe, because the movement allows the capability to threaten multiple cities at once.

I don't really have any overall opinion on redesigning unit costs, but that's one point to make.  Oh, one more point: upgrading is a factor for high weapon/armor units.  You can't price them too high, or it becomes more cost-efficient to build cheap basic unit shells and upgrade them instead.

Offline tnevolin

Re: SMACX Thinker Mod
« Reply #414 on: November 19, 2019, 12:01:38 AM »
Sea vs. land is heavily opinionated discussion. That is why I welcome different opinions and thank you for expressing them. Even if we cannot prove anything we can at least build something that most people would like.

So you believe foil units should be priced similar to speeder one? That makes sense to me on some accounts. In my mod I price speeder units 50% more than infantry ones. Let's see how does it turn out for foil units if I price them same as speeder based units.

Colony
In my mod I set colony cost to 6 to reduce infinite colony spawn exploit.
infantry: 6, speeder: 9, foil: 9
Generally I agree with you that sea colony should be more expensive than land one. Is 3 rows of minerals too much a difference for you? I think I can live with that.

Former
infantry: 2, speeder: 3, foil: 3
Fine with me. They are very cheap. Nobody will notice the difference.

Supply transport
In my mod I set supply cost to 8 to reduce supply spawning a little.
infantry: 8, speeder: 12, foil:12
I don't think I agree on higher priced foil supply. Yes, it is faster but once it reaches the destination it just sits there for eternity. Moreover, sea mineral squares are usually poorer than land ones. You can build enormous amount of mines on land and create the huge supply of minerals without any spare resources. Nothing like this is possible on sea.
For me foil supply is kinda correspond to infantry one, not the speeder one. That is actually why there is no much sense in building speeder supplies at all.

Probe
In my mod I set probe equipment cost to 4 to reduce probe spawning by AI.
infantry: 4, speeder: 6, foil: 6
Makes sense to me. One can as well build cheaper probe teams for defense purposes.

Combat units
Sea units meet land units only attacking ports. They mostly fight with each other. Considering that base foil cost makes no difference when you compare sea units with sea units. They just will be all proportionally cheaper or expensive.
In my mod mixed unit (with both high weapon and armor) is 50% more expensive than single purposed one. Sea units are usually mixed (fully armored). If we also increase foil cost by 50% comparing to infantry than fully armored foil would cost twice more than pure infantry defender in port. That is a huge disadvantage for attacking ports with sea units comparing to attacking land bases with land units. Although, sea bases do not benefit from sensor which equalize above disadvantage a little. Besides, sea bases are more vulnerable to sudden attack. There are no ZOC there.
Overall I agree that sea combat units should be more expensive.
« Last Edit: November 21, 2019, 08:49:02 PM by tnevolin »
Tim

Offline tnevolin

Re: SMACX Thinker Mod
« Reply #415 on: November 21, 2019, 08:54:44 PM »
Based on above discussion I plan to do just one change: price foil supply as if it had infantry chassis, price cruiser supply as if it had speeder chassis. Not that anyone would want to build speeder and cruiser supplies for harvesting but they can build them for project building since they are more expensive and faster.
Tim

Offline tnevolin

Reactor
« Reply #416 on: November 22, 2019, 02:04:05 AM »
I found where the reactor level is used to check whether unit lost all HP during the battle. The code uses reactor id/level directly, not the value. Then it multiplies it by 10 inline constant. This is completely hardcoded. There is no any function or configuration variable to modify - only the code itself. Even though, I think I can track all usages of this and still modify inline.

Modding wise, I also think it may be possible to 1) set the reactor value, not the level to the prototype reactor field and 2) use this reactor value as a direct amount of HP without any transformation and use it in the code like that.
This way anyone can just put an amount of HP per reactor right in the text configuration and be done with reactor imbalance nightmare.

Other reactor use such as needlejet extra range or planet buster blast radius can be left intact. They have pretty interesting uses and do not break game that much.
Tim

Offline tnevolin

Reactor value
« Reply #417 on: November 22, 2019, 02:33:33 AM »
Now why do I bother with reactor HP value since I've factored it into unit cost already thus fixing infamous reactor game break? Well, now when I made unit cost proportional to its health, I am thinking - whether I actually need to quadruple both health and the cost by the end of the game. Top level units already cost like 200-300 there is no need to raise it significantly any more. So I was thinking to give each reactor a health boost but not too big. Maybe by 10-20% for every level?
Now if the health increase is not that big, would it make sense not to increase price as well. That effectively makes reactor upgrade an improvement. However, 10-20% improvement is something worth putting on single technology without breaking unit effectiveness progression too much. What do you think, guys?
Tim

Offline tnevolin

Re: SMACX Thinker Mod
« Reply #418 on: November 23, 2019, 06:08:43 PM »
I've analyzed reactor usage in the code and it looks pretty gloomy. There are hundred places where unit reactor power is used and all for different reasons. Some just multiply it by 10 to get the total health, I guess. However, other usages are completely different. They may use reactor power directly comparing it to something, like detecting whether unit uses Fusion reactor or above. Others involve it in some unclear math.
A lot of algorithms tied to reactor like collateral damage adding percentage of health, native combat ignoring armor, etc. Don't want to disturb all this machinery.
Tim

Offline tnevolin

Reactor value
« Reply #419 on: November 23, 2019, 09:31:21 PM »
I think I came up with a compromise. Let reactor increase health as they do now and increase cost gradually slower so that fitting units with new reactor is economically beneficial but not that insanely by much as in vanilla to break the progression. I've build a scale where each following reactor drops effective cost by 20%. That is each following reactor health/cost ratio is only 80% of its predecessor.

REACTORS
Fission: 10 health, cost*1.0
Fusion: 20 health, cost*1.6
Quantum: 30 health, cost*1.9
Singularity: 40 health, cost*2.0

Along with decelerated item cost progression it makes late game units 4 times as less expensive comparing to 1:1 item and reactor cost. For example, 30-1-1*4 infantry would cost 30*4=120 rows of minerals with 1:1 cost model and only about 30 rows with decelerated cost model. Which is pretty affordable for late game bases with ~50 mineral production. After all one have to pay for better unit and with decelerated model higher end items are still more beneficial to use.

Here is my weapon and armor progression list for completeness sake
#WEAPONS
Hand Weapons,         Gun,            1, 0, 1, -1, None,
Laser,                Laser,          2, 0, 2, -1, Physic,
Particle Impactor,    Impact,         4, 0, 3, -1, Chaos,
Gatling Laser,        Gatling,        5, 1, 4, -1, Super,
Missile Launcher,     Missile,        6, 2, 5, -1, Fossil,
Chaos Gun,            Chaos,          8, 0, 6, -1, String,
Fusion Laser,         Fusion,        10, 1, 7, -1, SupLube,
Tachyon Bolt,         Tachyon,       12, 1, 8, -1, Unified,
Plasma Shard,         Fusion,        14, 2, 9, -1, Subat,
Quantum Laser,        Quantum,       16, 1,10, -1, QuanMac,
Graviton Gun,         Graviton,      20, 0,12, -1, AGrav,
Singularity Laser,    Singularity,   24, 1,14, -1, ConSing,
String Disruptor,     String,        28, 1,16, -1, BFG9000,
#DEFENSES
No Armor,            Scout,       2, 0, 1, None,
Synthmetal Armor,    Synthmetal,  3, 0, 2, Indust,
Plasma Steel Armor,  Plasma,      4, 2, 3, Chemist,
Silksteel Armor,     Silksteel,   5, 1, 4, Alloys,
Photon Wall,         Photon,      6, 1, 5, DocSec,
Probability Sheath,  Probability, 8, 2, 6, ProbMec,
Neutronium Armor,    Neutronium, 12, 1, 8, MatComp,
Antimatter Plate,    Antimatter, 16, 2,10, NanEdit,
Stasis Generator,    Stasis,     24, 2,14, TempMec,

As you can see even though item strength growth exponentially, cost is not that much. The most expensive weapon is only 16 comparing to 30 in vanilla.

« Last Edit: November 25, 2019, 01:16:22 PM by tnevolin »
Tim

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
18 (6%)
XP Compatibility patch
-=-
9 (3%)
Gog version for Windows
-=-
76 (29%)
Scient (unofficial) patch
-=-
28 (10%)
Kyrub's latest patch
-=-
14 (5%)
Yitzi's latest patch
-=-
85 (32%)
AC for Mac
-=-
2 (0%)
AC for Linux
-=-
5 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
12 (4%)
Total Members Voted: 259
AC2 Wiki Logo

* Random quote

From the delicate strands,
between minds we weave out mesh:
a blanket to warm the soul.
~Lady Deidre Skye 'The Collected Poems'

* Select your theme

*