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 2022-04-23 00:00:00Z and 2022-04-24 00:00:00Z
Avatar
Avatar
Tater
Hey what do you guys think of this pr? I think deen wants some more opinions before merging https://github.com/ddnet/ddnet/pull/4997
I agree with lynn smaller and a label would also be good. But I find this version also good https://user-images.githubusercontent.com/22122579/163871026-3845e192-547d-498c-a8cd-5752dadc8ea6.png You could also solve the label problem possibly by adding to each button a tooltip, like "Set Angry eyes as default eyes", you would have to test how that comes out. (edited)
Avatar
Thats how it normally looks, it only shows below in the sqaureish aspect ratios
05:28
I think the tooltip is a good idea, adding a label might be hard when its squeezed in between
05:32
The icon size is the same in all the images the aspect ratio is all that changes
Avatar
Avatar
Tater
Hey what do you guys think of this pr? I think deen wants some more opinions before merging https://github.com/ddnet/ddnet/pull/4997
maybe put skin prefix to the search filters as popup or smth
07:15
how about have the last selected emote of the emote wheel
07:15
and alawys try that on any server
07:15
thats probably what the user wants anyway
Avatar
TIL in C++, static variables get destructed after main finishes!?
07:23
that seems insane in the context of multi-threading to me
Avatar
other threads might still use those global variables
Avatar
I'm the only one who thinks that eye thing shouldnt be added? I like eyes to have a meaning
07:25
@heinrich5991 does rust, or llvm do the same?
07:26
Also is this for just main or for any entry point (embedded?)
Avatar
I only know of main, no further details
07:26
no, rust does the (IMO sane) other thing
Avatar
why do you want to kill the main thread without joining the other threads tho
Avatar
ddnet does that, for example
07:29
other threads might be stuck
07:29
I guess you have to call _Exit in that case
07:30
ah no, quick_exit
07:30
ah no, _Exit, nvm
Avatar
what threads do we keep open
Avatar
I don't quite see when else C++ would destruct the statics
Avatar
when signaling or smth?
07:32
guess there is always a way xd
Avatar
Avatar
Jupstar ✪
what threads do we keep open
I guess the sql thread and the curl thread could possibly live past main, if I recall correctly
Avatar
ok
07:32
we should fix that regardless
Avatar
why?
Avatar
i dont think its nice style to leave stuff open u opened
Avatar
the OS closes it
07:33
faster than you can do. you only slow things down by closing it yourself
Avatar
u also dont need to deallocate memory
07:33
the os does that
Avatar
weren't you the person obsessed with performance? ^^
07:33
yea, but at program exit, it's literally doing no useful work ^^
Avatar
correctness is still the most important thing
Avatar
it is correct to not free memory at program exit
07:34
and never freeing memory is also correct, probably, it's just not useful because you might run out of it
Avatar
Avatar
heinrich5991
faster than you can do. you only slow things down by closing it yourself
It's still probably a trivial amount of time lost if we join all threads before dying
Avatar
Avatar
Jupstar ✪
correctness is still the most important thing
oh, then why do u use c++
07:34
monkalaugh
07:34
joke joke
Avatar
@Learath2 only if we have some way to guarantee that they're done
07:35
the score threads in particular have a timeout for joining precisely because they do not terminate
Avatar
Avatar
Ryozuki
oh, then why do u use c++
xd a language that prevents logic errros would fix all errors xd
Avatar
but its true that closing stuff at exit doesnt pose a perfomance impact during the most critical parts of the program
07:35
e.g when playing
Avatar
yes, if it comes for free, it's fine. or if it's useful for other stuff
Avatar
anyway, i'd also argument that using static is bad
Avatar
but we don't have to go to great lengths to do that. "useful for other stuff" might e.g. be "better readable valgrind output"
Avatar
Avatar
Jupstar ✪
anyway, i'd also argument that using static is bad
yee
Avatar
in rare cases u might need them e.g. signaling states
07:36
but else u can always solve it in a better way
Avatar
my PR introduces a new static
07:36
what's the better way?
07:36
the global logging instance
Avatar
allocate it on main start
Avatar
wtf they updated github
Avatar
and where do I put it? @Jupstar ✪
Avatar
Avatar
heinrich5991
the score threads in particular have a timeout for joining precisely because they do not terminate
On timeout, it'll be done. I don't see much harm to the main thread waiting for the sql thread to timeout, especially when we have no idea of the consequences of two servers running with the exact same settings at the same time
Avatar
does matter use a shared pointer or smth like that
07:37
doesnt
Avatar
do you expect to pass it to every function so it can log?
Avatar
we should use unique_ptr and shared_ptr everywhere
Avatar
What if the dangling sql thread causes some database issue?
Avatar
isnt that c++11
Avatar
@Learath2 I think we have a timeout for waiting for sql threads. if you're sure that it isn't needed, remove it
Avatar
Avatar
heinrich5991
do you expect to pass it to every function so it can log?
i'd not call it from a global context if u mean that yes
Avatar
Avatar
heinrich5991
do you expect to pass it to every function so it can log?
How about a shared_ptr at the very start of the thread?
Avatar
Client()->LOG or Server()->Log or for specific components Log() as a function inside the class
Avatar
@Jupstar ✪ sounds impractical and performance sensitive
Avatar
You can keep the shared_ptr in TLS
Avatar
i doubt that tbh
Avatar
I do @Learath2
07:39
passing a parameter to each function does have performance implications
07:39
Client()->Log, Server()->Log, less so
Avatar
maybe logs can live in Client() and Server() from the engine?
Avatar
but they're still impractical because not everything knows about Client(), Server()
Avatar
they would' need to explicitly get the pointer then
Avatar
logging is a global concern in all languages I know of
07:40
can you show me a project that doesn't have a global logger, so I can see that it is at least a little bit practical?
Avatar
but then also use the language logging xD
07:40
not a custom one
Avatar
what about a thread holding the logger and using channels monkalaugh
Avatar
@Jupstar ✪ but the "language logging" is also just a static variable
07:41
or another case for a global variable:
07:41
in rust, if a file is opened, the stdlib dynamically determines if the kernel has a bug
07:41
if it doesn't, it'll never do the duplicate system call again
07:41
that's a good use for a global variable
Avatar
ah c++ doesnt support channels in the std
Avatar
how would you solve that in a better way?
Avatar
dynamically determines if the kernel has a bug
07:42
how does it do that?
07:42
and what would that bug be
Avatar
it checks whether the returned file descriptor has the CLOEXEC flag set after opening it with O_CLOEXEC
07:42
there's old kernels that don't know the flag, and apparently some less old kernels where this flag didn't work
07:43
but that looks like just holding a bool, doesnt logging have side effects or whathever it is called
Avatar
@heinrich5991 can't we have the actual instance on heap and only keep the shared_ptr in the static/thread_local?
Avatar
but the theory was that "all global variables are bad" @Ryozuki
07:44
and I'm arguing that "absolutely not!"
Avatar
the badness comes in the design already, why is the std lib function not part of a class
Avatar
are u suggesting java?
Avatar
why would it? less performance
Avatar
Avatar
Ryozuki
are u suggesting java?
depends, the OS has to be redesigned for that too
Avatar
why would you need to do this check over and over again, just because some part of the code needs to construct the file opening object again
07:46
global variables have a performance benefit
07:46
@Learath2 not sure what you mean. currently, we keep a raw pointer in the global variable/thread local variable
Avatar
they need to check if the variable was allocated in certain scenarious
07:47
e.g. if u use static inside a function
07:47
if we stay with "static"
Avatar
Avatar
heinrich5991
@Learath2 not sure what you mean. currently, we keep a raw pointer in the global variable/thread local variable
And where does the logger instance itself get allocated?
Avatar
yes. let's say "you can use global variables for a performance benefit" @Jupstar ✪
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 07:47:52Z
oh no major log rewrite... i can smell conflicts in my 100 ddnet forks :c
Avatar
@Learath2 the global loggers on the heap, getting leaked
07:48
@ChillerDragon I tried to keep the diff minimal. all existing logging code should continue to work, only the logging initialization is different
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 07:48:32Z
pog
Avatar
continue to work (even better!)
Avatar
btw is dbg_msg active in release builds? i always wanted to leave some more detail logging with dbg_msg but always feared it might pollute release
Avatar
because now you can see output from other threads in f1 and rcon
07:49
we could make LOG_TRACE only active in debug builds @Ryozuki (if we add a macro for it)
Avatar
Avatar
heinrich5991
@Learath2 the global loggers on the heap, getting leaked
I may have missed the issue here (just woke up), I thought your logger got destructed before the threads were done, if you aren't concerned about the leak, then I don't see any issue here
Avatar
Avatar
heinrich5991
we could make LOG_TRACE only active in debug builds @Ryozuki (if we add a macro for it)
ye that would be cool
07:50
it would be even more cool to also enable scoped logs via env vars
Avatar
no issue. it was just an unrelated post I saw on reddit @Learath2 ^^
Avatar
so if i want to debug some client specific thing i can get detailed logs on that
07:50
like any decent app
Avatar
check my PR and comment on the design questions I have @Ryozuki
Avatar
ill check
Avatar
@heinrich5991 how does rust go about destructing it's statics? Just using the compilers knowledge of usage?
Avatar
it doesn't destruct statics
Avatar
Borrow checker blackmagic
Avatar
statics live for 'static BASED
Avatar
that's how I learned about the issue in C++, because someone complained about missing destruction in /r/rust
Avatar
That sounds more concerning to me. How would you do cleanup in a static then?
Avatar
"log_log_impl" "log_log_color" honestly i prefer more the classes style instead of c style
07:54
also it would be cool if u used doxygen style docs
Avatar
commet in the PR pls
Avatar
so i dont need to parse this in the future :(
Avatar
anyway, independent of good or bad before we put _Exit now everywhere, keep in mind that other OS rely on global cleanup, e.g. Android It would else just not deallocate there (edited)
Avatar
can you elaborate @Jupstar ✪?
Avatar
i edited
07:55
i meant not deallocate
Avatar
I still don't quite get it. if your app leaks memory, it affects the whole system even after the app is closed?
Avatar
e.g. the java interface calls the .so file lets say libDDNet.so and we use some static variables that require specific intialization objects if its not deallocated it also isnt allocated
07:56
and that creates unwanted behavior for our android port
Avatar
you mean that if a dynamic library is loaded and then not used anymore at some point, the memory is still leaked?
Avatar
not leaked, but its still as is
07:57
the global variables are untouched
07:58
and they wont get to initlaize again
Avatar
Avatar
Learath2
That sounds more concerning to me. How would you do cleanup in a static then?
by explicitly writing code for it. I guess I don't see a use case rn so I can't really say how to handle it
07:58
yea, makes sense if the dynamic library isn't unloaded
Avatar
yes but as said, since we rely on the intiialization sometimes we have to unload it explicitly
07:59
else opening the client agian in android will not work
Avatar
the problem there is code that's not written in mind with something that's executed twice, if I understand it correctly? @Jupstar ✪
Avatar
i see you use a lot of shared_ptr in the cpp files, but then some functions return ILogger *l as is, is it common practice?
Avatar
yes
Avatar
I see
08:03
@Ryozuki where do I see example doxygen docs?
08:03
or u mean rendered?
Avatar
no
Avatar
doxygen has supports for groups
08:05
so free functions can be grouped
08:05
its nice for new ppl
Avatar
Avatar
Ryozuki
i see you use a lot of shared_ptr in the cpp files, but then some functions return ILogger *l as is, is it common practice?
I think I did that because I sometimes need them as std::unique_ptr, sometimes as std::shared_ptr and sometimes as raw pointer
Avatar
std::unique_ptr is the C++11 way to express exclusive ownership, but one of its most attractive features is that it easily and efficiently converts to a std::shared_ptr.
>
This is a key part of why std::unique_ptr is so well suited as a factory function return type.
Avatar
ah, interesting
08:08
TIL
Avatar
Does C++11 standard library provide any utility to convert from a std::shared_ptr to std::unique_ptr, or vice versa? Is this safe operation?
Avatar
comment on the PR with that please, so it doesn't get lost
Avatar
Once you’ve turned lifetime management of a resource over to a std::shared_ptr, there’s no changing your mind. Even if the reference count is one, you can’t reclaim ownership of the resource in order to, say, have a std::unique_ptr manage it.
08:09
weird, with a reference count of 1, it should be safe to turn back
Avatar
ah, I guess it's because multiple threads might have a reference to the same std::shared_ptr
08:10
makes sense, nvm me
08:10
(with rust, you can still turn it back though! 😛 )
08:11
what do u think about doxygen?
08:12
btw we have docs generated every day (or week i dont remember): https://codedoc.ddnet.tw/
08:12
i also started this some time ago https://wiki.ddnet.tw/wiki/Development
This article aims to introduce you into DDNet development, since it's an open-source game, it relies on random people kind enough to contribute to it on their free time.
08:12
if any time u want to add something
Avatar
I like docs that say something
Avatar
well the doxygen is just porting the system.h docs
Avatar
yes
Avatar
so idk what that has to do here
08:13
PES2_Pray
Avatar
I don't like redundant docs that are just restating the function name or the parameter names. I've seen such docs added in the past in projects that tried to increase some documentation metric
Avatar
Avatar
Ryozuki
so idk what that has to do here
you asked me what I think about adding doxygen
Avatar
ah well
08:14
i meant about system.h
08:14
but ye
Avatar
I think those redundant docs are worse than no docs
08:14
ah
Avatar
we already had this discussion
08:14
u can have it ur way
Avatar
xDDDD
Avatar
❤️
Avatar
if we agree then
08:15
try to use doxygen style docs on ur pr when u can
Avatar
yea, the huge diff isn't optimal, but I don't see a better way to do it
Avatar
i dislike that diff is always taken into account, this removes interest in large refactors that might be optimal
08:16
why does the vcs get in the way of dev interests
Avatar
I don't like huge diffs because it makes it harder for mods and vanilla patch porting
08:17
so I'd say it's not related to the vcs
Avatar
i dont think many mods change system.h
08:17
so it shouldnt be hard to merge
Avatar
one could arguee that this is the main reason ddnet (and teeworlds) is so mod unfriendly in fact
08:17
bcs nobody changes it bad design
Avatar
I don't think mod friendly design is being held back by that ^^
Avatar
the gamecontroller is essentially useless, u cant make a mod just adding one
08:18
which was the main intended way
Avatar
people explicitly refactored that, IIRC
Avatar
Avatar
Ryozuki
i dont think many mods change system.h
ask chillerdragon whether that contains merge conflicts for him
Avatar
tbh idc if it does
Avatar
xD
Avatar
even if it sounds rude
Avatar
true, the 2 users that use chillerbot
Avatar
but you just claimed that it doesn't
08:19
so you admit that statement might have been bullshit? ^^
Avatar
i didnt claim it doesnt
08:20
i dont think many mods change system.h so it shouldnt be hard to merge
08:20
i said many mods dont change this
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 08:20:23Z
i guess spamming system.h with comments should be fine. Its def conflicts but not too dramatic. But would be nice if we can also get it in teeworlds :D
Avatar
what mods do you think about here @Ryozuki?
08:20
name some examples so I can check
Avatar
simple mods that change gameplay only
08:20
e.g im porting xpanic to modern ddnet
08:20
that mod didnt touch system.h ever iirc
Avatar
got a link?
Avatar
i only have a link to the original xpanic
08:21
i still havent uploaded mine
Avatar
fine
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 08:21:19Z
i would also claim that as a mod it is good style to not touch system.h
Avatar
have a link to the original?
Avatar
don't xpanic, it's game. Contribute to kaitlynia/xpanic development by creating an account on GitHub.
08:21
well this one is updated
08:21
idk the original
08:21
TeeWorlds mod "XPanic", remade by kurosio. Contribute to teeworldsmods/teeworlds-xpanic development by creating an account on GitHub.
Avatar
its good style to use boost and not use system.h
Avatar
maybe its this one
Avatar
Avatar
Jupstar ✪
its good style to use boost and not use system.h
ye lets use boost
08:22
do they enforce shared_ptr and unique_ptr?
Avatar
no, please don't. exploding build times
Avatar
xddd
Avatar
e.g. factorio ripped it out due to that reason
Avatar
is it just ddnet or do most codebases not adopt shared_ptr unique_ptr etc
Avatar
depends
Avatar
it's not that simple to adopt it, I think. you could try to do it
08:23
there are some nonobvious relationships, I think
08:23
another mod for u to check
08:24
maybe this one modified system.h but its cuz it was rly old and lacked utf8 support
08:24
but i dont see any reason why most gameplay related mods modify system.h
08:24
chiller likes to do weird stuff
Avatar
because there's OS abstractions that you need, probably
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 08:25:08Z
idk i think in most cases i tried to push those changes upstream like str_startswith_nocase and shit
Avatar
or stuff that's buggy. I mean we only recently fixed str_copy to not produce invalid UTF-8
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 08:25:26Z
but for my curses client for example i had to wrap dbg_msg() into some macros
Avatar
u can wrap c apis around unique_ptr
08:25
struct SDLWindowDestroyer { void operator()(SDL_Window* w) const { SDL_DestroyWindow(w); } }; std::unique_ptr<SDL_Window, SDLWindowDestroyer> window_;
Avatar
I encourage you to grep for operator() in our source 😉
Avatar
ye i see
Avatar
Avatar
Ryozuki
the gamecontroller is essentially useless, u cant make a mod just adding one
This would be one of the biggest steps to mod friendliness, if we could concentrate our changes into a gamecontroller it'd be amazing
08:59
I actually had quite a few attempts at this, I kept getting stuck when doing entities and tiles iirc
09:00
It needs something like getting the collision code to depend on the controller somehow, I just never quite figured it out
Avatar
I noticed that, when I click "demo directory" inside a DDNet client started by steam and have no Dolphin(my file explorer) instance open it will create the process as if ddnet created it. So when i close DDNet without closing dolphin it keeps the process open, which is annoying with steam, bcs it only allows single instances. Maybe someone knows some ez way to start it in a new independent process or smth
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 11:03:37Z
15:28:24* +bridge | [ddnet] <Ryozuki> is protobuf used in games?
11:03
irc reply be like :D
11:03
Classic overhead run-and-gun game. Contribute to cxong/cdogs-sdl development by creating an account on GitHub.
Avatar
https://openbenchmarking.org/embed.php?i=2204214-PTS-NVIDIASM12&sha=7f11011ebcfd&p=2 lol mesa drivers best too bad phoronix didnt include rx 6900 xt would be cool to see amd on top but funny how good drivers can overcome hardware limits
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 12:47:57Z
Any rustian knows why my channel is not recieving data? :)
12:48
chidraqul5 the console game in the 5th generation designed to be cross platform - chidraqul5/client.rs at bd4bb4d506459b343e8c1689ba9877b9317e0dd0 · chidraqul/chidraqul5
12:48
chidraqul5 the console game in the 5th generation designed to be cross platform - chidraqul5/client.rs at bd4bb4d506459b343e8c1689ba9877b9317e0dd0 · chidraqul/chidraqul5
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 13:11:49Z
@heinrich5991 could you ellaborate on that? How does one implement a logger backend? https://github.com/chillerbot/chillerbot-ux/issues/94#issuecomment-1107453760
Failed to merge ddnet#5013 into chillerbot $ git status On branch updatebot-test-pull-chillerbot You have unmerged paths. (fix conflicts and run &quot;git commit&quot;) (use &quot;git m...
Avatar
[quakenet] ChillerDragon BOT 2022-04-23 13:21:40Z
^ rust thing is fixed
Avatar
TextRender()->TextColor i must set rgb like a value getted by color picker
16:05
but i can't do TextRender()->TextColor(g_Config.m_colorSIUMMMMMMMM);
16:05
some tips?
Avatar
convert HSL to RGB
16:06
look how other color config variables did it
Avatar
Avatar
Jupstar ✪
look how other color config variables did it
color_cast<ColorRGBA> ?
Avatar
just look how other color vars did it xD
16:06
just copy paste
Avatar
lets search
16:10
maybe found
Avatar
rand() not work 😦
Avatar
why do u need it
Avatar
random color
Avatar
maybe u are using it wrongly
Avatar
i must gen a number from 0.0 to 1.0
16:59
rand() % 2 give 0 or 1
16:59
😦
Avatar
well
17:01
so what is the answer
Avatar
Avatar
kio
rand() % 2 give 0 or 1
it's much simpler to just use <random>
Avatar
simply dont use % 2 but smth very high
17:02
and then divide
Avatar
e.g. use 2001 and divide by 2000.0f
Avatar
just return 4
17:03
every time
17:03
Avatar
Avatar
Jupstar ✪
so what is the answer
rand() / (RAND_MAX + 1.) this work but where i must place srand(time(NULL));
Avatar
Avatar
kio
rand() / (RAND_MAX + 1.) this work but where i must place srand(time(NULL));
at the program start
Avatar
Avatar
Jupstar ✪
at the program start
mh
17:07
where O.O
Avatar
int main()
Avatar
yes but in the client
Avatar
who cares, do u even need a seed?
Avatar
client.cpp
17:07
if its client side
17:07
else server.cpp
Avatar
Avatar
Jupstar ✪
who cares, do u even need a seed?
else it give always the same number
Avatar
well then put it somewhere xd
17:10
its not truly random anyway xd
17:11
❤️
17:11
im nub
Avatar
can sb. reopen this issue, it's probably the same bug: https://github.com/ddnet/ddnet/issues/4438
The server clock is not centered which really annoyed me for a long time. The default Teeworlds client doesn&#39;t do that. Pls fix If this is some settings issue you should change your default...
Avatar
i think it was never centered with days shown
17:12
just reload the server xd
Avatar
thats a workaround, not a fix 🙂
17:13
there was actually a bug there with the wrong fontsize
Avatar
Avatar
AssassinTee
there was actually a bug there with the wrong fontsize
do u compile urself?
Avatar
I could
Avatar
Avatar
AssassinTee
there was actually a bug there with the wrong fontsize
ah i see yeah
17:22
its bcs it uses 00d instead of single digit
Avatar
@c0d3d3v isn't that what u fixed for the hud thing?
Avatar
Does putting a password on a server do anything to prevent ddos?
Avatar
Avatar
Tater
Does putting a password on a server do anything to prevent ddos?
No (edited)
Avatar
what you can simply do if you don't want anyone to know you're running out a private server : simply just do not register it & do give the IP of the server to trusted people
Avatar
Ok thats good to know, thanks
Exported 353 message(s)