Move armordefs to unitdefs

Move armordefs to unitdefs

Requests for features in the spring code.

Moderator: Moderators

User avatar
code_man
Posts: 260
Joined: 19 Jan 2014, 13:10

Move armordefs to unitdefs

Post by code_man »

It seems really stupid to me having to write down all the unit names in a single sperate file instead of just being able to declare the armor inside the unitdefs themselfs.

I know its a small thing, but this gave me some grief and its really an oditty.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Move armordefs to unitdefs

Post by SinbadEV »

code_man wrote:It seems really stupid to me having to write down all the unit names in a single sperate file instead of just being able to declare the armor inside the unitdefs themselfs.

I know its a small thing, but this gave me some grief and its really an oditty.
... couldn't you have the unitdefs define an armordef property and just have a script in armordefs that sets the armordef of each unitdef to said value?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Move armordefs to unitdefs

Post by smoth »

Really dude? Codeman I did this sat least 3 years ago bro! EVO RTS uses the code
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Move armordefs to unitdefs

Post by Silentwings »

I guess the point is that usually what one wants to know is which units are in a particular armordef.

Either way - amordefs could be indexed via category names or via unit names - you have to text search when you want to see the information indexed the other way around. This way you only have to text search one file instead of all your unitdefs.
User avatar
code_man
Posts: 260
Joined: 19 Jan 2014, 13:10

Re: Move armordefs to unitdefs

Post by code_man »

SinbadEV wrote: ... couldn't you have the unitdefs define an armordef property and just have a script in armordefs that sets the armordef of each unitdef to said value?
Well i could ... or the engine could just have a armor parameter builtin so armordefs isnt needed anymore at all.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Move armordefs to unitdefs

Post by Anarchid »

I wonder if there's an armordefs_post... that'd make that stuff easy.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Move armordefs to unitdefs

Post by SinbadEV »

code_man wrote:
SinbadEV wrote: ... couldn't you have the unitdefs define an armordef property and just have a script in armordefs that sets the armordef of each unitdef to said value?
Well i could ... or the engine could just have a armor parameter builtin so armordefs isnt needed anymore at all.
In the TA paradigm things like armordefs and movedefs are expected to be shared by multiple units so setting them in a central place made more sense than duplicating the same settings in every unit that had the same armor or movement parameters.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Move armordefs to unitdefs

Post by smoth »

:twisted: anarchid, It would wouldn't it... ;)

Lol nah sinbad
User avatar
code_man
Posts: 260
Joined: 19 Jan 2014, 13:10

Re: Move armordefs to unitdefs

Post by code_man »

SinbadEV wrote: In the TA paradigm things like armordefs and movedefs are expected to be shared by multiple units so setting them in a central place made more sense than duplicating the same settings in every unit that had the same armor or movement parameters.
Movedefs make kinda sense, but armordefs.lua is just a a list of a list with unit names.
I cannot imagine armordefs.lua ever being an advantage over a simple armor parameter in the unitdefs.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Move armordefs to unitdefs

Post by smoth »

The solution is simple lua
User avatar
code_man
Posts: 260
Joined: 19 Jan 2014, 13:10

Re: Move armordefs to unitdefs

Post by code_man »

smoth wrote:The solution is simple lua
Seems like serious overkill to me, a simple unitdef param in the engine and marking armordefs.lua as deprecated would do it i think. I doubt anyone would miss that file.
But well i guess having lua read it from customparams is gonna do the trick ok.
Tough i still hope devs would consider this, it seems very out of place to me and inconsitency can drag itself a long way.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Move armordefs to unitdefs

Post by smoth »

Adding to the engine is overkill when you could have already added it
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Move armordefs to unitdefs

Post by Silentwings »

Seems like serious overkill to me, a simple unitdef param in the engine and marking armordefs.lua as deprecated would do it i think. I doubt anyone would miss that file.
I would miss it, for reasons explained above.
User avatar
code_man
Posts: 260
Joined: 19 Jan 2014, 13:10

