(August 15th, 2016, 18:24)grazzy Wrote: yeah, I cant reproduce it reliably. Just the first time its crashed on me in a long long time.
I actually realized something...these random crashes aren't all that random.
There is one common factor between them : They always happen when the next turn button was pressed, during the AI's turn. So maybe there is a real bug in there somewhere, something like a division by a random number that can be zero? I'll try to look through the entire AI turn to see if I find anything suspicious when I have time.
Edit : I found something. There is a procedure that is only executed at a 10% chance per continent per turn, and only if the continent's unit gathering point is full. Changing that 10% to 100% causes the crash to always happen exactly at the end of the turn after the one that was initially loaded (continent data is not saved so in the first turn something might be different so only the next one is crashing?) at least so far.
It's also one of the very few procedures I only skimmed through and didn't analyze in depth yet. This might be it, though finding the exact problem will be hard nonetheless, it's a pretty overcomplicated part.
Edit 2 : Haven't gotten deep into the procedure yet and I already discovered a huge bug. The plane variable passed down as "the plane this continent is on" is constantly being used as a temporal storage variable for "the plane this town/unit" is on instead. Not sure how that results in a crash yet but it's definitely completely wrong.
Edit 3 : Jackpot! Here is a part where the AI calculates the center of the main action continent by averaging the coordinates of all tiles (add them all up then divide by number of tiles). Now, if the AI has no main action continent selected because everyone is allied and all lairs have been cleared so there is absolutely nothing to do...or for any other reason, then...bam, we count 0 tiles and divide by zero.
Only time will tell if this was the only such crash source but it might have been the largest.
I'm going to reduce the Spell of Mastery research cost to 4*40000 from 4*60000 in the next update, the current amount is way too overkill, however, it'll still be 4*60000 for extreme and above AI since they have almost double power income not to mention their other advantages which ensures the game will drag out longer.
I played an impossible game and the AI reached SoM around 1430, only 5 years after me, even though I owned about 75% of the cities in the world and the land size was only medium. So they can't get access to this cost reduction at that level of difficulty.
-Fixed two random crash sources, one combat, one overland. Probably most of the remaining crashes were caused by these.
-AI learns to attack adjacent enemy units on the other side of city walls
-Cheaper Spell of Mastery (experimental, if it proves too easy to get, I might raise it back but it is unlikely)
-Random generated items can now contain any ability, except Spell Charges. Random generated items will put actual effort towards filling all 4 slots with powers if budget allows, though on very expensive treasure the chance of wasting a significant portion is still high.
-Predefined items now have the +1 and +2 defense bonus for plate and chain.
-Pathfinding and Noncorporeal works in combat to ignore terrain when moving.
-Fixed combat Stasis not setting unit movement to 0 for the turn it was cast
-AI is now able to attack adjacent enemy units with melee attacks from inside the city walls to outside. The only exceptions are, the unit at the gate will not move, and when a Wall of Fire is present, if the unit has no first strike, thrown, breath or gaze attack, then the AI will not move to attack and wait for the enemy to attack instead (and take damage from the wall)
-Fixed bug : game consistently crashes during combat under very specific conditions, including having a road and no walking units to attack by a walking army attacking a city. Actual bug was not found but eliminated by replacing the entire “shortest path” algorithm for combat with a bug free own version. (which is hopefully a bit faster too)
-Fixed bug : Evil Omens halves mana production of religious buildings as though it was Eternal Night.
-Noncorporeal units can move on all tiles for 1 movement point during combat – as though they were flying.
-Pathfinding units can move on all non-water non-mud tiles for 1 movement points during combat, unless they are also swimming, in which case they move as though they were noncorporeal.
-Fixed several major bugs in the AI continent evaluation systems, including some division by zero. Hopfully this will improve game stability by a lot.
-AI will not mark a continent “no targets” unless they have at least a stack of 8 units for all land sizes (instead of 5 on tiny, 9 on huge), to ensure the AI does build a large enough stack to be able to attack the human player on Tiny land before turning back.
-Spell of Mastery now only costs 4*40000 to research, except for AI wizards on Extreme and Impossible where it's still 4*60000 for them to compensate for the major resource advantage and expected longer game duration.
-Readjusted AI overland summoning spell priorities again.
-Readjusted AI artifact/item creation chance.
-When the AI is casting Enchant Item or Create Artifact, the selected item will not be more expensive than 10* the wizard's casting skill for item and 12* for artifact. This ensures the AI will finish the item spell in a reasonable amount of time, and also allows the AI to create better items if skill reaches very high.
-Fixed bug : random generated items can only have a value greater than the intended amount instead of lesser or equal. Note that there is no MINIMAL value for the item, if the first 4 powers selected do not use up even half the budget, it'll still provide that item. This is required to make sure the game does not freeze if the budget is too high to cover by any possible item. However, at the very least is is guaranteed to have 4 powers on the item, unless the entire budget is already used by fewer.
-Random generated items can have enchantment powers, not just stats – if such an item is generated for the AI's spell, books requirements are checked!
-Predefined items now gain the +1 or +2 armor for chain and plate mail!
This one focuses on the AI's ability to have better garrisons in cities. I think a big flaw in the game was that most AI cities only ever had units produced in that city, which is often not enough to even damage, let alone stop a mid or late game stack. This lets the player take over vast amount of cities without opposition and the need to stop and regroup. Now the AI will attempt to keep at least 1-2 fantastic creature in each city, and honestly, even 1 random efreet or angel in a city of 8 normal units should make a huge difference, especially if that city is a race with poor units.
The AI should also be able to judge which unit is better on defense more effectively, instead of having to rely on the simple "more expensive is stronger" logic.
I also expect this to reduce the cases where the AI players eliminate each other slightly, though probably not by much.
Obviously, the fantastic units commited on defense of regular towns will be missing from offensive stacks and the capital, and although the amount is low, hard to tell if this actually makes the game harder as intended, or easier due to less pressure. I generally found fantastic units attacking my cities underwhelming because I got the first turn and had the chance to eliminate them by ranged attacks or spells, not to mention my protective city enchantments. The attrition of the AI sending in massive amounts of normal units and casting all sorts of spells to support them (or kill my defenses) was way more threatening than a stray storm giant or two reaching my city. Or course if said stack had 9 giants that would have made a difference but stacks like those almost never happen until the very late game if ever anyway.
Please let me know how this update worked out for you, did it make the game easier, or harder to win? Did the fantastic units mixed in the garrisons made a difference? Was the pressure of AI attacks on your cities stronger, weaker or unchanged?
(Note that I don't expect this to improve the difficulty on normal due to lack of resources to summon a relevant amount of strong creatures to begin with, I'm mainly looking for experience on hard and above difficulty.)
If this update doesn't work out well, increasing the AI's overland casting power advantage to compensate having to summon more creatures is an option, but I hope that won't be needed. They receive quite a lot of that already.
2.66
-When the AI is selecting units to use for building a new stack, the best 2 nonhero units in cities will not be selected to ensure cities have a decent protection. As of now, this effect is not enabled for nodes, but it's a possibility for the future if needed. The amount is also subject to change but 2 seems about right.
-AI will move the summoning circle more frequently. AI will now move the circle at a 1/3 chance to each of the following : The fortress (original), The biggest city on the continent with the hihgest ratio of enemy cities to own cities (original) and to each and every city owned one at a time in the order they were created (NEW). This should provide some better defenses in all AI cities than the random crap that can be produced there.
-AI will not summon spirits or floating islands before turn 25 as they are likely not needed that early.
-The AI no longer decides which unit to keep in a city that has over 9 units based on unit cost, instead it has a separate table to decide which unit is a better defender and which is better to send outside to attack.
-AI is now able to move the Summoning Circle earlier than the default turn 80-120.
-The AI is now allowed to pull units for stackbuilding from cities 2 at a time instead of no more than 1. This should slightly reduce the chance of valuable units travelling alone. As city defense decisions are far superior, this should no longer cause a risk of insufficient defenses even if it might leave a city with 7 units for a turn or two.
Quote:* save8: attack the ruins with heroes, game crashes immediately (versions 2.6 and 2.66). When attacking without remilia there wasn't any crash (she is wielding a shadow sword). Only attacking with remilia didn't produce any crash either
Confirmed. Removing either piece of equipment from Remilia prevents the crash. Removing the attack bonus from the sword fixes it. Removing the defense bonus does not. The crash doesn't happen prior to the version when bonus to hit started counting in unit attack power ratings. I suspect an overflow for this one. I have to make calculations to locate where it happens. This will probably take a few hours or maybe half a day to fix. 2:25 am here doesn't help :D
Quote:* save7: Attack the temple, cast prayer and press auto or finish turn. When the AI tries to control units, game crashes (2.6 & 2.66)
If this doesn't happen without prayer, it's probably the same issue, the unit causes the overflow if buffed, not otherwise.
Quote:* save6: this one is hard to produce: once I saw tenshi raising a volcano at ocean on the west side of yukari's island
Raise volcano has a map scrolling bug in earlier versions. Unless the volcano is actually in the ocean when your turn comes, it was just displayed at the wrong place (should be fixed already in 2.66 though)
Quote:My trireme was attacked by 4 triremes. 2 of them were on the cloud therefore untouchable. Sorry no save games for that. Attacker was clown reed, who used flying castle almost on all of his cities. Btw. isn't that flying fortress dispellable? I couldn't dispel it and had to rely on ranged units...
If this was sea combat, then the ships were together with a Floating Island. This is normal, floating islands to create flying "land" in sea combat. Which is not very good for ships to stand on...
Flying Fortress can be dispelled but Clow has Runemaster usually so their spells are twice as hard to dispel.
Quote: Does flaming give an implicit +1to hit bonus? I don't see it's appearing on hero information screen
No it never did and still doesn't.
Quote:The game is slower compared to 1.40
The AI has a lot of new stuff to think about. Use cycles = 100000 and core=dynamic, or whichever number your PC can handle.
Edit : found the problem. The original game code handled a multiplication wrong : when calculating +25% more, it used
integertolongint(X*5)/4
Problem, in case of remilia she was powerful enough for X*5 to be greater than the max "integer", causing the overflow, after which point the number got converted to a negative longint. I honestly have no idea how a game written in C results in messy code like that, I would expect a C complier to not screw this up. I mean, the CPU automatically stores the result as a longint after word type multiplication in the first place, converting it again just breaks it.
Anyway, according to my calculations, it's still possible to cause an overflow if giving this hero a berserk buff and an illusion weapon...and a few more attack and to hit buffs. I probably need to adjust the numbers a bit.
...actually I'll just make it so that Illusion becomes not cumulative with doom and armor piercing and eldritch weapon in the calculation since their effect is not, and then it's probably impossible to reach the limit.
...Fixed and uploaded. You should be safe now even if you put berserk on that hero and then give her a doom and illusion weapon with max stats then cast prayer on top.
Quote:2.66a
-The AI will not attempt to move its summoning circle if the human player has Suppress Magic to avoid “countered” message spam.
2.66b
-Fixed bug : game crashes if a hero gets extremely high attack power due to overflow.
-Armor Piercing, Illusion, Doom and Eldritch Weapon are no longer cumulate on the melee and ranged attack ratings for strategic combat and AI decisions. Illusion is now only a 2x multiplier instead of a 3x.
(August 20th, 2016, 06:24)Tiltowait Wrote: Another triumph of bugfixing. Thanks Seravy!
You are right. Seravy joined us one year ago on 18th August 2015 and he pushed Master of Magic to a successful rebirth as Caster of Magic in one year only! Thank you very much, Seravy!
You have many spell research mini-descriptions (desc.lbx) incorrect. Pay particular attention to damage-related spells (e.g. lightning bolt), though Warp Node still states it draws only 5 (instead of 15) mana per turn.