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 2021-09-15 00:00:00Z and 2021-09-16 00:00:00Z
Avatar
chillerdragon BOT 2021-09-15 00:16:57Z
I implemented that in one of my clients. For Linux only tho. (@σℓí♡)
I think it would be really cool to send messages from the command line (console) when the game is alt+tab xd
Avatar
9deac14 Use gametick as int for emoticon calculation, add the fraction seperately - Jupeyy a49082d Merge #4164 - bors[bot]
Avatar
for noby (no HiDPI) https://github.com/ddnet/ddnet/blob/a49082d510594a13d6bc63f4beae133b902eb662/src/engine/client/backend_sdl.cpp#L946-L950 causes this https://cdn.discordapp.com/attachments/520621816226643972/887500328747008000/Screen_Shot_2021-09-14_at_7.49.22_PM.png just using SDL_GL_GetDrawableSize(m_pWindow, pCurrentWidth, pCurrentHeight); fixes it @TsFreddie did you not experience this when testing? It's really weird that SDL2 is so inconsistent then
09:00
nope
Avatar
ok xd
Avatar
can we sue SDL2
Avatar
xd
09:01
i'll just wait for an epic 10h debugging session by Learath and its fine
09:54
he might end SDL2
Avatar
chillerdragon BOT 2021-09-15 09:56:32Z
@Deleted User: what do you want me to do here? https://github.com/ddnet/ddnet/pull/4157#discussion_r707436519
Closes teeworlds/teeworlds#1450 (cherry picked from commit teeworlds/teeworlds@23a1b80) Checklist Tested the change ingame Provided screenshots if it is a visual change Tested in combination w...
Avatar
use reference
Avatar
chillerdragon BOT 2021-09-15 09:58:57Z
when calling the function?
Avatar
just use the function like UnloadTextureNew
09:59
its the most used anyway
Avatar
chillerdragon BOT 2021-09-15 09:59:35Z
not in upstream
09:59
i never understood refrences
Avatar
yeah idc, just merge the two functions
10:00
and use references
Avatar
chillerdragon BOT 2021-09-15 10:00:22Z
yea i thought they could be merged then i was scared :D
10:00
because of the REFRENCE
10:00
xxD
Avatar
why tho
Avatar
chillerdragon BOT 2021-09-15 10:01:06Z
dont we have a naming convetion for refrences?
Avatar
reference is bascially same as pointer, just without uglyness and NULL xd
Avatar
chillerdragon BOT 2021-09-15 10:01:13Z
like _r prefix?
Avatar
and no rebind
10:01
what? xD
Avatar
chillerdragon BOT 2021-09-15 10:01:37Z
sounds good
10:01
just wondering how i know a var is a refrence
Avatar
&
Avatar
you'll find out if something don't work greenthing
Avatar
chillerdragon BOT 2021-09-15 10:02:26Z
i mean by name
Avatar
why would you want to know it
Avatar
chillerdragon BOT 2021-09-15 10:02:39Z
doesnt it make sense to mark it with a prefix?
10:02
same as pointers
Avatar
if the object should not be modifable it should be const ref
10:03
else its just like you alter the object
Avatar
chillerdragon BOT 2021-09-15 10:03:20Z
one might think its a local variable
10:03
fromt he scope of the current function
Avatar
then he should learn coding xD
Avatar
chillerdragon BOT 2021-09-15 10:03:41Z
fak off
10:03
xd
10:03
i just feel like it would be more consistant wouldnt it
Avatar
no
Avatar
chillerdragon BOT 2021-09-15 10:04:10Z
ok
Avatar
just do the opposite of vanilla and you are god pro
Avatar
Jupstar and I disagree on whether we should use a reference there :/
10:04
I think we had an issue where this was discussed
Avatar
pointer always looks like you can pass NULL
Avatar
imho references should be used anywhere u dont expect null pointers
10:04
they are safer
10:05
its actually C++ fault you can pass a argument to a function expecting a reference without an implicit & imho
Avatar
well, there is also gsl::not_null if you need reassignable non-nullable pointers
Avatar
We should decide on a list of allowed C++ features, instead of having some unspecified list. Questions: Replace array with std::vector? Allow std::string? Allow auto? Only for iterators? Allow fore...
10:06
ah here
Avatar
then lets ignore that xD
10:06
i use references all the time
Avatar
Avatar
Ryozuki
its actually C++ fault you can pass a argument to a function expecting a reference without an implicit & imho
but in any case you won't know if a variable is actually a reference unless you have a naming convention, IDE features, know the code in and out or look it up
Avatar
also auto can make code rly confusing
10:06
is my auto var & && **?
10:06
cuz auto does weird things
10:06
xd
Avatar
Learath2 and deen also think we should use references where variables are non-null
Avatar
i think thats outdated for ddnet
Avatar
so we have pros/cons: + can't be null
  • non-obvious at call site
