Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Game State Editing #8

Open
Vhati opened this issue Oct 17, 2012 · 13 comments
Open

Enhancement: Game State Editing #8

Vhati opened this issue Oct 17, 2012 · 13 comments

Comments

@Vhati
Copy link
Contributor

Vhati commented Oct 17, 2012

I've partially deciphered the continue.sav file and written a parser with a toString() method to dump some of its contents. Should I commit it?

@Vhati
Copy link
Contributor Author

Vhati commented Oct 18, 2012

Here's what it dumps at the moment.

Ship Name: Man of War
Ship Type: PLAYER_SHIP_JELLY
Ship Layout: jelly_cruiser

Supplies...
Hull:         30
Fuel:         22
Drone Parts:   7
Missiles:     15
Scrap:         0

State Vars...
store_repair: 2
weapon_upgrade: 1
used_missile: 19
blue_alien: 1
reactor_upgrade: 4
dead_crew: 9
system_upgrade: 3
fired_shot: 111
store_purchase: 5
env_danger: 1
killed_crew: 25

Starting Crew...
  Name: Hassifa
  Race: slug
,
  Name: Tom Banks
  Race: slug

Current Crew...
  Name: Hassifa
  Race: slug
  Health:          85
  RoomId:           8
  Pilot Skill:     18
  Engine Skill:     0
  Shield Skill:     0
  Weapon Skill?:    0
  Repair Skill:     1
  Combat Skill?:   36
  Jumps Survived:  24
  / / / Unknowns / / /
  Alpha:            0
  Beta:           437
  Gamma:          157
  Delta:            0
  Epsilon:          1
  Digamma:          0
  Zeta:             1
  Eta:              1
  Theta:            0
  Iota:             1
,
  Name: Tom Banks
  Race: slug
  Health:         100
  RoomId:           6
  Pilot Skill:      0
  Engine Skill:    14
  Shield Skill:     4
  Weapon Skill?:    4
  Repair Skill:     9
  Combat Skill?:    0
  Jumps Survived:  24
  / / / Unknowns / / /
  Alpha:            0
  Beta:           192
  Gamma:          192
  Delta:            2
  Epsilon:          1
  Digamma:          0
  Zeta:             1
  Eta:              9
  Theta:            0
  Iota:             0
,
  Name: Starger
  Race: rock
  Health:         150
  RoomId:          13
  Pilot Skill:      0
  Engine Skill:     0
  Shield Skill:    14
  Weapon Skill?:   10
  Repair Skill:     5
  Combat Skill?:    0
  Jumps Survived:  21
  / / / Unknowns / / /
  Alpha:            0
  Beta:           262
  Gamma:          262
  Delta:            0
  Epsilon:          1
  Digamma:          2
  Zeta:             1
  Eta:              5
  Theta:            2
  Iota:             0
,
  Name: Stick
  Race: engi
  Health:         100
  RoomId:           5
  Pilot Skill:      0
  Engine Skill:     0
  Shield Skill:     0
  Weapon Skill?:   23
  Repair Skill:     2
  Combat Skill?:    0
  Jumps Survived:  12
  / / / Unknowns / / /
  Alpha:            0
  Beta:           297
  Gamma:          122
  Delta:            1
  Epsilon:          1
  Digamma:          1
  Zeta:             1
  Eta:              2
  Theta:            1
  Iota:             0
,
  Name: Mikhail
  Race: rock
  Health:         150
  RoomId:          10
  Pilot Skill:      0
  Engine Skill:     0
  Shield Skill:     0
  Weapon Skill?:    0
  Repair Skill:     0
  Combat Skill?:    0
  Jumps Survived:   5
  / / / Unknowns / / /
  Alpha:            0
  Beta:           367
  Gamma:          227
  Delta:            1
  Epsilon:          1
  Digamma:          0
  Zeta:             1
  Eta:              0
  Theta:            0
  Iota:             0
