Outdated description of Armordefs.lua in Wiki?

Outdated description of Armordefs.lua in Wiki?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Outdated description of Armordefs.lua in Wiki?

Post by Master-Athmos »

I think there is a need for some clarifications and in this process some updates to the Wiki considering the armordefs.

I'll sum up what's the problem here from my point of view. The wiki gives the following information about defining the armordefs.lua:
You get told prior to Spring v95 the armordefs were defined this way:

Code: Select all

if not(Game) or not(Game.version) then
  for categoryName, categoryTable in pairs(armorDefs) do
    local t = {}
    for _, unitName in pairs(categoryTable) do
      t[unitName] = 1
    end
    armorDefs[categoryName] = t
  end
end

return armorDefs
The new way is this though combined with respective entries in the weapons definitions:

Code: Select all

local armorDefs = {
	tanks = {
		"supertank",
		"megatank",
	},

	infantry = {
		"dude",
	},
}

Code: Select all

...
damage = {
	infantry = 60,
	tanks = 5,
},
...
At the end there then is the "more efficient with LUA" chapter:
Spring armor categories are kludgy and messy because they are extremely inefficient. There are a lot of inconsistencies. In some cases, only the first category listed will be obeyed. At other times in that same list, all will be obeyed.

In other words, do not rely on categories too heavily, because you will end up quite frustrated with the results.

You should look at smoth's armor system code. Evo uses it rather extensively.
Disregarding that I don't think the armor categories by itself are in any way kludgy or messy - what a new user bascially is told here is that Spring's armor system is dysfunctional as it sometimes simply doesn't apply the correct damage values. I'd like to have a confirmation if this is true or not because I still vaguely remember smoth doing some LUA magic and that must have been like 10 years ago. So from my point of view I'd say that this issue was fixed with the syntax change in v95 at the latest. Yet still I tried to look this up and I found a little bit here and there but what I saw wasn't really about fixing a broken feature but rather changing the way the armor definition works i.e. the discussions mostly were about writing a LUA replacement for the armordefs that would look up all the unit definitions and get a customparameter from there so that you would define the armor class in the unit definition file instead of having this seperate armordefs file you write the unitnames into manually. I also had a look at the recent Evo and Zero K githubs and while especially what was done for Evo might simply scare off any newbie ( :mrgreen: ), the Zero K way of using armordefs also didn't "fix" anything but it was rather about applying modifiers like 1.5 x damage against shields that are automatically applied...

So to sum this up I think that in contrast to what's said in the Wiki, the armordefs feature is not dysfunct and LUA implementations don't fix the feature itself but rather implement a different way situational damage differences are applied. It would be great to have some official statement considering the functionality though so the Wiki can be fixed and won't confuse anyone else again in the future.

As a final note - I think I also found another outdated Wiki entry considering the LUA access to the armor table:

Code: Select all

table Game.armorTypes (bidirectional)

 example: {
   [1]  = amphibious,   [2] = anniddm,     [3] = antibomber,
   [4]  = antifighter,  [5] = antiraider,  [6] = atl,
   [7]  = blackhydra,   [8] = bombers,     [9] = commanders,
   [10] = crawlingbombs, ...

   ["amphibious"]   = 1, ["anniddm"]    = 2, ["antibomber"] = 3
   ["antifighter"]  = 4, ["antiraider"] = 5, ["atl"]        = 6
   ["blackhydra"]   = 7, ["bombers"]    = 8, ["commanders"] = 9
   ["crawlingbombs"]= 10, ...
 }
This numbered approach that's shown here seems to be the pre 95 syntax so I guess this has changed by now...
saturnV
Posts: 107
Joined: 03 Dec 2020, 07:58

Re: Outdated description of Armordefs.lua in Wiki?

Post by saturnV »

what a new user bascially is told here is that Spring's armor system is dysfunctional as it sometimes simply doesn't apply the correct damage values. I
If such bug exists then why has nobody reported it on bugtracker? It seems extremely unlikely and the only reference is that vague text and some forum posts.
In some cases, only the first category listed will be obeyed. At other times in that same list, all will be obeyed.
What are those cases? At what "other times" does it happen?
the Zero K way of using armordefs also didn't "fix" anything but it was rather about applying modifiers like 1.5 x damage against shields that are automatically applied...
As far I see, this is correct. zero-K just applies some extra math but from engine side during playtime everything works the same. I would guess any "bugs" are/were gameside. For example from evo:

-- put any unit that doesn't go in any other category in medium armor
if (not found) then table.insert(armorDefs.LIGHT, name)

such typos might explain why the categories seemingly do not work.
Post Reply

Return to “Game Development”