Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories β€” IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2018-08-29 00:00:00Z and 2018-08-30 00:00:00Z
Avatar
[quakenet] <heinrich5991> Learath2: it has that
06:09
[quakenet] <heinrich5991> see the downloader client (it's maybe a bit unwieldy :/ )
Avatar
[quakenet] <deen> heinrich5991: I mean just a client that gives you chat on the command line and lets you use console and rcon
Avatar
[quakenet] <Learath2> deen: I always wanted to code one but never had the time, should be pretty easy with libtw already doing the work tho
Avatar
a63f210 Fix segfault when deleting lock - def-
09:11
[ddnet/ddnet] New branch created: test
09:13
c02c0a4 Forbid copying classes in threading - def-
Avatar
925f7b6 Fix weird Windows compilation - def- c9f28ce Forbid copying classes in threading - def-
Avatar
@deen ath has such a future. You only see the console, if i am right. Probably not what you are looking for but i thought it was worth mentioning.
Avatar
[quakenet] <deen> onby also has it, so no need to rewrite it 3 times over
10:57
[ddnet/ddnet] New branch created: test2
10:57
e8cac83 Test (fix #1280) - def-
Avatar
ChillerDragon 2018-08-29 11:37:24Z
@deen onby doesnt want to share his source thats why was creating my own version. And i successfully kicked the graphics and it also is able to connect but it somehow crashes after 2 secs and i have no idea how to debug that
11:50
9423c1a Test (fix #1280) - def-
Avatar
why does base/system.c defines functions that are already defined?
11:54
void mem_copy(void *dest, const void *source, unsigned size) { memcpy(dest, source, size); }
11:54
is it for style convention? compatibility with something?
Avatar
@ChillerDragon gdb
11:56
convention and being able to add something in there later on
Avatar
ChillerDragon 2018-08-29 12:58:02Z
the good old gdb advice .-.
12:58
any spot where i can learn how to master gdb that i finally understand the output?
Avatar
@noby start sharing already thonkery
Avatar
[quakenet] <heinrich5991> ChillerDragon: you need very few commands to use gdb successfully
13:05
[quakenet] <heinrich5991> gdb ./DDNet
13:05
[quakenet] <heinrich5991> to start a debugging session for the client
13:05
[quakenet] <heinrich5991> then in the gdb prompt:
13:05
[quakenet] <heinrich5991> run
13:05
[quakenet] <heinrich5991> then make it crash
13:06
[quakenet] <heinrich5991> then run bt
13:06
[quakenet] <heinrich5991> this shows you where it crashed (and all the functions that led to this crash)
13:09
[quakenet] <heinrich5991> this is basically it. more commands: print variable: tells you the value of variable (can also be an expression), up, down goes up and down in the call stack (e.g. to print variables from different functions)
Avatar
break File:LineNo or break FuncName sets breakpoints
Avatar
[quakenet] <heinrich5991> oh yea, that one is also useful
13:19
[quakenet] <Learath2> c continues after hitting a breakpoint, n steps one line, s steps one line but if it can go deeper it'll go deeper, r starts the program again
13:19
[quakenet] <Learath2> that's about all you need :)
13:19
[quakenet] <heinrich5991> (continue, next, step, run; run starts the program from the start again)
Avatar
[quakenet] <Learath2> oh also very useful while stepping is if you just hit enter it repeats the last command
13:34
[quakenet] <heinrich5991> l(ist) shows you the surrounding code lines
Avatar
[quakenet] <Learath2> One last thing if you launch gdb with gdb -tui you get code view on top :)
13:54
[quakenet] <deen> no need to use -tui, just use ctrl-x a to toggle the TUI
13:54
[quakenet] <heinrich5991> (the point, however, is that you need very little to actually debug a segfault: gdb ./DDNet, run, bt
13:54
[quakenet] <heinrich5991> )
13:55
[quakenet] <deen> And you have to understand what a backtrace is
14:01
[quakenet] <deen> And if something is unclear, the documentation is good: https://sourceware.org/gdb/current/onlinedocs/gdb/
Debugging with GDB: Top
14:02
[quakenet] <deen> A few months ago I discovered that Python also has pdb: https://docs.python.org/3/library/pdb.html
Avatar
[quakenet] <heinrich5991> nice
14:14
[quakenet] <heinrich5991> I've never looked far enough to find a python debugger, it was too easy using printf-debugging ^^
14:14
[quakenet] <heinrich5991> thanks for that hint :)
Avatar
@heinrich5991 connection packets are not supposed to be compressed right?
Avatar
[quakenet] <heinrich5991> yes, control packets are never compressed anywhere, but vanilla supports decompressing control packets
Avatar
I tried to use CNetClient from outside tw, it seems to compress the packets
15:42
what prevents their comression normally?\
Avatar
[quakenet] <heinrich5991> huh
15:45
[quakenet] <heinrich5991> it seems compression is enabled
15:45
[quakenet] <heinrich5991> let me check vanilla
Avatar
I'm fairly certain the packets we receive on the servers are not compressed, we can them out at the firewall
Avatar
[quakenet] <heinrich5991> okay, it does allow compression
15:46
[quakenet] <heinrich5991> it's just that the compressed packets are usually longer, I think each compressed packet has at least 3 bytes of data
15:46
[quakenet] <heinrich5991> whereas the normal control messages have 1 byte of data, uncompressed
Avatar
Well somehow mine "compresses" it to 1 byte which is insane, so I'm guessing I need to initialize something about huffman
Avatar
[quakenet] <heinrich5991> yes, huffman needs to be initialized
15:49
[quakenet] <heinrich5991> call CNetBase::Init()
15:49
[quakenet] <heinrich5991> (or construct a CEngine)
15:51
[quakenet] <heinrich5991> Learath2: here's the compression table: https://github.com/heinrich5991/libtw2/blob/master/doc/huffman.md#appendix
Some Teeworlds stuff in Rust. Contribute to heinrich5991/libtw2 development by creating an account on GitHub.
Avatar
yay, that fixes some of it
15:51
heinrich5991: How long is the securitytoken? 4 bytes?
Avatar
[quakenet] <heinrich5991> yes
15:52
[quakenet] <heinrich5991> +TKEN
15:52
[quakenet] <heinrich5991> (another 4 bytes for the CONNECT message)
15:52
[quakenet] <heinrich5991> note that there is no support for that message in libtw2 yet
Avatar
huffman compression is used on the whole payload?
Avatar
[quakenet] <heinrich5991> yes
15:54
[quakenet] <heinrich5991> on everything except the three bytes of teeworlds packet header
Avatar
hmm heinrich5991 could dbg_lognetwork not be updated to log properly with security tokens?
Avatar
[quakenet] <heinrich5991> mh?
Avatar
00 00 00 00 0C 00 00 00 10 00 00 02 54 4B 45 4E 02 CE E9 05
15:59
00 indicates that it's raw, 00 00 00 0C indicates it's 12 bytes, there are more then 12 bytes remaining
16:00
however this is insane, 00 00 00 0C is printed by io_write(Size, sizeof Size); and io_write(Data, Size);
Avatar
[quakenet] <heinrich5991> b'\x00\x00\x00\x00\x0c\x00\x00\x00\x10\x00\x00\x02TKEN\x02\xce\xe9\x05'
16:01
[quakenet] <heinrich5991> wait what?
16:01
[quakenet] <heinrich5991> not &Size?
Avatar
it' &Size, I miswrote
Avatar
[quakenet] <heinrich5991> so what's insane?
Avatar
a 12 is written, and the next command can only possibly write 12 bytes
16:03
so where do the rest of the bytes (which obviously belong to the packet and are the security token bytes) come from?
Avatar
[quakenet] <heinrich5991> I only see 12 bytes
16:03
[quakenet] <heinrich5991> 00 00 00 00 (type)
16:03
[quakenet] <heinrich5991> 0c 00 00 00 (size)
Avatar
Oh I am a moron
Avatar
[quakenet] <heinrich5991> little endian? :)
Avatar
endianness
16:07
heinrich5991: 10 00 00 00 02 CE E9 05 do you happen to know which packet this is?
16:07
10 00 00 00
Avatar
[quakenet] <heinrich5991> that looks like a keepalive
16:07
[quakenet] <heinrich5991> sent when nothing is happening
16:07
[quakenet] <heinrich5991> I think every half a second or so
Avatar
so if I start getting keepalives is it safe to assume I have connected successfully?
Avatar
[quakenet] <heinrich5991> yes
16:08
[quakenet] <heinrich5991> however in a normal connection, you'll never receive KEEPALIVEs
Avatar
[quakenet] <heinrich5991> because there's always an outstanding conversation (log on) or you're already in game so you're receiving snaps every 0.04 seconds
16:09
[quakenet] <heinrich5991> Learath2: what are you doing? :)
Avatar
coding a chat only client πŸ˜›
Avatar
[quakenet] <heinrich5991> why you not using libtw2? :)
Avatar
deen wanted one that is a target, and I wanted to see how spaghetti the tw code is
Avatar
[quakenet] <heinrich5991> ah, like a part of ddnet?
Avatar
and my rust is pretty rusty (ha)
16:12
yeah make text_client
Avatar
with rust?
16:12
ayyy
Avatar
not with rust, with C
16:13
well C+(+?)
16:13
@heinrich5991 so after connecting, the client is supposed to send 10 00 00 01?
Avatar
[quakenet] <heinrich5991> no, that's the first thing the client sends, that's the CONNECT message
Avatar
So wait, I am getting keepalives, the server is definitely expecting me to send sth
16:15
is there a protocol doc somewhere that outlines the process?
16:15
NETMSG_INFO?
Avatar
[quakenet] <heinrich5991> lol
16:15
[quakenet] <heinrich5991> but yes, I wrote a bit on that
16:15
[quakenet] <heinrich5991> only a tiny bit though
16:15
[quakenet] <heinrich5991> but lol docs
16:16
Some Teeworlds stuff in Rust. Contribute to heinrich5991/libtw2 development by creating an account on GitHub.
16:18
Some Teeworlds stuff in Rust. Contribute to heinrich5991/libtw2 development by creating an account on GitHub.
16:18
[quakenet] <heinrich5991> the game messages can be found in datasrc/network.py in your ddnet source code
16:20
[quakenet] <heinrich5991> Learath2: questions?
Avatar
can u help me with the first 8 bytes? xD
16:33
16:33
9th byte is client_id from the writer
16:33
then the message follows
16:33
and last 4 bytes are some footer
Avatar
[quakenet] <heinrich5991> I should really finish my wireshark dissector some time
Avatar
[quakenet] <heinrich5991> https://github.com/heinrich5991/libtw2/blob/master/doc/packet.md gives information about the first 6 bytes
Some Teeworlds stuff in Rust. Contribute to heinrich5991/libtw2 development by creating an account on GitHub.
Avatar
[quakenet] <heinrich5991> next byte is message ID
16:38
[quakenet] <heinrich5991> that's 6/2=3, i.e. the third item in the list https://github.com/ddnet/ddnet/blob/c9f28ce0941ef1727242005ff1cd18c4b741aef3/datasrc/network.py#L230
DDraceNetwork, a mod of Teeworlds. Contribute to ddnet/ddnet development by creating an account on GitHub.
16:38
[quakenet] <heinrich5991> so it's a Sv_Chat message
16:38
[quakenet] <heinrich5991> containing two integers and a string
Avatar
why /2 though
Avatar
[quakenet] <heinrich5991> (also, capturing bytes as picture, really? :P)
16:39
[quakenet] <heinrich5991> the number is either even or odd
16:39
[quakenet] <heinrich5991> if it's even, it's a game message and /2 is the ID
16:39
[quakenet] <heinrich5991> if it's odd, then it's a system message and /2 (rounded down) is the ID
Avatar
hmm, I really should have just used libtw
16:40
why does network,cpp depend on a config being available? :/
16:40
atleast it doesn't request it from a kernel
16:41
at that point I might aswell work backwards and remove stuff from the actual client
16:42
what is libtw2 btw
Avatar
[quakenet] <heinrich5991> some building parts for teeworlds, rewritten from scratch, in rust
16:42
[quakenet] <heinrich5991> can read maps, demos, teehistorian, can decode/encode messages, has a working map downloader and a bare-minimum server
Avatar
heinrich5991 any tip on getting config working? πŸ˜›
Avatar
[quakenet] <heinrich5991> no, not really
16:45
[quakenet] <heinrich5991> src/engine/config.h seems to be the interface
16:46
[quakenet] <heinrich5991> haven't really worked with that a lot
Avatar
eh, just created a kernel and registered config in it πŸ˜›
16:51
kernel itself depends on storage, yeah this is all pretty spaghetti
Avatar
well got it connected and sending messages, now just need to set up a send buffer
Avatar
ChillerDragon 2018-08-29 17:34:38Z
wow thanks a lot for the gdb instructions ima test them later c: !!! ❀ @Learath2 @heinrich5991 @deen
Avatar
bt full
17:34
for more detail
17:36
Thread 1 "zcatch_srv_d" received signal SIGSEGV, Segmentation fault. 0x000055555558ca66 in CRingBufferBase::Allocate (this=0x7ffff6ca73b8, Size=71) at src/engine/shared/ringbuffer.cpp:109 109 pNewItem->m_pNext->m_pPrev = pNewItem; #0 0x000055555558ca66 in CRingBufferBase::Allocate (this=0x7ffff6ca73b8, Size=71) at src/engine/shared/ringbuffer.cpp:109 #1 0x0000555555573b6a in TStaticRingBuffer<CNetChunkResend, 32768, 0>::Allocate (this=0x7ffff6ca73b8, Size=71) at src/engine/shared/ringbuffer.h:59 #2 0x0000555555572b49 in CNetConnection::QueueChunkEx (this=0x7ffff6ca7398, Flags=1, DataSize=31, pData=0x7fffffffcf00, Sequence=416) at src/engine/shared/network_conn.cpp:128 #3 0x0000555555572c4b in CNetConnection::QueueChunk (this=0x7ffff6ca7398, Flags=1, DataSize=31, pData=0x7fffffffcf00) at src/engine/shared/network_conn.cpp:154 #4 0x000055555558ec66 in CNetServer::Send (this=0x7ffff6c8de08, pChunk=0x7fffffffce80) at src/engine/shared/network_server.cpp:647 #5 0x0000555555591754 in CServer::SendMsgEx (this=0x7ffff6a47010, pMsg=0x7fffffffcf00, Flags=1, ClientID=3, System=true) at src/engine/server/server.cpp:683 #6 0x000055555559252e in CServer::SendRconLine (this=0x7ffff6a47010, ClientID=3, pLine=0x7fffffffd780 "[game]: leave player='7:iheb'") at src/engine/server/server.cpp:927 #7 0x00005555555925d4 in CServer::SendRconLineAuthed (pLine=0x7fffffffd780 "[game]: leave player='7:iheb'", pUser=0x7ffff6a47010) at src/engine/server/server.cpp:942 #8 0x000055555557c618 in CConsole::Print (this=0x555555981720, Level=0, pFrom=0x5555556b5e33 "game", pStr=0x7fffffffdbb0 "leave player='7:iheb'") at src/engine/shared/console.cpp:204 #9 0x00005555555d1fc5 in CPlayer::OnDisconnect (this=0x555555958450 <ms_PoolDataCPlayer+8176>, pReason=0x7ffff6cd10a0 "") at src/game/server/player.cpp:331
17:36
anyone :/?
Avatar
ChillerDragon 2018-08-29 17:36:29Z
baut the console client. Why i used the ddnet source is because i want a client that can do more than chatting. I just love consoles and using some ncurses stuff or what ever to enable keypresses would be awesome. And rendering a poor image out of text just shwing tees and collision tiles would be awesome. If you just want to chill on a server vote, chat. move around see a bit of the gameplay etc. I would love to see such thing.
Avatar
@jxsl13 pretty hard without seeing some code
Avatar
[quakenet] <heinrich5991> print pNewItem->m_pNext
17:41
[quakenet] <heinrich5991> print pNewItem
Avatar
how ._. this occurs quite often, but not in the way I can reproduce it.. and the debugger is turned off atm ?
Avatar
[quakenet] <heinrich5991> you should write these lines in the debugger ^^
17:43
[quakenet] <heinrich5991> (if you can get the stack trace, you should be able to print these as well, from inside gdb)
Avatar
then gotta wait for it to crash again, @ChillerDragon mind flooding my server johnbehm.de:8303 ?
Avatar
[quakenet] <heinrich5991> you can save coredumps or so
Avatar
heinrich5991: do you know how CGameClient populates its m_aClients?
Avatar
#0 0x000055555558ca66 in CRingBufferBase::Allocate (this=0x7ffff6ca73b8, Size=71) at src/engine/shared/ringbuffer.cpp:109 pNewItem = 0x7ffff6ca74a8 WantedSize = 96 pBlock = 0x7ffff6ca7448 #1 0x0000555555573b6a in TStaticRingBuffer<CNetChunkResend, 32768, 0>::Allocate (this=0x7ffff6ca73b8, Size=71) at src/engine/shared/ringbuffer.h:59 No locals. #2 0x0000555555572b49 in CNetConnection::QueueChunkEx (this=0x7ffff6ca7398, Flags=1, DataSize=31, pData=0x7fffffffcf00, Sequence=416) at src/engine/shared/network_conn.cpp:128 pResend = 0x5007fffffffcec0 pChunkData = 0x7ffff6caf58d "" Header = {m_Flags = 1, m_Size = 31, m_Sequence = 416}
Avatar
[quakenet] <heinrich5991> then you can investigate the crash even if no debugger was attached at the time
Avatar
bt full info
Avatar
[quakenet] <heinrich5991> print pNewItem->m_pNext
17:45
[quakenet] <heinrich5991> Learath2: in Reset or so and in the snapshot handling
Avatar
how do I save the coredump?
Avatar
[quakenet] <heinrich5991> I don't know
17:45
[quakenet] <heinrich5991> there's an option in linux to save them automatically
Avatar
damn, I have to handle snapshot stuff to get client names
Avatar
[quakenet] <heinrich5991> yes
17:46
[quakenet] <heinrich5991> there you'll also find one obvious flaw in the tw protocol
17:46
[quakenet] <heinrich5991> :
17:46
[quakenet] <heinrich5991> nothing synchronizes game messages with snapshots
17:46
[quakenet] <heinrich5991> i.e. you can get chat messages for people who have left/whose slot has been reassigned
17:46
[quakenet] <heinrich5991> then you get the wrong sender in the client
Avatar
in gdb this seems to do the job generate-core-file ... let's wait xD
Avatar
fk it i give up
18:06
writing python program to chat in tw 2 hard
Avatar
@ZimE Use libtw2 and learn yourself some rust for great good
Avatar
lol thats all ur trying to do??
18:18
Avatar
bypassing ur protection was too ez
Avatar
u tried so many times lmao
Avatar
nub apple
Avatar
[quakenet] <heinrich5991> maybe I should write a python wrapper for libtw2
18:33
[quakenet] <heinrich5991> might come handy for some easy scripting
18:46
Such a horrible experience
18:47
Will finish it up when I can see again
Avatar
[quakenet] <heinrich5991> receive! not recieve ^^
Avatar
fixeth
18:54
DDraceNetwork, a mod of Teeworlds. Contribute to Learath2/ddnet development by creating an account on GitHub.
18:59
now the question is do I introduce sth like readline or do I just do a non-blocking read of stdin until I get a \n in my buffer and call it a day? πŸ˜›
Avatar
[quakenet] <heinrich5991> if I had to guess, I'd say you'd settle for the latter
18:59
[quakenet] <heinrich5991> :P
πŸ˜› 1
Avatar
I really don't feel like implementing a whole input buffer and a send queue :/
19:01
i'll check how fstd does it in icat, maybe I can steal sth πŸ˜ƒ
Avatar
[quakenet] <heinrich5991> icat just reads from stdin
19:05
[quakenet] <fstd> actually the process is quite a bit involved
19:05
[quakenet] <fstd> iirc
19:06
[quakenet] <heinrich5991> mhk
19:06
[quakenet] <heinrich5991> select()?
19:08
[quakenet] <fstd> on the icat level, it first checks whether it can read (which ends up as a select, yes)
19:08
[quakenet] <fstd> and confusingly already fills the read buffer as part of the check
19:09
[quakenet] <fstd> whereas the actual "readline" function just considers that buffer and never does any i/o by itself
Avatar
does the chat client allows to interact with your character
19:18
inb4 machine learning bot (edited)
Avatar
It can't even chat yet πŸ˜›
19:20
waiting for it
19:20
i always wanted try stuff with a headless client
Avatar
ChillerDragon 2018-08-29 20:44:21Z
meh fok windows C:\MinGW\bin\gdb.exe: TUI mode is not supported
Avatar
hi, is there a flag to allow editing a config variable only in the cfg file?
Avatar
ChillerDragon 2018-08-29 21:57:51Z
?
21:57
client or server side
21:58
i think sv_test_cmds can only be set in config
πŸ‡· 1
πŸ‡Ή 1
πŸ‡« 1
β“‚ 1
tear 1
what 1
21:59
just load the config var value into a variable after loading the config and use this variable instead
Avatar
srv side
Avatar
ChillerDragon 2018-08-29 21:59:37Z
idont think there is a flag
Avatar
nah test cmds can be edited
Avatar
ChillerDragon 2018-08-29 22:00:05Z
but it has no effect
22:00
u cant change a ddnet server into a testddnet server
22:00
ingame
Avatar
it has only CFGFLAG_SERVER as flag
22:00
it can be edited
Avatar
ChillerDragon 2018-08-29 22:00:51Z
yes
22:01
maybe done in a similar way i suggested
22:01
it has no effects
22:01
but it could be edited
Exported 248 message(s)