As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
Submod "Caster of Magic for Windows: Warlord"

What causes those scripts to be run? Is it done for overall military strength, or strength/army, or some other reason? If so, could the unit value be kept as a separate value and changed whenever something changes the unit (spells, XP, damage, etc)? Then, for example, if someone casts a global spell that has a chance of reducing Defense by 1, it need to check every unit in the game, but thereafter it doesn't need to run a script every turn to calculate the unit's Defense. If that method accumulates errors, then an occasional 'recalculate unit values' might need to be done.

I'm not a programmer, but I get the impression that there are various tricks that can be used to reduce the number of "If Then's" that need to be run to do a task. Some trade off memory space for speed; some might use data structures and addressing modes (maybe not available in the scripting language). Some might trade off precision for speed, such as not requiring ten decimal places of accuracy for deciding whether to attack an army. I think a lot of the 'done every turn' checks and calculations are not really necessary.
Reply

What causes those scripts to be run? Is it done for overall military strength, or strength/army, or some other reason? If so, could the unit value be kept as a separate value and changed whenever something changes the unit (spells, XP, damage, etc)? Then, for example, if someone casts a global spell that has a chance of reducing Defense by 1, it need to check every unit in the game, but thereafter it doesn't need to run a script every turn to calculate the unit's Defense. If that method accumulates errors, then an occasional 'recalculate unit values' might need to be done.

I'm not a programmer, but I get the impression that there are various tricks that can be used to reduce the number of "If Then's" that need to be run to do a task. Some trade off memory space for speed; some might use data structures and addressing modes (maybe not available in the scripting language). Some might trade off precision for speed, such as not requiring ten decimal places of accuracy for deciding whether to attack an army. I think a lot of the 'done every turn' checks and calculations are not really necessary.
Reply

(November 9th, 2022, 19:26)Suppanut Wrote: The biggest culprit of speed down is in unitcalc.cas and unitcalcpre.cas. I did some code steamlining on it for sometimes but time spending still high, I need to look into detail what I should trim down

