Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Extensions » Inside of Stars! Files
poll.gif  Inside of Stars! Files Mon, 18 July 2011 10:15 Go to next message
XyliGUN is currently offline XyliGUN

 
Ensign
Stars! V.I.P


Messages: 325
Registered: July 2004
Location: Russia, St.Petersburg

In this thread I'll post results of my research on Stars! files structure. My research is based on work/research of other peoples, so here the credits and my thanks:
* PaulCr - initial knowledge and about 40% files structure were taken from his work. Definitely his work gives me the main keys to what I know now.
* wasp - unvaluable help with events structure and messages table as well as some hints on where to search on serial stuff.
* craebild - for his Wheel of Life game series, which were my first real expirience in applying my research results and modifying Stars! files not just reads them. Wheel of Life IV brings to life m/h files merges (as well as several other tools) and Wheel of Life V brings up stars mover.
* Ron - for giving me access to some nice & fat game files.
* Micha - for finding "Penta Block".
* Kotk and Captin Maim - for sharing their knowledge.
And of cause BlueTurbit, donjon, gible, ma.stars, Marduk (sorry if I forget somebody) - for your input, ideas, comments and objections. Wink


[Updated on: Mon, 18 July 2011 11:45]




"Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
Robert A. Heinlein, Time Enough For Love

Report message to a moderator

Re: Inside of Stars! Files Mon, 18 July 2011 10:19 Go to previous messageGo to next message
XyliGUN is currently offline XyliGUN

 
Ensign
Stars! V.I.P


Messages: 325
Registered: July 2004
Location: Russia, St.Petersburg

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.

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.


[Updated on: Mon, 18 July 2011 11:48]




"Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
Robert A. Heinlein, Time Enough For Love

Report message to a moderator

Re: Inside of Stars! Files Mon, 18 July 2011 10:42 Go to previous messageGo to next message
XyliGUN is currently offline XyliGUN

 
Ensign
Stars! V.I.P


Messages: 325
Registered: July 2004
Location: Russia, St.Petersburg

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:

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

I’ll describe details of each of these blocks in the next posts.


[Updated on: Mon, 18 July 2011 10:46]




"Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
Robert A. Heinlein, Time Enough For Love

Report message to a moderator

Re: Inside of Stars! Files Tue, 19 July 2011 08:32 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
Hmmm, I wonder if there should be a "We have a winner/game is over" block, or a "You're not the legitimate ruler of your empire/emperor nerf" block, or perhaps some MT-related blocks. Sherlock


So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Inside of Stars! Files Tue, 19 July 2011 09:57 Go to previous messageGo to next message
XyliGUN is currently offline XyliGUN

 
Ensign
Stars! V.I.P


Messages: 325
Registered: July 2004
Location: Russia, St.Petersburg

ma.stars wrote

Hmmm, I wonder if there should be a "We have a winner/game is over" block, or a "You're not the legitimate ruler of your empire/emperor nerf" block, or perhaps some MT-related blocks. Sherlock

'Game over' is a bit in the first block of m file, also winner is declared by event block, which says you lost or you win. MT data stored as an ObjectBlock and MT-toys availability is a bits in PlayerBlock.


[Updated on: Fri, 22 July 2011 18:27]




"Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
Robert A. Heinlein, Time Enough For Love

Report message to a moderator

Re: Inside of Stars! Files Tue, 19 July 2011 19:44 Go to previous messageGo to next message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

http://wiki.starsautohost.org/wiki/Technical_Information

Report message to a moderator

Re: Inside of Stars! Files Tue, 01 November 2011 11:54 Go to previous message
donjon is currently offline donjon

 
Lt. Commander

Messages: 808
Registered: November 2002
Location: Benque Viejo del Carmen, ...

HI,

I suspect, but cannot be sure:

10. WaypointRepeatOrdersBlock
11. Never met it (Waypoints extension block)

13. PlanetBlock
14. PartialPlanetBlock (Planets extension block)
15. Never met it (Planets extension block)

16. FleetBlock
17. PartialFleetBlock (Fleets extension block)
18. Never met it (Fleets extension block)

21. FleetNameBlock
22. Never met it (FleetNames extension block)

It makes sense that overflows were allowed for specific data types... 1024 bytes is tiny Smile

regards,
dj

Report message to a moderator

Next Topic: starstat
Goto Forum:
  


Current Time: Fri Mar 29 05:21:20 EDT 2024