FBI batch editor

FBI batch editor

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
muzzybear
Posts: 6
Joined: 10 Jun 2007, 05:09

FBI batch editor

Post by muzzybear »

Hello, just wrote a small toy in case anyone's interested. It's a python script to help manage FBI files in case you need to do repetitive changes to large amount of them. Also practical for dumping information from the files.

EDIT: and ofcourse I screwed up the release, there was a minor bug .. and then I uploaded a version with debug code in it. Ohwell, here's the one that should be fine:
http://spring.unknown-files.net/file/30 ... 07-06-18c/
muzzybear
Posts: 6
Joined: 10 Jun 2007, 05:09

Post by muzzybear »

There are some other uses for my fbi batch editor. For example, we might want to know what's most profitable unit for producing energy. We assume energy gets converted into metal using MMMs, and want to know how long it takes for an unit to pay its own cost back. Units which take more than an hour for payback are excluded.

testfoo.py:

Code: Select all

mmm_ratio = 12.0/600.0

if locals().has_key('energymake') and locals().has_key('energyuse'):
  etotal = float(energymake)-float(energyuse)
  
  if (etotal > 0):
    cost_in_e = float(buildcostenergy) + float(buildcostmetal)/mmm_ratio
    payback_time = cost_in_e / etotal
    if payback_time < 3600:
      print "%4s %25s: %+7.1f  (pays itself in %d s)" % (side, name, etotal, payback_time)
The fbiedit is then invoked with:
fbiedit.py ba\units\*.fbi -f testfoo.py -r

And the results should look like this:

Code: Select all

 ARM   Advanced Fusion Reactor: +3000.0  (pays itself in 173 s)
 ARM  Advanced Solar Collector:   +75.0  (pays itself in 291 s)
 ARM            Air Repair Pad:   +40.0  (pays itself in 875 s)
 ARM                  Colossus:  +225.0  (pays itself in 666 s)
 ARM  Cloakable Fusion Reactor: +1000.0  (pays itself in 243 s)
 ARM            Fusion Reactor: +1000.0  (pays itself in 220 s)
 ARM                    Scarab:  +200.0  (pays itself in 799 s)
 ARM           Solar Collector:   +20.0  (pays itself in 362 s)
CORE                 Bladewing:    +2.0  (pays itself in 1950 s)
CORE   Advanced Fusion Reactor: +3000.0  (pays itself in 166 s)
CORE  Advanced Solar Collector:   +75.0  (pays itself in 281 s)
CORE            Air Repair Pad:   +40.0  (pays itself in 892 s)
CORE                      Hive:  +225.0  (pays itself in 682 s)
CORE            Fusion Reactor: +1100.0  (pays itself in 214 s)
CORE                  Hedgehog:  +200.0  (pays itself in 838 s)
CORE           Solar Collector:   +20.0  (pays itself in 352 s)
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Post by quantum »

Wow, thanks, this will save a lot of time :D
And as a bonus it will make balancing the economy easier :-)
muzzybear
Posts: 6
Joined: 10 Jun 2007, 05:09

Post by muzzybear »

Generic TDF editor in the same spirit:

http://hack.fi/~muzzy/files/tdfedit_2007-06-20.zip

for example, to list crush strengths from moveinfo:
tdfedit.py moveinfo.tdf -e "for k in sorted(TDF.keys()): x=TDF[k]; print '%8s %s' % (x['name'], x['crushstrength'])" -r

or to double them and write to moveinfo.tdf.new:
tdfedit.py moveinfo.tdf -e "for x in TDF.values(): x['crushstrength'] = int(x['crushstrength'])*2" -s .new
Post Reply

Return to “Game Development”