Rules and Strategy for our beloved game

[Posting] TRN BaseBuildShip with zero values
Thread opener
Posted Fri, 2020-07-10 21:47 GMT

Can someone who is familiar with the details of TRN file format explain what a Code 53 (35h=BaseBuildShip) command means if everything other than Base ID is set to zero?

Quoting from Stefan's File Format List:

--- Code 53 (35h=BaseBuildShip) ---
 +0     WORD    Base Id
 +2     WORD    Hull Number
 +4     WORD    Engine
 +6     WORD    Beam Weapon Type
 +8     WORD    Beam Weapon Count
+10     WORD    Torpedo Type
+12     WORD    Torpedo Count
+14     WORD    Set to zero. See BDATAx.DAT for more info.

  A well-known Winplan bug (now fixed) is that its built-in MAKETURN
  did not generate this command if the build order _changed_; instead it
  generated it if it was _present_. This prevented users from canceling
  a build order after the ship limit.

  PHost has a workaround for this, which you should be aware of when
  generating Winplan TRNs: if it receives a Winplan TRN, the BaseBuildShip
  command specifies the current build order for the starbase. If there is
  no such command for a particular starbase, the base's build order is
  canceled. So you must send this command for all bases with either
  changed or present build orders to generate TRNs suitable for both THost
  and PHost.

I came across a trn file (I suspect from Winplan, perhaps?) that has one such command (it happens to be the last command in the TRN if that's relevant) that has baseID set, but the other components are all zero. What does this mean?

[Posting] Re: TRN BaseBuildShip with zero values
Posted Sat, 2020-07-11 07:37 GMT

Can someone who is familiar with the details of TRN file format explain what a Code 53 (35h=BaseBuildShip) command means if everything other than Base ID is set to zero?
[...]
I came across a trn file (I suspect from Winplan, perhaps?) that has one such command (it happens to be the last command in the TRN if that's relevant) that has baseID set, but the other components are all zero. What does this mean?

The meaning of this command, like most TRN commands, is: copy these values to the appropriate place in the host files. A BaseBuildShip command with everything zero therefore means: replace that base's build order with nothing (=cancel the build order).

For most commands, that would be the end of the story: Maketurn computes differences, Host applies patch, done.

There is a bug in Winplan that I tried to describe in filefmt.txt: Winplan doesn't send a BaseBuildShip if the build order is changed, but if (and only if) it is present (not sure about which versions are affected, PHost doc claims it partially affects Dosplan as well). Therefore, PHost interprets absence of a command as cancellation if the turn file is coming from Winplan. This means everyone who sends Winplan-style turns needs to send all present orders, even if unchanged, to avoid triggering that logic.

Corollary: the turn file you got does NOT come from Winplan, but most likely from PCC.

Corollary 2: Winplan users cannot cancel build orders with HOST.

--Stefan

[Posting] Re: TRN BaseBuildShip with zero values
Thread opener
Posted Sat, 2020-07-11 12:39 GMT

A BaseBuildShip command with everything zero therefore means: replace that base's build order with nothing (=cancel the build order).

Hmm, ok. I wouldn't expect a "cancel" order on turn 19 with only ~250 ships built. Is it possible that this TRN command could be sent to mean "not building anything this turn" instead of "cancel previous build order", since with <500 ships there really shouldn't be any pre-existing build orders.

I'm confirming with the user what client they use, but is there something in the TRN file itself that differentiates Winplan vs PCC (vs c2mkturn vs VPA vs EchoView vs etc)? I know there's the trailer block at the end of the TRN file which I haven't yet set up for parsing but at a quick glance it just seems to contain a bunch of checksums. I guess the registered user block is interesting, but I don't see anything with regards to client identification.

[Posting] Re: TRN BaseBuildShip with zero values
Posted Sat, 2020-07-11 13:07 GMT

Hmm, ok. I wouldn't expect a "cancel" order on turn 19 with only ~250 ships built. Is it possible that this TRN command could be sent to mean "not building anything this turn" instead of "cancel previous build order", since with <500 ships there really shouldn't be any pre-existing build orders.

Yes, this could be, if someone just sends out a BaseBuildShip for all bases instead of just looking at changes.

I'm confirming with the user what client they use, but is there something in the TRN file itself that differentiates Winplan vs PCC (vs c2mkturn vs VPA vs EchoView vs etc)? I know there's the trailer block at the end of the TRN file which I haven't yet set up for parsing but at a quick glance it just seems to contain a bunch of checksums. I guess the registered user block is interesting, but I don't see anything with regards to client identification.

There's this field

 +4     DWORD   Contains random data with original MAKETURN. Some
                MAKETURNs put a signature here.

which can give a hint.

It seems I didn't document the values I know for this field? Anyway, un-trn / c2untrn will decode it. Works like a fourcc for videos :smile: The following programs write specific values into this field; Tim's maketurn leaves it uninitialized. So, any of the following values is an indication (but not a guarantee) to have a file written by that program:

  • 0x00000000 = VPMaketurn
  • 0x21434350 = "PCC!" = PCC
  • 0x2E522E53 = "S.R." = Portable Maketurn
  • 0x32434350 = "PCC2" = PCC2
  • 0x474E3243 = "c2ng" = PCC2ng
  • 0x49494343 = "CCII" = PCC2 (early versions)
  • 0x6F72654B = "Kero" = k-Maketurn
  • 0x6F72656B = "kero" = k-Maketurn
  • same as file position = VPA

Stefan

[Posting] Re: TRN BaseBuildShip with zero values
Thread opener
Posted Mon, 2020-07-13 14:43 GMT
  • 0x00000000 = VPMaketurn
  • same as file position = VPA

Clarification on VPA: the "file position" is the start of the DOS footer (start of "checksum X"), which is 4 bytes less than where this "signature" DWORD is.

Forgive my ignorance but what is "VPMaketurn"?

[Posting] Re: TRN BaseBuildShip with zero values
Posted Mon, 2020-07-13 17:21 GMT

Forgive my ignorance but what is "VPMaketurn"?

VPMaketurn ist to VPUtil what c2mkturn is to PCC2. VPUtil is a text-mode client that used to be popular in the mid-1990s, at least popular enough for PHost to explicitly deal with it.

It seems to have disappeared from the 'net. Dammit, I guess I need to set up a download archive as well. On the other hand, today's software probably needn't deal with it :smile:

--Stefan

This is a testing version.
It may be incomplete, and have more bugs (or features) than the public live version at planetscentral.com.