Challenge unpacker

is anyone interested in such a thing?

I am, if you mean something that would take .gsb files and turn them into readable deployments. Of course, it does let you see what opponents have the easy way, potentially without fighting them. On the other hand, it’s not as if people can’t observe 90% of that stuff yourself, and it would be handy for other things…

messy, about as unfriendly as is possible, but it should do it. python.
you can can run it, you should be able to figure out how to

[code]import struct
import sys

class reader:
def init(self,name):
self.pointer=0
self.data=open(name,‘rb’).read()
print "length: ",len(self.data)
self.pointer=4

def getstr(self,debug=0):
    start=self.pointer
    stop=start+struct.calcsize('l')
    if debug: print start,stop,len(self.data)
    ret=struct.unpack('l',self.data[start:stop])
    num=ret[0]
    start,stop=stop,stop+struct.calcsize('B'*num)
    chars=struct.unpack(str(num)+'s',self.data[start:stop])
    self.pointer=stop
    return chars[0]

def getlong(self):
    start=self.pointer
    stop=start+struct.calcsize('l')
    ret=struct.unpack('l',self.data[start:stop])
    self.pointer=stop
    return ret[0]

def getfloat(self):
    start=self.pointer
    stop=start+struct.calcsize('f')
    ret=struct.unpack('f',self.data[start:stop])
    self.pointer=stop
    t=float(int(ret[0]*100))/100
    return t

def read_ship(self,dump_ship=0):
    shipname=self.getstr()
    if dump_ship:
        output=open(shipname+".txt",'w')
    else:
        output=sys.stdout
    shipgui=self.getstr()
    hull=self.getstr()
    modules=self.getlong()
    slots=[]
    for i in range(modules):
        module=self.getstr()
        slot=self.getlong()
        slots.append(module)

    out="[config]\n"
    out+="name = "+shipname+"\n"
    out+="guiname = "+shipgui+"\n"
    out+="hull = "+hull+"\n"
    out+="cost = 1"+"\n"
    out+="\n[modules]"+"\n"
    for i in range(modules):
        out+=str(i)+" = "+slots[i]+"\n"

    output.write(out)

    if dump_ship:
        output.close()
    return

def read_deploy(self,dump=0):
    name=self.getstr()
    design=self.getstr()
    dunno=self.getlong()
    quantity=self.getlong()
    shipid=self.getlong()
    x=int(self.getfloat())
    y=int(self.getfloat())
    out="[ship"+str(shipid-1)+"]\n"
    out+="shipid = "+str(shipid)+"\n"
    out+="name = "+name+"\n"
    out+="design = "+design+"\n"
    out+="pos = %d,%d\n" % (x,y)
    out+="quantity = "+str(quantity)+"\n"
    out+="angle = 90\n"
    num_behaviours=self.getlong()
    for b in range(num_behaviours):
        prob=self.getfloat()
        dist=self.getfloat()
        huh=self.getlong()
        behaviour=self.getstr()

        out+="behaviour_%d = %s,%d,%.2f,%.2f\n" % (b,behaviour,huh,prob,dist)
    out+="angle = 90\n"
    return out


def read_gsb(self):
    opponent=self.getstr()
    description=self.getstr()
    name=self.getstr()
    scenario_file=self.getstr()
    sc_name=self.getstr()
    sc_image_file=self.getstr()
    sc_icon_file=self.getstr()
    self.pointer+=37
    mods=self.getstr()
    ships=self.getlong()
    for index in range(ships):
        self.read_ship(1)

    ships=self.getlong()
    output=""
    for index in range(ships):
        output+=self.read_deploy(1)
    o=open("deployage.txt",'w')
    o.write(output)
    o.close()
    

    print description

r=reader(‘4397933.gsb’)
r.read_gsb()

exit()
[/code]

Good job. Cliffski’s challenge:

[ship0] shipid = 1 name = Fun With Fusion design = multiple warhead challenger pos = 495,723 quantity = 1 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.10,300.00 behaviour_1 = ATTACK_FRIGATES,-1,0.50,935.71 behaviour_2 = ATTACK_CRUISERS,-1,1.00,985.71 behaviour_3 = CO_OPERATIVE,-1,0.00,0.00 behaviour_4 = VULTURE,-1,0.00,0.00 angle = 90 [ship1] shipid = 2 name = Total Overkill design = all purpose challenger frigate pos = 395,550 quantity = 1 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.30,500.00 behaviour_1 = ATTACK_FRIGATES,-1,0.69,428.57 behaviour_2 = ATTACK_CRUISERS,-1,0.50,835.71 behaviour_3 = RETALIATE,-1,0.00,0.00 angle = 90 [ship2] shipid = 3 name = Warped Mind design = ultimate armored challenger pos = 218,678 quantity = 1 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.00,557.14 behaviour_1 = ATTACK_FRIGATES,-1,0.69,564.28 behaviour_2 = ATTACK_CRUISERS,-1,1.00,571.42 behaviour_3 = CO_OPERATIVE,-1,0.00,0.00 angle = 90 [ship3] shipid = 4 name = Victory Or Death design = ultimate armored challenger pos = 200,1070 quantity = 1 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.00,557.14 behaviour_1 = ATTACK_FRIGATES,-1,0.69,564.28 behaviour_2 = ATTACK_CRUISERS,-1,1.00,571.42 behaviour_3 = CO_OPERATIVE,-1,0.00,0.00 angle = 90 [ship4] shipid = 5 name = The Zap Wagon design = ecm challenger frigate pos = 128,539 quantity = 1 angle = 90 behaviour_0 = ATTACK_FRIGATES,-1,0.08,500.00 behaviour_1 = ATTACK_CRUISERS,-1,1.00,614.28 angle = 90 [ship5] shipid = 6 name = Stellar Badass design = ecm challenger frigate pos = 82,1186 quantity = 1 angle = 90 behaviour_0 = ATTACK_FRIGATES,-1,0.08,500.00 behaviour_1 = ATTACK_CRUISERS,-1,1.00,614.28 angle = 90 [ship6] shipid = 7 name = Die Puny Humans! design = all purpose challenger frigate pos = 363,1253 quantity = 1 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.30,500.00 behaviour_1 = ATTACK_FRIGATES,-1,0.69,428.57 behaviour_2 = ATTACK_CRUISERS,-1,0.50,835.71 behaviour_3 = RETALIATE,-1,0.00,0.00 angle = 90 [ship7] shipid = 8 name = Galactic Maniac design = dogfight challenger pos = 222,503 quantity = 16 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.95,200.00 behaviour_1 = ATTACK_FRIGATES,-1,0.40,200.00 behaviour_2 = ATTACK_CRUISERS,-1,0.20,200.00 behaviour_3 = ESCORT,3,0.00,0.00 angle = 90 [ship8] shipid = 9 name = Nuclear Kitten design = dogfight challenger pos = 213,1306 quantity = 16 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.95,200.00 behaviour_1 = ATTACK_FRIGATES,-1,0.40,200.00 behaviour_2 = ATTACK_CRUISERS,-1,0.20,200.00 behaviour_3 = ESCORT,4,0.00,0.00 angle = 90 [ship9] shipid = 10 name = Planet Pounder design = multiple warhead challenger pos = 512,1139 quantity = 1 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.10,300.00 behaviour_1 = ATTACK_FRIGATES,-1,0.50,935.71 behaviour_2 = ATTACK_CRUISERS,-1,1.00,985.71 behaviour_3 = CO_OPERATIVE,-1,0.00,0.00 behaviour_4 = VULTURE,-1,0.00,0.00 angle = 90 [ship10] shipid = 11 name = Andromeda or Bust design = multiple warhead challenger pos = 506,919 quantity = 1 angle = 90 behaviour_0 = ATTACK_FIGHTERS,-1,0.10,300.00 behaviour_1 = ATTACK_FRIGATES,-1,0.50,935.71 behaviour_2 = ATTACK_CRUISERS,-1,1.00,985.71 behaviour_3 = CO_OPERATIVE,-1,0.00,0.00 behaviour_4 = VULTURE,-1,0.00,0.00 angle = 90 [ship11] shipid = 12 name = Lasers R Us design = ecm challenger frigate pos = 240,893 quantity = 1 angle = 90 behaviour_0 = ATTACK_FRIGATES,-1,0.08,500.00 behaviour_1 = ATTACK_CRUISERS,-1,1.00,614.28 angle = 90

