Unit Morphing LuaRules Gadget
Moderator: Moderators
Unit Morphing LuaRules Gadget
Here's an example of a unit morphing gadget (LuaRules), and its config file.
12.5 MByte video
http://trepan.bzflag.bz/spring/morph.mpeg
LuaRules/Gadgets/unit_morph.lua
http://trepan.homelinux.net/spring/unit_morph.lua
LuaRules/morphdefs.lua (config file)
http://trepan.homelinux.net/spring/morphdefs.lua
Some points:
1. The config file data could be integrated into the FBI files. I much
prefer using lua files as config files (for testing), because their scripting
ability makes it much easier to change multiple entries with less typing.
2. The morph rendering effect is weak, it could be made a lot better.
One thing that I might add is the ability to completely disable the normal
unit rendering to allow some neat clip plane effects. The progress
indicator could be made to look more like the standard ones.
3. Attaching the new unit to a transporter should be possible.
4. This gadget is ".luarules reload" safe, although morphs are restarted.
It will remove and re-add the 'Morph' command to all applicable units
during a reload, and will return the used metal (with normal stopping
penalty) to the unit's team.
12.5 MByte video
http://trepan.bzflag.bz/spring/morph.mpeg
LuaRules/Gadgets/unit_morph.lua
http://trepan.homelinux.net/spring/unit_morph.lua
LuaRules/morphdefs.lua (config file)
http://trepan.homelinux.net/spring/morphdefs.lua
Some points:
1. The config file data could be integrated into the FBI files. I much
prefer using lua files as config files (for testing), because their scripting
ability makes it much easier to change multiple entries with less typing.
2. The morph rendering effect is weak, it could be made a lot better.
One thing that I might add is the ability to completely disable the normal
unit rendering to allow some neat clip plane effects. The progress
indicator could be made to look more like the standard ones.
3. Attaching the new unit to a transporter should be possible.
4. This gadget is ".luarules reload" safe, although morphs are restarted.
It will remove and re-add the 'Morph' command to all applicable units
during a reload, and will return the used metal (with normal stopping
penalty) to the unit's team.
Try this one:
3.3 MByte AVI (ffmpeg -i morph.mpeg morph.avi)
http://trepan.bzflag.bz/spring/morph.avi
3.3 MByte AVI (ffmpeg -i morph.mpeg morph.avi)
http://trepan.bzflag.bz/spring/morph.avi
- Lolsquad_Steven
- Posts: 488
- Joined: 27 Jun 2006, 17:55
1. I used the 'standard' xvidcap codec. Does the AVI version not work?
2. The button is already hooked up. Scan through the code and look
for morphCmdDesc to see how it is done. Note that is works with both
the default control panel and LuaUI (and that an AI can even look for
it by searching through the CommandDescriptions).
You can use the SetUnitRulesParam() command to keep track of
unit states. If you go that route, the information will be maintained even
when LuaRules is shutdown. It can be queried by all lua scripts, and
will probably be made available to the AI interface in the future (once
I've cleaned up the lua scripts, made them easier to use (gadgets), and
finished some of the documentation).
2. The button is already hooked up. Scan through the code and look
for morphCmdDesc to see how it is done. Note that is works with both
the default control panel and LuaUI (and that an AI can even look for
it by searching through the CommandDescriptions).
You can use the SetUnitRulesParam() command to keep track of
unit states. If you go that route, the information will be maintained even
when LuaRules is shutdown. It can be queried by all lua scripts, and
will probably be made available to the AI interface in the future (once
I've cleaned up the lua scripts, made them easier to use (gadgets), and
finished some of the documentation).
Re: Unit Morphing LuaRules Gadget
Not sure if I should post it here or in a new thread, but here it goes. I've cooked up a new version of unit_morph.lua with the following improvements:
-- Default buildtime, buildcostenergy and buildcostmetal is now the difference between original and target unit values
-- Accepts and prioritizes definitions in customData.morphdef
-- Properly talks to multi_tech.lua (tech tree gadget by zwzsg)
-- 'require' entry now require techs instead of units
-- 'require' supports multiple tech requirements (comma-separated)
-- Morph button text now shown in red when requirements not fulfilled
PS.: This version doesn't require an unitdefs_data.lua file (big blob of all units .fbi which I use for Google Sheets integration), simply uncomment the first block within the AddCustomMorphDefs() method for the standard multi-file units definitions.
Hope it helps!
-- Default buildtime, buildcostenergy and buildcostmetal is now the difference between original and target unit values
-- Accepts and prioritizes definitions in customData.morphdef
-- Properly talks to multi_tech.lua (tech tree gadget by zwzsg)
-- 'require' entry now require techs instead of units
-- 'require' supports multiple tech requirements (comma-separated)
-- Morph button text now shown in red when requirements not fulfilled
PS.: This version doesn't require an unitdefs_data.lua file (big blob of all units .fbi which I use for Google Sheets integration), simply uncomment the first block within the AddCustomMorphDefs() method for the standard multi-file units definitions.
Hope it helps!
- Attachments
-
- unit_morph.lua
- (47.4 KiB) Downloaded 15 times
Re: Unit Morphing LuaRules Gadget
Hey MaDDoX, which version of the gadget did you use a base?
Thanks nixtux
Thanks nixtux
Re: Unit Morphing LuaRules Gadget
The latest I could find :)
Forboding Angel has added it successfully to a recent EvoRTS release.
My current dev version also includes morph pause (must have!) and a powerful morph queue, with which you can queue units/structures to be morphed and they're morphed one at a time, to prevent stalling your economy. Not ready for release though, some lingering errors to be fixed.
Other nice things are planned and/or under development, like prioritizing energy/metal/units morphs in the queue, highlight the units in queue (and show their index #) while holding the meta key, etc.
Forboding Angel has added it successfully to a recent EvoRTS release.
My current dev version also includes morph pause (must have!) and a powerful morph queue, with which you can queue units/structures to be morphed and they're morphed one at a time, to prevent stalling your economy. Not ready for release though, some lingering errors to be fixed.
Other nice things are planned and/or under development, like prioritizing energy/metal/units morphs in the queue, highlight the units in queue (and show their index #) while holding the meta key, etc.