10:07
anything else?
Avatar
we got a issue with the naming stuff
Avatar
looks cleaner than putting & before everything
Avatar
can you elaborate? & makes it obvious that the variable can be changed (in the absence of non-const references)
10:08
so you consider that clutter?
Avatar
as said in the pr, const pointer
10:08
so it doesnt imply anything
10:09
you have to check the function body anyway
Avatar
yes, it implies it – in the absence of non-const referneces the variable cannot be changed if you don't put a &
10:09
an & doesn't imply that it will be changed
Avatar
yeah
Avatar
you cannot guarantee that anyway(?), not even rust has that
Avatar
see, so it doesnt improve anything to use &
Avatar
@ChillerDragon this is ours https://github.com/ddnet/ddnet/issues/2945
The meta journey continues. Proposed business rules about variable naming: Classes, structs Name starts with C or I. Second letter must exist and be a capital letter. Enum constants Must be all upp...
Avatar
I think it does improve the following: in the majority of cases, the argument is passed without & and then I know that it won't be changed
10:10
do you disagree with this argument?
Avatar
yes, bcs i expect references
10:11
just like there can be const pointers
Avatar
okay, but in the absence of non-const references
10:11
do you see how this argument is valid?
10:11
const pointers seem to be a distraction here. I'm not saying that & will change the variable
10:12
just that without an ampersand (and without non-const references) it won't change the variabel
Avatar
@Learath2 ur missing an important convo monkalaugh
Avatar
yes, and that's why i dont see any reason that & should be used for modifying stuff like references shouldnt
Avatar
you completely don't understand my argument? I don't know how else to explain it tbh
10:12
you can obviously weigh it less than any counterpoints, but it seems my point doesn't get across
Avatar
The problem is even if you see & in the code, you have to check if the function takes it as const pointer or not
10:14
so it doesnt improve anything anyway
Avatar
okay, let me try once more:
10:15
the benefit of not using non-const references is that I don't have to check whether the argument is modified if there's no &
10:15
I'm not claiming anything about the case where there's an &. obviously it might or might not be modified there
10:16
even if it's a non-const pointer, it might not be modified
10:16
do you see what I mean with my first of the three messages? (keeping in mind the second and the third)
Avatar
I think this is an issue of what you are used to. As a C programmer the & makes it extremely likely to me that the object I pass will be changed. A modern C++ programmer that is more used to references would obviously argue that the & doesn't imply anything since the reference feature indeed makes it quite ambiguous
Avatar
nope, just isnt really an arguement for me Doesn't matter if & or no &, in the end you look at the function body anyway
Avatar
without non-const references, you don't need to look at the function body. do you agree?
10:19
this seems to be a matter of logic to me, not really something to have an opinion on
Avatar
you have to check if the value is modified or not anyway
10:19
so you end up looking at the function body
Avatar
it should be expected that non-const references are modified and const-references are not
Avatar
I'm sorry, missed the ampersand thing
Avatar
Avatar
Robyt3
it should be expected that non-const references are modified and const-references are not
that sounds the most reasonable imho
Avatar
without non-const references, you don't need to look at the function body if there's no ampersand. do you agree?
10:20
I agree that the first one was wrong
Avatar
Avatar
heinrich5991
without non-const references, you don't need to look at the function body if there's no ampersand. do you agree?
@Deleted User
10:21
(if oyu don't pass a pointer, you can generate a pointer without an ampersand…)
Avatar
Double negative makes that a bit hard to read :P
10:22
"With only const references, you need to look at the function body if there is no ampersand"
10:22
Hm that doesnt make much sense either :D
Avatar
with only const references, you only need to look at the function body if there's an ampersand
10:23
I think this is the same statement, but positive
10:24
(btw, I see that you need to look at the function body to see if it's actually modified if you do pass a pointer, I also see that you need to look at the function body to see if a variable is modified in the presence of non-const references)
Avatar
chillerdragon BOT 2021-09-15 10:25:32Z
didn't other style guides solve this issue already?
Avatar
Most style guides are led by ideology not logic. C++ people would promote the use of their shiny references and C people would promote pointers
Avatar
well style guides by definition are subjective
10:27
no matter the lang
Avatar
You can have an objective discussion on when to use 2 equivalent things
Avatar
chillerdragon BOT 2021-09-15 10:27:23Z
Yea so the issue is that we introduced c++ at all :p
Avatar
I was trying to establish arguments in favor and against usage of references
10:27
I thought this was kinda objective, but one of my arguments was dismissed as invalid (edited)
Avatar
I think what tips the scale for references are rvalue references, which achieve something you can't do with pointers
Avatar
what you're doing is giving a conclusion already. I think it's better to collect arguments first and get to a conclusion later
10:29
so people like me don't get stuck on their position, but rather document the pros/cons together and then see how we weigh them
Avatar
Avatar
heinrich5991
without non-const references, you don't need to look at the function body if there's no ampersand. do you agree?
so you are saying you don't care how the value is passed?
Avatar
Can we assume proper const usage so the arguments are easier?
Avatar
Avatar
Deleted User
so you are saying you don't care how the value is passed?
no, that's not what I'm trying to say. can you explain what part of my message made you think that?
10:31
I was trying to present the statement in a logical form (edited)
Avatar
ok then let me ask this: You talk about references, what kind of references?
10:32
do you want to forbid moving code or what?==
Avatar
I'm talking about c++98-style references
Avatar
c++98monkaS
Avatar
maybe this is where our disagreement on what's logical comes from?
Avatar
So only lvalue references
Avatar
you were already considering rvalue references?
Avatar
mhh, I'm just not sure if a const ref should imply, you don't have to care about it
Avatar
you mean you're not sure if a const reference should imply that the function doesn't change the variable's value?
Avatar
not that, but e.g. taking an address of a member of the reference for example
10:36
e.g. not passing variables with limited lifetime
Avatar
The const is poisonous, you cant take a non const pointer through it
10:38
Can't even call a non const function through it. So const is fairly safe
Avatar
assuming there is no const cast, which there is in vanilla justatest
Avatar
and then there is mutable xd
Avatar
Avatar
Robyt3
assuming there is no const cast, which there is in vanilla justatest
Wait what?? What for?
Avatar
in CChat to replace newlines with spaces or something like that
Avatar
mutable - permits modification of the class member declared mutable even if the containing object is declared const.
10:42
monkalaugh
Avatar
probably somewhere else as well
Avatar
src/game/client/components/chat.cpp 669: *(const_cast<char *>(pStr)) = 0; 674: *(const_cast<char *>(pEnd)) = 0; 677: char *p = const_cast<char *>(pLine); src/game/server/gamecontext.cpp 1736: *(const_cast<char *>(p)) = 0; 1741: *(const_cast<char *>(pEnd)) = 0; src/engine/shared/console.cpp 1088: str_copy(const_cast<char *>(pCommand->m_pName), pName, TEMPCMD_NAME_LENGTH); 1089: str_copy(const_cast<char *>(pCommand->m_pHelp), pHelp, TEMPCMD_HELP_LENGTH); 1090: str_copy(const_cast<char *>(pCommand->m_pParams), pParams, TEMPCMD_PARAMS_LENGTH);
Avatar
Um, modifying a const object through a non const lvalue is still UB
Avatar
no, unfortunately not
10:45
it only matters if the original variable is declared const
Avatar
That’s what I said?
Avatar
which means the compiler can't use const on pointers to optimize
10:46
ah
10:46
then I misunderstood
Avatar
I assumed the members of pCommand were declared const
Avatar
c++ class CCommandInfo { protected: int m_AccessLevel; public: CCommandInfo() { m_AccessLevel = ACCESS_LEVEL_ADMIN; } virtual ~CCommandInfo() {} const char *m_pName; const char *m_pHelp; const char *m_pParams; virtual const CCommandInfo *NextCommandInfo(int AccessLevel, int FlagMask) const = 0; int GetAccessLevel() const { return m_AccessLevel; } };
10:48
so it matters with what it's initialized
Avatar
Anyway, we veered off course. @heinrich5991 so talking about lvalue references and assuming proper const usage. Do you have any reason you don’t like references? I think either way you need to look at the signature
Avatar
how did you made it colored
Avatar
```c++
Avatar
oh ok
Avatar
jupstar nobo
😡 1
Avatar
yes, my argument against lvalue references was that they make variable modification at call sites nonobvious
Avatar
i am not going to deny that this is an argument, i just wouldn't know if i'd rely on that in every situation
Avatar
Hm, well it is non-obvious even with &, which could be a const pointer. I don’t think you can avoid a look at the signature in C++
Avatar
A good function name solves more problems
Avatar
but it is obvious for the cases where you just pass a non-pointer
10:52
is that a significant amount of cases in our code base?
10:52
I guess strings are passed as pointers
Avatar
Avatar
heinrich5991
but it is obvious for the cases where you just pass a non-pointer
Hm, how about wrapper classes like shared_ptr?
Avatar
we currently call them p
10:54
(i.e. you can still see it at the call site)
Avatar
That’s fair. So pointers make the code easier to skim
Avatar
only if you dont care about const refs
Avatar
add _mut at end of the function if it modifies monkalaugh
Avatar
so no mutable, no pointers from const ref
10:56
addresses*
Avatar
Avatar
Deleted User
only if you dont care about const refs
? If references don’t exist in the codebase no & and not an array implies no modification
Avatar
(we do have mutable in the codebase, but it is rare)
Avatar
Huh, where did we use one? A mutex?
Avatar
Avatar
Learath2
? If references don’t exist in the codebase no & and not an array implies no modification
you can use them without modifying tho
Avatar
yes, but that's not what my point is about
10:58
it's about the case where you don't pass the pointer (see also what Learath2 said)
Avatar
Avatar
Learath2
? If references don’t exist in the codebase no & and not an array implies no modification
what you're saying is not an argument against the benefit Learath2 said
10:58
it's not an equivalence, it's just a one-way implication
Avatar
anyway, anything that isnt flagged const must be expected to be modified anyway
11:01
a good function name solves more
11:02
while coding i normally see the signature anyway, so it doesn't improve the situation imo
Avatar
those are arguments on top of the presented argument
11:02
have we accepted the argument and can move to counter arguments?
Avatar
Well idk about you but I don’t only skim on my computer. I sometimes browse on less than ideal situations
Avatar
NULL is the counter argument
Avatar
yes, it's a different argument
Avatar
NULL 0 nullptr
11:03
monkalaugh
Avatar
do you refuse to list pros/cons individually? @Deleted User
Avatar
c++ loves diversity
Avatar
Avatar
Learath2
Well idk about you but I don’t only skim on my computer. I sometimes browse on less than ideal situations
Assuming everyone uses a cutting edge space station IDE is a bad idea imo. It leads to Java
Avatar
i thought we are at the counter argument for pointers now
Avatar
okay, so you do accept the above argument as valid, i.e. might not apply to you but you see why other people might think that?
Avatar
i use vim and just have to press K to view the signature and gd to view the definition
11:04
u dont need an ide monkaS
Avatar
Avatar
Ryozuki
i use vim and just have to press K to view the signature and gd to view the definition
Your vim setup is not far off from an ide 😛
monkaS 1
Avatar
i dont know what you mean, but i still wouldn't ignroe const refs, just bcs they are not modifable
Avatar
I don't think this discussion is viable if you refuse to accept counter arguments
Avatar
Avatar
Deleted User
i dont know what you mean, but i still wouldn't ignroe const refs, just bcs they are not modifable
Hm, isn’t the point of this argument to pretend the other option doesn’t exist?
Avatar
i accept that a extra symbol in c++ could improve the situation
11:06
an
11:06
i see his argument
11:06
i just dont weight it as 100% given
Avatar
If we decide pointers are the better tool we wouldn’t have const references in the codebase
Avatar
i'd like to not rely on that
11:07
wait
11:07
he talks about only using const ref
11:07
doesnt he
Avatar
yes. I think Learath2 means non-const
Avatar
Hm, now I disagree. I think we should use one, not mix and match. Const references do make it ambiguous again
Avatar
well with pointers only we have the same situation
11:08
we want a visual difference between modifyable and not modyfiable
Avatar
No we don’t with pointers only, if you don’t see an & and the thing you are passing is not an array it’s guaranteed that no modification can even happen
Avatar
yeah, so i guess the easiest is what deen said acutally
11:10
not allow null pointers
11:11
and still keep in mind there is mutable and also you might want to take a const ref and expect a different lifetime
11:11
so its not a 100% garantuee imo
11:12
anyway, i think we should still allow references, they just feel nicer to use, like you just work with that variable
11:12
UnloadTexture implies to me that the object is invalid after calling it
Avatar
Avatar
Learath2
No we don’t with pointers only, if you don’t see an & and the thing you are passing is not an array it’s guaranteed that no modification can even happen
But the fact that there is mutable doesn’t change this
Avatar
i dont understand that tbh, why does mutable not change it?
11:13
isnt that the whole sense of mutable
Avatar
If you don’t see an & how is the called function supposed to mutate anything?
11:14
The called function will get it’s own copy of the object through the copy constructor
Avatar
AHH
11:14
thats what u mean xD
11:15
yeah, but can create quite a bit of copying
11:15
e.g passing a std::vector
Avatar
Ofc, which is why you’d pass those as a pointer instead. A const one if you don’t modify, a non-const one if you do. If you see an ampersand you need to look at the signature. If we enforce proper const usage that’s where you are done (edited)
Avatar
sure, but then we defs also have to limit more stuff
Avatar
Btw, I don’t mean to say this is the best solution. I’m just illustrating that it is indeed possible to reason more about a call locally when only using pointers
11:18
Dare I say a 100% even, if you look at the signature 🙂 (edited)
Avatar
well you could also always use std::ref xD
11:19
if you have no other hobbies
11:19
that would visually split it
11:19
i mean
Avatar
@heinrich5991 why were you okay with const references anyway? The rarity of const_cast and mutable?
Avatar
yes, that only works with rarity of const_cast and mutable
Avatar
I guess we can now talk about references being non-null?
Avatar
idk, has Jupstar understood that the above is an argument that can be made?
Avatar
i'd still say lifetime is underestimated if you have like SetInstance the ref cannot be rebinded
11:22
rebound
Avatar
Avatar
heinrich5991
idk, has Jupstar understood that the above is an argument that can be made?
i think i have been clear its an argument, but not one that eliminates reference usage for me
Avatar
I wasn't really asking for the latter, I was trying to enumerate valid arguments
Avatar
No one is saying 1 argument needs to convince us. Just need to make the arguments first, then we can look at them and decide
Avatar
but I understand that you feel strongly about this
11:24
ok, so let's move on to other argumetns
11:25
ambiguity of whether a variable can be null or not is indeed a problem for pointers
11:25
there's no easy native non-null pointer type, unfortunately
Avatar
The not-null guarantee also allows us to drop null checks at some places, albeit very easy for the branch predictor
11:26
Peppering the code with gsl::not_null doesn’t really seem viable, it’s a tad ugly imo
Avatar
where? mostly in dbg_assert?
11:26
yes, and it's also something that should be a default
11:27
not something you have to remember to write
Avatar
[gcc::nonnull] void* pPtr
11:27
[[]]
Avatar
Avatar
heinrich5991
where? mostly in dbg_assert?
Well responsibly if you expect someone might re-use your function it’s s good idea to have a null check. With references you are forcing it to never be called in a wrong way
Avatar
I agree that with references you don't have the problem
11:29
I'd say pretending they're non-null is a fine strategy for pointers
11:29
, hoping for it to crash in that case
11:31
but yes, that's a clear win for references
Avatar
chillerdragon BOT 2021-09-15 11:43:22Z
yikers
11:43
jupjapjop rage quitted the pr :(
Avatar
neutral = idc
Avatar
chillerdragon BOT 2021-09-15 11:45:13Z
i tried to avoid the discussion and only implement ur merge request
Avatar
we dont allow size_t, we dont allow anything, i just dont want to judge on all these restrictions
monkaS 1
Avatar
chillerdragon BOT 2021-09-15 11:45:29Z
i wanted your feedback on if i did that correctly
Avatar
i think you did
Avatar
chillerdragon BOT 2021-09-15 11:45:43Z
:)
Avatar
size_t best
Avatar
auto best
Avatar
I love unsigned types ❤️
12:40
petition to finally make all indices unsigned so we don't have to goof around with int casts
Avatar
size_t is unsigned right
Avatar
usize from rust describes it better imho
12:42
An integer that is known not to equal zero.
12:42
"This enables some memory layout optimization"
Avatar
usize misses the distinction between size_t and uintptr_t, not sure how relevant this is
Avatar
I had an interesting discussion in #C a couple days ago, given a start and an end pointer, how would you check if an object of n bytes given in size_t fits? e.g. bool fits(char *b, char *e, size_t n)
Avatar
I believe objects larger than SSIZE_MAX are UB? (edited)
Avatar
ye right?
Avatar
They can't possibly exist due to how the standards written iirc
Avatar
so e-b <= n? (edited)
Avatar
This is indeed the correct answer, but bonus question, most compilers will complain about this, how would you fix it?
Avatar
cast it to size_t
Avatar
well you have the comparison the wrong way around actually
Avatar
because we know that hte left side can't be negative, given the specification
12:46
ah true
12:46
(size_t)(e-b) >= n (edited)
12:46
we don't know if the right side is smaller than SSIZE_MAX
Avatar
do we rly not allow size_t rn?
Avatar
I believe I said to Jupstar that we don't use it and that he should change it in the PR
Avatar
what was the pr
Avatar
Thanks to @murpii for noticing the long line.

Checklist

  • [ ] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test if it works standalone, system.c especially
  • [ ] Considered possible null pointers and out of bounds array indexing
  • [ ] Changed no physics that affect existing maps
  • [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://...
Avatar
Avatar
heinrich5991
(size_t)(e-b) >= n (edited)
This is the conclusion we came to aswell, surprised you got it that quickly 😛
Avatar
heinrich is a genius
Avatar
I had the benefit that I knew it was a trick question 😛
Avatar
The naive approach is b + n < e which leads to all sorts of interesting questions about pointer arithmetic and whether it's UB to even calculate an invalid pointer
Avatar
someone want to review #4151?
Avatar
The idea is taken from the implementation of this in ATH client Checklist Tested the change ingame Provided screenshots if it is a visual change Tested in combination with possibly related con...
Avatar
ah i actually understood it
12:52
just ur naming got me confused whe nu asked it
12:52
b and e
12:52
why not start and end
12:52
well its just me being dumb
12:53
(size_t)(end-start) >= size
12:53
ez
Avatar
There is also another thing that came up while we discussed this. It is possible that e-b don't fit in a ptrdiff_t how would you take care of that one? 🙂
Avatar
time to search what a ptrdiff_t is
Avatar
it's the type of the result of a pointer subtraction
12:54
but it is signed, so it has half the range of size_t
Avatar
is it possible that it doesn't fit? I think we said that maximum object size is SSIZE_MAX in C
12:55
ah, ptrdiff_t and ssize_t is different? need to research 😮
Avatar
well ptrdiff_t is signed, so even if the two have the same amount of bits one has half the range in positive numbers
Avatar
If an array is so large (greater than PTRDIFF_MAX elements, but less than SIZE_MAX bytes), that the difference between two pointers may not be representable as std::ptrdiff_t, the result of subtracting two such pointers is undefined.
12:55
monkalaugh
12:56
(I know it's an insane case btw, it's just fun to language lawyer around 😛 )
Avatar
int_fast64_t
12:57
what does it mean fastest?
12:57
fastest signed integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef)
Avatar
fastest to compute, but ignore them
Avatar
fastest for operations like arithmetic, I think
Avatar
on linux they just 64bit
12:57
even if 32bit
Avatar
or better, 32_t is 64bit i think
Avatar
c++ has so many typedefs
Avatar
The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear grounds for choosing one type over another, it will simply pick some integer type satisfying the signedness and width requirements.
It's mostly not very useful
13:00
I want a language with good support for fixed point arithmetic pls
Avatar
C++ should do fine, I'd think
13:00
you can overload operators
Avatar
ac50cd1 Split long system message into two lines - heinrich5991 37caf97 Merge #4165 - bors[bot]
Avatar
so the obvious next question is: what operations do you want from the language?
13:01
(that I don't see rn)
Avatar
Avatar
Learath2
I want a language with good support for fixed point arithmetic pls
a game engine, would be interesting 😄
Avatar
Avatar
heinrich5991
you can overload operators
Hm, one could indeed make it quite pretty in C++. It does let you overload a whole lot of things
13:03
I guess with templates you can even allow a lot of different radix positions
Avatar
Ah that is cute
13:10
Now the only thing that remains is begging for fixed point extensions to the instruction sets
Avatar
most fixed point operations are just integer operations, plus some shifts
13:10
at least +-*/ are
Avatar
division is probs slow
Avatar
Oh those are trivial, I was looking for more interesting ones like sqrt
13:11
and maybe a FPSINCOS
Avatar
does sqrt from C use the CPU instructions?
13:11
I think they use the taylor expansion because the CPU's version is shit
Avatar
Huh, really?
13:13
mh, this looks like they use the CPU's version for sqrt
Avatar
clang 12 -O3
Avatar
seems like I'm wrong ^^
Avatar
I wonder what the jmp sqrt is for there, it only happens if xmm0 is negative
Avatar
correct error handling
13:16
I'd guess
Avatar
ah, there is more to floating point errors than just returning -1 😛
13:17
might need to raise an exception and stuff
Avatar
set errno
13:17
would all bloat this function
Avatar
yep EDOM iirc
13:18
Interesting though, it does notice that one branch is very short and does inline that
Avatar
I wonder if that's hardcoded for math functions
Avatar
Well I'm not about to dig into clang to find out 🙂
Avatar
this message would also be in character without the "not"
Avatar
heh, I do like going spelunking but I'm busy today
13:21
actually I'll check glibc now that I'm curious I probably cant think about anything else
Avatar
if (__glibc_unlikely (isless (x, M_LIT (0.0)))) __set_errno (EDOM);
13:25
Seems the error handling isn't that complex after all?
Avatar
hm, so it's the unlikely that causes it not to get inlined?
13:25
or the errno modification?
Avatar
let me check if __set_errno is complex
Avatar
errno is in thread-local storage, I think
13:28
maybe [gs:4] or so
13:28
so I guess also not complex
Avatar
even if unlikely I see no reason not to inline it btw, unless setting errno entails more than just setting erno
13:28
errno*
Avatar
square(int): push rax call __errno_location mov DWORD PTR [rax], 33
Avatar
#define __set_errno(e) (errno = (e)) mh
Avatar
what does push rax do there?
13:30
yes, but errno is in TLS
13:30
errno is defined as something like (*__errno_location())
13:30
probably exactly that
Avatar
@trml how important is it that the tuning resets shotgun tunings? https://github.com/ddnet/ddnet/blame/37caf97bd9c81fab960e1fca4f05921cdd9fde15/src/game/client/gameclient.cpp#L2977 In ddrace the shotgun is a laser anyway, and it currently breaks the vanilla shotgun rendering
Avatar
extern int *__errno_location (void) __THROW __attribute_const__; # define errno (*__errno_location ())
Avatar
it's important for the shotgun bullets that are spawned by tiles, I think
13:32
those that freeze you and sometimes explode when hitting walls
Avatar
are they not simple projectiles?
13:32
but shotgun projectiles?
13:32
i really no idea what ddrace does
Avatar
they are shotgun projectiles, to the client, I think
Avatar
Avatar
heinrich5991
square(int): push rax call __errno_location mov DWORD PTR [rax], 33
what is your function body here?
Avatar
errno = EDOM
Avatar
i assume OnConnect is not safe enough to request what mod type the server is?
Avatar
hm, gcc doesn't do the weird push rax, I wonder what clang is thinking there
Avatar
Avatar
Deleted User
i assume OnConnect is not safe enough to request what mod type the server is?
Don't we already have a message reporting server capabilities? You either need to send something there or use an ugly string match since we know the gametype string
Avatar
yeah seems to be sent before
13:38
i just want to be sure, so i dont break anything
Avatar
RAX is caller saved as far as I'm aware
Avatar
you could theoretically add a flag to the server capabilities (bit weird because it's game-specific and those are engine) or to the game flags (but those can change any time during the game and are only available later)
Avatar
i'd just not set any ddrace specific tunings if the server isnt ddrace for now
Avatar
@Deleted User what is the problem with the tuning btw? What do you need to handle differently for vanilla?
Avatar
not set ddnet-specific custom tuning, i.e. no shotgun spread etc.
Avatar
c++ if(m_GameInfo.m_EntitiesDDRace) { TuningList()[i].Set("gun_curvature", 0); TuningList()[i].Set("gun_speed", 1400); TuningList()[i].Set("shotgun_curvature", 0); TuningList()[i].Set("shotgun_speed", 500); TuningList()[i].Set("shotgun_speeddiff", 0); } simple patch like this
Avatar
eeeeeeeeh piggybacking off a semi related flag :/
Avatar
what?
Avatar
Technically m_GameInfo.m_EntitiesDDRace doesn't imply anything other than show ddrace entities
Avatar
mh i guess we also have a better var for that
Avatar
Wait, so these tunings don't exist in vanilla?
Avatar
ah, look at that
13:41
maybe we can just remove these things on the client side
13:42
we apparently send the tuning params unconditionally on connect?
Avatar
Avatar
heinrich5991
maybe we can just remove these things on the client side
The client needs to know them for proper prediction on ddrace, no?
Avatar
that would work too, no edge cases? spawning in tune zone or smth
Avatar
I actually don't know how tune zones are sent to the client
Avatar
Ok, I seriously don't get what's wrong here. I thought these tunes don't exist in vanilla, setting them to their default sounds sane to me
Avatar
gun_curvature
13:45
those things exist in vanilla with different defaults
13:45
shotgun and gun have curvature in vanilla
Avatar
Ahhh these are ddnet defaults
Avatar
Avatar
heinrich5991
I actually don't know how tune zones are sent to the client
Very inefficiently, in CGameContext::SendTuningParams
13:46
Ah, you said tune zones, soz
13:47
Well it's still in SendTuningParams 😛
Avatar
i could assume they are sent anyways, so vanilla clients dont break or smth xd
13:47
if whoever implemented tune zones thought about it
Avatar
I like your optimism
Avatar
How about we don't touch tunezone 0 (which is where I think we store the global tunes) when reseting there?
13:50
The server will send the proper tunes when you are ingame (NETMSGTYPE_SV_TUNEPARAMS) and tunezone 0 will become correct
Avatar
there's also a different m_Tuning variable oO
Avatar
what about stopping support for legacy 0.6 kekw
Avatar
tune zones are strange anyway, we have so many dublicates in the client prediciton xD
13:51
idc about 0.6 clients, but vanilla
Avatar
0.6 vanilla servers
Avatar
there is that one person, who uses nightly and is annoyed by vanilla shotgun tuning being wrong xD
Avatar
Avatar
heinrich5991
there's also a different m_Tuning variable oO
Yeah this was what confused me aswell
Avatar
Avatar
heinrich5991
0.6 vanilla servers
then i don't know what about you are talking here :P
Avatar
xD
Avatar
I have a feeling that this will get more broken the more we dig into it
13:53
ah!
13:53
there's m_UseTuneZones
13:53
this should be false for vanilla
13:53
in this case we seem(?) to ignore the tune zones and use the tuning in m_Tuning
Avatar
but what populates tunezone 0 if m_UseTuneZones?
Avatar
and m_Tuning is the default. so where do we get the discrepancy?
13:54
I have the feeling it's executing the map commands to find out
Avatar
m_GameWorld.m_WorldConfig.m_UseTuneZones = m_GameInfo.m_PredictDDRaceTiles;
13:54
so i can rely on the game info
Avatar
Avatar
heinrich5991
I have the feeling it's executing the map commands to find out
yup, looks like it, look for CGameClient::ConTuneZone in gameclient.cpp
Avatar
Mh, I don't like that there are 50 copies of the tuning in the client :/
Avatar
only 25 😉
13:55
27
Avatar
There is one part of the charactercore, the world seems to keep 2 aswell
Avatar
it seems the bug is that the client is looking at tune zones when it should not @Deleted User
Avatar
no tunezone 0 is the global now, tsfreddie changed it, to reduce the amount of tune zone copies xd
Avatar
But if !m_UseTuneZones tune zone 0 is set to the tunes received from the server
Avatar
yeah thats ok too i guess
13:59
i just remove the initial tune zone params
Avatar
fixes #4140

Checklist

  • [x] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test if it works standalone, system.c especially
  • [ ] Considered possible null pointers and out of bounds array indexing
  • [ ] Changed no physics that affect existing maps
  • [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresss...
Avatar
^
13:59
like this
13:59
if its wrong, correct me
Avatar
@Learath2 i got a calculation that works now, for the dynamic camera. Just bad, that it wont work when dyndeadzone or dynfollowfactor are non-default :(
14:00
why does this line exist?
Avatar
Avatar
GitHub
Click to see attachment 🖼️
uhm, I don't think that's correct, is that not too early to check m_UseTuneZones
Avatar
it shouldn't be changing the world config
Avatar
@heinrich5991 well gameinfo can change, e.g. in fokkonauts mod
Avatar
but its the only code path that sets the variable
14:01
well, this commit looks wrong
Avatar
but it only moves it a few lines up
Avatar
Avatar
heinrich5991
well, this commit looks wrong
he probably needed it somewhere else
Avatar
ah, I'm looking at this the wrong way, I thought the m_WorldConfig object came from the network, nvm
Avatar
That is an extremely curious change though. It looks um, useless to me
Avatar
it moves it above the return
Avatar
Ah, hm, well shouldn't the entire thing move above ideally?
Avatar
yea
14:04
I'll PR it
Avatar
Yeah idk all this stuff is weird, I never touch it because only @trml seems to know it all 😛
Avatar
and tsfreddie xd
Avatar
Interesting for weapons etc.

Checklist

  • [ ] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test if it works standalone, system.c especially
  • [ ] Considered possible null pointers and out of bounds array indexing
  • [ ] Changed no physics that affect existing maps
  • [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/...
Avatar
@Learath2 There is no chance in getting to know about the deadzone or follow factor of a player right=
14:07
right now i need to assume default values, deadzone 300 and followfactor 60 in order to create dyncam zoomed cursor
14:07
which obviously wont work for other values
Avatar
@Deleted User anyway, I think OnConnected happens immediately on CON_READY, which I think is before the first tunes are sent
14:07
first snap is sent*
Avatar
Avatar
fokkonaut
right now i need to assume default values, deadzone 300 and followfactor 60 in order to create dyncam zoomed cursor
hm, I thought deadzone and ff wouldn't matter at all :/
Avatar
sadly they do
14:12
yea there is no fucking way in getting those values
14:12
also as it seems no hack or smth
Avatar
ye I took a look aswell, they do indeed matter and there is no way to get them
14:16
besides reversing the calculation on the server is hardly a good solution anyway, I guess ideally the position of the cursor should be sent relative to the tee
Avatar
it is
14:16
but the clientside cursor is not rendered at that exact point
14:16
thats my issue, because i want them to be exactly matching
14:17
which only works in zoom 10 (for any follow factor or deadzone), or with my calculation with any zoom and dycam off or dyncam on and default ff and deadz
Avatar
@heinrich5991 not bcs of this pr, but is there no way the gameinfo atleast sets an estimated GameInfo, so entities are shown correctly most of the time, before the first snap comes in
Avatar
Client wont show anything until first snap
Avatar
client will wait for three snaps, I think, even
Avatar
three then, sirry
Avatar
but i defs see a change in entities
14:24
so the gameinfo kinda is delayed
Avatar
Previously, the old game info persevered into the next server.

Checklist

  • [x] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test if it works standalone, system.c especially
  • [ ] Considered possible null pointers and out of bounds array indexing
  • [ ] Changed no physics that affect existing maps
  • [ ] Tested the change with [ASan+UBSan or valgrind's m...
Avatar
hmmm
14:26
maybe it renders the game before evaluating the snaps?
Avatar
possible, i can also only see it on ctf3, ctf5 is too slow or smth
14:29
ah see it when i connect to non EU servers
Avatar
can confirm, interesting
14:34
trying to debug it
Avatar
huh, that is indeed most interesting, I don't think it could render before evaluating snaps
Avatar
it has 2 snaps
14:42
in my 1 min debugging session xd
Avatar
2 snaps?
Avatar
2 snaps received
Avatar
could it be that we run out of space in the first few snaps?
Avatar
it seems OnRender() is called with IClient::STATE_ONLINE before OnNewSnapshots() is called
Avatar
The very silent returns in all the Snap functions would make it invisible if we run out of space in the snaps
Avatar
if(m_ReceivedSnapshots[g_Config.m_ClDummy] >= 3)
14:44
seems like there is a missmatch
14:45
why does it even wait 2 snaps, so it has a current and previous one?
Avatar
2 is definitely needed as many things expect a prev snap, 3 is probably for things like prevprevpos
Avatar
teeworlds has so weird design choices, why does the server not just send 2 snapshots or smth xd
14:47
no need to wait 4 ticks
Avatar
Um, it's not exactly weird to me tbf, sending 2 snaps instantly would just send identical snaps
Avatar
it could store the last 2
14:47
and send them at connect
14:47
so the cleint can directly start
14:47
instead of wasting 80ms xD
Avatar
But why? 80ms is absolutely nothing
Avatar
depends, plus ping delay for first packages
14:48
tw connecting is not really fast, i'd say
14:48
except for map downloading everything else could be almost instant
Avatar
why don't we implement the factorio map rendering stuff? because we currently have simpler code that works, I'd guess
14:49
same here
Avatar
Does it need to be fast? We could also remove the loading screen with something like matricks' bluesky branch
Avatar
Avatar
heinrich5991
why don't we implement the factorio map rendering stuff? because we currently have simpler code that works, I'd guess
mhh is memory bliting really faster than redrawing?
Avatar
yes, if I zoom all the way out, it starts to lag
Avatar
i made some benchmarks a while ago for android, and the GPU cores were faster 😄
14:50
yeah ok
14:50
is situation dependend
14:50
zooming out is mostly laggy, bcs of teeworlds map extension
14:50
like outside of map is rendered too
14:51
and gpus arent really good in firing up instaces
14:51
and cpus are slow in handling alot of stuff insglethreaded
Avatar
Didn't factorio people already bench this? scrolling the old buffer over was an order of magnitude cheaper than going through and rendering the entire screen again iirc
Avatar
yeah, but their scene might also be more complex
Avatar
Hello, We released 0.18.4 this week, same old same old, more bugfixes, more bugs, more changes. At this stage of development, not many interesting things are happening, we are just polishing what we have. Minor terrain render optimization posila Just a couple days before the release of 0.18.0 I had an epiphany about a terrain renderin...
14:52
doesn't look like it (left side is what they cache) (edited)
Avatar
Anyway, besides the point, there are indeed some optimisations we can do but I don't think they are worth the pain of introducing new codepaths for the handful of ms they save us
14:53
Like how would you create these 2 older snaps to be sent on connect? Who would they be snapped for?
Avatar
old snaps from the server
14:54
saved server side
Avatar
snaps are done for specific client IDs
Avatar
But we don't send the same snaps to everyone, there is a lot of branching on SnappingClient
Avatar
but yeah, i just feel like you can always improve, but network is almost impossible anyway, bcs of vanilla compability
Avatar
you could snap the entire world like for a demo, does this extremely fat snap still fit? is sending this fat snap over slower connections still faster than waiting for the 2 snaps?
Avatar
but it does knwo the client id, doesnt it
14:56
i mean it generates it itself
Avatar
Avatar
heinrich5991
I actually don't know how tune zones are sent to the client
i think tune zones arent predicted
14:56
so probs the client dont know about them
Avatar
also doesnt actually need to contain anything specific
Avatar
Avatar
Ryozuki
i think tune zones arent predicted
They are both predicted by parsing the map and by sending tunes on entering them
Avatar
@Ryozuki the client apparently executes the statements from the map, see above
Avatar
ah that must be quite new then
14:57
cuz i remember when u spec someone in tune zones it looked weird
14:57
e.g slow grenade
14:57
idk
14:57
but u must be outside the tune zone
Avatar
Avatar
Deleted User
also doesnt actually need to contain anything specific
point is that it's not impossible, it's that it's a lot of work for saving a couple dozen ms
Avatar
and another player in
Avatar
tsfreddie improved stuff tehre 😄
Avatar
Avatar
Learath2
point is that it's not impossible, it's that it's a lot of work for saving a couple dozen ms
im junkie#
Avatar

Checklist

  • [ ] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test if it works standalone, system.c especially
  • [ ] Considered possible null pointers and out of bounds array indexing
  • [ ] Changed no physics that affect existing maps
  • [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--u...
Avatar
Well if you want to optimize that to it's limit the model you should implement is the bluesky branch. Maps sent as a group of resources which are asynchronously loaded as they are sent. The loading screen is like instant on there
Avatar
do we rly need to optimize it?
14:59
running at 1k fps is enough xd
Avatar
"runs fine on my developer machine"
Avatar
i think this is more about network
Avatar
@Ryozuki not rendering in this case, we were talking about the loading screen
Avatar
not a good benchmark
Avatar
if we'd be OGl 3.3 only, i'd also love to implement LED corrected text
15:00
so its sharper when the font size is small
Avatar
what's LED?
Avatar
@heinrich5991 btw wanna try enabling aio for the next patch on windows?
Avatar
RGB
15:01
the LED of your monitor i mean
Avatar
ah, the subpixel rendering?
Avatar
yea
15:01
i remember when i implemented some text rendering on my own, on certain positions it looked a bit blurred
15:01
but that must be something i made wrong xd
Avatar
lets drop unicode support and use msdf for the text, that should get us an extra couple hundred fps 😛
15:02
as a + msdf text looks gorgeous at any scale
Avatar
Japan Maritime Self-Defense Force, the Japanese Navy
15:02
?
15:02
xd
Avatar
Multi-channel signed distance field generator. Contribute to Chlumsky/msdfgen development by creating an account on GitHub.
Avatar
oh valve
Avatar
well valve came up with sdf
Avatar
but tbf, is there a gain in 2d?
Avatar
this guy came up with the idea of generating more than one sdf and shoving it into the other channels
Avatar
or are we already thinking about 3d tw, im in xd
Avatar
oh definitely, with the amount of text we can have in ddnet on a single screen I'm sure the gpu would blast through it
15:05
(you can render these in shader)
Avatar
libreoffice ;~;
15:05
not even they can handle text xd
Avatar
wdym?
15:06
the selection over the f?
Avatar
the f goes outside
Avatar
you know who handles text
15:06
LaTeX
Avatar
might make sense for selection, letter can overlap
Avatar
yeah
15:06
i just noticed it, when i improved our text selection
15:07
and felt releafed
Avatar
ah 🙂
Avatar
hm, never saw it anywhere on macOS
Avatar
browsers are also good at handling text 🙂
Avatar
it's surprising how the open source world is so behind all the proprietary magic, CoreText is a beast and it looks very pretty
Avatar
can you try with AV, @Learath2
Avatar
eh, discord doesn't do kerning
15:08
the letters "AV"
Avatar
Sure, let me check
15:09
If you have a font with heavier kerning I can check that too
Avatar
just select the A there
Avatar
Ah, I see what you mean, though I wonder if one can even argue as to which is correct
Avatar
^^ I guess libreoffice should select the whole letter if it doesn't intersect with others
Avatar
It seems the selection box is just shrinked by the amount of kerning
15:13
well since the kerning is negative in this case, the kerning is just added to the width would be a more correct way to put it
15:15
Things like arabic just completely break this idea of "bounding boxes" btw 😛
15:17
I have a random notepad instance open with a password that has no explanation next to it open...
Avatar
Avatar
Ryozuki
monkaS
latex
Avatar
i stared at this image rly long when figuring out how to render text
Avatar
yo we talking typography
Avatar
typographygang
Avatar
Avatar
Ryozuki
i stared at this image rly long when figuring out how to render text
Now look into how to lay arabic glyphs properly and you want to die 😛
Avatar
Avatar
Learath2
hm, never saw it anywhere on macOS
depends on the font ofc, but generally spoken, freetype doesn't give me a perfect size to calculate with, the char advance can be smaller than the char width and the char width is too big (edited)
Avatar
huh, how is the width too big?
Avatar
i dunno, maybe it is some very transparent pixel or smth
Avatar
you mean the rect (bearingX, bearingY) x (bearingX + width, bearingY + height) wasn't correct? interesting
Avatar
ah and we also have outline ofc
15:40
that destroys everything too xd
Avatar
hm, how do we do the outline? if it's thickness is known you just add double that in every direction, if we render a bigger character then just do the bounding box around that?
Avatar
i mean i can just say general things as i dont know any details: e.g. the size metrics are not reliable and freetype also mentions it https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_size_metrics "Note that due to glyph hinting and the selected rendering mode these values are usually not exact; consequently, they must be treated as unreliable with an error margin of at least one pixel!"
API Reference Documentation for FreeType-2.11.0
Avatar
Avatar
Learath2
hm, how do we do the outline? if it's thickness is known you just add double that in every direction, if we render a bigger character then just do the bounding box around that?
yeah but sadly what i experienced is that the advance can be smaller than what is rendered and atleast the breaing does not respect the outline
Avatar
well bearingX-outlinewidth would work, no?
15:44
advance + kerning is where the next origin should be, right?
Avatar
i mean that the advance doesnt even reach the end of the non outline glyph
15:46
i only use the advance here to calculate the selection quad
15:46
i even add the bearing of the next character and its still to less
Avatar
the sum of advanceX + 2 * glyph_count * outlinewidth should always be correct imo, so weird
Avatar
ah yeah, but i mean that advance is not enough to end after the inner A
15:47
that is weird
15:47
it could ofc be improved with the outline, which i didnt use
15:48
but i'd except the selection to atleast end before the inner char end
15:48
s
15:50
mhh but yeah
15:50
maybe you are right
15:50
i should just use the outline than it should fit pretty much
15:50
or i should completly ignore the outline, as it destroys the other math
15:51
hard to say
15:51
you vote @Learath2
15:52
current behavior is like vanilla 0.6 i think
15:53
mhh since i use advance now, i think i could indeed ignore it
15:53
good catch, i was blind for that
Avatar
@Deleted User btw do you know any way to fix the ugly overlapping outline?
Avatar
either respecting outline
16:08
or use stencil buffer
16:08
bcs stencil best xd
16:08
but ogl 3.3
16:08
ok not 3.3
16:08
but atleast not garantueed in gl 1.x
Avatar
@Deleted User could we maybe ignore the transparency and instead precalculate the color of the outline pixels in advance?
Avatar
without transparency the imagine behind won't be respected
16:11
but yeah
16:11
theorectically it would work, dunno how important the transparency is
16:11
in a red background it will ofc look different with transparency
Avatar
but before we render the text, we have the background pixels, we could calculate the outline color at all points
Avatar
xD
16:13
yeah, but that is even less supported by gl 1.x than stencil i guess
16:13
that would require reading frame buffer
Avatar
well not in a good performance at least, ofc we could go completly crazy and load the current framebuffer and calculate everything on fly 😄
Avatar
let me read some 90s text rendering stuff, maybe they have it figured out
Avatar
i'd assume most gpus always supported stencil
16:15
i mean its not more special than a zbuffer or smth
Avatar
is there no extension we can check for?
Avatar
or as you said, no transparency at all
16:16
i think before win7 transparency wasnt a thing so much
Avatar
Avatar
Learath2
is there no extension we can check for?
no idea tbh
16:16
probably there is
16:16
but i dunno if the SDL_CreateWindow can fail bcs of this
16:16
since that creates the default frame buffer
Avatar
it kinda makes it better, but the annoying outline still annoys xd
Avatar
chillerdragon BOT 2021-09-15 17:14:32Z
@Deleted User: when make split screen for dummy?
Avatar
already made it
17:16
but is horrible, bcs switchting dummy requires OnSnapshot to be called
Avatar
chillerdragon BOT 2021-09-15 17:16:43Z
ik u made it thats why iping u
17:16
when polish and merge into ddnet
Avatar
good question
17:17
i'd say, when someone cleansup everything with [DUMMY_CLIENTS]
Avatar
chillerdragon BOT 2021-09-15 17:18:09Z
whats the issue with dummy_clients?
Avatar
the network code mostly
Avatar
chillerdragon BOT 2021-09-15 17:19:13Z
ah true network code is still 0.6 thats bad
17:19
hrhrhrhrhrh
Avatar
like using m_CurrentGameInfo or whatever all these vars are called
17:19
some are set in OnSnapshot only
Avatar
chillerdragon BOT 2021-09-15 17:19:51Z
so its hard to get both at the same time or what?
17:20
or get the one from dummy
17:20
i see
Avatar
switchting between them per tick is hard
Avatar
chillerdragon BOT 2021-09-15 17:24:09Z
playing like that must be pain anyways
17:24
i want it mostly for spectating
17:26
this was the last try xd
Avatar
cool. Would be even nicer to only show the pip when dummy is not on main screen anymore maybe
Avatar
yeah and maybe pip for other team members 😄
Avatar
oh yeah, that would be sweet too when speedrunning
Avatar
What the fuck is with the audio
Avatar
onsnapshot generates them i think
17:30
and since its called per frame its quite alot of sound xD
Avatar
Avatar
Learath2
How about we don't touch tunezone 0 (which is where I think we store the global tunes) when reseting there?
this was my first thought about this (since that code is only useful for tunezones the player hasn't visited yet), but seems like using the gameinfo may be the cleanest
Avatar
If it does arrive in time, sure
Avatar
bebc417 Ensure a snap is evaluated before the world is rendered the first time - heinrich5991 54dab9b Merge #4169 - bors[bot]
Avatar
@heinrich5991 could you also reset on connect, that the server sended the message for rcon username login? because when i connect to ddnet, then to my server it asks for a password, but my server doesnt send that
18:14
fresh client restart doesnt ask for username
Avatar
[8:14 PM] fokkonaut: @heinrich5991 could you also reset on connect, that the server sended the message for rcon username login? because when i connect to ddnet, then to my server it asks for a password, but my server doesnt send that [8:14 PM] fokkonaut: fresh client restart doesnt ask for username
18:17
b7fe9b1 Clear game info on connect - heinrich5991 b454990 Merge #4168 - bors[bot]
Avatar
ca2d851 Update world config even if the local character is dead - heinrich5991 f2dd9a0 Merge #4167 - bors[bot]
Avatar
Java 17 (released yesterday) comes with many new features and enhancements. However, most of those require code changes to benefit from. Except for performance. Simply switch your JDK ...
19:14
tldr > >
Java 17 is 8.66% faster than Java 11 and 2.41% faster than Java 16 for G1GC (default).
>
Java 17 is 6.54% faster than Java 11 and 0.37% faster than Java 16 for ParallelGC.
19:15
monkalaugh
Avatar
nice, more fps in modded minecraft
19:16
and actually u can use java 17 on minecraft 1.16+
19:16
before it was stuck at 11
19:16
and 8
19:17
19:17
i was rly surprised
19:17
i thought they would have been perma stuck in java 8
Avatar
@Deleted User do you know which server the tuning problem happened at?
Avatar
vanilla
19:17
the shotgun bullets
Avatar
oh. because I just tested this on a vanilla server, and it looks like the server does send the tunings
19:18
at join
Avatar
before OnConnect or what?
Avatar
so Im starting to wonder if the problem could be the opposite, that "OnConnected" is somehow called after the tuning msg
Avatar
not impossible 😄
Avatar
hmm, yeah, never thought about it
Avatar
we can also initialize it when connecting 😄
Avatar
yeah, the earlier the better it seems:P
Avatar
or, no, it doesnt actually happen before OnConnected
19:28
but?
19:28
the tune params are wrong or what?
Avatar
but my shotgun also worked
19:28
so maybe I was lucky with something
Avatar
maybe my network just works different xd
19:29
btw
Avatar
oh, so you could reproduce it as well?
Avatar
its when you spec someone
19:29
someone shoots, and you spec him
Avatar
oh, I see
Avatar
@trml 138.255.102.160:8241
Avatar
@trml what is the ddrace packet for tunezones that are not 0
Avatar
I dont think we have a separate packet
19:45
the client just gets sent a new tune packet after the player crosses the zone border
Avatar
oh
19:46
why do we even have a tunezone list then?
Avatar
to keep the tunes for the other zones in memory, so that projectiles and other things still look correct when in a different zone zone
Avatar
but how is it filled then
Avatar
and it also removes latency from the prediction when crossing to a zone with different gravity, etc
Avatar
there has to be some index or smth xd
Avatar
in UpdatePrediction (search for things like "m_ExpectingTuningSince")
Avatar
i see
Avatar
@Deleted User it's updated from the map, and later from the server when you enter the tune zones, from how I read the code
Avatar
ah i see, there also is m_GameWorld.TuningList()[0] = m_Tuning[g_Config.m_ClDummy];
19:50
but its not the same tuning list as the one in gameclient xD
19:51
bcs we have so many
Avatar
oh, since it only happens in UpdatePrediction, the player will miss it if it's in spec ("if(!m_Snap.m_pLocalCharacter)")
19:53
which I think would happen if the player joins to spec on a vanilla server
Avatar
ah thats the problem
19:53
i see
19:53
is that check useful?
Avatar
for the rest of the code in that function, yes
19:54
or, I assume at least
Avatar
there are only a few m_pLocalCharacter
19:54
accesses
19:54
but yeah
19:54
seems like they all need the char pos
19:55
well if you want to fix it i'd be glad, bcs i dont really know that code
19:56
this is the blame commit btw
Avatar
yes, it was updated by TsFreddie to make the association to the tune zone number more accurate, I believe. before it just looked at the player position from the snapshot
Avatar
why isnt the tunezone just always calculated if tunezone index is not 0 for whatever entity and else just use the params the server sends?
20:00
like inside the prediction code or somewhere
20:01
UpdatePredictions is only called by OnNewSnapshot but the collision index could always be calculated couldnt it
20:01
would make the prediction more accurate
Avatar
for the association between the server messsage and the tunezone number?
20:02
we always know the tunezone tiles from the map
Avatar
i'd imagine it like this somewhere in the prediction GetTuneCollisionIndex Get tune param from that index Calculate the prediction with these tune params
Avatar
yeah, but the map index only gives the tunezone number
Avatar
so the server has to send the tunezone params in the end or what
Avatar
then we have to look up the m_Tunezones[...] table, that are based on what the server sent
20:04
yes, although on ddnet they are also stored in the map
Avatar
ok, but then these paramlist should just be updated everytime a new packet comes in
20:04
i guess its accurate enough still isnt it
Avatar
(but its possible to change tunings in rcon afterwards)
Avatar
ah you can even change tunings of tune zones?
20:05
that isnt 0
20:05
but well wouldnt change anything
20:05
just keep the list updated with the snapshots
20:05
rest isnt really a problem of the packets but prediction
Avatar
Avatar
Deleted User
ok, but then these paramlist should just be updated everytime a new packet comes in
that is what is done now, I believe, but we try to update each tunezone individually, based on what tunezone was updated by the server
Avatar
yeah i understand that, but the local char isnt really needed for that is it?
Avatar
the client enters a new zone -> server sends a tuning msg -> the client needs to figure out what tunezone it was meant for
Avatar
ah i see
20:07
yeah
20:07
then rip
Avatar
and the only way to figure out the tunezone is to look at the player position
Avatar
so there isnt really a server packet telling u what tunezone you looking at
20:08
sounds annoying
Avatar
yes, thats part of the problem
Avatar
and if m_GameWorld.TuningList()[0] = m_Tuning[g_Config.m_ClDummy]; is just called even without char(top of the function)?
20:09
in worst case u have that tuning, in best case it gets updated
Avatar
yes, moving it to the top looks like it might be safe
Avatar
im crying
20:16
wtf
20:16
client can only process 1024 snaps
20:16
per snapshot
20:16
even tho max size is not reached
20:17
this is why
20:17
only this
Avatar
then increase it
20:18
and this ofc
Avatar
Avatar
Deleted User
then increase it
wouldnt work, its also clientside
Avatar
then dont change it
Avatar
@Deleted User oh, I was perhaps thinking of the whole entire block
Avatar
why do you even need so many 😄
20:19
what block?
20:19
the above uses the character position
Avatar
Avatar
Deleted User
why do you even need so many 😄
on my server there are many objetcs :( currently, i have removed the dbg_asserts from snapnewitem, so that too many items/size just gets dropped without crashing the server
Avatar
i see too bad
Avatar
hmm, yes, but the default to tunezone 0 should perhaps only happen if tunezones are not used, or if the player is in spec/not available
Avatar
so just add an if?
20:21
xd
Avatar
I think so, just have to think about it for a second 😛
Avatar
sure
20:22
i'd have thought it doesnt matter as the players tune index is different anyway (edited)
20:23
if its inside a tune zone
Avatar
oh, it would be for keeping zone 0 correct (and the projectiles in it, etc) when the player is outside it
Avatar
c++ if(!m_GameWorld.m_WorldConfig.m_UseTuneZones) m_GameWorld.TuningList()[0] = m_Tuning[g_Config.m_ClDummy]; But this should have the same effect then
Avatar
Avatar
trml
oh, it would be for keeping zone 0 correct (and the projectiles in it, etc) when the player is outside it
so its desired anyway? xd
20:24
ah i see
20:24
got it wrong way
20:25
it would keep it correct yeah
20:25
true
Avatar
Avatar
Deleted User
c++ if(!m_GameWorld.m_WorldConfig.m_UseTuneZones) m_GameWorld.TuningList()[0] = m_Tuning[g_Config.m_ClDummy]; But this should have the same effect then
yes, this would work
Avatar
nais
Avatar
08881e8 Refactor text renderer - Jupeyy 4317c43 Console copy string - BloodWod-513 79dbbe2 Merge #4151 - bors[bot]
Exported 902 message(s)