Shoot, I should have read this post some hours ago. Anyway, i wrote my own gsb extractor as I wanted to look into the feasibility of writing a ship / challenge generator. Is there a project you are working on?

Anyway, here is what clifski’s ships are :wink:

==== TYPE: multiple warhead challenger (multiple warhead challenger) ====
  Alliance Alligator Cruiser hull
    Mod cruiser_ecm shock at 0
    Mod cruiser missile multiple at 1
    Mod cruiser missile multiple at 2
    Mod cruiser missile multiple at 3
    Mod cruiser missile multiple at 4
    Mod cruiser_engine V at 5
    Mod cruiser_engine V at 6
    Mod cruiser power at 7
    Mod cruiser power at 8
    Mod cruiser crew II at 9
    Mod cruiser_ecm shield at 10
    Mod cruiser shield II at 11
    Mod cruiser shield II at 12
    Mod cruiser powered armor at 13
==== TYPE: all purpose challenger frigate (all purpose challenger frigate) ====
  Alliance Cobra Frigate hull
    Mod frigate_laser at 0
    Mod frigate crew at 1
    Mod frigate_laser at 2
    Mod frigate_laser at 3
    Mod frigate power II at 4
    Mod frigate crew at 5
    Mod frigate_armour III at 6
    Mod frigate_armour III at 7
    Mod frigate plasma at 8
    Mod frigate plasma at 9
    Mod frigate shield II at 10
    Mod frigate shield II at 11
    Mod frigate_engine II at 12
==== TYPE: ultimate armored challenger (ultimate armored challenger) ====
  Alliance Stingray Cruiser hull
    Mod cruiser_alliance_beamlaser at 0
    Mod cruiser_repair_armor1 at 1
    Mod cruiser_repair_armor1 at 2
    Mod cruiser_engine III at 3
    Mod cruiser_engine III at 4
    Mod cruiser powered armor at 5
    Mod cruiser powered armor at 6
    Mod cruiser power at 7
    Mod cruiser_pointdefence at 8
    Mod cruiser_pointdefence at 9
    Mod cruiser powered armor at 10
    Mod cruiser powered armor at 11
    Mod cruiser_alliance_beamlaser at 12
    Mod cruiser_alliance_beamlaser at 13
    Mod cruiser power III at 14
    Mod cruiser_engine III at 15
    Mod cruiser crew II at 16
==== TYPE: ecm challenger frigate (ecm challenger frigate) ====
  Alliance Wasp Frigate hull
    Mod frigate disruptor bomb at 0
    Mod frigate ecm shock missile v2 at 1
    Mod frigate ecm shock missile v2 at 2
    Mod frigate shield II at 3
    Mod frigate shield II at 4
    Mod frigate_engine II at 5
    Mod frigate_engine II at 6
    Mod frigate power at 7
    Mod frigate_armour III at 8
    Mod frigate crew at 9
    Mod frigate crew at 10
==== TYPE: dogfight challenger (dogfight challenger) ====
  Alliance Hornet Fighter
    Mod fighter_laser at 0
    Mod fighter_engine at 1
    Mod fighter power at 2

no project. i just fancied seeing the designs i was fighting… and outputting them in game-format so you could just load them up seemed sensible.

plus i guess in a game dominated by text data files, a binary one just itched :slight_smile:

Could someone post instructions on how to run this python program? I use Linux on the desktop so I python installed and I am somewhat computer-literate, but I am not a programmer by any stretch. I would really like to be able to see ship configurations and orders after I’ve fought a challenge without playing a long guessing game as I have been doing. Thanks in advance. :slight_smile:

1.) Save the program → extractor.py in the same directory as your gsb files.
2.) Let’s say that your gsb file is named 123.gsb
3.) change the line “r=reader(‘4397933.gsb’)” to "r=reader(‘123.gsb’)
4.) open up a shell:

cd [gsb file directory]
python extractor.py

I hope that was clear and correct.