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

Discussion of the space strategy game where you design ships, issue orders to your fleet, then play hands-off battles against human or AI designed enemies.
User avatar
GATC
Supreme Robot
Supreme Robot
Posts: 295
Joined: Mon Sep 06, 2010 5:10 am
Location: France

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

Postby GATC » Sun Oct 28, 2012 12:54 pm

http://www.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!
Xedilco are coming for you! http://positech.co.uk/forums/phpBB3/viewtopic.php?f=23&t=5506
User avatar
8wGremlin
Junior Line Supervisor
Junior Line Supervisor
Posts: 13
Joined: Tue Dec 20, 2011 10:40 pm

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

Postby 8wGremlin » Mon Oct 29, 2012 1:23 am

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...
User avatar
8wGremlin
Junior Line Supervisor
Junior Line Supervisor
Posts: 13
Joined: Tue Dec 20, 2011 10:40 pm

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

Postby 8wGremlin » Mon Oct 29, 2012 5:23 am

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)
User avatar
GATC
Supreme Robot
Supreme Robot
Posts: 295
Joined: Mon Sep 06, 2010 5:10 am
Location: France

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

Postby GATC » Mon Oct 29, 2012 10:39 am

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:)

Code: Select all

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)
Xedilco are coming for you! http://positech.co.uk/forums/phpBB3/viewtopic.php?f=23&t=5506
User avatar
8wGremlin
Junior Line Supervisor
Junior Line Supervisor
Posts: 13
Joined: Tue Dec 20, 2011 10:40 pm

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

Postby 8wGremlin » Mon Oct 29, 2012 11:37 pm

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'
User avatar
8wGremlin
Junior Line Supervisor
Junior Line Supervisor
Posts: 13
Joined: Tue Dec 20, 2011 10:40 pm

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

Postby 8wGremlin » Tue Oct 30, 2012 5:34 am

User avatar
GATC
Supreme Robot
Supreme Robot
Posts: 295
Joined: Mon Sep 06, 2010 5:10 am
Location: France

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

Postby GATC » Tue Oct 30, 2012 9:00 am

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:

Code: Select all

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 ^^
Xedilco are coming for you! http://positech.co.uk/forums/phpBB3/viewtopic.php?f=23&t=5506
User avatar
8wGremlin
Junior Line Supervisor
Junior Line Supervisor
Posts: 13
Joined: Tue Dec 20, 2011 10:40 pm

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

Postby 8wGremlin » Wed Oct 31, 2012 4:21 am

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?
User avatar
GATC
Supreme Robot
Supreme Robot
Posts: 295
Joined: Mon Sep 06, 2010 5:10 am
Location: France

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

Postby GATC » Wed Oct 31, 2012 9:19 am

8wGremlin wrote: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.

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.

8wGremlin wrote:Is "the date" relivent to you? What are you using it for?

Absolutely not. It's just they were present on the first version. ^^
Xedilco are coming for you! http://positech.co.uk/forums/phpBB3/viewtopic.php?f=23&t=5506
User avatar
8wGremlin
Junior Line Supervisor
Junior Line Supervisor
Posts: 13
Joined: Tue Dec 20, 2011 10:40 pm

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

Postby 8wGremlin » Wed Oct 31, 2012 10:14 pm

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.

Code: Select all

    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()


Return to “Gratuitous Space Battles”

Who is online

Users browsing this forum: No registered users and 1 guest