On Sun, Mar 10, 2019 at 02:15:29PM -0700, Darrell Root wrote:
> I’m making good progress on my MacOS/Swift netrek client.  It’s
> playable!  I’ve even gotten a couple kills.  I’m hoping to release
> an alpha version Friday March 15th.  “Beware the ides of March”.
> I’ve attached a screenshot at the bottom.

Looks good.  Ships inbound to Draconis ought to be cloaked; please add
the code to hide them somehow.

Team colours are unconventional; we would normally use a red or orange
colour for Romulan team, and a yellow colour for Federation.  This
would make is easier for people to move to another client and fit
existing documentation.  Most clients allow the colours to be
customised.

> I’m having trouble understanding the CP_MESSAGE format.  At first it
> looks simple:
> 
> struct mesg_cpacket { /* CP_MESSAGE py-struct "!bBBx80s" #1 */
>     char type;
>     char group;
>     char indiv;	/* does this break anything? -da */
>     char pad1;
>     char mesg[MSG_LEN];
> };
> 
> I captured a packet trace of a distress call to the Rom team with 4
> in the group (MTEAM?) and 2 in the indiv (TEAM=ROM?) fields.  But
> I’m having trouble sending messages with the MacTrek client so I
> don’t have a full set of packet traces to work with.

Run another client.  MacTrek did not mature.

> Other client headers below but let me ask a couple specific questions:
> 
> 1) If I want to send a message to ALL, what do I put in group/indiv?

Deriving from source code;

MALL in group.
zero in indiv.

https://github.com/quozl/gytha/blob/master/gytha/__init__.py#L2266
https://github.com/quozl/netrek-client-cow/blob/master/smessage.c#L221

> 2) If I want to send a message to TEAM ROM, what do I put in
> group/indiv (I think group=4 (MTEAM) and indiv=2 (ROM)).

Deriving from source code;

MTEAM in group.
ROM in indiv.

https://github.com/quozl/gytha/blob/master/gytha/__init__.py#L2270
https://github.com/quozl/netrek-client-cow/blob/master/smessage.c#L227

> 3) If I want to send a message to individual player #3 what do I put
> in the group/indiv fields?

Deriving from source code;

MINDIV in group.
ship number in indiv.

https://github.com/quozl/gytha/blob/master/gytha/__init__.py#L2290
https://github.com/quozl/netrek-client-cow/blob/master/smessage.c#L248

> 4) At startup, client is supposed to send the following message:
> 	CP_MESSAGE (MINDIV|MCONFIG, self, "@clientname clientversion")
> MINDIV is 0x02
> MCONFIG is 0x04
> So I guess 0x06 goes in the group field.  What is the “self” that
> (presumably) goes in the indiv field?  Is that my PlayerID (0
> through 31)?

p_no

https://github.com/quozl/netrek-client-cow/blob/master/dmessage.c#L278

But it probably does not matter, as the server does not check it;

https://github.com/quozl/netrek-server/blob/master/ntserv/socket.c#L1704
https://github.com/quozl/netrek-server/blob/master/ntserv/socket.c#L1953

> Darrell
> -----------
> 
> Looking at the existing source code I’m finding a bunch of different things to put in the group and indiv fields (although I may be getting CP_MESSAGE and SP_MESSAGE mixed up).
> 
> The team flags are as follows:
> 
> IND=0x0
> FED=0x1
> ROM=0x2
> KLI=0x4
> ORI=0x8
> 
> Below is the message header source I’ve dug up.
> 
> #define MVALID 0x01
> #define MGOD   0x10
> #define MMOO   0x12
> 
> #ifdef TOOLS
> #define MTOOLS 0x14
> #endif
> 
> /* order flags by importance (0x100 - 0x400) */
> /* restructuring of message flags to squeeze them all into 1 byte - jmn */
> /* hopefully quasi-back-compatible: MVALID, MINDIV, MTEAM, MALL, MGOD use up
>  * 5 bits. this leaves us 3 bits. since the server only checks for those
>  * flags when deciding message related things and since each of the above
>  * cases only has 1 flag on at a time we can overlap the meanings of the
>  * flags */
> 
> #define MINDIV 0x02
> /* these go with MINDIV flag */
> 
> #ifdef STDBG
> #define MDBG   0x20
> #endif
> 
> #define MCONFIG 0x40                             /* config messages from * *
>                                                   * server */
> #define MDIST 0x60                               /* flag distress type * *
>                                                   * messages properly */
> #ifdef MULTILINE_MACROS
> #define MMACRO 0x80
> #endif
> 
> #define MTEAM  0x04
> /* these go with MTEAM flag */
> #define MTAKE  0x20
> #define MDEST  0x40
> #define MBOMB  0x60
> #define MCOUP1 0x80
> #define MCOUP2 0xA0
> #define MDISTR 0xC0                              /* flag distress type
>                                                   * messages */
> #define MALL   0x08
> /* these go with MALL flag */
> #define MGENO  0x20                              /* MGENO is not used in INL
>                                                   * here  */
> #define MCONQ  0x20                              /* not enought bits to
>                                                   * distinguish MCONQ/MGENO :-( */
> #define MKILLA 0x40
> #define MKILLP 0x60
> #define MKILL  0x80
> #define MLEAVE 0xA0
> #define MJOIN  0xC0
> #define MGHOST 0xE0
> /* MMASK not used in INL server */
> 
> #define MWHOMSK  0x1f                            /* mask with this to find
>                                                   * who msg to */
> #define MWHATMSK 0xe0                            /* mask with this to find
>                                                   * what message about */

> _______________________________________________
> netrek-dev mailing list
> netrek-dev at us.netrek.org
> http://mailman.us.netrek.org/mailman/listinfo/netrek-dev


-- 
James Cameron
http://quozl.netrek.org/