Looking a bit at the files, I assume this script is going roughly by "for each unit in the game, check every condition (e.g. if it has an enchantment, global enchantment etc.) and update values", and hence the massive slowdown.
I'm not sure if you have access to the code, but a few things that might help hastening the loading time, based on the comments. While some of it may be obvious or impossible, I hope it may help solving the issue.
> memory over computation - save the units in memory and update them per effect. Run the script only on load game and possibly after a trigger (such as dispel magic). Could possibly do this once for each unit type as middle ground, applying all general modifications. For example I see that Vampiric weapon got changed from -2 to -5. Saving all such units' base as -5 and not running the script could help.
> check the script is not ran by all wizards. It seems it should be run once per turn, or once per combat, or something similar, if at all possible.
> if we run for every unit, it might be possible to reverse the search to lookup by effect. e.g. instead of looking if a unit has Zeal on every unit, get all units with Zeal, and apply the effect on each.
> depending on implementation, checking for an effect might be costly (for example, running a binary search or something). Saving a boolean for 'is there any unit with Zeal effect' and raising it once there is any might help speed up the process. The same can be applied for groups, e.g. until any player researches a rare spell, don't check any of them.
> if possible, check why we need it run. if it's wizards inspecting a stack to figure out power, it might be possible for a unit to have a power score (and the effects in the list modify it), and use that score directly. That might lose accuracy for the AI, but it sounds like it's worth it for the speedup. (Alternatively, the AI use it for a rough estimation, and does the full check if close. E.g. if the setting is "attack if enemy power < my power" and result is that "enemy power = my power -1", it'll run a deep check to ensure it's actually weaker, and not a bit stronger
Reply

Hi, I'm a support developer to Suppanut (the author deserves 99+% of the credit for this mod). I'm currently helping with streamlining code in the mod for 1.4.18.

On the side, I'm trying something different and appear to have successfully met my goal: Warlord "lite"

This project is about preserving as much as I can from the Warlord mod while wiping out nearly all those special scripts that slow down game. I'm surprised at how little I lost while reducing end turn speeds by 60-85% (depending on game size). Yes, 15 spells are removed, several others simplified, and a few minor changes to a couple retorts ... beats going back to Caster of Magic or early versions of Warlord mod (shared a few months back as 'retro') for end turn speed. I shared this to the author as I won't release it under my name (I did not make Warlord)

I'm hoping to obsolete my own project - I like the full Warlord so much and expect to be my go-to as I tend to play smaller games.

Reply

Yes, I was thinking that deleting most or all of those two files and disabling the spells that they reference might be better than going back to vanilla COM. Since you've already done that work, I hope you or Suppanut includes those files as options, even without a convenient button to switch between them. Label them as Fastxxx.cas and Fastspells.ini, so the player can rename the originals as Slowxxx.cas/ini and rename the Fast ones.

My computer (mini-PC) is fairly slow, so with those scripts running each turn, it got to the point of reading a book during those waits, and that was reached fairly early in the game.
Reply

(November 12th, 2022, 14:24)JustOneMoreTurn Wrote: ... it got to the point of reading a book ...

Aha. That's what I'm doing right now, even without turns. I'm halfway through with "Elric of Melniboné" and would like to recommend it to anyone here who shouldn't know it yet. You quickly get the feeling of reading a literary template for MOM. The books sat on my shelf untouched for years because of an ugly beginning, but it's really worth reading.
Reply

Warlord Lite: https://www.moddb.com/mods/caster-of-mag...ersion-101

I got it to the point you can have both in launcher and either has its standalone manual (accessed through launcher manual button). You would need to follow same kind of installation steps except with a foldername that has a space after warlord and ‘lite’ “master of magic caster windows warlord lite” and overwrite the multi with this one provided. Caster DOS 1 sacrificed for this.

It’s really Suppanut’s work with some specific things adjusted/removed and minor balance tweaks for more flexibility for larger games.

Reply

Congrats, Zitro, it performs considerably faster. 
A word to tactician: Seems pretty strong - in nodes, I place my elven lords in forests/on rocks and bang.
Another word, in general: Why not enable warlord/tactician combination? If it is too easy, too bad for the human who chooses to play thus.
Reply

https://www.moddb.com/mods/caster-of-mag...nloadsform

Warlord mod version 1.4.18 is out with

Change log version 1.4.18:
Retort/Books:
Benefactor - comes with heroic heart researched
Tactician – no longer grants +1 move in favorable terrain. However, it grants +5% to hit and negate first strike instead (end turn time savings)

Buildings:
- Alchemist Guild now grants +2 research – bringing back the original master of magic feature of it granting a minor economy bonus.

Units:
- Dwarf musketeer loses 1 resistance
- Gugalanna gains +1 melee
- Minotaur gains +1 hp
- Doom Drake costs 10 less
- Kraken no longer stealthy in sea (end turn time savings)
- Archangel has a charge of hierophany (new spell)

AI:
- Overhauled how AI values spells in regards to trading with other players, more in line with spell worth and whether the spell is not used at its full potential by dumb AI.

Spells:
- Soul flay costs 45 (from 5)
- Lycanthropy costs 90 (from 105) and has resistance 5 (from 4)
- Divine Order's magic market effect changed from guaranteed to conditional – if opponent has no life books, it no longer provides power. If opponent has more non-life books than life – magic market is 50% as effective. If opponent has more life books – magic market is unchanged. - nerfed
- Plane shift research cost is 6000 (from 8000)
- Focus Magic, if cast in combat and unit does not have ranged attack, grants +3 resist. - buffed, mainly to help AI.
- Inner Power also grants mountaineer to qualifying units.
- Ensuring magic immunity does not counter web
- State of Rot Redesigned without 'healing immunity' at all given the various bugs around it not expected to be fixed - All enemy non-undead units in combat lose regeneration and 8% to defend. Additional State of Rot enchantments in play reduces to defend by 4%.
- Sanctify effect to turn unit into life creature only happens during battle (end turn time savings)
- Angelic Guardians effect of giving your units exorcise only happens during battle (end turn time savings)
-AI values some spells slightly more or less when trading.
- Removed Purity due to impact on end turn processing.
- NEW UNCOMMON - hierophany (24 cost)– Combat curse with -4 resist modifier (-7 if undead). If resistance roll unsuccessful, unit loses half armor, all immunities, lightning resistance, negate first strike, and all mobility-related perks. This spell is most successful against death and undead units which happen to have some of these perks.
- Focus magic no longer can be cast in combat (end turn time savings)
- Vampirism no longer transfers thrown/breath into range, only into melee (end turn time savings and to encouraging melee among enchanted units)

Other:
- This version is all about lowering end turn game speeds, a problem associated with the Warlord mod. The scripts simplified to reduce calculations. In some cases, certain features got simplified or moved to just combat-only effects. Simplified eternal night/state of rot/vampiricism/shadow strike/colossal strength/Temporal Twist.
Reply

- Focus Magic, if cast in combat and unit does not have ranged attack, grants +3 resist. - buffed, mainly to help AI.
- Focus magic no longer can be cast in combat (end turn time savings)

Focus magic seems to not be castable, but it does something else in combat. Were they referring to different spells, or just two variations and got lost while writing the notes?
Reply



Forum Jump: