07:40 < bridge> [ddnet] github search keyword highlight is drunk. I thought this was something that needed a fix. 07:40 < bridge> [ddnet] https://cdn.discordapp.com/attachments/293493549758939136/852784390908018758/unknown.png 08:28 < bridge> [ddnet] @deen\: @Jupstar โœช can I get at least 24h to have a look at the data svg prs? \:) 08:58 < bridge> [ddnet] https://rocket.rs/v0.5-rc/news/2021-06-09-version-0.5-rc.1/ 08:58 < bridge> [ddnet] :poggers: 09:10 < bridge> [ddnet] yo @TsFreddie any plans on porting your text refactor to ddnet? \:) 09:11 < bridge> [ddnet] it's too much work :justatest: 09:11 < bridge> [ddnet] yea i can imagine 09:12 < bridge> [ddnet] but two different text renders are splitting the code bases even more \:/ 09:12 < bridge> [ddnet] :feelsbadman: 09:12 < bridge> [ddnet] can it be done step by step? without doing all the work at once? 09:13 < bridge> [ddnet] is there a way i could support you without knowing what this all textrender stuff is \:D 09:13 < bridge> [ddnet] maybe. the TextEx can be replaced without touching all other parts. 09:13 < bridge> [ddnet] i think 09:14 < bridge> [ddnet] you removed textex right? 09:14 < bridge> [ddnet] i rewrote a new layout code, it behave differently so i just dropped the textex name with something 09:14 < bridge> [ddnet] else 09:17 < bridge> [ddnet] if should be possible to port `TextDefered` and `MakeWord` as a replacement for `TextEx`. 09:17 < bridge> [ddnet] it should be* 09:17 < bridge> [ddnet] sounds like a start \:) 09:18 < bridge> [ddnet] but the behavior of text need to be reexamined case by case for every TextEx call 09:18 < bridge> [ddnet] which is most of the work for vanilla. is just to redo all text. 09:22 < bridge> [ddnet] we can also nuke all gpu optimization for text in ddnet, get the entire thing over here. then redo the gpu optimization ๐Ÿ˜… . but i'm not sure if that's easier. 09:22 < bridge> [ddnet] or we port gpu optimizations to vanilla and then take all back? 09:23 < bridge> [ddnet] you can't 09:24 < bridge> [ddnet] at least you can't do it without extending teeworlds's graphic code. 09:26 < bridge> [ddnet] yea no omg i do not feel comfortable replacing TextEx 09:28 < bridge> [ddnet] ye... 11:37 < bridge> [ddnet] Chillerdragon webhook 11:37 < bridge> [ddnet] :feelsgoodman: 13:03 < bridge> [ddnet] Smart people in here right? 13:03 < bridge> [ddnet] I've got a few questions if anyone is willing to answer them 13:07 < bridge> [ddnet] don't ask to ask, just ask ^^ 13:12 < bridge> [ddnet] Its not involved with teeworlds thats why @murpi 13:39 < ChillerDragon> #offtopic then 14:35 < bridge> [ddnet] You can look at them the whole day xd 16:21 < bridge> [ddnet] @heinrich5991 https://paste.pr0.tips/Fe am I doing something wrong? 16:21 < bridge> [ddnet] How is this compiling so awfully? 16:22 < bridge> [ddnet] I'm doing like some TRIVIAL string manipulation 16:22 < bridge> [ddnet] what are you trying? separating "words" by whitespace? 16:23 < bridge> [ddnet] yeah, just return one word 16:23 < bridge> [ddnet] (I need to do some bookkeeping for further lexing, so I can't just `.split_whitespace()` 16:23 < bridge> [ddnet] s\/$/)/ 16:27 < bridge> [ddnet] Split once? 16:28 < bridge> [ddnet] @Learath2 no, I don't immediately see why this is slow 16:28 < bridge> [ddnet] @Ryozuki need to keep track of indices 16:28 < bridge> [ddnet] https://doc.rust-lang.org/std/primitive.str.html#method.split_once 16:29 < bridge> [ddnet] Ah 16:29 < bridge> [ddnet] Well it's probably not slow in any amount you'd care about anyway, the assembly looks concerning to me 16:29 < bridge> [ddnet] the only thing I notice specifically is that you're splitting on all unicode whitespace 16:29 < bridge> [ddnet] ah, then this info might be relevant ^ 16:29 < bridge> [ddnet] On rust all strings are valid unicode 16:30 < bridge> [ddnet] I think indexing is harder somethimg about glyphs idk 16:30 < bridge> [ddnet] utf8* 16:30 < bridge> [ddnet] no 16:30 < bridge> [ddnet] it's still indexing by byte offsets 16:31 < bridge> [ddnet] indexing by graphemes would be harder, rust just uses fixed size (4 bytes iirc) per char 16:31 < bridge> [ddnet] no, &str uses UTF8 as representation 16:32 < bridge> [ddnet] the indices are byte indices into this byte array 16:32 < bridge> [ddnet] @Learath2 do you always look at the assembly output of everything you do? 16:32 < bridge> [ddnet] Should i do that too? 16:33 < bridge> [ddnet] Just while i'm learning a language so I can know it's characteristics 16:33 < bridge> [ddnet] @Learath2 I'm somehow missing a "get index from slice and element" 16:33 < bridge> [ddnet] e.g. what to avoid in critical paths, like virtual calls in languages with bad devirtualization in their compilers 16:33 < bridge> [ddnet] but you can probably hack it yourself 16:34 < bridge> [ddnet] I would only look at it if i was doing something where i know i can help the compiler vectorize it 16:34 < bridge> [ddnet] But otherwise never 16:34 < bridge> [ddnet] :pepeH: 16:35 < bridge> [ddnet] @Learath2 some advice i seen, always try to use iterator functions instead of traditional for loops 16:35 < bridge> [ddnet] Ppl say they optimize better 16:35 < bridge> [ddnet] In eust 16:35 < bridge> [ddnet] Rust 16:38 < bridge> [ddnet] Btw im using rust at work (yes i got a job yay, altho its part time) doing web dev 16:38 < bridge> [ddnet] :greenthing: :monkalaugh: 16:40 < bridge> [ddnet] Hm, my unsafe version is about 100 instructions shorter 16:40 < bridge> [ddnet] Indexing with unchecked? 16:40 < bridge> [ddnet] which unsafe version? 16:40 < bridge> [ddnet] Just checking that index is within range and unwrapping unchecked 16:41 < bridge> [ddnet] https://godbolt.org/z/38sP94rjP 16:42 < bridge> [ddnet] Oh shit, that web is not the best on mobile 16:42 < bridge> [ddnet] Yeah awful on phone ๐Ÿ˜„ 16:43 < bridge> [ddnet] Actually doesn't even need to be unsafe now that I think of it, I can just match the None case and ignore it 16:44 < bridge> [ddnet] (though it is wasteful, `end < len` implies it's not `None` 16:49 < bridge> [ddnet] Yeah this version is good 16:50 < bridge> [ddnet] I think none and some are zero cost or smth 16:51 < bridge> [ddnet] I wanted to use iterators but `Chars` contains a reference to the string it's iterating, so I can't keep it in the same struct as the string. (no self referential structs in rust) 16:51 < bridge> [ddnet] I initially wanted to keep an iterator instead of an index in my struct 16:55 < bridge> [ddnet] Hmm 16:55 < bridge> [ddnet] I dont know exactly what u want to do 16:55 < bridge> [ddnet] Well as the name says, it's just a lexer ๐Ÿ˜› 16:55 < bridge> [ddnet] Like the one we have in `CConsole` 16:57 < bridge> [ddnet] Are you doing it as an exercise to learn ? 16:57 < bridge> [ddnet] If not https://github.com/maciejhirsz/logos 16:57 < bridge> [ddnet] Well it's a trivial lexer, I honestly would rather not bring in more dependencies 16:58 < bridge> [ddnet] The entire thing is a learning exercise anyway, so it's fine 16:58 < bridge> [ddnet] I'll probably never be okay with linking to a billion external dependencies :/ 16:59 < bridge> [ddnet] In rust its common 17:00 < bridge> [ddnet] In all languages it's common 17:00 < bridge> [ddnet] In c++ its a pain 17:00 < bridge> [ddnet] I've never been very happy with it, I'm a very big NIH sufferer 17:00 < bridge> [ddnet] So i underdtsnd where u come from 17:00 < bridge> [ddnet] I like to make things myself 17:06 < bridge> [ddnet] I just got an even better idea ๐Ÿ˜› 17:16 < bridge> [ddnet] :poggers: 17:40 < bridge> [ddnet] BTW i vaguely remember some demand for spectating specific switch numbers i quickly cracked that feature together for my client its not crystal clean but it does the job. In case someone is interested in that or wants me to pr against upstream https://github.com/chillerbot/chillerbot-ux/commit/d9d895ff84045a9ae4dbb47053053e82ed8d271d 17:47 < bridge> [ddnet] BTW i vaguely remember some demand for spectating specific switch numbers i quickly cracked that feature together for my client its not crystal clean but it does the job. In case someone is interested in that or wants me to pr against upstream https://github.com/chillerbot/chillerbot-ux/commit/f73296964679e2e9a519b23b3b4eaa7d30900a08 19:18 < bridge> [ddnet] Who even thought banning self-referential structs was an acceptable solution? 20:57 < bridge> [ddnet] linked lists don't exist in Rust? 21:03 < bridge> [ddnet] Not the kind of self referential struct I was talking about but those are also not trivial 21:04 < bridge> [ddnet] Rust doesn't allow references inside structs to reference other fields of the struct 22:05 < bridge> [ddnet] I think it is a very good solution 22:08 < bridge> [ddnet] that possible to kill people only on 1 side on a tile? 22:08 < bridge> [ddnet] ```cpp 22:08 < bridge> [ddnet] if (m_TileIndex == TILE_UP || m_TileFIndex == TILE_UP) 22:08 < bridge> [ddnet] { 22:08 < bridge> [ddnet] if ((int)GameServer()->Collision()->GetPos(MapIndexT).y > 0) 22:08 < bridge> [ddnet] { 22:08 < bridge> [ddnet] Die(m_pPlayer->GetCID(), WEAPON_WORLD); 22:08 < bridge> [ddnet] } 22:08 < bridge> [ddnet] } 22:08 < bridge> [ddnet] ``` 22:08 < bridge> [ddnet] for exemple if i want to kill when when the player arrives from the bottom up that dont kill him but if he player arrives from top to bottom that kill him 22:09 < bridge> [ddnet] i mean idk if i can add an option only for 1 side of the y axe 22:09 < bridge> [ddnet] i mean idk if i can add an option only for 1 side of the y axis 22:10 < bridge> [ddnet] idk to explain maybe 22:17 < bridge> [ddnet] that possible to kill people only if he come to 1 side of a tile? 22:17 < bridge> [ddnet] ```cpp 22:17 < bridge> [ddnet] if (m_TileIndex == TILE_UP || m_TileFIndex == TILE_UP) 22:17 < bridge> [ddnet] { 22:17 < bridge> [ddnet] if ((int)GameServer()->Collision()->GetPos(MapIndexT).y > 0) 22:17 < bridge> [ddnet] { 22:18 < bridge> [ddnet] Die(m_pPlayer->GetCID(), WEAPON_WORLD); 22:18 < bridge> [ddnet] } 22:18 < bridge> [ddnet] } 22:18 < bridge> [ddnet] ``` 22:18 < bridge> [ddnet] for exemple if i want to kill when when the player arrives from the bottom up that dont kill him but if he player arrives from top to bottom that kill him 22:18 < bridge> [ddnet] that possible to kill people only when he come from 1 specific side on a tile? 22:18 < bridge> [ddnet] ```cpp 22:18 < bridge> [ddnet] if (m_TileIndex == TILE_UP || m_TileFIndex == TILE_UP) 22:18 < bridge> [ddnet] { 22:18 < bridge> [ddnet] if ((int)GameServer()->Collision()->GetPos(MapIndexT).y > 0) 22:18 < bridge> [ddnet] { 22:18 < bridge> [ddnet] Die(m_pPlayer->GetCID(), WEAPON_WORLD); 22:18 < bridge> [ddnet] } 22:18 < bridge> [ddnet] } 22:18 < bridge> [ddnet] ``` 22:18 < bridge> [ddnet] for exemple if i want to kill when when the player arrives from the bottom up that dont kill him but if he player arrives from top to bottom that kill him 22:19 < bridge> [ddnet] that possible to kill people only when he come from 1 specific side on a tile? 22:19 < bridge> [ddnet] ```cpp 22:19 < bridge> [ddnet] if (m_TileIndex == TILE_UP || m_TileFIndex == TILE_UP) 22:19 < bridge> [ddnet] { 22:19 < bridge> [ddnet] if ((int)GameServer()->Collision()->GetPos(MapIndexT).y > 0) 22:19 < bridge> [ddnet] { 22:19 < bridge> [ddnet] Die(m_pPlayer->GetCID(), WEAPON_WORLD); 22:19 < bridge> [ddnet] } 22:19 < bridge> [ddnet] } 22:19 < bridge> [ddnet] ``` 22:21 < bridge> [ddnet] ok that good i did it 22:21 < bridge> [ddnet] i just forgot 1 thing 22:39 < bridge> [ddnet] @Learath2 it's hard to guarantee safety in presence of these 22:40 < bridge> [ddnet] you have to guarantee that the other field isn't modified, and in some cases that the whole struct isn't moved 22:52 < bridge> [ddnet] @Nouaa you can check where they were last tick 23:27 < bridge> [ddnet] they should be fine as long as the struct is pinned 23:29 < bridge> [ddnet] and the struct fields are frozen 23:32 < bridge> [ddnet] frozen? for what? as long as the struct doesn't move around self references can't go stale, no? 23:51 < bridge> [ddnet] if you point inside a vector, the vector mustn't reallocate, e.g. 23:52 < bridge> [ddnet] in rust, a constant reference guarantees that the underlying thing doesn't changeยน