,
  Name: Sem
  Race: human
  Health:         100
  RoomId:          10
  Pilot Skill:      0
  Engine Skill:     0
  Shield Skill:     0
  Weapon Skill?:    0
  Repair Skill:     0
  Combat Skill?:    0
  Jumps Survived:   1
  / / / Unknowns / / /
  Alpha:            0
  Beta:           367
  Gamma:          192
  Delta:            0
  Epsilon:          1
  Digamma:          0
  Zeta:             1
  Eta:              0
  Theta:            0
  Iota:             0

Rooms...
RoomId:  0 (Empty)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  1 (Doors)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  2 (Cloaking)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  3 (Medbay)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  4 (Life Support)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  5 (Weapons)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  6 (Engines)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  7 (Empty)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  8 (Pilot)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId:  9 (Empty)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId: 10 (Teleporter)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId: 11 (Sensors)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId: 12 (Empty)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId: 13 (Shields)
  Oxygen: 100%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
,
RoomId: 14 (Drone Ctrl)
  Oxygen:  95%
  / / / Unknowns / / /
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?
  Square:  0?  0? -1?

Doors...
DoorId:  0 (2,3,V)
  Open: 0, Alpha?: 0
,
DoorId:  1 (3,4,H)
  Open: 0, Alpha?: 0
,
DoorId:  2 (4,2,V)
  Open: 0, Alpha?: 0
,
DoorId:  3 (2,2,H)
  Open: 0, Alpha?: 0
,
DoorId:  4 (2,0,V)
  Open: 0, Alpha?: 0
,
DoorId:  5 (3,0,V)
  Open: 0, Alpha?: 0
,
DoorId:  6 (4,1,H)
  Open: 0, Alpha?: 0
,
DoorId:  7 (6,2,V)
  Open: 0, Alpha?: 0
,
DoorId:  8 (5,3,H)
  Open: 0, Alpha?: 0
,
DoorId:  9 (5,4,H)
  Open: 0, Alpha?: 0
,
DoorId: 10 (6,5,V)
  Open: 0, Alpha?: 0
,
DoorId: 11 (5,6,H)
  Open: 0, Alpha?: 0
,
DoorId: 12 (4,7,V)
  Open: 0, Alpha?: 0
,
DoorId: 13 (2,7,V)
  Open: 0, Alpha?: 0
,
DoorId: 14 (1,6,V)
  Open: 0, Alpha?: 0
,
DoorId: 15 (1,7,V)
  Open: 0, Alpha?: 0
,
DoorId: 16 (1,1,V)
  Open: 0, Alpha?: 0
,
DoorId: 17 (1,0,V)
  Open: 0, Alpha?: 0
,
DoorId: 18 (3,6,H)
  Open: 0, Alpha?: 0
,
DoorId: 19 (7,3,V)
  Open: 0, Alpha?: 0

Weapons...
  WeaponId: BEAM_BIO
  Armed: 1
  / / / Unknowns / / /
  Alpha: 1
,
  WeaponId: BOMB_BREACH_1
  Armed: 1
  / / / Unknowns / / /
  Alpha: 1
,
  WeaponId: LASER_BURST_2
  Armed: 1
  / / / Unknowns / / /
  Alpha: 1
,
  WeaponId: LASER_BURST_5
  Armed: 0
  / / / Unknowns / / /
  Alpha: 0

Augments: ION_ARMOR, SLUG_GEL, STASIS_POD

Mystery Bytes...
  Location: 0-24
  0200 0000 0100 0000 0300 0000 1800 0000   ................
  5A01 0000 0600 0000
,
  Location: 59-67
  0200 0000 0000 0000
