Technical Information

From Stars!wiki
Revision as of 05:04, 18 May 2012 by Gible (talk | contribs) (Library Articles)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

See also Utilities | Index | Downloads | Patches and versions | Related Websites | Technical Information
Game setup | References | Calculators | In-game information processing and sharing | m and x file management | Online Utilities


Plagiarized from XyliGUN's thread Inside of Stars! Files at HWF

I'll start from the very basic things (that some of you already knows) and then will go deeply into file structure. So, let’s start.

Basics

Stars! stores all game information in several files: game.xy, game.hst, game.m*, game.x*, game.h*, where * is a player number.

game.xy
is actually a game configuration file, with very basic information:
  • game settings: universe size, planets density, players number (note: there is no details on specific players and their races), distance between players start locations, game options (like public players scores, galaxy clumping and others) and winning conditions
  • planet locations and their names (note: there is no planet stats, like minerals concentrations)
game.hst
is almost a full state of the game/universe, ‘almost’ except planets locations and their names (which are stored in game.xy only). It includes everything about all players, their planets and fleets. This is a main file, which game engine uses to generate next turn.
game.m*
is a sort of filtered game.hst file, which contains only the partial game/universe state known/available to the specific player. There is one thing that present in m file and never present in hst file: game events (like you build X factories on planet Y) and players’ messages. Note: some of these events are not stored in files at all, but generated by game client when turn is opened (like for example: you have found a new planet).
game.x*
is a player actions log, which contains log of all actions player performed working on a turn. Compared to m file, which actually contains just a static data (planet x has y minerals), x file actually contains an actions (load x minerals to ship y). Note: even if you will do a number of opposite actions, they won’t be ‘merged’, but all of them will be included into x file (let’s say you check and uncheck explosive minefield continuously 100 times in row, this will results in 200 actions recorded into x file: 100 for check action and 100 for uncheck action).
game.h*
is a player knowledge history, which contains knowledge about others players met, planets scanned, designs known, own score and others scores if PPS is available.

General File Structure

In general any Stars! file consists of blocks. All blocks data in any files except the first block in file are encrypted (there is one exclusion, I’ll mention it later). Each block have 2 bytes header followed by data of variable length. Header contains block type and block length. First header byte is a low 8 bits of the block size. Low 2 bits of the second byte is a high 2 bits of the block size and high 6 bits of the second byte is a block type. Each block in file can have up to 1024 bytes of data.

So, here is a header block bitwise: XXXXXXXX YYYYYYZZ

(XXXXXXXX is a first byte, YYYYYYZZ is a second byte)

Where:

  • YYYYYY is a block type.
  • ZZXXXXXXXX is a block size.

Here is a list of blocks and their types I found so far. I’ve never met several of them in any game file, which I can access to, but you can try to find them in your own game files using this small command line tool (there is no decryption code, since block headers are never encrypted), and please if you find them let me know:

  1. FileFooterBlock
  2. ManualSmallLoadUnloadTaskBlock
  3. ManualMediumLoadUnloadTaskBlock
  4. WaypointDeleteBlock
  5. WaypointAddBlock
  6. WaypointChangeTaskBlock
  7. PlayerBlock
  8. PlanetsBlock
  9. FileHeaderBlock (unencrypted)
  10. FileHashBlock
  11. WaypointRepeatOrdersBlock
  12. Never met it
  13. EventsBlock
  14. PlanetBlock
  15. PartialPlanetBlock
  16. Never met it
  17. FleetBlock
  18. PartialFleetBlock
  19. Never met it
  20. WaypointTaskBlock
  21. WaypointBlock
  22. FleetNameBlock
  23. Never met it
  24. MoveShipsBlock
  25. FleetSplitBlock
  26. ManualLargeLoadUnloadTaskBlock
  27. DesignBlock
  28. DesignChangeBlock
  29. ProductionQueueBlock
  30. ProductionQueueChangeBlock
  31. BattlePlanBlock
  32. BattleBlock (content isn't decoded yet)
  33. CountersBlock
  34. MessagesFilterBlock
  35. ResearchChangeBlock
  36. PlanetChangeBlock
  37. ChangePasswordBlock
  38. FleetsMergeBlock
  39. PlayersRelationChangeBlock
  40. BattleContinuationBlock (content isn't decoded yet)
  41. MessageBlock
  42. Record made by AI in H file (content isn't decoded yet)
  43. SetFleetBattlePlanBlock
  44. ObjectBlock
  45. RenameFleetBlock
  46. PlayerScoresBlock
  47. SaveAndSubmitBlock

Technical Utilities

Stars! Bitmaps

The bitmap resources from the Stars! executable. (aka - all the pics from the game)

StarsFileStat

StarsFileStat analyses Stars! files and shows what block types are in each of your files, and at the end there will be a note on whether your files contains blocks with any of the 6 remaining unknown ids: 11, 15, 18, 22, 25, 41.

Starstat & Starinfo

Starstat & Starinfo are otherwise identical DOS and Windows programs, respectively, that report on various aspects of the Stars! gamefiles such as the version, the presence of multiple turns in a .m file etc. Both incorrectly, but consistently, report the Stars version for v1.1a(reports 1.2a), v2.0a(2.65), 2.6i(2.81j) and 2.6JRC4(2.83) game files.


Library Articles