Page 1 of 1

Even more mod defs flexibility

Posted: 05 Sep 2007, 04:10
by trepan

Code: Select all

* Added 'gamedata/defs.lua'
 - returns a table that contains the UnitDefs, FeatureDefs, and WeaponDefs
 - parsed using CGame::defsParser, and deleted before the game starts
 - allows modders to automate inter-def dependencies
   (ex: feature metal vs. unit metal cost, or fully defined weapons in unitDefs)
Actually, this could have been done before defs.lua was added (with the other
*.lua defs files), but it would have taken a full reload of unitDefs to make them
available to featureDefs (because they were running in different script environments).

http://spring.clan-sy.com/fisheye/chang ... g/?cs=4316

Posted: 05 Sep 2007, 10:21
by KDR_11k
Hm, can we also get some form of COB parser? With that we could e.g. generate modular units from a set of weapons and chassises but we would still have to manually COB them all.

Posted: 05 Sep 2007, 13:42
by trepan
It sounds to me like you want a BOS -> COB compiler built into the engine,
and a way to modify the input BOS file before it gets compiled. Could you
explain exactly what you want?

P.S. Implementing my version of your suggestion would probably mean that
it would take significantly longer to load mods with a lot of units.

Posted: 05 Sep 2007, 14:23
by Argh
What we ultimately need is a JIT for BOS, or a BOS --> LUA solution. I'm more than a little concerned about performance, however- COB may be a stupid language, and lacks some features, but it's very fast, when optimized correctly.

Posted: 05 Sep 2007, 14:45
by trepan
http://spring.clan-sy.com/phpbb/viewtop ... 589#166589

But's thats not really the point of this thread...

Posted: 05 Sep 2007, 15:03
by KDR_11k
trepan wrote:It sounds to me like you want a BOS -> COB compiler built into the engine,
and a way to modify the input BOS file before it gets compiled. Could you
explain exactly what you want?

P.S. Implementing my version of your suggestion would probably mean that
it would take significantly longer to load mods with a lot of units.
Not necessarily modify much, just being able to "copy" a COB would be a good deal (e.g. Spring.LoadCobAs(cobname, newname)). Imagine you have e.g. ten levels of creep and you want to use lua defs to create the defs for the different levels while only making one definition file for the creep type. Now this would be fine except you won't have matching COBs for your different creeps so if you have ten levels of creeps you still need to have the creep1.cob - creep10.cob files and if you decide to add ten more levels you'll have to manually copy those files to creep11.cob and so on.

For handling differences in the intended script behaviour I think it'd be enough to initialize some static-var differently for each creep level and let the scripter have his code branch if he needs that. This part could probably be handled by a LuaRule anyway so any code for that in the def stuff would be merely for convenience.