,
  Location: 977-1221
  0C00 0000 0200 0000 0200 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0400 0000 0400 0000 0000 0000 0000 0000   ................
  0000 0080 0000 0000 0000 0000 0100 0000   ................
  0100 0000 0000 0000 0000 0000 0000 0080   ................
  0000 0000 0000 0000 0400 0000 0400 0000   ................
  0000 0000 0000 0000 E71E 0000 0000 0000   ................
  0000 0000 0000 0000 0100 0000 0100 0000   ................
  0000 0000 0000 0000 0000 0080 0000 0000   ................
  0000 0000 0100 0000 0100 0000 0000 0000   ................
  0000 0000 0000 0080 0000 0000 0000 0000   ................
  0000 0000 0200 0000 0200 0000 0000 0000   ................
  0000 0000 8F1B FFFF 0000 0000 0000 0000   ................
  0100 0000 0000 0000 0000 0000 0000 0000   ................
  0000 0080 0000 0000 0000 0000 0000 0000   ................
  0000 0000
,
  Location: 1921-1925
  0000 0000
,
  Location: 2024-2028
  0000 0000
,
  Location: 2071-3686
  0000 0000 D146 0000 7F6B 0000 06FF FFFF   .....F...k......
  3601 0000 0000 0000 0000 0000 0000 0000   6...............
  0000 0000 0000 0000 1300 0000 0100 0000   ................
  0000 0000 0100 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0100 0000 0000 0000   ................
  1600 0000 0000 0000 0000 0000 0000 0000   ................
  0100 0000 0000 0000 0000 0000 0000 0000   ................
  0100 0000 0000 0000 0100 0000 0000 0000   ................
  0000 0000 0100 0000 1700 0000 7374 6172   ............star
  732F 6267 5F64 6172 6B6E 6562 756C 612E   s/bg_darknebula.
  706E 6718 0000 0073 7461 7273 2F70 6C61   png....stars/pla
  6E65 745F 6269 6762 6C75 652E 706E 671E   net_bigblue.png.
  0100 0076 0000 00B4 0000 0001 0000 0001   ...v............
  0000 000A 0000 004C 4F4E 475F 464C 4545   .......LONG_FLEE
  5411 0000 0053 4849 5053 5F52 4542 454C   T....SHIPS_REBEL
  5F45 4C49 5445 D067 0000 0100 0000 0000   _ELITE.g........
  0000 0000 0000 0100 0000 1700 0000 7374   ..............st
  6172 732F 6267 5F6C 6F6E 656C 7973 7461   ars/bg_lonelysta
  722E 706E 6716 0000 0073 7461 7273 2F70   r.png....stars/p
  6C61 6E65 745F 6272 6F77 6E2E 706E 67FD   lanet_brown.png.
  0000 0056 0000 0000 0000 0001 0000 0001   ...V............
  0000 000A 0000 004C 4F4E 475F 464C 4545   .......LONG_FLEE
  5411 0000 0053 4849 5053 5F52 4542 454C   T....SHIPS_REBEL
  5F45 4C49 5445 AE7F 0000 0100 0000 0000   _ELITE..........
  0000 0000 0000 0000 0000 0100 0000 0000   ................
  0000 0100 0000 0000 0000 0000 0000 0100   ................
  0000 1700 0000 7374 6172 732F 6267 5F6C   ......stars/bg_l
  6F6E 656C 7973 7461 722E 706E 6716 0000   onelystar.png...
  0073 7461 7273 2F70 6C61 6E65 745F 6272   .stars/planet_br
  6F77 6E2E 706E 6725 0000 00A9 0000 0000   own.png%........
  0000 0001 0000 0001 0000 000A 0000 004C   ...............L
  4F4E 475F 464C 4545 5411 0000 0053 4849   ONG_FLEET....SHI
  5053 5F52 4542 454C 5F45 4C49 5445 2E2C   PS_REBEL_ELITE.,
  0000 0100 0000 0000 0000 0000 0000 0100   ................
  0000 1700 0000 7374 6172 732F 6267 5F64   ......stars/bg_d
  756C 6C73 7461 7273 322E 706E 6714 0000   ullstars2.png...
  0073 7461 7273 2F70 6C61 6E65 745F 7265   .stars/planet_re
  642E 706E 67F5 0200 00B1 0000 0000 0000   d.png...........
  0001 0000 0001 0000 000A 0000 004C 4F4E   .............LON
  475F 464C 4545 5411 0000 0053 4849 5053   G_FLEET....SHIPS
  5F52 4542 454C 5F45 4C49 5445 5817 0000   _REBEL_ELITEX...
  0100 0000 0000 0000 0000 0000 0100 0000   ................
  1700 0000 7374 6172 732F 6267 5F64 6172   ....stars/bg_dar
  6B6E 6562 756C 612E 706E 6718 0000 0073   knebula.png....s
  7461 7273 2F70 6C61 6E65 745F 6269 6762   tars/planet_bigb
  6C75 652E 706E 67AB 0200 00BC 0000 00B4   lue.png.........
  0000 0001 0000 0001 0000 000A 0000 004C   ...............L
  4F4E 475F 464C 4545 5411 0000 0053 4849   ONG_FLEET....SHI
  5053 5F52 4542 454C 5F45 4C49 5445 0D5E   PS_REBEL_ELITE.^
  0000 0100 0000 0000 0000 0000 0000 0000   ................
  0000 0100 0000 0000 0000 0100 0000 0000   ................
  0000 0000 0000 0100 0000 1700 0000 7374   ..............st
  6172 732F 6267 5F64 6172 6B6E 6562 756C   ars/bg_darknebul
  612E 706E 671B 0000 0073 7461 7273 2F70   a.png....stars/p
  6C61 6E65 745F 6761 735F 7965 6C6C 6F77   lanet_gas_yellow
  2E70 6E67 4D00 0000 3300 0000 0000 0000   .pngM...3.......
  0100 0000 0100 0000 0A00 0000 4C4F 4E47   ............LONG
  5F46 4C45 4554 1100 0000 5348 4950 535F   _FLEET....SHIPS_
  5245 4245 4C5F 454C 4954 45C3 4600 0001   REBEL_ELITE.F...
  0000 0000 0000 0000 0000 0000 0000 0001   ................
  0000 0000 0000 0001 0000 0000 0000 0000   ................
  0000 0001 0000 0017 0000 0073 7461 7273   ...........stars
  2F62 675F 6C6F 6E65 6C79 7374 6172 2E70   /bg_lonelystar.p
  6E67 1600 0000 7374 6172 732F 706C 616E   ng....stars/plan
  6574 5F62 726F 776E 2E70 6E67 FE01 0000   et_brown.png....
  1F00 0000 0000 0000 0100 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0100 0000   ................
  1700 0000 7374 6172 732F 6267 5F6C 6F6E   ....stars/bg_lon
  656C 7973 7461 722E 706E 6716 0000 0073   elystar.png....s
  7461 7273 2F70 6C61 6E65 745F 7065 6163   tars/planet_peac
  682E 706E 6729 0300 00A0 0100 0000 0000   h.png)..........
  0001 0000 0001 0000 000A 0000 004C 4F4E   .............LON
  475F 464C 4545 5411 0000 0053 4849 5053   G_FLEET....SHIPS
  5F52 4542 454C 5F45 4C49 5445 542A 0000   _REBEL_ELITET*..
  0100 0000 0000 0000 0000 0000 0000 0000   ................
  0100 0000 0000 0000 0100 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0100 0000 0000 0000 0000 0000 0100 0000   ................
  1700 0000 7374 6172 732F 6267 5F64 756C   ....stars/bg_dul
  6C73 7461 7273 322E 706E 6719 0000 0073   lstars2.png....s
  7461 7273 2F70 6C61 6E65 745F 6761 735F   tars/planet_gas_
  626C 7565 2E70 6E67 F001 0000 CE00 0000   blue.png........
  B400 0000 0100 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0100 0000 1700 0000   ................
  7374 6172 732F 6267 5F64 756C 6C73 7461   stars/bg_dullsta
  7273 322E 706E 6714 0000 0073 7461 7273   rs2.png....stars
  2F70 6C61 6E65 745F 7265 642E 706E 6749   /planet_red.pngI
  0200 0089 0000 00B4 0000 0001 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0000 0001 0000 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0001 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0000 0001 0000 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0001 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0000   ................
  0000 0000 0000 0000 0000 0000 0000 0010   ................
  0000 0000 0000 0001 0000 0000 0000 00

