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 2023-04-13 00:00:00Z and 2023-04-14 00:00:00Z
Avatar
Hi @matricks
Avatar
Imagine if matricks submits a PR to ddnet
06:06
that would be so funny
Avatar
HAHAHA LMAO
06:12
sorry
06:12
Excuse my autism, Sir.
Avatar
its ok im just the same
06:19
probably worse
Avatar
Don't blame something u don't understand for it tho
Avatar
I've been saying this for a decade now and people keep denying it. Modern text editors have insane input lag
06:52
Try vim on a tty, then boot up to windows and try vscode
Avatar
Avatar
Learath2
I've been saying this for a decade now and people keep denying it. Modern text editors have insane input lag
Except u have 7ghz Intel running @ 200000watt
Avatar
It feels like you are typing over ssh
Avatar
Ah wait, we are actually not that far away from 7ghz
06:53
Ok 7thz
Avatar
Make that 700thz and maybe we'll get some visible light out of it. That'd be cool
Avatar
chillerdragon BOT 2023-04-13 07:13:54Z
Gotta say tho pasting large texts in insert mode vim always loses against vscode in performance. (@Learath2)
Try vim on a tty, then boot up to windows and try vscode
Avatar
In paste mode it should be better. But yes, that is indeed an issue
Avatar
chillerdragon BOT 2023-04-13 07:15:48Z
Yes but I forget to enter paste mode all the time haha. And then there is no going back when vim hangs ._.
07:16
Im also a big electron hater. But gotta admit vscode is really smooth.
Avatar
Phish Bot BOT 2023-04-13 07:18:13Z
#### 🚨 Phishing Link Detected 🚨 ##### A message has been detected to contain a problematic link. We recommend not pressing any links within the message. ###### If this is a false positive, please let us know by joining our support server through the command !phish support
Avatar
A good algorithm in a slow language will always win against a slow algorithm in a fast language xd (edited)
07:19
Or design or whatever
Avatar
tf is this bot lmao
Avatar
At least it seemed to have worked
07:26
Xd
Avatar
!phish support
Avatar
Phish Bot BOT 2023-04-13 07:27:19Z
Join our space here: #phishbot:matrix.org
Unknown
Reply with unknown content
07:27
it's a matrix bot
Avatar
Mhh I assume the bridge has lot of rights? I wonder if u can make it leave xd
07:32
!phish help
Avatar
Phish Bot BOT 2023-04-13 07:32:11Z
### Commands !phish help - Displays this menu. !phish ping - Pings the bot and gives uptime. !phish space - Provides a link to join the Phish Bot space.
Unknown
Reply with unknown content
Avatar
Ah no CMD for that xd
Avatar
i decided ill contribute smth to llvm
08:32
time to clone this massive monorepo and setup a dev env
Avatar
Avatar
Ryozuki
i decided ill contribute smth to llvm
😎😎😎
Avatar
Couldn't you clone with --depth 1 Since you dont need the entire history of commits justatest
Avatar
i want the entire history
09:04
anyway its just 2gb
09:04
the build is 20gb
Avatar
What will you be contributing to llvm?
Avatar
for now i want to extend the c api of mlir to be able to call mlir-translate via the api instead of the tool
09:05
the cpp api allows this already
Avatar
Coolcool C is best
09:06
09:06
ok mr discord
Avatar
bro, im also shocked
Avatar
How dare you post that?
Avatar
yeah i know cpp errors are heinous
Avatar
Nice try, trying to hack discord
Avatar
i guess i have to use gcc
09:24
well ill try when im back from work
Avatar
would be weird that llvm cannot be compiled with clang
10:32
error is in std header, so those are common to gcc and clang
Avatar
Clang offers an own cpp std lib. Libc++ and libc++-abi
Avatar
yeah it uses gcc std instead of clang or smth
Avatar
@Tater How to run Tater client from https://github.com/sjrc6/TaterClient-ddnet/releases/tag/7.1.5 ? @Cøke asked
-added bind wheel back -removed kog spec fix (not longer does anything, kog updated their servers) -fixed player indicator not showing frozen tees.
Avatar
DDraceNetwork, a cooperative racing mod of Teeworlds - GitHub - danielkempf/TaterClient-ddnet: DDraceNetwork, a cooperative racing mod of Teeworlds
Avatar
yeah sorry used wrong client version
Avatar
you can download the ddnet version it says from the website then replace the exe
10:50
or compile it yourself
Avatar
yes thx it works
11:15
ded0af1 Don't update skin release date on re-release - Jupeyy 32ed8da Merge pull request #247 from Jupeyy/pr_dont_change_release_date_on_reupload - def-
Avatar
@Jupstar ✪ how do you handle the texture atlases like game.png btw? using it as a texture directly makes the hook bleed into the grenade a little
Avatar
I split them. I didn't find another easy solution for gl1
11:21
On cpu
Avatar
split them as in creating a separate atlas with more space inbetween?
11:22
or some texture array?
Avatar
Individual textures
Avatar
Avatar
Jupstar ✪
Individual textures
so one draw call for each weapon and so on if I understand correctly?
Avatar
Avatar
Patiga
so one draw call for each weapon and so on if I understand correctly?
Yes. But don't u already face this problem with skins
Avatar
I don't think so, I think pretty much all skins don't go close to the texture borders
11:25
wait do you do mipmapping with skins?
Avatar
It will not match ddnet rendering then tho. Just that u are aware
Avatar
hm if it is only about details not noticeable in regular gameplay I think I'd be okay with it
Avatar
What you can do is to use texture query lod and then simply apply the query lod to the expected texture size to get the Texel offset apply that to the texture coordinates (u need to keep track of if it's bottom right etc.) And then with texturelod u have no bleeding . Tho no mipmap interpolation
11:34
Also it will still distort very slightly. Since edges aren't clamped but skipped instead
Avatar
void CGameWorld::Clear() { // delete all entities for(auto &pFirstEntityType : m_apFirstEntityTypes) while(pFirstEntityType) delete pFirstEntityType; // NOLINT(clang-analyzer-cplusplus.NewDelete) } did some experimenting with prediction and somehow when clearing a simulated world this crashed on me while deleting. fixed it like this... idk if this is a issue or some preperations where wrong on my side void CGameWorld::Clear() { // delete all entities for(auto &pFirstEntityType : m_apFirstEntityTypes) { while(pFirstEntityType) { auto nextEntityType = pFirstEntityType->m_pNextTypeEntity; delete pFirstEntityType->m_pPrevTypeEntity; delete pFirstEntityType; pFirstEntityType = nextEntityType; } } }
Avatar
doesnt delete[] m_apFirstEntityTypes; work?
11:39
my cpp is rusty anyway
11:39
pun intended
Avatar
It's a linked list
11:40
So no
11:40
Or multiple linked lists even
Avatar
CEntity *m_apFirstEntityTypes[NUM_ENTTYPES];
Avatar
Avatar
Ryozuki
CEntity *m_apFirstEntityTypes[NUM_ENTTYPES];
Yeah. U can't delete an array
Avatar
isnt this the point of delete[]
11:41
The delete [] operator deallocates memory and calls destructors for an array of objects created with new [].
Avatar
Avatar
Teero
void CGameWorld::Clear() { // delete all entities for(auto &pFirstEntityType : m_apFirstEntityTypes) while(pFirstEntityType) delete pFirstEntityType; // NOLINT(clang-analyzer-cplusplus.NewDelete) } did some experimenting with prediction and somehow when clearing a simulated world this crashed on me while deleting. fixed it like this... idk if this is a issue or some preperations where wrong on my side void CGameWorld::Clear() { // delete all entities for(auto &pFirstEntityType : m_apFirstEntityTypes) { while(pFirstEntityType) { auto nextEntityType = pFirstEntityType->m_pNextTypeEntity; delete pFirstEntityType->m_pPrevTypeEntity; delete pFirstEntityType; pFirstEntityType = nextEntityType; } } }
Besides the code is really weird ddnets could should be right i think
Avatar
Avatar
Ryozuki
The delete [] operator deallocates memory and calls destructors for an array of objects created with new [].
It's a compiler time sized array
Avatar
Not heap
Avatar
cpp sux
Avatar
Lmao
Avatar
Avatar
Jupstar ✪
Besides the code is really weird ddnets could should be right i think
it works and i aint complaining xD
Avatar
^^
Avatar
magic 🧙‍♂️
Avatar
i hate smileys
11:43
^^
11:43
🙂
Avatar
poggers2 kek troll justatest
justatest 1
Avatar
better
11:43
its like
11:43
"u did good 🙂"
Avatar
Smileys i usually don't use xd
Avatar
cpp is nice 🙂
Avatar
Rust sucks🥲
Avatar
Avatar
Jupstar ✪
What you can do is to use texture query lod and then simply apply the query lod to the expected texture size to get the Texel offset apply that to the texture coordinates (u need to keep track of if it's bottom right etc.) And then with texturelod u have no bleeding . Tho no mipmap interpolation
hm then what is actually the ddnet way of tee rendering? if you have every texture separately, what are your actual vertex/transformation buffers?
Avatar
Avatar
Patiga
hm then what is actually the ddnet way of tee rendering? if you have every texture separately, what are your actual vertex/transformation buffers?
I assume they are all push constants
11:47
No buffers involved
11:47
what about the camera, are all positional calculations done on the cpu?
Avatar
Since max 64 tees are visible it should be fine probably
11:48
Desktop computers might have a slight advantage. But creating rendering info buffers also costs a bit time
11:48
So in total it's probably not too much overhead and works on all renders
11:49
And is pixel perfect
11:49
I'd say if I reimplement ddnets. I'd not put images with different sizes in an Atlas anyway
11:49
Skin bodies could be in an array. But even there I'm not sure
11:50
Or weapons in your case
Avatar
but in the case of skins it shouldn't actually matter, no? all body parts are much smaller than their atlas segment
Avatar
Probably yes. There is some really fat skin in the database
11:51
Maybe it bleeds for body outline
11:52
defatulYoda
11:52
Looks fine tho
11:52
So yeah will probably never happen
11:53
Maybe when zooming out lot
Avatar
okay and in the case of weapons, if I would put them into an texture array, I would have to rescale some of them since they don't have the same proportions, is that rescaling okay?
11:53
11:53
yeah it looks the closest but is probably still fine
Avatar
Avatar
Patiga
okay and in the case of weapons, if I would put them into an texture array, I would have to rescale some of them since they don't have the same proportions, is that rescaling okay?
Mhh then that's also a problem here too
11:54
Thought they are all same
11:55
Generally rescale should be fine. But on fly u probably don't use a very expensive algorithm, which might make it ugly
Avatar
yea it wouldn't be on the fly
Avatar
Tbh. I'd really do the sampling my own completely
Avatar
I currently have a texture array for the tee skins and want to also insert the weapons in some static slots to be able to use them easily in the same draw call
11:58
I don't really have a feel for pushconstants yet, when would you suggest using them. if we have at max 64 tees, I personally would've guessed that its better to have a buffer for all of them together than providing different push constants and doing each individually
Avatar
so u want everything in one fat texture? :D
Avatar
it probably is better to have them in one buffer, but u also have to respect some hardware weirdnesses like caching and stuff
11:59
from feeling i'd say it might be faster, but only very slightly, since it doesnt involve less GPU work
12:00
anyway, skins are different res than game.png? do you want to upscale all skins?
Avatar
so u want everything in one fat texture?
my thought was that it would be nice cause then I can render everything a single tee needs in a single draw call. and then even all tees in a single draw call
Avatar
yep its nice and for demo rendering where all skins etc can be known beforehead it will probably be faster
12:01
as in you dont update the texture itself
Avatar
anyway, skins are different res than game.png?
well by default a skin.png is 256x128, game.png is 1024x512, but shotgun and grenade above each other is 256x128 again. since a tee only uses a few segments from game.png, I thought that I'd just take the size of the skins and use one slot of the skin array texture for 1 or 2 weapons
12:03
I mean even for regular gameplay there can be at max 64 different skins
Avatar
but anyway, your only real problem is the interpolated sampling isnt it?
12:04
the rest is just design of choice
12:06
since 100% pixel perfection is not your goal, isnt the solution i posted before good enough?
Avatar
Avatar
Jupstar ✪
What you can do is to use texture query lod and then simply apply the query lod to the expected texture size to get the Texel offset apply that to the texture coordinates (u need to keep track of if it's bottom right etc.) And then with texturelod u have no bleeding . Tho no mipmap interpolation
This
Avatar
hm well my biggest question still: lets say I wanna make it easy for myself and use exactly one skin slot for each weapon, we only have 6 of them so it should be fine and easy for the texture coordinates. however, will that rescaling make the weapons look much worse? it fear it would smoothen out edges when it shouldn't or smth (maybe I missed your answer)
Avatar
btw u dont even need to rescale do you
12:08
simply put the weapon in the top left of the texture and then apply the texture coordinates % of the expected size
12:09
(since texture coordinates are normalized anyway)
Avatar
hm true, that sounds good
12:10
yea I like that
12:10
I'll probably also try to put the hook somewhere, so that I can use a single quad to render the entire repeating part of the hook ^^
Avatar
that's gonna be the hardest part, since it might look very slightly wrong. But tbf vanilla teeworlds does this since 13 years and nobody really noticed. but yeah if the chains dont repeat pixel perfect u could™ notice it
Avatar
hm I'll see 😅
12:14
btw how would you rate that indirect rendering thing? I think it looks fancy because you can use it to reuse command buffers where I would otherwise need to record them each time on buffers where I might need a different slice each time
12:15
(just looked at it yesterday for the first time)
Avatar
did we talk about smth like that?, bit confused rn :D
Avatar
not yet
12:19
but I currently struggle a lot with gpu buffers, especially with ones where I have them at a dynamic size and need to access the length on the cpu side each time which complicates the code there, since I can't just prerecord it
Avatar
All these indirect stuff is really opengls try to reduce some cpu overhead with having a named state machine
Avatar
also, why do you switch between irc and discord so much? ^^
Avatar
Chatting on mobile sucks
12:22
But mobile xd
12:22
ah right one more thing
12:23
back during the bigger voice chat with matricks, we had also talked a bit about rendering. regarding dilating he mentioned that we should just be able to use the blending mode with premultiplied_alpha, and wouldn't need to dilate ever again
Avatar
Avatar
Patiga
but I currently struggle a lot with gpu buffers, especially with ones where I have them at a dynamic size and need to access the length on the cpu side each time which complicates the code there, since I can't just prerecord it
I'm not quite sure I understand anyway. But prerecord is nice for environment drawing where all stuff always has same amount of vertices etc to draw
Avatar
Avatar
Patiga
back during the bigger voice chat with matricks, we had also talked a bit about rendering. regarding dilating he mentioned that we should just be able to use the blending mode with premultiplied_alpha, and wouldn't need to dilate ever again
Yes that's true. U have to pre multiply every pixel then tho
Avatar
yea and with that indirect drawing you could also prerecord stuff with variable amounts of vertices
12:25
but the gpu does that for us, no?
12:25
eh ^ each line goes to one of your messages
Avatar
Avatar
Patiga
yea and with that indirect drawing you could also prerecord stuff with variable amounts of vertices
But wouldn't u need to update the information then?
Avatar
yeah I thought you could just do a central buffer somewhere, but ofc that would introduce complexity elsewhere
Avatar
Avatar
Patiga
but the gpu does that for us, no?
No the image itself need to be premultiplied
12:27
I dunno if GPUs have an API for that
12:27
Vanilla does it on cpu
12:29
Also premultiplied implies no alpha modification afterwards(fragment shader)
12:30
Since e.g. a tile layer has a color that is applied at fragment stage
Avatar
ouch I thought it was a setting of a sampler, but now I see its about blending the different things we render
Avatar
A alpha channel inside the color to be precise
Avatar
@matricks maybe you could chime in here if you have time. premultiplied alpha is a setting at the wrong part of the pipeline to fix needing to dilate, no? dilating fixes the interpolation in the fragment shader
Avatar
It does
12:34
But ddnet multiplies tile layer color at fragment stage. U can do it by hand ofc Vanilla prepares the color on the cpu already
12:34
And I assume the static pipeline handles the rest then
12:36
It should not matter tho probably when I think about it
Avatar
not sure what you mean by doing it by hand. dilating solves the issue of the interpolation during the sampling of the texture, no? since pixels with alpha = 0 have an effect on the color
Avatar
But I'm not aware of the GPU handling it for textures
Avatar
Avatar
Patiga
not sure what you mean by doing it by hand. dilating solves the issue of the interpolation during the sampling of the texture, no? since pixels with alpha = 0 have an effect on the color
Yep but pre multiplies alpha also don't have the problem ofc
Avatar
aah but as I just figured out such a thing doesn't exist, right? not sure how you would do that by hand (in the fragment shader) since you would somehow need to get the color of all the pixels you need to interpolate between
Avatar
U can get them. But yeah it's a bit of struggle
Avatar
agreed ^^
Avatar
So either go dilate and have disadvantage when creating the img. Or premultiplied and have to run over the full texture
Avatar
I don't recommend any tho. From what I read both methods are used . GTA 5 uses smth like dilate for bushes ans similar assets apparently
12:42
Maybe it depends on how often they upload and unload textures
Avatar
With key transparency, WhatsApp provides a set of proofs that affirms the correctness of public encryption keys.
14:48
made with rust xd
Avatar
my ddnet always crashes after a few seconds if i join skyblock on ddnet ger server
Avatar
There are numerous graphics (gfx) related bugs users encountered. Not all are fixable, but might have workarounds. This site is there to collect these to help those encountering the same issues.
Avatar
ddnet usa and everything else works fine tho
15:14
its just that one server
Avatar
chillerdragon BOT 2023-04-13 15:15:54Z
What even is skyblock? Sounds like minecraft xd
Avatar
skycraft*
Avatar
chillerdragon BOT 2023-04-13 15:16:44Z
A
Avatar
where is the switch for laser no 7 on that map? i cant find it
Avatar
@Jupstar ✪ what do u think about this https://mlir.llvm.org/docs/Dialects/MemRef/#
Multi-Level IR Compiler Framework
15:27
this dialect is used to represent a "pointer descriptor" (edited)
15:27
tldr: a pointer an all possible info about it, to optimize better
Avatar
Epic af
Avatar
Avatar
Simon
my ddnet always crashes after a few seconds if i join skyblock on ddnet ger server
Hardware info. F1 after client start whole console and purple text mentioning gfx
15:31
And top right in F1
15:31
Text
Avatar
ChillerDragon BOT 2023-04-13 15:32:25Z
use chilerbot hax and type goto_switch 7 in console
Avatar
Avatar
Jupstar ✪
Hardware info. F1 after client start whole console and purple text mentioning gfx
what?
Avatar
Avatar
ChillerDragon
use chilerbot hax and type goto_switch 7 in console
no fr i searched it in the editor, theres no switch 7. i want to open the laser at the big shortcut where u jump left from spawn and then fly under the big tube
Avatar
Avatar
Simon
what?
Press F1 after client start pls and make screenshot
15:45
Mh ok. Any crash dumps in %appdata%/ddnet/dumps?
Avatar
Original message was deleted or could not be loaded.
U can delete that btw
Avatar
no its empty
Avatar
Weird then
Avatar
also is MACRO_ALLOC_HEAP() needed? #define MACRO_ALLOC_HEAP() \ public: \ void *operator new(size_t Size) \ { \ void *p = malloc(Size); \ mem_zero(p, Size); \ return p; \ } \ void operator delete(void *pPtr) \ { \ free(pPtr); \ } \ \ private: it does the same thing constructor does
15:57
appears to be used only in src/game/server/entity.h
Avatar
yes
15:58
its overloading thje new opeartor
15:59
is it not defined twice?
Avatar
ok its not nvm me than, i thought its a different one
16:01
yeah its useless, according to vanilla they once used it for dbg msgs
16:01
will get rid of alloc.h
Avatar
ah but actually its maybe not useless
Avatar
An Emacs framework for the stubborn martian hacker - GitHub - doomemacs/doomemacs: An Emacs framework for the stubborn martian hacker
Avatar
new CEntity != new CEntity()
Avatar
i need to try this
16:02
i never rly tried emacs
Avatar
Avatar
Jupstar ✪
new CEntity != new CEntity()
first one will leave centity uninitialized if no custom constructor was implemented
16:02
tho we probably always have one
Avatar
@Learath2 probs knows the details
16:03
@Jupstar ✪ is there a semantic difference between new with cpp and malloc?
16:03
maybe thats why its done
16:03
well this ensures the memory is zeroed atleast
Avatar
not with new but with implicit constructors
Avatar
Avatar
gerdoe
also is MACRO_ALLOC_HEAP() needed? #define MACRO_ALLOC_HEAP() \ public: \ void *operator new(size_t Size) \ { \ void *p = malloc(Size); \ mem_zero(p, Size); \ return p; \ } \ void operator delete(void *pPtr) \ { \ free(pPtr); \ } \ \ private: it does the same thing constructor does
We probably also used it while testing as ASan has trouble with global memory
Avatar
Avatar
Jupstar ✪
new CEntity != new CEntity()
that's why this for implicit constructors the first would not zero the bytes
Avatar
Avatar
gerdoe
also is MACRO_ALLOC_HEAP() needed? #define MACRO_ALLOC_HEAP() \ public: \ void *operator new(size_t Size) \ { \ void *p = malloc(Size); \ mem_zero(p, Size); \ return p; \ } \ void operator delete(void *pPtr) \ { \ free(pPtr); \ } \ \ private: it does the same thing constructor does
why not just use calloc here? it zeroes the memory
16:04
might me more efficient
Avatar
the second guarantes it
Avatar
Avatar
Ryozuki
why not just use calloc here? it zeroes the memory
tbh just remove that then xD
16:04
then c++ can decide
Avatar
Avatar
Ryozuki
why not just use calloc here? it zeroes the memory
Ancient code. It's been there forever
Avatar
based on the object structure
Avatar
Btw, we probably should delete the implicit constructors for some of our classes
Avatar
well if a custom is provided they are automatically deleted
Avatar
@Learath2 does new from cpp zero memory?
16:07
oh
Avatar
damn i tried cargo-geiger didn't expect so much use of unsafe tbh xD
Avatar
maybe it uses default values
Avatar
Avatar
Ryozuki
@Learath2 does new from cpp zero memory?
Depends entirely on what flavor of initialization you do. C++ has like a billion ways
Avatar
this is the thing with cpp, u need to know this, in rust this isnt a problem cuz u just cant have uninit values
Avatar
Avatar
Learath2
Depends entirely on what flavor of initialization you do. C++ has like a billion ways
blegh
16:09
@Learath2 iirc i saw there are entire books on initialization in cpp
16:09
its insane
Avatar
Avatar
Ryozuki
this is the thing with cpp, u need to know this, in rust this isnt a problem cuz u just cant have uninit values
yep it would defs be nice to have it explicit, like unsafe{new CEntity; //<-- no zeroing }
16:09
would make more sense
16:10
39850 unsafes linked into the final executable ez
16:10
lets see if lto changes smth
16:11
wdym by that
16:11
unsafes linked
16:11
i lost u
Avatar
i used cargo geiger to see uses of unsafe in dependencies (and own code)
16:12
and apparently 39850 times unsafe code is used that also lands in the final code
16:12
in ur project?
Avatar
yeah
Avatar
well if u interface with vulkan c api its inevitable
16:13
xd
Avatar
yep, but there are many unsafes in libs i didnt expect. well pretty much all libs have at least one time use 😄
Avatar
does geiger tell u
Avatar
Yeah, there is a really nice talk in it that tells you that you basically should always be using T t{} which is value-initialization that invokes aggregate-initialization which does zero-initialization on every member according to the rules of that
Avatar
@Jupstar ✪ another awesome thing about rust is exactly this
16:14
u know where the unsafe is
16:14
its localized
Avatar
Avatar
Ryozuki
does geiger tell u
does geiger tell u which*
16:14
libraries
16:14
i cant type today
Avatar
Avatar
Learath2
Yeah, there is a really nice talk in it that tells you that you basically should always be using T t{} which is value-initialization that invokes aggregate-initialization which does zero-initialization on every member according to the rules of that
Which avoids setting some things to zero like memzero would, if not needed that is. And it won't nuke the vtable 😛
Avatar
slow brain lol
Avatar
Avatar
Jupstar ✪
Click to see attachment 🖼️
pog
Avatar
Avatar
Learath2
Yeah, there is a really nice talk in it that tells you that you basically should always be using T t{} which is value-initialization that invokes aggregate-initialization which does zero-initialization on every member according to the rules of that
Noted
Avatar
Avatar
Jupstar ✪
Click to see attachment 🖼️
can u try color_eyre
16:16
instead of anyhow
16:17
Honestly it's mostly shit only because we have to keep 2 decades of code working
Avatar
Please, just break this stuff already. The two decade old code can compile with an older compiler. It doesn't need to compile with this one
Avatar
A wrapper type to construct uninitialized instances of T.
16:18
if u do advanced stuff
Avatar
yknow i already forgot what does the rust code in ddnet do again
Avatar
use std::mem::MaybeUninit; // Create an explicitly uninitialized reference. The compiler knows that data inside // a `MaybeUninit<T>` may be invalid, and hence this is not UB: let mut x = MaybeUninit::<&i32>::uninit(); // Set it to a valid value. x.write(&0); // Extract the initialized data -- this is only allowed *after* properly // initializing `x`! let x = unsafe { x.assume_init() };
Avatar
Rust is cheating by making the default be the better safe than sorry option
16:19
Illegal
Avatar
Avatar
Voxel
yknow i already forgot what does the rust code in ddnet do again
Nothing for now
Avatar
printing the rust version
Avatar
which is needed for rust propaganda
Avatar
Heinrich wanted to replace the entire networking stack with it and someone else wanted to replace the entire gamecore
Avatar
i want to do smth with rust in ddnet but all stuff i think may be too complex or time consuming
16:20
ideally we should move the http stuff to rust
Avatar
Neither project ended up being a thing tho
Avatar
if it replaces graphics related things then i rq being a dev
16:21
because in the future i want to make my own client
Avatar
@Voxel with this u can generate maps https://github.com/edg-l/ddnet-map-gen
A map generator made in Rust using twmap. Contribute to edg-l/ddnet-map-gen development by creating an account on GitHub.
16:21
kek
Avatar
automatic gores
Avatar
Graphics only @Jupstar ✪ would dare convert to Rust, and he would only support 40xx series nvidia cards
Avatar
Avatar
Voxel
automatic gores
it has a fly map generator and maze for now
16:22
gores in the future tm
Avatar
so basically infinite plantknight content
Avatar
Avatar
Learath2
Graphics only @Jupstar ✪ would dare convert to Rust, and he would only support 40xx series nvidia cards
i already converted the whole vk backend lel
16:23
rust takeover is inevitable
Avatar
i might not backport it tho
Avatar
deen also uses rust in his work iirc as a test engineer
16:23
who is left to convert to the cult?
16:23
chairn i guess
Avatar
i might not even release it. i am still unsure myself... heinrich will probably be against rewritting ryo and me are for ez
Avatar
Avatar
Ryozuki
who is left to convert to the cult?
but not everyone is a fan like u xD
Avatar
what im saying is in the future i want to rehaul the tee animations thing in its own client to make all the movements procedrial, plus some other stuff basically making ddnet "pretty" for the fun of it
Avatar
learath is a closet fan
16:24
he is just a tsundere
Avatar
Avatar
Voxel
what im saying is in the future i want to rehaul the tee animations thing in its own client to make all the movements procedrial, plus some other stuff basically making ddnet "pretty" for the fun of it
go for it
16:25
but prepare a thick skin
16:25
as the oldies will cry
16:25
konsti_zoozer
Avatar
its why im making it a seperate client
Avatar
how the hell did i end up using turkish google translate xD
16:26
anyways i tried using rust for smth personal, mainly the ninnou crate but i gave up after like 5 minutes
Avatar
but why
16:27
am i the only person here that thinks that rust isnt as hard as ppl make it seem
👋 1
Avatar
you need to do like 20 steps in order to make something more than a "hello world"
Avatar
the only annoying things are QOL things. they make it harder bcs of e.g. fighting with borrow checker about valid code
Avatar
rust is ez
Avatar
Avatar
Voxel
you need to do like 20 steps in order to make something more than a "hello world"
i dunno
16:29
in worst case u can basically use rust like javascript and copy around everything and convert to json xD
Avatar
well voxel do u even know how to do more complex stuff in cpp?
16:29
maybe u simply lack basics
16:30
rust facepalms u with quite advanced things
16:30
slices, iterators, etc
16:30
some ppl dont even know what that is
Avatar
Avatar
Ryozuki
well voxel do u even know how to do more complex stuff in cpp?
barely i just scavenge the ddnet code and make sense of what i have in front of me
Avatar
u probs tried to use a mutable var inside a for loop withiut knowing how
16:31
read the rust book
16:31
and learn lots
16:32
its a web btw not rly a book
Avatar
i forgot when i actually tried rust
16:32
so i wouldnt know what i tried to do
Avatar
Available to download on GitHub, open source enables modders to extend Remix’s feature set and game compatibility.
Avatar
wait it even converts 32bit to 64bit?
16:41
or is it graphics driver only
16:41
"Bridge, which translates the renderer from a x86 to a x64 instruction set. This component uncaps the memory available for rendering."
16:41
mhh i am bit sceptical about that one 😄
16:42
as in they convert vs they simply use a server client model
16:45
interesting non than less, have to try for an old game that always had a bug 😄
Avatar
Avatar
Jupstar ✪
am i the only person here that thinks that rust isnt as hard as ppl make it seem
rust syntax seems ugly to me. At least for now. For example the types, putting them after the name of the var triggers me. Feels hard when you aren't used to it. (Haven't really looked too deep into it yet though)
Avatar
yeah but usually u get used to it
16:59
i started with pascal, so it wasnt uncommon to me
Avatar
Avatar
Devinci
rust syntax seems ugly to me. At least for now. For example the types, putting them after the name of the var triggers me. Feels hard when you aren't used to it. (Haven't really looked too deep into it yet though)
even cpp is moving to types on the right
16:59
herb stutter has a whole talk on that I think
Avatar
Oh really? I guess I'll stay on C then greenthing
Avatar
Avatar
k2d222
even cpp is moving to types on the right
how are they doing that? lol
17:00
would be a huge mess to support both
Avatar
I mean not syntaxically but conceptually
Avatar
like auto x = MyClass() instead of MyClass x
Avatar
ah
17:01
i dont think he means that
Avatar
But auto is the type here
Avatar
he means let x: i32<-- = 0
Avatar
well, u dont write explicit types that often in rust do you
Avatar
but yeah excpect for functions and struct members u often dont need to set the type
17:01
since it automatically will do it similar to auto
Avatar
Yeah, I read it's only when there can be confusion. Still, felt strange
Avatar
what i really find ugly is calling generic functions
17:03
Type::<i32>::func()
17:03
or func::<i32>()
Avatar
Avatar
Ryozuki
slices, iterators, etc
Btw, are there slices on cpp? Didn't really here of them, and tried googling it and I just got the class std::slice (which didn't seem to be the same)
Avatar
Avatar
Jupstar ✪
Type::<i32>::func()
yea but they compensate with a cool name the turbofish operator XD
Avatar
Avatar
Devinci
Btw, are there slices on cpp? Didn't really here of them, and tried googling it and I just got the class std::slice (which didn't seem to be the same)
there are ranges
Avatar
on iterators?
Avatar
iterator adaptators
Avatar
y kk, thanks
Avatar
rust slices are beautiful
17:05
and safe
Avatar
*adaptor whatever
Avatar
cpp iterators are a minefield
Avatar
xd
17:05
string_view
17:05
kekw
Avatar
rip
17:06
only good thing is that c++20 supports them for hashes xd
17:07
can u hash a str in rust? not even sure rn
17:07
for a HashMap<String, ...> ofc
Avatar
there is a hash trait no?
Avatar
define hashing a str
Avatar
but can u use it for a HashMap that uses String
17:08
i mean let a = HashMap<String, ...> let b = "str"; a.get(b);
Avatar
the hash trait allows the type to be hashed by a type implementing hasher
Avatar
Avatar
Jupstar ✪
i mean let a = HashMap<String, ...> let b = "str"; a.get(b);
that works
Avatar
ok
Avatar
but its also kinda a special case
17:09
well its not special
17:09
its well defined
17:09
what happens here is that
17:09
get accepts a reference to a String
17:09
and &str derefs to it xd
17:10
.get() arg is a &String
17:10
so it accepts a &str
17:10
is what i mean
Avatar
yeah
17:10
sounds good
Avatar
hashmaps take keys by reference unless they need the key to insert
17:11
due to thread safety iirc
17:11
@Jupstar ✪ btw u should look at the entry api of hashmaps
17:11
and dashmap is nice for mt hashmap
17:12
let mut letters = HashMap::new(); for ch in "a short treatise on fungi".chars() { letters.entry(ch).and_modify(|counter| *counter += 1).or_insert(1); } assert_eq!(letters[&'s'], 2); assert_eq!(letters[&'t'], 3); assert_eq!(letters[&'u'], 1); assert_eq!(letters.get(&'y'), None);
17:12
epic
17:12
dashmap uses this api kinda to allow atomic get or inserts
Avatar
Avatar
Ryozuki
let mut letters = HashMap::new(); for ch in "a short treatise on fungi".chars() { letters.entry(ch).and_modify(|counter| *counter += 1).or_insert(1); } assert_eq!(letters[&'s'], 2); assert_eq!(letters[&'t'], 3); assert_eq!(letters[&'u'], 1); assert_eq!(letters.get(&'y'), None);
oh interesting
Avatar
let entry = STRING_CACHE .entry(string.to_owned()) .or_insert_with(|| CString::new(string).unwrap()); unsafe { Self::from_raw(mlirStringRefCreateFromCString(entry.as_ptr())) }
Avatar
Avatar
Ryozuki
chairn i guess
sorry, no time for this
Avatar
this is using dashmap
Avatar
and rust needs more const/constexpr everywhere xd but i heard they working on it
Avatar
// We need to pass null-terminated strings to functions in the MLIR API although // Rust's strings are not. static STRING_CACHE: Lazy<DashMap<String, CString>> = Lazy::new(Default::default);
17:14
xd
17:14
stupid c deciding null terminated strings
Avatar
Avatar
Ryozuki
// We need to pass null-terminated strings to functions in the MLIR API although // Rust's strings are not. static STRING_CACHE: Lazy<DashMap<String, CString>> = Lazy::new(Default::default);
rip
Avatar
they make rust less efficient when interfacing with it
Avatar
yeah
Avatar
some c apis dont require null terminated strings
17:15
some llvm parts use a array with len
17:15
but not here
Avatar
well the vk api is even worse
17:15
it sometimes expects i8 arrays xD
Avatar
char arrays basically
Avatar
converting to them sucks
17:15
or from
Avatar
its c fault
17:16
rust is the sane one here
17:16
imagine needing to loop a string to figure out its length
Avatar
How does rust do it?
Avatar
size: usize
Avatar
it has a array with the data and a variable holding the length of the data
Avatar
ez
Avatar
so getting the length is constant time
17:17
u keep track of it separate of the data itself
17:17
and u don have limitations
17:17
for example ur data can hold null chars
17:17
unlike c
Avatar
Avatar
Ryozuki
it has a array with the data and a variable holding the length of the data
yeah but where do you get the lenght initially? From the constructor?
Avatar
str is basically a slice
17:18
so it also does the same
17:18
so basically its always known
17:18
if not working with c or filesystems or other io stuff
Avatar
its like vec
17:19
#[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "Vec")] #[rustc_insignificant_dtor] pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { buf: RawVec<T, A>, len: usize, } (edited)
17:19
for the String type
17:19
the size is always known ye
Avatar
btw c++ does it too but additionally has null termination
Avatar
Avatar
Ryozuki
for example ur data can hold null chars
Can't C have null chars on array? I'm pretty sure it can, but will just stop there
Avatar
yes
17:21
but is that a desired functionality? 😄
Avatar
"it's not a bug it's a feature"
Avatar
thats the thing
17:22
null chars are used for behaviour
17:22
so u cant have them for data as is
Avatar
Ah I got what you meant
Avatar
give me the length in C of a array of null chars with length 10
Avatar
c follows the paradigma "everything is a file" so a string ends with a null just like a file ends with EOF
Avatar
of a string array*
17:23
xd
Avatar
char pointer 😎
Avatar
Avatar
Ryozuki
give me the length in C of a array of null chars with length 10
0?
Avatar
i mean using strlen yeah
Avatar
Avatar
Chairn
sorry, no time for this
Ain't Nobody Got Time for That
Avatar
knowing the len allows for neat things, knowing a str is valid utf always too
18:01
its actually UB to unsafely create a str with invalid utf8
Avatar
L'Agència Espanyola de Protecció de Dades obre una investigació d'ofici després que s'ha acordat un grup de treball a escala europea pels reptes que planteja la revolucionària eina d'intel·ligència artificial
19:34
spain is also investigating chatgpt lmao
19:34
(catalan news kek)
Avatar
what is there to investigate xD
Avatar
privacy concerns xd
19:35
@Jupstar ✪ everybody talks about AI
19:35
even normies
19:35
on the bars
19:35
trust me
19:35
i heard on restaurants too
19:35
the revolution is imminent
Avatar
it still irks me tbh
Avatar
well yeah
19:40
its untested waters
19:43
more perf
19:43
The latest release, v0.17.8, takes from 15% to 75% less time to decode images than the previous v0.17.7. 75% less time means 4x faster! The gains depend heavily on the exact image used, but even 15% is impressive given how fast the code already is. These gains in decompression are achieved by: A new, specialized Zlib implementation designed specifically for PNG from the ground up. It delivers much higher performance than the generic Zlib implementation used previously. PNG filters were rewritten to take advantage of autovectorization, making use of SIMD without unsafe or platform-specific code. This should make the png crate faster than the reference C implementation in most cases. But it's difficult to benchmark libpng because its API is so unwieldy, and it doesn't provide example code for decoding an image. We'd be very happy to see such benchmark results!
19:44
a news*
19:44
lol
19:45
somehow i just need to read the rust reddit to get more hyped about rust
19:45
and keeps going
19:47
i need to write a blog about llvm and rust
19:47
someday
19:47
but i always feel lazy
19:47
the life of a dev
19:48
im literally the only maintainer of the active mlir api bindings for rust
Avatar
i'll read
19:48
the tl;dr
19:50
then ill make no tldr
Avatar
How do I run football maps on my server?
19:55
I have the map but I need to configure the teams and rules
19:55
and I dont know how (edited)
Avatar
you probably need to download the football mod source code and compile it
20:30
@Jupstar ✪
Avatar
Avatar
Devinci
char pointer 😎
unless you predefine the size & access exactly that many chars, either by just using the proper size or using a fixed-size array, you won't be able to use strings with null bytes in them because string functions that glean info from char pointers will always end at \0
Exported 551 message(s)