Commit graph

79 commits

Author SHA1 Message Date
ChillerDragon 639edda489 Add support for control messages 2023-04-06 17:44:17 +02:00
ChillerDragon 7ba6e18ced Keep messages a union of ctl and net (closed #1)
The messages array in the TwPacket class
is now planned to stay a Union of CtrlMessage and NetMessage.
Which both are empty duck typed classes. That abstract away
the 5 specific CtrlMessage classes and the many
game and system message classes.

```python
class CtrlMessage(Protocol):
    message_name: str
    def unpack(self, data: bytes) -> bool:
        ...
    def pack(self) -> bytes:
        ...

class NetMessage(Protocol):
    message_name: str
    system_message: bool
    header: ChunkHeader
    def unpack(self, data: bytes) -> bool:
        ...
    def pack(self) -> bytes:
        ...

class TwPacket(PrettyPrint):
    def __init__(self) -> None:
        self.messages: list[Union[CtrlMessage, NetMessage]] = []
```
2023-04-06 15:47:08 +02:00
ChillerDragon 37730deaa2 Start drafting control message layout 2023-04-02 21:01:44 +02:00
ChillerDragon a75c95d2ad Run ruff --fix . 2023-04-02 20:06:31 +02:00
ChillerDragon 760d8bce1f Fix comment too long 2023-04-02 20:03:50 +02:00
ChillerDragon 044e17b6e6 Do not import unused Unpacker 2023-04-02 20:02:27 +02:00
ChillerDragon d6d8abc091 Do not instantiate unused unpacker 2023-04-02 20:00:42 +02:00
ChillerDragon df3fcb9b17 Fix optional type assuming int 2023-04-02 19:56:29 +02:00
ChillerDragon bffa9f70cb Warn about open todos on major release
During this early development I love hacking down
half finished unpolished code with open todos
and then mark them with a TODO comment

Then at some later point I might forget how everything
is held together by duck tape and do a 1.0.0 release

This check in the release script should avoid this mistake
and ensure that the 1.x.x and all other major releases
are what they claim to be: a finished, polished and working version
2023-04-02 19:37:27 +02:00
ChillerDragon 03cb8a5eb7 Move json and shell to lint stage 2023-04-02 11:53:30 +02:00
ChillerDragon e20fd4c019 Use vanilla server defaults for tunes 2023-04-02 11:51:21 +02:00
ChillerDragon a4a71d4069 Document progress 2023-04-02 10:41:46 +02:00
ChillerDragon 029cebcb25 Fully support tune params 2023-04-02 10:39:52 +02:00
ChillerDragon da6d0cfc40 Prepare test for tune params 2023-04-02 09:42:20 +02:00
ChillerDragon 0013b9b8c0 Add shebang to gen script 2023-04-02 09:40:54 +02:00
ChillerDragon d6727ddcbe Test rcon_cmd and sys input fields 2023-04-02 09:22:20 +02:00
ChillerDragon b4b1dc8ff3 Release 0.3.0 2023-03-31 10:29:44 +02:00
ChillerDragon b2f2ff2f9a Generate system and game message classes
Most of the code is generated by

`./scripts/generate_messages.py`
2023-03-31 10:26:04 +02:00
ChillerDragon 91df2614b3 Separate snap and msgs in roadmap 2023-03-31 10:17:44 +02:00
ChillerDragon 41f4742ac1 Generate system message matcher 2023-03-31 10:14:55 +02:00
ChillerDragon a19df04b80 Sort dependencies to avoid changes on regen
Seems like the set has different orders when running
the generate script multiple times
this causes all game message class files to change
2023-03-31 09:55:07 +02:00
ChillerDragon e0203ebc78 Fix map change msg field rename
`chunks_per_request` -> `msg.num_response_chunks_per_request`
2023-03-31 09:32:47 +02:00
ChillerDragon 0d4f6057a2 Prefix generated classes with Msg 2023-03-29 16:50:28 +02:00
ChillerDragon d21092f44b Fix line too long (pylint) 2023-03-29 16:23:11 +02:00
ChillerDragon b39f067222 Generate system messages 2023-03-29 16:22:00 +02:00
ChillerDragon 14fd5f2b40 Fix rename 2023-03-29 14:54:21 +02:00
ChillerDragon 0131390285 Rename message constants to match generated code 2023-03-29 14:52:39 +02:00
ChillerDragon 4adf33061c Gen game msg id matching 2023-03-29 14:51:58 +02:00
ChillerDragon e77422bf1f Add broadcast packet test (not passing yet) 2023-03-29 13:26:34 +02:00
ChillerDragon 5f76de93a9 Generate pack() code for messages 2023-03-26 13:03:04 +02:00
ChillerDragon 992a855a57 Fix and finish map change msg 2023-03-26 12:22:13 +02:00
ChillerDragon a55817e8ab Some progress on packing (pack() and unpack raw) 2023-03-26 11:19:47 +02:00
ChillerDragon e22530743c Fix build of generated game msgs
the vote status field `pass` conflicts
with the python keyword so rename it to `pass_`

also fix `get_string()` not being a function
2023-03-25 18:43:45 +01:00
ChillerDragon bfa8162aa1 Start working on code generation
Using libtw2's network spec

a6e26ebd0a/gamenet/generate/spec
2023-03-25 18:19:52 +01:00
ChillerDragon 9d2524c199 Support parsing compressed packets 2023-03-25 16:12:27 +01:00
ChillerDragon f2ab08bfa6 Fix wrong offset when parsing multiple chunks 2023-03-25 16:11:42 +01:00
ChillerDragon 86d591bbdd Show flags when printing chunk header 2023-03-25 16:09:53 +01:00
ChillerDragon 1574c64d06 huffman: please mypy and pylint 2023-03-25 16:06:44 +01:00
ChillerDragon c477f736cb Add @edg-l's huffman from TeeAI 2023-03-25 14:41:51 +01:00
ChillerDragon 51dc981acf Release 0.2.0 2023-03-25 14:27:00 +01:00
ChillerDragon 0988cff4c9 Refactor to prepare proper msg unpacking
Rename `name` -> `message_name`
Replaced `GameMessage` and `SysMessage` with duck typed `NetMessage`
Split up packet.py in multiple files
2023-03-25 14:22:45 +01:00
ChillerDragon d96367374e Use map change as the first sample message 2023-03-23 13:29:44 +01:00
ChillerDragon 60ef395086 Release 0.1.2 2023-03-19 18:24:03 +01:00
ChillerDragon be2ffcc690 Fix import 2023-03-19 18:22:45 +01:00
ChillerDragon bdfa4bf2a0 Relative imports are broken 2023-03-19 18:13:18 +01:00
ChillerDragon 17b99ef262 Release 0.1.1 2023-03-19 18:07:02 +01:00
ChillerDragon cec1edcaa5 First draft of chunk header parsing 2023-03-19 18:03:13 +01:00
ChillerDragon 32ba361c04 Thoughts about packers 2023-03-19 14:34:51 +01:00
ChillerDragon 1a0e195060 Add tests for int unpacker 2023-03-19 14:24:44 +01:00
ChillerDragon bf28581b44 Port C unpacker code letter by letter to python 2023-03-19 11:57:10 +01:00