Re: Move armordefs to unitdefs

Post by code_man »

smoth wrote:Adding to the engine is overkill when you could have already added it
I dont see why armor should be treated any different from say autoheal or category or sounds or maybe even build parameters.
What bothers me is that this is the only param that must be specified in a seperate file with a different format.
Now being able to compute parameters trough lua is great and all, but in this case it just feels like doing extra work that could be done by the engine simply having another unitdef param, considering dmg calculations are already done by the engine its more like having to "fix" something the engine should be handling straight forward.
Silentwings wrote: I would miss it, for reasons explained above.
Assuming you reference your post above, then i dont see how say health doenst fall in the same batch as armor.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Move armordefs to unitdefs

Post by smoth »

Ok I do not agree and see we are now in the realm of opinions. your problem is easily solved if you would bother to spend some actual time looking into it
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Move armordefs to unitdefs

Post by Silentwings »

Assuming you reference your post above, then i dont see how say health doenst fall in the same batch as armor.
I rarely have a need to know e.g. a list of units that have >x heath. However, I do often want to know how much health unit y has. So health is better in unitdefs.

Maybe you didn't understand above so let me give you a specific example - whenever I redesign a unit (in particular, how much damage it does) I need to know how much damage it does to each other unit. For that I need a place to look up the armourclasses of _all_ units, ideally one that doesn't involve a grep across multiple files. So armourclass is better not in unitdefs.
User avatar
code_man
Posts: 260
Joined: 19 Jan 2014, 13:10

Re: Move armordefs to unitdefs

Post by code_man »

Silentwings wrote:
Assuming you reference your post above, then i dont see how say health doenst fall in the same batch as armor.
I rarely have a need to know e.g. a list of units that have >x heath. However, I do often want to know how much health unit y has. So health is better in unitdefs.

Maybe you didn't understand above so let me give you a specific example - whenever I redesign a unit (in particular, how much damage it does) I need to know how much damage it does to each other unit. For that I need a place to look up the armourclasses of _all_ units, ideally one that doesn't involve a grep across multiple files. So armourclass is better not in unitdefs.
I dont get it, if you want to know much damage it does against other units then you still need the heath from each of the unitdefs.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Move armordefs to unitdefs

Post by knorke »

I agree it is a bit of oddity.
While ago there was armor.txt which afaik was really just a list of unit names, guess that where it comes from.

Deprecating armordefs.lua is not good idea imo. Usually cleaning things up a bit is nice but here is not much too gain. All mods would need updating and the easiest fix would be to "reinvent" the armordefs.lua...

Like SinbadEV said, in armordefs.lua you can read the unitDefs table and all parameters of units.
So can read the units parameters and build your armor table based on that. For example: http://sourceforge.net/p/mwspring/code/ ... ordefs.lua from http://springrts.com/wiki/Armordefs.lua ... e_Examples
In your case it would be simpler, maybe something like this:

Code: Select all

for unitName, unitDef in pairs(unitDefs) do
  table.insert(armorDefs[unitDef.customparams.armorType], unitName)
end
(just to show principle idea)
Putting such construct in armordefs.lua basically does what you want: Can now put armorType="paperarmor" in unit files.
Yes maybe it would "feel cleaner" in engine, but you could just never look at the file ;) because functionality wise it is the same.

armordefs_post: what would it do that armordefs.lua can not do already?
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Move armordefs to unitdefs

Post by Silentwings »

I dont get it, if you want to know much damage it does against other units then you still need the heath from each of the unitdefs.
No, I don't. (Although, if I did want to know that, which as I said above I rarely do, unlike armordefs, I can pretty remember all those anyway.)
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Move armordefs to unitdefs

Post by Forboding Angel »

Code_man, you aren't getting it. It has already been done. I can help you out if you like whenever I have a chance.
Post Reply

Return to “Feature Requests”