wanted: script to clean up unitdef files

wanted: script to clean up unitdef files

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
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

wanted: script to clean up unitdef files

Post by knorke »

Seeing the scripts by yanom and Cubex, I thought it might be cool to have a script to clean up unitdef files.

The problem:
In many mods, the tags in units files are basically ordered randomly.
I facepalm every time I open a unit file. (in my mod too :roll: )
ctrl-f all the things?


Random example:
Say you want to edit the movent of that unit then you want to look at:
acceleration, brakeRate maxVelocity and turnRate
Those tags kind of go together in function.
In that file they are dozens of lines apart, that is annoying.

The idea:
Someone make a thingy to neatly reorder the lines like this:

Code: Select all

--Cost--
buildCostMetal = 500,
buildCostEnergy = 0,
buildTime = 25,
--Health--
maxDamage = 1500,
idleAutoHeal = 0,
--Movement--
maxVelocity = 3.0,
Acceleration = 0.5,
BrakeRate = 0.3,
FootprintX = 3,
...
The to-be order could be defined in some config file that lists the tags in the shall-be order.
Inspiration might be the grouping on this page:
http://springrts.com/wiki/Units-UnitDefs

Any unlisted tags can be considered invalide and should be removed. (maybe keep them at the end of the new file, commentated out, for manual checking)

pro tip:
If it was some .lua file that can simply be included in unitdefs_post.lua, then it would be simplest to use: No need to install funny frameworks or figuring out how they work ;)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: wanted: script to clean up unitdef files

Post by FLOZi »

Evil4Zerggin made a python script which s44 used for a long time, but it is for fbi/tdf. It stripped out junk tags, alphabetized and also allowed arbitrary modifiers to numerical values e.g. all LOS ranges doubled (ofc that is mostly done via defs_post now).

( http://spring1944.svn.sourceforge.net/v ... gin/pytdf/ )

Grouping on the wiki page is ok but order is mostly that of the source code with the occasional rearrangement by my whim / perceived utility, alphabetical might be better.
Last edited by FLOZi on 31 Oct 2012, 20:40, edited 1 time in total.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: wanted: script to clean up unitdef files

Post by PicassoCT »

i heavily disagree. alphabetical order is not the correct approach.

Statisticall likelyhood to be tweaked and changed would be the more appropriate sorting criteria.

Additonal Mainfunctions
Speed
Hitpoints
Weapons

Sorted into groups,necessary tags bevor behaviour, behaviour before looks, looks bevor comented out stuff
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: wanted: script to clean up unitdef files

Post by Jools »

How about we group them with the same logic that our QWERTY keyboards work: avoid putting often used tags adjacent to that they will not 'jam' (like keyboard keys).
Post Reply

Return to “Game Development”