Doors coords are from counting either Horizontal or Vertical walls from 0,0 in the top left.
The recent beacon info has some unknown length variation so I can't reliably get at those obvious strings.
I haven't yet found the sector map stuff.

@ComaToes
Copy link
Owner

Looks good. We can add this as an extra tab if a continue.sav is found in the same directory as the prof.sav

@ComaToes
Copy link
Owner

I have established that the sector map is generated based on the int at location 2079 in your example (7F6B 0000). Changing the value of this radically alters the map. My guess is that it's used as a seed to a random number generator which is then used to generate the layout.

@Vhati
Copy link
Contributor Author

Vhati commented Oct 19, 2012

a seed to a random number generator

Gah. Well, if it turns out sensor data isn't parsable, there's still the possibility of a "randomize map" button. :P


The first big mystery block (977-1221 above) describes all possible systems in a fixed order: Shields, Engines, Oxygen, Weapons, Drone Ctrl, Medbay, Pilot, Sensors, Doors, Teleporter, Cloaking, Artillery.

First, an int describing reserve capacity.
Thereafter, each system begins with capacity (4 bytes). If it's zero, the system is truncated.
If capacity is non-zero, next comes used power (4 bytes), which is why there are pairs of similar values for powered up systems. Then there's 20 bytes of weird non-int stuff.

