Commit graph

151 commits

Author SHA1 Message Date
ChillerDragon 7697e5f451 color annotate hexdumps
Thanks to the legend @Learath2
2022-11-16 12:40:52 +01:00
ChillerDragon 59c2886046 hexdump snaps 2022-11-16 11:30:13 +01:00
ChillerDragon 616e14be1f Verbose snap data printing on client side 2022-11-16 10:57:49 +01:00
ChillerDragon 653ee661e9 Fix english cancle -> cancel ty swarfey and rcon 2022-11-16 10:50:54 +01:00
ChillerDragon 4a12262ad3 Move all network payload classes to messages/ 2022-11-16 09:37:47 +01:00
ChillerDragon 0f4646e011 Add sanitize cc 2022-11-15 18:26:49 +01:00
ChillerDragon db56a97e8c String unpacker should sanitize by default 2022-11-15 18:15:27 +01:00
ChillerDragon 07eb3841d2 Print emotes on the server side
thanks to @AlexIsTheGuy for brainstorming emote names
2022-11-15 17:48:56 +01:00
ChillerDragon 6283648964 Use SvClientDrop on the client side 2022-11-15 12:55:43 +01:00
ChillerDragon c11a7ae2d2 Generate SvClientDrop
twnet g sv SvClientDrop client_id:int reason:str silent:bool
2022-11-15 12:43:23 +01:00
ChillerDragon 3ab4fc61d1 Regenerate input timing with correct order
also remove the boolean placeholder if there is no bool field
2022-11-15 11:44:20 +01:00
ChillerDragon 3a219f406b Change context api! And add input timing msg
Remove the client attribute from the Context class
The block that exposes a Context class has to be called on a client
anyways so also passing it to the block args is redundant.

Replace it by a parsed version of the chunk which has yet to be properly
named current working title is: todo_rename_this
2022-11-15 10:39:44 +01:00
ChillerDragon fa08043968 First generated code pog
I ran this

	twnet g sp InputTiming intended_tick:int time_left:int
2022-11-15 10:10:45 +01:00
ChillerDragon 86a306664c Continue with packet generate script 2022-11-14 18:52:25 +01:00
ChillerDragon fe3e581f86 Make client callbacks arrays
Allows to setup multiple on_* hook blocks as a lib user

closed #10
2022-11-14 10:25:28 +01:00
ChillerDragon 2bec19ff21 rage quit on snap single 2022-11-13 17:24:13 +01:00
ChillerDragon 26fa55c428 Do not crash server on emotes 2022-11-13 15:54:27 +01:00
ChillerDragon 41b5277613 Fix multiple clients being connected at the same time 2022-11-13 15:47:37 +01:00
ChillerDragon 1949e1eb2e Add check script for hook documentation
related to #11
2022-11-13 12:28:38 +01:00
ChillerDragon 36a5100230 Add unit tests for bytes.rb 2022-11-13 11:42:46 +01:00
ChillerDragon acba9e7a5d Display chat messages in server log 2022-11-13 11:15:33 +01:00
ChillerDragon fc48a53bbd Make server log look nice in non verbose mode 2022-11-13 10:42:49 +01:00
ChillerDragon 3358cc6608 Parse start info on server side 2022-11-13 10:37:46 +01:00
ChillerDragon d9b0096ae8 Send server settings 2022-11-13 09:40:05 +01:00
ChillerDragon 263e579661 Create models folder for all the storage classe 2022-11-13 08:58:33 +01:00
ChillerDragon 846b487eb2 Only send snaps to in game clients 2022-11-13 08:40:17 +01:00
ChillerDragon 09bd7bfebb Count ack per client and thus fix reconnect
Sadly reconnecting somehow crashes the client :(

https://github.com/teeworlds/teeworlds/issues/3182
2022-11-13 08:29:21 +01:00
ChillerDragon 409f880f36 Do not crash on ctrl close of invalid connection 2022-11-13 07:51:50 +01:00
ChillerDragon 44e20583e6 Refactor integration test names 2022-11-12 17:49:50 +01:00
ChillerDragon 7422ee9d94 Proper client drop support on the server side 2022-11-12 16:24:28 +01:00
ChillerDragon c770695f22 Timeout clients that did not sent for 10s 2022-11-12 15:58:08 +01:00
ChillerDragon 821036fba4 Fix client tokens 2022-11-12 15:55:24 +01:00
ChillerDragon 6d7bd0371d Print rcon commands sent by the client 2022-11-12 15:46:38 +01:00
ChillerDragon 11898d0f41 Ensure tokens being in correct format 2022-11-12 12:51:09 +01:00
ChillerDragon e3292deb15 Thoughts about ctrl close 2022-11-12 12:08:25 +01:00
ChillerDragon e914ec3fa2 Send broken close message to clients after 1 second
Aka starting to work on timeouting clients
2022-11-12 12:01:38 +01:00
ChillerDragon 15139ceb68 Ignore input packets from clients 2022-11-12 11:38:46 +01:00
ChillerDragon e9dc1ae75f Support non vital chunks 2022-11-12 11:35:12 +01:00
ChillerDragon 050e4b9e00 Weird idea about seq 2022-11-12 11:22:54 +01:00
ChillerDragon c782eb82e6 Start to work on seq per client 2022-11-12 11:18:12 +01:00
ChillerDragon ff21d6ca84 Check args for chunk header
related to #7
2022-11-12 10:39:11 +01:00
ChillerDragon 83c38c4639 Change chunk header api 2022-11-12 10:17:54 +01:00
ChillerDragon 4813652b82 Send empty snaps to get client in happy state 2022-11-12 09:42:50 +01:00
ChillerDragon 7f7963189c Got client stuck in connecting till timeout 2022-11-11 17:52:57 +01:00
ChillerDragon 1876038d82 Reached "invalid standard map" with a few hax 2022-11-11 17:32:03 +01:00
ChillerDragon cf57146260 Mess with tokens 2022-11-11 14:48:26 +01:00
ChillerDragon 45d1361408 Server send game and server info 2022-11-11 13:42:11 +01:00
ChillerDragon 1baf3fcad0 Start working on server side map packet 2022-11-11 10:21:48 +01:00
ChillerDragon 0a04af1cb6 Parse client info on the server side 2022-11-09 16:46:04 +01:00
ChillerDragon ddc6a1ad17 Fix server 100% CPU usage in idle 2022-11-09 13:55:09 +01:00
ChillerDragon d013656ffb Remove packer debug msg 2022-11-09 13:50:15 +01:00
ChillerDragon 6c005497d4 Layout server control msg structure
Thus closed #5
By deciding to support server as well.

This is rebranding from teeworlds-client to teeworlds_network
And thus also including a bunch of file renames
2022-11-09 08:56:18 +01:00
ChillerDragon 3a39d3f9f8 Start working on the server side 2022-11-08 16:20:46 +01:00
ChillerDragon fff2e9efb0 First draft of sending inputs
Thanks a lot to @Swarfey for his tw-chatonly typescript package
https://www.npmjs.com/package/teeworlds

His simple calculation of the pred time was saving me a lot of time!
2022-11-06 20:15:47 +01:00
ChillerDragon ffbc433b67 Add rcon support 2022-11-06 18:26:14 +01:00
ChillerDragon 2db8b7058d All packer tests passing and verified 2022-11-06 16:43:32 +01:00
ChillerDragon cca183818e Fix tests and packer (multi negative still broken) 2022-11-06 16:26:00 +01:00
ChillerDragon 01d8f8d8e6 Single byte negative int unpacks wrong 2022-11-06 13:57:53 +01:00
ChillerDragon 0479e7f07e Add packer tests 2022-11-06 13:35:10 +01:00
ChillerDragon 11a7e9629d Unpacker should be fully working now
Covered by good test coverage.
Parts of the tests are commented out because they depend on the
currently borken packer to work.
2022-11-06 13:18:26 +01:00
ChillerDragon cafbd79fe9 Mess w packer (no actual progress) 2022-11-06 12:11:54 +01:00
ChillerDragon a3f28aaf37 Make flag bits string mutable (unfreeze) 2022-11-05 18:01:04 +01:00
ChillerDragon 39389ae379 Add rubocop to CI (closed #2) 2022-11-05 17:57:12 +01:00
ChillerDragon 742b665f26 rubocop -A 2022-11-05 17:48:47 +01:00
ChillerDragon 28477ab90d Manually fix netbase 2022-11-05 17:47:47 +01:00
ChillerDragon 70a03dc88f rubocop -A lib/packet.rb 2022-11-05 17:27:13 +01:00
ChillerDragon e7f1d82e2d rubocop -A lib/packer.rb 2022-11-05 17:26:08 +01:00
ChillerDragon 940cc4269f Fix ugly rubocop if and silent disconnect 2022-11-05 17:23:35 +01:00
ChillerDragon ddef46991b rubocop -a 2022-11-05 17:19:05 +01:00
ChillerDragon 0be954538c Add tests (closed #3) 2022-11-05 17:13:23 +01:00
ChillerDragon db106ba70e Add on_client_drop() 2022-11-05 11:59:36 +01:00
ChillerDragon 8fe595b0a6 Client info is actually used to display join msgs
Looked at the c++ client code and it actually does that.
The entergame message is only used in demos. Yeet on those.
2022-11-05 11:34:34 +01:00
ChillerDragon 771bdfe859 Holy sh*t this lib is actually usable 2022-11-05 11:07:16 +01:00
ChillerDragon 7689d2725a Strong control over lib using Context objects 2022-11-05 10:35:40 +01:00
ChillerDragon 1d3076e34b Break api hook_chat -> on_chat 2022-11-05 09:39:16 +01:00
ChillerDragon 57dfc76588 Stabilize api yikes 2022-11-04 16:57:50 +01:00
ChillerDragon 0f9c9a0804 Proper chat message support 2022-11-04 16:26:24 +01:00
ChillerDragon 316a24852e Enough unpacker to be dangerous 2022-11-04 15:35:54 +01:00
ChillerDragon b36df089ff Bunch of failing tests 2022-11-04 15:21:48 +01:00
ChillerDragon 831a9b6452 Start working on unpacker 2022-11-04 13:58:19 +01:00
ChillerDragon 875132a03a Document more samples 2022-11-04 13:22:29 +01:00
ChillerDragon 794915942c Close connection on ctrl+c 2022-11-04 13:07:34 +01:00
ChillerDragon effa00b001 Disconnect before connecting 2022-11-04 13:04:51 +01:00
ChillerDragon 0e42839e74 Fix reconnecting 2022-11-04 12:55:01 +01:00
ChillerDragon 57a8f0bcc7 Unhardcode the last packet (startinfo)
Also support bigger integers than 63 :)
2022-11-04 12:31:42 +01:00
ChillerDragon 2c8e6aeb8f Unhardcode startinfo
Thanks a lot to @Learath2 for explaining the int packer to me <3
2022-11-04 11:39:41 +01:00
ChillerDragon 2919feb529 Unhardcode more chunk headers 2022-11-04 10:12:23 +01:00
ChillerDragon 68e8cb6dd0 Alert on empty payload instead of crashing 2022-11-04 09:27:36 +01:00
ChillerDragon 24fa105f66 Do not spawn a thread by default
This allows users to implement better multi threading than me.
Or if someone just wants to fire and forget a client that should just
use the provided hooks then not detaching takes away the effort
of keeping the program running.

Imo it is an easier and more fun problem to have:

  "My client connects fine but my other ruby code does not run"

than

  "My program just quits when I run it"
2022-11-01 15:32:47 +01:00
ChillerDragon f7486c353f Spawn thread for connection 2022-11-01 15:27:39 +01:00
ChillerDragon 9fc83cb327 Allow hooking in custom chat code 2022-11-01 14:25:56 +01:00
ChillerDragon 01915a5629 Remove hacks and break everything in the process 2022-11-01 10:52:48 +01:00
ChillerDragon cd0d5da9fa Working send_chat() poggers 2022-11-01 10:37:24 +01:00
ChillerDragon e3bda9a3e6 Still timeouts but looks good in wireshark 2022-10-30 19:58:51 +01:00
ChillerDragon b7a2cfb5c3 Start working on proper packet header 2022-10-30 19:00:13 +01:00
ChillerDragon f75eaebcee Print info packet when sending it 2022-10-30 11:18:15 +01:00
ChillerDragon 1ef6abf377 A bit of cleanup 2022-10-30 10:13:18 +01:00
ChillerDragon 8352033d0b TODO: ack in packet header 2022-10-29 17:04:35 +02:00
ChillerDragon 4544bb3e1a Reach old connection state with less hacks 2022-10-29 16:18:07 +02:00
ChillerDragon d68be4eb68 More todos than progress 2022-10-29 13:17:42 +02:00