Armory Mod - Sp/Mp mod

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

User avatar
Samonella
Posts: 381
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Armory Mod - Sp/Mp mod

Post by Samonella »

Armory Mod is updated for 1.14! The inventory interface is also improved since my last post here, allowing you to view multiple weapons at once.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Trossknecht
Posts: 31
Joined: January 29th, 2016, 11:10 pm

Re: Armory Mod - Sp/Mp mod - Black Cross of Aleron

Post by Trossknecht »

Let me start by saying that the Armory Mod is nothing short of epic. Well done, Samonella!

The mod has worked well with all but one of the 1.14 single-player campaigns that I have played. This is the add-on campaign is "The Black Cross of Aleron."

When I play this campaign with the Armory Mod engaged, I've noticed some interesting effects.

1. When a unit levels up to Level 2, it receives a double allocation of new weapons. This applies to both standard units and units that are peculiar to "The Black Cross of Aleron."

2. When I play the fourth game in the campaign ("Descent into the Orcish Realm"), the time needed for the AI to respond to a turn increases somewhat. This increase, moreover, is progressive. Thus, by the time that I reach the eighth term of the fifth game, the AI requires more than an hour to respond.

I have also reported these things on the thread devoted to the "The Black Cross of Aleron."

For an example of the first phenomenon, see the three level-two units (all elvish sorceresses) at hexes (19,9)(19,8), and (19,7) in the following attachment. One of these (Nëmia) is a generic unit. The other two are "speedy" units peculiar to "The Black Cross of Aleron."
BCoA-Reinforcements from Analandoron-Auto-Save8.gz
(872.92 KiB) Downloaded 455 times
For an example of the second phenomenon, see the second attachment.
BCoA-Tracing the Goblins' Path Turn 14 copy.gz
(205.89 KiB) Downloaded 445 times
User avatar
Samonella
Posts: 381
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Armory Mod - Sp/Mp mod - Black Cross of Aleron

Post by Samonella »

Trossknecht wrote: August 26th, 2018, 8:48 pmLet me start by saying that the Armory Mod is nothing short of epic. Well done, Samonella!
Wow, thanks! :D

Trossknecht wrote: August 26th, 2018, 8:48 pm1. When a unit levels up to Level 2, it receives a double allocation of new weapons. This applies to both standard units and units that are peculiar to "The Black Cross of Aleron."
Looks like the campaign has some code for whenever units level up that's conflicting with mine. Not much I can do except add a warning for when people try to play that campaign with the mod on. :/

Trossknecht wrote: August 26th, 2018, 8:48 pm2. When I play the fourth game in the campaign ("Descent into the Orcish Realm"), the time needed for the AI to respond to a turn increases somewhat. This increase, moreover, is progressive. Thus, by the time that I reach the eighth term of the fifth game, the AI requires more than an hour to respond.
No idea what's happening here, I didn't mess with the ai at all. I guess that scenario must be doing some kind of calculation based on units' attacks.

Thanks for reporting it.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Trossknecht
Posts: 31
Joined: January 29th, 2016, 11:10 pm

Re: Armory Mod - Sp/Mp mod

Post by Trossknecht »

While playing three scenarios from user-made (add-on) single-player campaigns, I encountered a dramatic increase in the time that it took to resolve each turn. That is, each time that I hit the "end turn" button, several minutes (in some cases ten or twenty or more) for the computer to make moves for the enemy team and calculate the results of combats.

The campaigns (scenarios) were as follows:

The Black Cross of Aleron (Reinforcements from Analandoron)
Return from the Abyss (Mud and Iron)
Return from the Abyss (Forrest of the Crossing Paths)

The common elements in all three experiences were:

1. In each scenario, the player controls two groups of characters, rather than the usual one.
2. I was playing each campaign with the "armory modification" installed.
3. The slow down in turn resolution begins after the player gains control of the second group of characters.

Some sample saved turns are attached.
Attachments
RftA-Iron and mud Turn 25 copy.gz
(302.48 KiB) Downloaded 395 times
RftA-Iron and mud Turn 38 copy.gz
(299.94 KiB) Downloaded 436 times
RftA-Iron and mud Turn 47 copy.gz
(305.65 KiB) Downloaded 438 times
User avatar
Samonella
Posts: 381
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Armory Mod - Sp/Mp mod

Post by Samonella »

Thanks for reporting it and providing saves, normally that would be everything I need to figure out the problem. But with this one I really don't know where to start, I didn't mess with the ai at all in this mod and I don't know much about the ai in general. I'll mess around with the saves and look through those scenarios' code but I'm not expecting any success.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Can-ned_Food
Posts: 217
Joined: December 17th, 2015, 10:27 pm

Re: Armory Mod - Sp/Mp mod

Post by Can-ned_Food »

My first thought, and probably many others' too, would be that so many available combinations of attacks causes the computations to slog through processing which doesn't predict each combination in parallel — but I don't know what I'm talking about there, because I've not looked at how it processes combat or whether multithreading doesn't operate so well in the versions compiled for some OS platforms as it does for others.

I do know that it anticipates level–up healing in the predictions, but I do not know how: does it presume [advancement] healing, or does it actually look at the changes applied with the level–up?
Anyway, that probably doesn't have any pertinence here.

I wonder whether the same slow–down would occur if a [side] controller=ai had more than one [side] as enemy, regardless of who controlled that side.
Does it occur in skirmish, i.e. non–campaign, games?
User avatar
Samonella
Posts: 381
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Armory Mod - Sp/Mp mod

Post by Samonella »

Can-ned_Food wrote: December 28th, 2018, 11:39 pm My first thought, and probably many others' too, would be that so many available combinations of attacks causes the computations to slog through processing
That was my first thought too, but if that was the case then this kind of slow down would happen in all large scenarios. I played through several campaigns and never saw anything like it. I'll have to try it in a really, really big 1v1 too rule this out for sure.
Can-ned_Food wrote: December 28th, 2018, 11:39 pmI've not looked at how it processes combat or whether multithreading doesn't operate so well in the versions compiled for some OS platforms as it does for others.
I was under the impression that wesnoth had no parallelization at all?
Can-ned_Food wrote: December 28th, 2018, 11:39 pmI do know that it anticipates level–up healing in the predictions, but I do not know how: does it presume [advancement] healing, or does it actually look at the changes applied with the level–up?
If it was simulating the advance and all the events that go with it then that could be a lengthy computation, but that seems pretty unlikely. And again that would slow it down in any large match.
Can-ned_Food wrote: December 28th, 2018, 11:39 pmI wonder whether the same slow–down would occur if a [side] controller=ai had more than one [side] as enemy, regardless of who controlled that side.
Does it occur in skirmish, i.e. non–campaign, games?
This is a good idea to test. I did do a fair number of multiplayer games where the ai had multiple enemies, but they were all on very small maps, no more than 20 units per side. Also, I know I've played games with an allied AI against multiple AI enemies (like the first scenario of HttT) without problems.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
HSFreitas
Posts: 3
Joined: February 27th, 2019, 3:39 pm

Re: Armory Mod - Sp/Mp mod

Post by HSFreitas »

Como funciona esse mod?
semaphore
Posts: 3
Joined: January 26th, 2021, 10:56 pm

Re: Armory Mod - Sp/Mp mod - Black Cross of Aleron

Post by semaphore »

Trossknecht wrote: August 26th, 2018, 8:48 pm Let me start by saying that the Armory Mod is nothing short of epic. Well done, Samonella!
I must echo Trossknecht's sentiments. This is truly outstanding work!

However, there is an issue where Armory Mod will overwrite any external changes to the unit's attack the next time armory_rebuild_unit is triggered. This causes conflicts with several mods that modify the unit's attack.

Some mods make changes to the unit attack directly, either temporarily or permanently. For examples, XP Modification makes permanent changes the attack damage, whereas a mod like "Different Luck" adds a temporary sniper [special] to the unit's attack that get reverted after combat; but if the opposing unit is killed or the unit levels up then the armory_rebuild_unit event will conflict and stop it from reverting. When this happens, the sniper special somehow ends up getting duplicated exponentially every time armory_rebuild_unit or armory_udpate_unit_vars is called (need to investigate to figure out exactly what is going on).

Other mods make changes to the attack through use of objects (e.g. "Artifact Mod"). So if you pick up an object with an effect that applies to the unit's attack, those changes will get overwritten even though the unit still has the object.

I don't know if there is anything to be done about mods that change the attack directly. As you mentioned earlier in the thread, it's a bad idea to update the armorymod weapon's stats to reflect permanent changes, and it's infeasible/impossible to keep track of these direct changes to separate ones that may be temporary. However, armory mod should be able to coexist with mods that use objects to modify the attack values.

To this end, I modified the armory_rebuild_unit event to create and immediately remove a dummy object in order to trigger a "recalculation" of the unit's objects (reverting unit to base, then reapplying each object in sequence). I put it at the very end of the event after cleanup so the object changes will persist:

Code: Select all

	# create then immediately remove this dummy object in order to trigger a "recalculation" of any object effects that modify the attack
	[object]
		id="armorymod_temp_rebuilder"
		take_only_once=no
		[filter]
			id=${WORKSPACE}unit.id
		[/filter]
	[/object]
	[remove_object]
		id=${WORKSPACE}unit.id
		object_id="armorymod_temp_rebuilder"
	[/remove_object]

	{CLEAR_VARIABLE armorymod.rebuild_unit}
[/event]

#undef WORKSPACE
So far, this seems to fix the issue and object modifications are applied properly (including to new weapons that get picked up later); but I don't know if this will have unintended consequences elsewhere, so I will test it out for a while to see if any issues arise. I'm also not familiar with WML, so I don't know if this is even the best way to trigger this "recalculation".

Assuming this change I made is sound, I'll try to modify some of those aforementioned mods to use objects to alter the attack instead of making direct changes (but I only wish their code was as clean and well commented as yours ;))

Anyway, let me know what you think.
semaphore
Posts: 3
Joined: January 26th, 2021, 10:56 pm

Re: Armory Mod - Sp/Mp mod - Black Cross of Aleron

Post by semaphore »

semaphore wrote: January 27th, 2021, 12:27 am but I don't know if this will have unintended consequences elsewhere, so I will test it out for a while to see if any issues arise.
I've just discovered such a consequence to my approach. The "recalculation" of the objects at the end of the armory_rebuild_unit event ends up with attacks that no longer have the [armorymod_type] special on them and so they end up getting re-indexed each time armory_update_unit_vars is run, leading to duplicated weapons :oops:

I'm thinking either the special has to be re-added to all the weapons after the "recalculation" step (which seems difficult, clunky, and wasteful) or the special should be added in a way that allows it to get re-added automatically when objects are "recalculated" like this (e.g. using objects or some other WML feature I'm not yet aware of).

I will have to investigate further. Back to the drawing board for me!
semaphore
Posts: 3
Joined: January 26th, 2021, 10:56 pm

Re: Armory Mod - Sp/Mp mod

Post by semaphore »

After playing with it some more and getting acquainted with WML, I've realized my approach is completely nonviable. Recalculating the unit by invoking [remove_object] in the armory_rebuild_unit event just leads to all of armorymod's attack changes getting overwritten. It only seemed like it was working because I merely tested it briefly by picking up weapons that the unit had dropped itself. The attacks don't show up at all when picking up someone else's weapons, and the attacks are not removed when dropping them either.

I was hoping this would be a quick fix, but it looks like there is no easy way around this issue in the short term. There's another approach I'm considering to fix this issue, but it is very involved and would require a complete overhaul of how Armory Mod stores weapons:
Spoiler:
User avatar
Samonella
Posts: 381
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Armory Mod - Sp/Mp mod - Black Cross of Aleron

Post by Samonella »

semaphore wrote: January 27th, 2021, 12:27 am (I only wish their code was as clean and well commented as yours ;))
That's some praise I'm not sure I deserve! :lol: Glad you enjoyed Armory Mod so much!

Yeah it always bugged me that even something as simple as holy water made the mod act up so much, but I couldn't think of easy solutions and it never quite bothered me enough to make a serious attempt at fixing it. I vaguely remember thinking about using [object]s back when I was making this... I knew wml just about inside and out back then, but not so much now. One possibility I remember thinking about would be a Diff tool, for finding the difference between what the unit's attacks look like and what it should look like according to the weapons and skills. You could use that to modify the weapons until they match. I guess you'd have to look at the unit's [object]s to see if the change is supposed to expire at the end of scenario or whatever, and make a note in the weapon variable. That would be a LOT of work to implement though.

Wish I could be of more help. But I will try to make time to help test, proof read, answer questions about armorymod code, etc.
semaphore wrote: January 27th, 2021, 9:12 am If only there were a way to access the unit_type directly...
There is [store_unit_type]. Memory is really foggy but I feel like it was hard to use for some reason... I don't remember exactly what data it stored. I remember I wanted to use it for checking unit's skills, instead of making variables for it, and there was some reason it didn't work. Maybe you've already considered it and it doesn't fit the problem. Actually I think I remember the problem: I wanted units to retain skills from previous levels, but there's no way to see what units advance TO a given unit, only FROM. Unless you want to use [store_unit_type_ids], use [store_unit_type] for every unit in existence, parse the entire list and make your own advancement trees.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
User avatar
Wedge009
Developer
Posts: 17
Joined: June 24th, 2009, 11:17 am
Location: Sydney, Australia

Re: Armory Mod - Sp/Mp mod

Post by Wedge009 »

Greetings. I'm not sure if it's necessarily your add-on that's responsible but when I scroll to it in the add-on manager for 1.15 I get the following message (twice) in the error log:

Code: Select all

error display: ~BLIT(): image not found: 'units/dunefolk/blademaster.png'
The image appears to have been moved to

Code: Select all

units/dunefolk/soldier/blademaster.png
for 1.15/1.16.
Soli Deo Gloria
User avatar
Samonella
Posts: 381
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Armory Mod - Sp/Mp mod

Post by Samonella »

I'll get right on that, thanks for letting me know!
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Post Reply