Move armordefs to unitdefs
Moderator: Moderators
Move armordefs to unitdefs
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.
I know its a small thing, but this gave me some grief and its really an oditty.
Re: Move armordefs to unitdefs
... 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?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.
Re: Move armordefs to unitdefs
Really dude? Codeman I did this sat least 3 years ago bro! EVO RTS uses the code
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Move armordefs to unitdefs
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.
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.
Re: Move armordefs to unitdefs
Well i could ... or the engine could just have a armor parameter builtin so armordefs isnt needed anymore at all.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?
Re: Move armordefs to unitdefs
I wonder if there's an armordefs_post... that'd make that stuff easy.
Re: Move armordefs to unitdefs
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.code_man wrote:Well i could ... or the engine could just have a armor parameter builtin so armordefs isnt needed anymore at all.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?
Re: Move armordefs to unitdefs
anarchid, It would wouldn't it...
Lol nah sinbad
Lol nah sinbad
Re: Move armordefs to unitdefs
Movedefs make kinda sense, but armordefs.lua is just a a list of a list with unit names.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.
I cannot imagine armordefs.lua ever being an advantage over a simple armor parameter in the unitdefs.
Re: Move armordefs to unitdefs
The solution is simple lua
Re: Move armordefs to unitdefs
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.smoth wrote:The solution is simple lua
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.
Re: Move armordefs to unitdefs
Adding to the engine is overkill when you could have already added it
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Move armordefs to unitdefs
I would miss it, for reasons explained above.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.
Re: Move armordefs to unitdefs
I dont see why armor should be treated any different from say autoheal or category or sounds or maybe even build parameters.smoth wrote:Adding to the engine is overkill when you could have already added it
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.
Assuming you reference your post above, then i dont see how say health doenst fall in the same batch as armor.Silentwings wrote: I would miss it, for reasons explained above.
Re: Move armordefs to unitdefs
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
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Move armordefs to unitdefs
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.Assuming you reference your post above, then i dont see how say health doenst fall in the same batch as armor.
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.
Re: Move armordefs to 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.Silentwings wrote: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.Assuming you reference your post above, then i dont see how say health doenst fall in the same batch as armor.
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.
Re: Move armordefs to unitdefs
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:(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?
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
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?
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Move armordefs to 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.)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.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Move armordefs to unitdefs
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.