wilbefast wrote:That's the thing though isn't it - everyone thinks that everyone else wants to steal their ideas, but in the end everyone else has their own ideas they want to work on - not somebody else's...
zwzsg wrote:You learn fast
- Written as .bos or .lua?
- .fbi or .lua?
At the beginning of times, there was no .lua.
Spring used retro-engineered Total Annihilation files formats.
- Units "stats sheet" were defined in /units/*.fbi (with syntax similar to windows's .ini file)
- Units "animations scripts" where defined in /scripts/*.bos /scripts/*.cob, where BOS is a compiled
custom language with C-like syntax. You write the .bos, which is the source file, then you use a program called Scriptor.exe to compile it into a .cob, and .cob is the file actually used by the engine.
Then .lua was introduced to Spring.
Lua is an interpreted language, so you don't need any compiler for it, just write it in any text editor (Notepad++ would be a good choice though). Technically, I *think* the lua file are autocompiled by Spring the moment the engine loads them, but for the user it's transparent: You can edit a widget or a gadget, then reload the widget or the gadget, and have your change taken into account while still staying in the game, for instance.
- First Lua was for widget and gadgets.
But .lua is now progressively replacing everything else:
- Whenever someone ask for a feature request that previously could only be implemented engine-side by a C++ dev, now they are told to "Lua it!".
- At some point, the FBI parser that was in the engine was replaced by a FBI parser written in Lua, with the engine loading only the Lua version of the unit defs, allowing people to directly write their unit defs in Lua instead of FBI.
- Recently, Tobi abstracted the unit scripting, and then made it able to use .lua in addition to .cob.
So, now, you can write unitdefs and unit scripts either in Lua, either in the old way (respectively FBI and .cob/.bos). Being old school, I still use .FBI and .bos/.cob, which I find clearer, but I guess everybody else would tell you to forget about FBI and .bos/.cob and use only Lua. Using .lua offer the advantage of easier communication with other .lua stuff, and allow for dynamic stuff with ease. By that I mean, like, your unit "stat sheets" changing according to mod options, or unit scripts sharing tables with gadgets.
As for the syntax, crack open a mod that use them, and look around the wiki.