So... systems that are present are 28 bytes. Systems that aren't are 4 bytes.


A smaller block, (2024-2028 above, appearing right after weapons) is a count of drones, which in this example was 0. They have a bunch of int attributes I haven't nailed down yet.

@Vhati
Copy link
Contributor Author

Vhati commented Oct 20, 2012

I just looked at an escort-quest ship while it was still on-screen. Stored exactly like the player's, except using an id from autoBlueprints.xml. So I'll be moving [blueprint/name/layout through augments] out of SavedGameState into a generic ShipState class.

The ship I saw was at the end of the file, so I don't know if it was after the beacons, or part of the final one.

@ComaToes
Copy link
Owner

I've added parsing for cargo, beacons and sector data. The ship data at the end of the file is there if you save while there's another ship at the current beacon (e.g. if you accept surrender or avoid combat). It's not a part of the beacon list.

@Vhati
Copy link
Contributor Author

Vhati commented Oct 30, 2012

Something's not quite right about door indexing. Engi cruiser 2's doors aren't all in ShipLayout.txt order.

@Vhati
Copy link
Contributor Author

Vhati commented Oct 30, 2012

Okay doors are fixed in commit 870728e . The game sorts doors at runtime prior to saving, same relative order, except vacuum-adjacent doors are moved to the end.

@Vhati Vhati closed this as completed Oct 30, 2012
@Vhati
Copy link
Contributor Author

Vhati commented Oct 30, 2012

Okay doors are fixed in commit 870728e . The game sorts doors at runtime prior to saving, same relative order, except vacuum-adjacent doors are moved to the end.

@Vhati Vhati reopened this Oct 30, 2012
@Vhati
Copy link
Contributor Author

Vhati commented Oct 30, 2012

So that's what the 'close' button does. :P

@Vhati
Copy link
Contributor Author

Vhati commented Nov 1, 2012

Good timing with v11. I was in the middle of writing commit 77cdbda which edits almost every crew field.
That'll need some corner-case testing because of the goofy way FTL handles races and flags.

@Vhati
Copy link
Contributor Author

Vhati commented Nov 9, 2012

When v12 comes out, screenshots would be nice.

  • Engi B with drones deployed, a couple rooms open to vacuum, a varied crew, and one crew being edited.
  • Some other ship with a weapon being changed to Boss Missile... >:D
  • A nightmare scenario with intruders, breaches, and fires...

@Vhati
Copy link
Contributor Author

Vhati commented Nov 10, 2012

Editing the forum thread's description to mention saved game editing would be good too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants