Modules Stats Beta 1.10 current. Updated: 9/16/09 Ver: 1.15

Yes, the last few balance changes have not been incorporated, and none of the DLC is included.

I have all of the modules stats uploaded on the wiki (and they are current/correct); but have not yet made comparison tables for them. Anyone who wants to work on that is quite welcome. :slight_smile:

I’m going to put in some time today and/or tomorrow uploading the rest of the ship hull data and adding the Nomad-specific modules.

Thank you…you’re a good man, my smoke-free friend. :slight_smile:

Sorry for the thread necro, but has anyone expanded this to include all the other races/expansion mods?

Also would there be a way to re-engineer this so you could have the whole of GSB as a csv, and parse back to files at run time, would make it a hell of a lot easier to compare and contrast items

FYI: Generally, I tend to discourage unnecessary thread-bumps to topics with no significant progress to them in over 1 year. This one’s been dead for over two.

I’m not aware of anyone who’s ever completed such a thankless task, let alone in any kind of useful fashion. Our regular forum-active GSB membership these days is not too much more than what can be counted on ten fingers, anyhow.

I agree that would be easier.

mediafire.com/view/?g3po8hzl6oudoy7

^^Only include unmodded content.

BTW, I’m doing the modded content right now, and I’ve just discovered that His Voice got two OP radiation weapons with a decay of 1 O.O

EDIT: Did anyone have a script or something? When I see the work for mod like Matmos Rift, Scavengers, Union, and Praetorian Industries, I don’t have enough courage!

Ok I did the next best thing…

I took the python code, and then created a new folder called mymods and placed every mod I have (pretorian, collective, swarm, etc…) and then ran the script against that.
Am away from my home pc, but I’ll put the spreadsheet up on google docs and share it when I get home today…

Here is the google docs code https://docs.google.com/spreadsheet/ccc?key=0Ahi_8r8IS2dNdDBMVHZYNDJXTFpsendiRGNxbmJMZWc

Added in one column, DPS wrote this as (Damage/Fire Interval)*1000…

it has aliance, alliance, coll,empire,federation,nomads,order,parasites,praetorian,rebel,swarm,tau’ri,tribe (note the spelling mistakes, are in the modules themselves)

Amazing job!
The only problem is that now I must combine the two T.T

There is two things who is missing: The data and the “filename”
(The thing that look like that:)

0 = cost,DECIMAL 1 = weight,DECIMAL 2 = hitpoints,DECIMAL 3 = powerconsumed,DECIMAL 4 = max_range,DECIMAL 5 = damage,DECIMAL 6 = fire_interval,INTEGER 7 = tracking_speed,DECIMAL 8 = shield_penetration,DECIMAL 9 = armour_penetration,DECIMAL 10 = crew_required,INTEGER 11 = min_range,DECIMAL 12 = has_decoys,BOOL 13 = missilespeed,DECIMAL

Edit: Can you (if possible) use the same data order than my own? (In “my” document)

Yeah I’ll look in to it tonight (given time) and pull out the columns in the order you want.
I took out the filename, as it pointed to my modules dump folder and not the original GSB folder (each race having its own modules folder)
getting the original filename will take a whole lot more work, or option2 i can do a concatinated file name of ‘allowed race’ + module file

also what did you mean about ‘The data’

https://docs.google.com/spreadsheet/ccc?key=0Ahi_8r8IS2dNdDhZT3M0RDZDQVJ5YkFnbEdwRXVIWGc

Updated order as requested by @GATC

It’s still not the good order, but I’ll do with that, no problem.

The thing I called “the data” is the 10-15 last line of a module .txt who follow the form:

0 = cost,DECIMAL 1 = weight,DECIMAL 2 = hitpoints,DECIMAL 3 = powerconsumed,DECIMAL 4 = max_range,DECIMAL 5 = damage,DECIMAL 6 = fire_interval,INTEGER 7 = tracking_speed,DECIMAL 8 = shield_penetration,DECIMAL 9 = armour_penetration,DECIMAL 10 = crew_required,INTEGER 11 = min_range,DECIMAL 12 = has_decoys,BOOL 13 = missilespeed,DECIMAL

They are not on your database, even if they are not the most useful data ^^

An right I think I understand now.
The python code reads to key value pairs of data and then creates a spreadsheet of the data
The past lines of the module, that has “the date” might not follow the same format and thus is not extracted
I will see if I can write the code to extract that too.

Also what order do you want the values to be listed in, as that is a simple change to implement.

Is “the date” relivent to you? What are you using it for?

The order I want is the same that in the database of the first post of this topic, if you have the time of course.

Absolutely not. It’s just they were present on the first version. ^^

my GSB python code is available from my dropbox here https://dl.dropbox.com/u/6351180/gsb.py (see code below)
The new code can be run on your folder structure, and it should (will test tonight) read through all the files in the GSB root directory, looking for module folders, then it will look in those folders to intergogate the module files themselves.

This produces a tab-delimited spreadsheet “module_data.tsv” which should be able to be imported in to any spreedsheet program (remember it is TAB delimited)

The first few columns listed are:
“guiname”, “category”, “classname”, “size”, “cost”, “powerconsumed”, “crew_required”, “weight”,“damage”, “fire_interval”, “armour_penetration”, “shield_penetration”, “tracking_speed”, “max_range”, “min_range”, “optimum_range”

Some of these columns will be blank as not all weapons, shields, engines etc. have these values, but all values are listed in the spreadsheet.
Please take the code and edit it to your own needs if you wish, and post back to the community if you do.

@GATC, I looked at the original spreadsheet and he has differentiated all the weapons via thier type etc, whilst the python script reads all the modules and then makes a spreadsheet of all the values of all the items

If you want to just see the weapons then you can filter the spreadsheet on any of the listed columns. Trying to change the python script to format the data like the original post would be wasted effort, for the return.

    import os
    from cStringIO import StringIO

    GSB_FOLDER = r'D:\Games\Gratuitous Space Battles Beta'

    def parse_file(filename):
        f = file(filename)
        lines = f.readlines()
       
        data = {"filename" : filename}
        for l in lines:
            try:
                d = l.split(" = ")
                data[d[0]] = d[1].strip()
            except IndexError:
                pass
        return data

    def get_module_data():

        '''
        module_folder = os.path.join(GSB_FOLDER, 'data', 'modules')
       
        filenames = [os.path.join(module_folder, f) for f in
                      os.listdir(module_folder)]

        data = [parse_file(f) for f in filenames]
        '''
        for root, dirs, files in os.walk(GSB_FOLDER):
            if os.path.basename(root) != 'modules':
                continue
            data = [parse_file(os.path.join(root,f)) for f in files]

        return data

    def make_tsv(first_fields = None, exclude_fields = None):
        if first_fields is None:
            first_fields = []
        if exclude_fields is None:
            exclude_fields = []
           
        data = get_module_data()
       
        fields = set()
        for d in data:
            fields.update(d.keys())
        fields = first_fields + list(fields - set(first_fields)
                                     - set(exclude_fields))
       
        tsv = StringIO()
        for f in fields:
            tsv.write(f + "\t")
        tsv.write("\n")
        for d in data:
            for f in fields:
                try:
                    s = str(d[f])
                    tsv.write(s + "\t")
                except KeyError:
                    tsv.write("\t")
            tsv.write("\n")

        return tsv.getvalue()

    if __name__ == "__main__":
        tsv = make_tsv(["guiname", "category", "classname", "size",
                    "cost", "powerconsumed", "crew_required", "weight",
                    "damage", "fire_interval", "armour_penetration",
                    "shield_penetration", "tracking_speed", "max_range",
                    "min_range", "optimum_range"],
                       [str(n) for n in range(20)])
       
        f = file("module_data.tsv", "w")
        f.write(tsv)
        f.close()