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-02-15 00:00:00Z and 2021-02-16 00:00:00Z
Avatar
[quakenet] PerfeCtion_ BOT 2021-02-15 00:14:08Z
Hey
00:14
Can someone help me changing small things in the teeworlds source? I already compiled it I just need some help please
Avatar
[quakenet] heinrich5991 BOT 2021-02-15 00:17:07Z
hello also from over here ;) ask your question and you might get an answer within a day or so ;)
00:23
good night
Avatar
[quakenet] PerfeCtion_ BOT 2021-02-15 02:03:35Z
Okayy so in which cpp file can I do unlimited ammo?
Avatar
[quakenet] PerfeCtion_ BOT 2021-02-15 02:14:23Z
i found it out myself
02:14
but how can i make the gun autoshoot?
Avatar
[quakenet] PerfeCtion_ BOT 2021-02-15 02:28:30Z
Heheee i got ittttt
Avatar
[quakenet] PerfeCtion_ BOT 2021-02-15 02:38:46Z
Oh mann Wie kann ich die shotgun mehr spread machen?
Avatar
[quakenet] PerfeCtion_ BOT 2021-02-15 02:46:04Z
i need the shotgun to spread more but it is acting weird i dont get it :/
Avatar
i guess you didn't add new directions for your bullets (edited)
04:50
f4d7654 Add nanami & mermydon redrawn by mind - Jupeyy c07485b Merge pull request #14 from Jupeyy/pr_naname_and_mermydon_by_mind - Jupeyy
04:59
714881d Fix paths - Jupeyy c95da31 Merge pull request #15 from Jupeyy/pr_fix_paths2 - Jupeyy
Avatar
ChillerDragon: can we also get a script to remove paths automatically xd
Avatar
bruh
Avatar
intel driver
Avatar
using nvidia tho lol
05:42
it is probably the site that is broken
Avatar
man these botters that ask for source code help are increasing exponentially lately
Avatar
[quakenet] fokkonaut BOT 2021-02-15 08:48:43Z
Hey fstd
Avatar
[quakenet] fstd BOT 2021-02-15 09:03:29Z
hi fokkonaut
Avatar
[quakenet] fokkonaut BOT 2021-02-15 09:09:02Z
heinrich told me you have a 512 player server? Could you show me how you did the collision between tees? My server sometimes need up to 100% of the CPU, I did some local tests and think it is related to the collision code, e.g. CCharacterCore::Move()
Avatar
[quakenet] fstd BOT 2021-02-15 09:19:47Z
oh well he's probably referring to http://penenen.de/twparticle.png
09:20
in no way shape or form i run such a server, that screenshot is at least 6-8 years old
Avatar
oh true, i remember this
09:20
ohhh
Avatar
[quakenet] fstd BOT 2021-02-15 09:20:31Z
and i didn't do anything special collision wise, it performed horribly at 512
09:20
in fact the lesson learned was
Avatar
exactly
Avatar
[quakenet] fstd BOT 2021-02-15 09:20:48Z
many tees needs ac ollision overhaul
09:21
quadtree maybe
Avatar
well, i probably dont know how :D
Avatar
[quakenet] fstd BOT 2021-02-15 09:22:54Z
the general idea is to group tees together that are physically close
09:23
that way you only have to check collisions against your group rather than everything
09:23
of course maintaining the groups has some overhead on its own
Avatar
uhm..
09:24
why is it even that expensive?
Avatar
[quakenet] fstd BOT 2021-02-15 09:26:43Z
what collisions?
Avatar
[quakenet] fokkonaut BOT 2021-02-15 09:26:53Z
yea
Avatar
[quakenet] fstd BOT 2021-02-15 09:27:37Z
well because the vanilla approach checks every tee vs every other tee
09:27
so N tees -> N^2 checks
09:27
that gets costly as N grows
Avatar
[quakenet] fstd BOT 2021-02-15 09:30:09Z
(technically it only takes half the amount of checks as after checking X vs Y you don't have to check Y vs X
09:30
so there's a /2 in there somewhere
09:30
but that becomes insignificant as N grows as well
Avatar
but for 128 players it should be possible to improve it, right?
Avatar
[quakenet] fstd BOT 2021-02-15 09:31:46Z
IIRC 128 was right at the edge of becoming noticably nasty but still kinda playable (i only tested with dummies though, not with 128 real clients)
09:32
but yes for 128 players the naive approach really gets to its limits
Avatar
well for my server i can say it usually works, i even had 128 clients connected 2-3 times, but in the past few days im facing problems more and more, where CPU usage goes up to 100%
09:33
i dont really know why it suddenly started to do that so often
Avatar
the easiest you could do without changing source too much is replacing distance checks with squared distance
Avatar
isnt distance already checked by squared distance?
Avatar
oh in 0.7? i dunno ^^
Avatar
let me check it
Avatar
[quakenet] fstd BOT 2021-02-15 09:34:59Z
fokkonaut: it's a little involved but a profiler would tell you what part is eating the CPU
Avatar
@Deleted User sqrtf(a.xa.x + a.ya.y)
Avatar
thats not squared
Avatar
@Deleted User sqrtf(a.x*a.x + a.y*a.y)
Avatar
its rooted
09:35
root function is expensive
Avatar
ah lol
Avatar
[quakenet] fstd BOT 2021-02-15 09:36:01Z
see this is the kind of thing you'd probably want to profile before changing
Avatar
Avatar
[quakenet] fstd
fokkonaut: it's a little involved but a profiler would tell you what part is eating the CPU
ChillerDragon tried to do that, but couldnt get it to work
Avatar
Avatar
[quakenet] fstd
see this is the kind of thing you'd probably want to profile before changing
i did some local tests with visual studio, and it looked like the distance function in CCharacterCore::Move (inside of the player <-> player loop) is very expensive
Avatar
you could also compile with Ofast, then it optimizes floating calculations
Avatar
[quakenet] fstd BOT 2021-02-15 09:37:23Z
okay
Avatar
fstd: Jupstar: do you think you can help?
Avatar
sqrt(9) == 3 becomes 9 = 3*3 so basically remove sqrt and instead increase the checks by ^ 2
09:40
but this is really only about optmizing the math a bit, fstd's approach of grouped physics will still be faster
09:44
last time i checked with Ofast vs O2 was about 10% performance increase, tho i didnt dig much deeper into what exactly is better probs the static sized loops like MAX_CLIENTS and maybe the floating point arithmetics
09:44
creating a mod gets more complicated every time
Avatar
I would really appreciate any help
10:20
with this specific lag problem
10:22
@Deleted User i will try the squared way<
Avatar
2a30324 Add donation by Mekrioz.' - def-
Avatar
@Deleted User sqrtf(a.x*a.x + a.y*a.y)
10:33
What do I have to replace this with? (edited)
Avatar
We can all suggest optimizations but doubt anyone will know what to do without a profile
Avatar
Locally with some server dummies I can see that its the distance function
Avatar
What jupstar meant was to compare distances without sqrt which would work because sqrt is monotone increasing
Avatar
I understood what he means, but not how to do it
Avatar
(As long as we don't have negative coordinates, that will crash and burn)
Avatar
oh wait, thats very important
10:59
I want to try it anyways
Avatar
I don't think it would help significantly, check perf see how much of the time is spent on the sqrt
11:02
fstd was considering a quadtree which would help with much larger N but it's not trivial to implement.
11:05
I considered a precalculated BSP or spatial hashing (chunking) both are much easier to implement
11:08
I guess most engines now use a Bounding Volume Hierarchy though so that's also an option you can look into
Avatar
Avatar
Learath2
(As long as we don't have negative coordinates, that will crash and burn)
Actually this will work just fine, sorry, just woke up
11:11
Could you help me implement any of those ideas
Avatar
If I had time to code anything I'd finish my own PRs
Avatar
@fokkonaut You can try the trivial optimization of checking squared distance but I have a feeling gcc/clang already figures this out on it's own
Avatar
I doubt that will do much though. I'd go straight to spatial hashing. You basically split the map into chunks and a hash function tells you which chunk you are in. When checking for collision you only check against other tees in your chunk
Avatar
makes sense, but i doubt i can implement such thing
Avatar
Avatar
fokkonaut
@Deleted User sqrtf(a.x*a.x + a.y*a.y)
make a 2nd function called distance_squared
11:29
and change all affected calculations to the squared versions
Avatar
i still dont know what i should calculate in there
Avatar
e.g. float D = distance(Pos, pCharCore->m_Pos); if(D < 28.0f && D >= 0.0f) { if(a > 0.0f) m_Pos = LastPos; else if(distance(NewPos, pCharCore->m_Pos) > D) m_Pos = NewPos; return; } gets float D = distance_squared(Pos, pCharCore->m_Pos); if(D < 28.0f * 28.0f && D >= 0.0f) { if(a > 0.0f) m_Pos = LastPos; else if(distance_squared(NewPos, pCharCore->m_Pos) > D) m_Pos = NewPos; return; }
Avatar
i mean inside of that function...
Avatar
remove sqrt
Avatar
Well doesn't the name tell you what it is? 😄
Avatar
but better create a 2nd function
Avatar
Definitely create a 2nd function, changing it everywhere at once won't be fun
Avatar
just retuirn a.x*a.x + a.y*a.y
11:32
and that works without problems?
Avatar
up to a certain point
Avatar
Avatar
fokkonaut
makes sense, but i doubt i can implement such thing
Shouldn't be too hard btw, in CCharacterCore::Move instead of going thru all the tees, you only go thru tees in your and neighbouring chunks
Avatar
how would i define where a chunk is and ends?
Avatar
Avatar
Deleted User
up to a certain point
what are the boundaries?
Avatar
Avatar
fokkonaut
what are the boundaries?
When the squares get way too large
11:37
At some point floats will become too inaccurate
Avatar
u shouldnt care too much i think, in theory u could also use doubles, bcs x87 uses 80bit precision internally
Avatar
Also I think there is a conversion to an integer there so floor(D) + 1 can't be larger than INT_MAX
11:38
So that's another limit
11:38
Ooooh now that I think about it you shouldn't replace that first distance with a distance squared e.g.
11:39
It will square the amount of iterations you do along the line 😄
Avatar
yeah only inside the MAX_CLIENTS loop
Avatar
I think you can skip thru tees aswell
11:40
didn't know this
Avatar
Avatar
Deleted User
just retuirn a.x*a.x + a.y*a.y
it performs better i think, but not yet perfect of course
Avatar
is ur server on linux?
11:46
for the release build u could deffs try out Ofast and lto the good thing here is, if they dont work as expected, you can just remove them again without changing any code
Avatar
ChillerDragon:
11:52
you here for this? :D
Avatar
i think the reference looks wrong
Avatar
why?
Avatar
&v => v
11:54
bcs u take a reference of a tmp object
Avatar
just as the length function would do
Avatar
no, it accepts a const reference
Avatar
i never understoof this xD
Avatar
just remove the reference
11:55
the compiler is smart enough to not produce slower code
Avatar
i dont even know what that is
Avatar
its like a pointer just that it cant be null xd
Avatar
what is it used for
11:55
like
11:55
idk
Avatar
e.g. if you have an object of class CPlayer and u take it by reference, you modify the object itself
11:56
not a copy of it
Avatar
but isnt that the same with a pointer?
Avatar
yes
11:57
references are basically pointers
11:58
its not directly true, but they are implemented like that
11:58
the rest looks fine to me
Avatar
okay, thanks
Avatar
if its broken you'd notice anyway, bcs the collision wont work 😄
Avatar
it all works fine, as it seems
11:59
I wonder if my mod has more of these "bugs"
12:00
performance issues
12:00
I think I should replace the distance by distance_squared in gameworld too, right?
12:00
all these FindEntities etc
12:00
ClosestCharacter
Avatar
u can replace it basically everywhere, where the distance is not used directly, but only compared against others
12:04
but it wont improve it everywhere as much
Avatar
makes sense
12:05
why?
12:05
i guess a single call is not that bad? :d
12:05
:D*
12:05
8a74afd Add mermydon-coala redrawn by mind, and update some others - Jupeyy e8e313c Merge pull request #16 from Jupeyy/pr_add_mermydon-coala_by_mind - Jupeyy
Avatar
well the FPU might not even profit from a signle call, if it waits on another call anyway (edited)
12:06
its really hard to predict what happens inside the CPU
12:06
ask an intel or amd dev xd
12:06
so basically you lol
12:06
what you've done to ddnet is immaculate xD
Avatar
but i havent done anything FPU related xD
12:07
i also dont know how GPU drivers are implemented in detail, its more guessing
Avatar
also dont know what that is tbh
Avatar
floating point unit
Avatar
Avatar
Deleted User
i also dont know how GPU drivers are implemented in detail, its more guessing
xD thats why its experimental?
Avatar
its like a CPU just for floating points
Avatar
ah no, opengl is well defined
12:08
its experimental, bcs we had quite a few bugs on Mac and older hardware on windows
12:08
we even have an unknown bug in 6+7th gen intel
12:08
tho it also affects older GL versions
12:09
but i'd say GL 3.3 is stable, i didnt really encounter an issue lately
12:13
anyway fokko, if u have the motivation to change every distance check do it. it wont hurt^^
Avatar
Avatar
Deleted User
anyway fokko, if u have the motivation to change every distance check do it. it wont hurt^^
:D
Avatar
something something premature optimization something something
12:27
Profile your code before making small insignificant optimizations a modern CPU has so many tricks up it's sleeve, small changes usually mean nothing
Avatar
i ran my fng server with 256 slots, 255 dbg dummies which randomly moved and jumped etc. and it worked fine without code modications, but maybe i just used a stronger CPU
Avatar
I had trouble with cpu usage so I'd guess that's what helps
12:33
Maybe just throw money at the problem @fokkonaut
Avatar
ChillerDragon said that we have the best CPU already
12:33
i wondered too
12:33
he said anything better costs > 100€
12:34
p/m
Avatar
Avatar
heinrich5991
idk why it only happens in your repo. you can do something like this for -Wstringop-truncation
12:41
doesnt work
12:43
ah
12:43
i think i know how this works
12:43
yea i fucked it up lol
12:48
still doesnt work
Avatar
cant u use smth like push "-Wno-..."
13:03
ah nvm that looks right indeed
13:03
maybe outdated compiler?
Avatar
not sure, its github actions test
13:04
the first error just occured out of nowhere
13:05
and the fix doesnt work
Avatar
its also missing a pop isnt it?
13:06
but probs not causing this issue
13:07
but ubuntu latest doest fail?
13:07
then its probs the compiler version, i'd say
13:07
gcc 5.5 is pretty old xd
Avatar
added the pop later on
13:08
how do i update it?
Avatar
i think you can just check the gcc version somehow
Avatar
i am not familiar with all of this xD
13:09
at all
Avatar
#if defined(__GNUC__) && .... (edited)
13:10
/* Test for GCC > 3.2.0 */ #if __GNUC__ > 3 || \ (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || \ (__GNUC_MINOR__ == 2 && \ __GNUC_PATCHLEVEL__ > 0))
13:10
so a && __GNUC__ > 7 might do the job
13:10
i dunno when they added that pragma support
Avatar
well, i do have a fix already in f-ddrace
13:11
for other false positives
Avatar
maybe it just fails bcs the actual warning is unsupported
Avatar
no idea, but how can it suddenly pop up?
13:11
like the whole warning why i want to add this ignore thing
Avatar
yes, but like this: warning was added in gcc 8 warning causes werror in gcc 8 so u only want to remove it for gcc 8
Avatar
i mean
13:13
13:13
from one day to another
13:13
this error appeared
13:13
Avatar
yes, maybe ubuntu latest was updated
13:13
true
Avatar
that warning is considered not very useful anyway, i already read it in the gcc mailing lists, and they were devided, if its useful or not, in the end, not warning might cause more issues 😄
Avatar
[quakenet] ChillerDragon BOT 2021-02-15 13:15:30Z
@fokkonaut haha we do not have the best single core cpu on the market but i think the best we can afford at the current hoster
Avatar
[quakenet] ChillerDragon BOT 2021-02-15 13:15:44Z
anything i missed i did not read all?
Avatar
yes
13:15
Can you add a script to remove the paths for svgs? XD
Avatar
[quakenet] ChillerDragon BOT 2021-02-15 13:16:08Z
sure
Avatar
nice thanks
Avatar
[quakenet] ChillerDragon BOT 2021-02-15 13:16:13Z
make an issue please
13:16
wait i can make one :D
Avatar
ok
Avatar
[quakenet] ChillerDragon BOT 2021-02-15 13:16:31Z
oh no then i do not get a mail
13:16
can you do it ? :D
Avatar
ok xD
Avatar
[quakenet] ChillerDragon BOT 2021-02-15 13:16:44Z
nice thanks
Avatar
Add scripts to automatically remove meta data we don't want to have in the repo @ChillerDragon
Avatar
[quakenet] ChillerDragon BOT 2021-02-15 13:20:51Z
ofast and lto is just to boost performance right? not to solve the actual issue but more compating the sympthoms?
Avatar
yes, but it heavily relies on defined behavior
13:22
so better write good code with it xD, there are edge cases you never heard of, before you googled them xD
Avatar
[quakenet] ChillerDragon BOT 2021-02-15 13:39:09Z
i wrote "compating" sometimes i wonder how people understand me
Avatar
i just ignore words i dont understand xd
Avatar
The Linux 5.11 kernel series is now officially available with improved hardware support, new features, and numerous updated and new drivers.
13:49
poggers
13:53
562c36d Add whis redrawn by mind - Jupeyy 8ce32b6 Merge pull request #18 from Jupeyy/pr_add_whis_by_mind - Jupeyy
Avatar
It should always search all lines(reprod. by changing windows size, which causes text containers to reset, which then causes skins to be not refound, when skins actually changed)

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 indexi...
Avatar
00e22d8 Fix chat refind skins - Jupeyy dafb120 Merge #3621 - bors[bot]
Avatar
@Learath2 splitting the map into different chunks doesnt make mush sense if all players are in the same chunk, or in chunks close to it
Avatar
You make the chunks rather small
14:40
There is a version of this scheme that makes the density of the grid variable at a given point (quadtrees), quite a bit harder to implement though
Avatar
Making a slow program fast can lead to both joy and frustration. But sometimes a new approach yields amazing improvements.
15:29
👀
15:34
15:34
u have to scroll all the way down
15:34
to reject all their shit
15:34
but allow all is up there
15:35
i wonder if u can law suit them
15:35
doesnt it have to be clear?
15:36
gdrp should make this a opt in feature, where it is disabled by default, and the user has to explicitly go and activate it by his own will
Avatar
@Deleted User @fstd: it probably is not even related to that part of the code, i did some tests with real clients, and it seems the DoSnapshot function is just taking so much
17:35
and all the entities in general
17:36
i did some intense debugging with chillerdragon but idk, i cant really find anything, but i also never had anything like this before, sucks really hard
17:38
I dont know why it ran so good for months now, I dont want to remove 128p support again
Avatar
Can i for example thread some specific stuff?
17:52
for example the snapshotting which will go up to 60% iirc, or some other stuff?
Avatar
Trafalgar Law 2021-02-15 18:04:55Z
Eh the gun is broken xD
18:05
You cant see if you shoot with grenade or smth (edited)
Avatar
@Trafalgar Law you made a bad update. I think the version you got is already removed
18:07
Check out if you can download the latest version
Avatar
Trafalgar Law 2021-02-15 18:09:41Z
So its not the problem from the srv?
18:10
Ah I see
Avatar
@fokkonaut would it kill you to learn how to profile the code? Speculating about where the issue might be and randomly moving things to threads won’t help
Avatar
I profiled it
18:11
DoSnapshot is using 50-60% of the CPU on my local server
18:12
CGameWorld::Tick and Snap takes a lot too
18:12
iterating over all entities
18:12
CSnapshotBuilder::Finish is also very expensive due to the tl_swap
18:12
and all the loops in CCharacterCore::Move and ::Tick
Avatar
Snap on what?
Avatar
CDragger takes 10%, character just about 2-5
18:14
but creating the snapshots takes a lot
Avatar
There is a tl_swap in ::Finish?
18:16
well not in finish i think
18:16
let me see
18:17
yes
18:17
3 times per index
18:17
in the loop
Avatar
Also is this profile from a live server? People moving around and chatting might change the profile drastically due to the way collision is handled
Avatar
i tested it with clients locally because chillerdragon said its not possible to get a profiler on the live server
Avatar
There is no loop in CSnapshotBuilder::Finish?
Avatar
i am on 0.7
18:18
my mod
Avatar
ChillerDragon learn to use perf nobo
Avatar
his argument was that the one he used didnt give any information
Avatar
Oh 0.7 now sorts the snapshots?
Avatar
and valgrind or some others are way to expensive
Avatar
Avatar
Learath2
Oh 0.7 now sorts the snapshots?
i have no idea
18:19
maybe? it seems like
18:19
why tho?
Avatar
Well bubble sort has awful performance characteristics as n grows. Maybe try replacing that with std::sort?
Avatar
I see, I should have based on 0.6 xD
Avatar
Avatar
Learath2
Well bubble sort has awful performance characteristics as n grows. Maybe try replacing that with std::sort?
how would that work?
18:21
std::sort(pSnap->SortedKeys()[0], pSnap->SortedKeys()[NumItems]);?
18:22
ah no
Avatar
You need a custom swap function to swap the offsets too
Avatar
why is that even needed
Avatar
Because of the way split 1 item into 3, (data, size, offset) all go into separate arrays
18:25
So when sorting the data by key, you also need to swap around the size and the offset so they stay correct
Avatar
Oh, yea of course! i mean why does 0.7 sort them?
Avatar
Oh, so they can do binary search on the client
18:26
Avoids the costly linear search 0.6 does
Avatar
But I don’t like the idea honestly. The client sorting it would distribute the cost. The server pays a huge cost per client all on it’s own like this
Avatar
And why dont you need to do that for 0.6?
18:28
i mean for the bridge servers
Avatar
I think I did, didn’t I?
Avatar
not sure
Avatar
Hm I actually don’t remember
Avatar
you sounded surprised
Avatar
I did but then I do remember discussing this before
18:29
Well let me check
Avatar
i dont think you sort them, tbh
Avatar
Hm, okay than idk what the bubble sort on the server is for. Maybe to reduce the cost for the client?
Avatar
[quakenet] fstd BOT 2021-02-15 18:30:21Z
fokkonaut: if nothing about your build changed then i guess something changed on the host (duh)
Avatar
Well I push changes every day almost
Avatar
[quakenet] fstd BOT 2021-02-15 18:30:39Z
this would be a good time to have been running munin for a few months :)
Avatar
and Mr. Anderson says nothing has changed on his side
Avatar
[quakenet] fstd BOT 2021-02-15 18:31:10Z
so you can revert to a commit that has okay performance?
18:31
in that case use git bisect
Avatar
Avatar
[quakenet] fstd
so you can revert to a commit that has okay performance?
thats the point, i dont know when it started
Avatar
This is indeed why they bubble sort, I wonder how our bridge even works at all now 😄
Avatar
[quakenet] fstd BOT 2021-02-15 18:32:18Z
finding out at what point it started is the whole point of using git bisect
Avatar
Avatar
Learath2
This is indeed why they bubble sort, I wonder how our bridge even works at all now 😄
x D
Avatar
[quakenet] fstd BOT 2021-02-15 18:32:33Z
?
Avatar
Avatar
[quakenet] fstd
finding out at what point it started is the whole point of using git bisect
how does it work?
18:32
i reacted to learaths message fstd
Avatar
[quakenet] fstd BOT 2021-02-15 18:32:50Z
you tell it a good and a bad commit
18:32
and it does a binary search
Avatar
no idea what any of those means
Avatar
binary search is rly simple
18:33
just look it up
Avatar
[quakenet] fstd BOT 2021-02-15 18:33:29Z
it makes find teh bug fast
18:33
is what it means
Avatar
But I would like to understand xD
Avatar
[quakenet] fstd BOT 2021-02-15 18:33:45Z
or let's say the commit that introduced the bug
Avatar
binary search discards half
Avatar
[quakenet] fstd BOT 2021-02-15 18:34:27Z
well
Avatar
every iteration
18:34
Avatar
[quakenet] fstd BOT 2021-02-15 18:34:31Z
there's this magical network of information
18:34
i'd explain it to you but only if you genuinely can't figure out out by yourself using google or wikipedia etc
18:35
literally wikipedia can tell u all this
18:35
u just a lazy bones
Avatar
so how do i use git bisect
Avatar
google it
18:36
or run "git bisect"
18:37
git bisect --help
18:37
it runs git-bisect.hmtl (edited)
Avatar
on linux it opens a man page
Avatar
Ah the client when unpacking the delta also uses the snapshotbuilder so it sorts too
Avatar
[quakenet] fstd BOT 2021-02-15 18:38:59Z
even the .html file will do. i think you can download .html viewers somewhere
Avatar
okay, but git bisect wont help me much i think. since i need about 60-80 players for it to trigger
Avatar
@fokkonaut you can probably abuse that to distribute the cost of sorting. Just send unsorted snaps
Avatar
[quakenet] fstd BOT 2021-02-15 18:39:30Z
you obviously need some way to tell whether a given version is good or bad
Avatar
Avatar
[quakenet] fstd
you obviously need some way to tell whether a given version is good or bad
i dont really have that
18:40
because it just starts to lag very hard, there is no value that pops over :D
Avatar
Avatar
Learath2
@fokkonaut you can probably abuse that to distribute the cost of sorting. Just send unsorted snaps
so removing the bubble sort should work?
Avatar
[quakenet] fstd BOT 2021-02-15 18:40:37Z
well but you notice whether it lags very hard or not...?
18:40
so you can tell when it's bad
Avatar
yea, true
Avatar
[quakenet] fstd BOT 2021-02-15 18:41:11Z
now with the same test load if it doesn't lag very hard, it's good, no?
Avatar
but its not always happening
Avatar
[quakenet] fstd BOT 2021-02-15 18:41:40Z
okay that sucks
Avatar
its not just, oh okay 70 players i will start to lag now
18:41
yea
18:41
it sucks so bad
Avatar
[quakenet] fstd BOT 2021-02-15 18:42:01Z
well bring 70 players then every time?
Avatar
its at 72 right now and doesnt lag
Avatar
[quakenet] fstd BOT 2021-02-15 18:42:41Z
sigh
Avatar
There is actually a way to handle this. perf is perfectly capable of saving to a ring buffer and you can send a SIGUSR2 to it to get it to dump the buffer to a file
Avatar
its pure randomness so the only thing i can do is improving everything
Avatar
So to profile transient issues like this keep perf running and send it a SIGUSR2 when it gets laggy
Avatar
[quakenet] fstd BOT 2021-02-15 18:43:15Z
Learath2: nice idea
Avatar
ChillerDragon
18:43
u there :/
Avatar
[quakenet] fstd BOT 2021-02-15 18:43:46Z
Learath2: what's perf tho? not gprof?
Avatar
Avatar
fokkonaut
so removing the bubble sort should work?
@Learath2 ?
Avatar
@fokkonaut I think so, try it it should break very obviously if my hypothesis is wrong
Avatar
okay, thanks
Avatar
fstd: perf is part of the kernel
18:45
it can do the kind of sampling profiling gprof does
Avatar
works @Learath2
Avatar
Again not sure how much it'll help but it's one less bubble sort per player per snap less
18:51
O(nk^2) where k is the number of snapitems which I guess is fair to assume is of the same order as n so an O(n^3) process gone
18:52
(atleast I think, I'm usually not very good with the theory part of CS)
Avatar
well, just locally already it is a huge improvement
Avatar
fstd: perf works without instrumenting the code so a little less information but it's still very useful imho, you should add it to your toolkit for profiling stuff
Avatar
NarsistHumanist 2021-02-15 19:05:39Z
ulan ziyaaa
Avatar
rider is better than vs but running trying to run 32 bits on it sucks
19:25
you gotta download some of shit (edited)
19:25
sad
Avatar
@Learath2 why is the CDragger::Snap so expensive?
19:50
because it moves all the time?
Avatar
Because of their very complex behaviour with respect to teams and solo
19:56
The way we fake entities being separate in different teams is actually quite costly. That’s what I’d suspect to be the culprit
Avatar
for (int i = 0; i < MAX_CLIENTS; i++) { if (m_SoloIDs[i] == -1) break; Server()->SnapFreeID(m_SoloIDs[i]); m_SoloIDs[i] = -1; } stuff like this belongs to the Tick function, no?
19:56
that would save us quite a bit already
19:56
on fuller servers
Avatar
I honestly don’t remember the logic there at all, it’s been that way for a long time
19:57
All I know is that snap function is called once per player and it has a large costly loop that is run once per player. That’s O(n^2) and O(n^2) bad
19:58
snaps every 2nd tick for all active players
Avatar
I have no idea why for snapping for a single player it needs to go thru alll players. You’ll have to read the code to figure it out
Avatar
i believe for spectators
19:59
idk
19:59
nah probbaly not xD
Avatar
that looks like it checks if people are in solo
Avatar
yeah thats just a small snippet
20:00
well, we have a SnappingClient already, I also dotn understand why we would need a loop inside of the Snap function
20:01
the Snap function basically IS A loop
Avatar
oh, yeah, that's really strange
Avatar
But it really is expensive
Avatar
Well maybe check the commit messages? At the end of the day to optimize something you need to understand it first
Avatar
the handling of m_SoloIDs is also very, very strange (edited)
Avatar
My theory is that it’s snapping multiple times because it can be attached to multiple people in different teams
Avatar
thats what i thought too
Avatar
So a way to optimize could be to keep track if connections instead of going thru every tee to see if we are connected
20:05
But again, I’m only speculating
Avatar
fact tho: i need to change it
20:05
the more players are online on my server the more it eats
20:05
locally, it went up to 17%
20:06
just the dragger snap
Avatar
Sounds like a great place to optimize
Avatar
i already improved another thing to not loop over all players, works fine
20:06
also the snap sorting was quite expensive
20:07
if i understood the profiler correctly
Avatar
I did some tests now
20:24
1. You will only see draggers from your team
20:24
2. using /showothers you can see the draggers of another person from the same team who is in solo
20:26
i dont really think its needed to see other draggers than the one that can affect you
20:27
thats what the loop is for, as you suspected, showing multiple draggers
Avatar
Are there some resources on the Maths behind Tw physics, best i could find is some old Forum post https://www.teeworlds.com/forum/viewtopic.php?id=10603
More tuningdetails ? (Page 1) — Support — Teeworlds Forum — Everything Teeworlds!
Avatar
wow it even creates 1 CDragger for every team
Avatar
Before I embarrass myself on the rust books issue tracker: This section from the book explaining lifetimes doesn't make sense, right?
``` fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { if x.len() > y.len() { x } else { y } } ``` The function signature now tells Rust that for some lifetime 'a, the function takes two parameters, both of which are string slices that live at least as long as lifetime 'a. The function signature also tells Rust that the string slice returned from the function will live at least as long as lifetime 'a.
Rather it should be:
The function signature now tells Rust that for some lifetime 'a, the function takes two parameters, both of which are string slices that live at least as long as lifetime 'a. The function signature also tells Rust that lifetime 'a will live at least as long as the string slice returned from the function.
(edited)
20:48
Where are you rust crew? :D
Avatar
Isn’t that an iff?
20:50
The two sound equivalent
Avatar
(Disclaimer I’m not much of a rust person, just thinking)
Avatar
As an argument that it's not equivalent (ik it's super shallow but idk how to talk about lifetimes idk if I understand them good enough): The sentence is "x lives at least as long as y", so x >= y. You can't change x and y here.
20:57
No?
Avatar
Ah I see, hm
Avatar
I guess you could say that the lifetime of 'a should really be the same as the lifetime of the string slice returned from the function
20:59
That would make sense in my understanding of lifetimes
Avatar
So your argument is that it's the lifetime 'a that is constrained by the lifetime of the string slice?
Avatar
Exactly that
Avatar
but from what I understand (even more shallow than your knowledge) lifetimes exist separate from the objects that they constrain
Avatar
@Learath2 omg
Avatar
This is important context from later in the paragraph:
[...] only that some scope can be substituted for 'a that will satisfy this signature.
21:01
So it will compile only if there is any scope 'a that works
Avatar
@Learath2 if i dont create the draggers, it doesnt lag that heavily, because one dragger creates MAX_CLIENTS draggers, 1 for each team, so in my case 128 draggers which alle have to be snapped
21:02
it only snaps draggers to the same team tho
Avatar
Yeah the proper solution is to get rid of this silly idea of entities having multiple personality disorder
Avatar
but just alone the calls to CDragger::Snap, 128 calls to 128 draggers, so 128*128 takes already 5% alone
Avatar
GameWorld per team is the future
Avatar
thats so insane
21:03
sadly, i dont know what a good fix for this would be.
Avatar
@timakro doesn't that signature basically say that the lifetime of the returned string slice is the same as the lifetime of the inputs?
Avatar
i think i will rework the dragger for my purposes xD
Avatar
Yeah you could say it like that and I guess it would be unambiguous what you mean.
21:05
But that wouldn't be precisely right because the lifetime of the inputs can be longer than that of the output, right?
Avatar
I see your confusion though. I think the original sounds more correct to my understanding of rust lifetimes but the only one that understands the concept well enough to comment on a technical matter like this is probably @heinrich5991
Avatar
Heck, I don't even know if the lifetime includes when the variable comes into scope or only means the time when it goes out of scope
21:06
From the ascii art stuff they draw in their code it seems like they mean both, where lifetime A is "longer" than lifetime B if A comes into scope before B and goes out of scope after B
21:09
For a moment think of a' as the lifetime which starts right before the function is called and ends right after the function returns. That would work with the original sentence, right?
Avatar
I think it would be a great idea to rewrite CDragger class. On my server I have noticed insane laggs, which are partly caused by draggers, thats because placing one single dragger tile from editor, will create MAX_CLIENTS new draggers, so in DDNet 64, for each tee one, and in my mod 128. All of these draggers need to get snapped, which is not good at all, it creates many snap items and requires many calls to CDragger::Snap which will eat some ressources. Also, I think there is still a me...
Avatar
Avatar
timakro
Before I embarrass myself on the rust books issue tracker: This section from the book explaining lifetimes doesn't make sense, right?
``` fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { if x.len() > y.len() { x } else { y } } ``` The function signature now tells Rust that for some lifetime 'a, the function takes two parameters, both of which are string slices that live at least as long as lifetime 'a. The function signature also tells Rust that the string slice returned from the function will live at least as long as lifetime 'a.
Rather it should be:
The function signature now tells Rust that for some lifetime 'a, the function takes two parameters, both of which are string slices that live at least as long as lifetime 'a. The function signature also tells Rust that lifetime 'a will live at least as long as the string slice returned from the function.
(edited)
The function signature also tells Rust that the string slice returned from the function will live at least as long as lifetime 'a.
21:54
both have to live as long as 'a
21:54
note that rust only knows stuff at compile time
21:54
there is no runtime
21:54
so it needs this
21:55
also len() on a str is the length in bytes
21:55
use .chars().count() if u want the count in chars
Avatar
Avatar
Ryozuki
so it needs this
u dont know if it will return x or y at runtime
21:57
ur best bet is to return a owned str
21:57
aka a String
21:58
altho i find it hard to find this function practical
21:58
or just do it this way and deal with the lifetimes
Avatar
Avatar
Ryozuki
both have to live as long as 'a
Both parameters? Yes, both parameters need to live at least as long as 'a. But the returned value? I'm arguing 'a has to live at least as long as the returned value. Not the other way around.
Avatar
the returned value has to live as long as 'a too
Avatar
This example is not my code, it's from the book
Avatar
cuz its a reference still
Avatar
Why would you want it to live longer than anything? It could be dropped immediately after the function returns, no? (edited)
Avatar
it has to live as long as the parameter
22:01
cuz what u return is the parameter
22:02
they are references to the same thing
Avatar
No, the returned reference can live at most as long as the thing it's referencing, not any longer
22:04
it has to live as long as 'a
Avatar
Or shorter
Avatar
no, it has to be 'a
22:07
22:07
22:08
the lifetime of both parameters has to be equal or longer than 'a
22:08
lifetimes reminds me of learning pointers
22:08
in c++
22:08
all confusion
Avatar
And to be more specific, the lifetime of the things the parameters are pointing to has to be equal or longer than 'a (edited)
Avatar
but u once u get it its fine i guess
22:09
ye
Avatar
I get it but the explanation in the book is still wrong xD
22:09
I think
22:10
And the lifetime of the reference that is returned has to be equal or shorter than 'a
Avatar
The function signature now tells Rust that for some lifetime 'a, the function takes two parameters, both of which are string slices that live at least as long as lifetime 'a. The function signature also tells Rust that the string slice returned from the function will live at least as long as lifetime 'a.
22:10
its not wrong
22:10
check my image again
22:10
u can see the value returned will live as long as lifetime 'a
22:10
check how i marked 'a
22:10
and where it gets dropped
22:13
btw, i think i get what u think, if a was a reference to b in that context, it will only get dropped once all its lifetimes drop
22:13
thats how i would say it
22:14
i dont think the compiler drops x directly as u would think, it drops x in that scope and b in that scope
Avatar
In the image you sent 'b would be the argument and 'a would be the string slice that's returned from the function. And now I can't go on because we have two different 'as ^^
22:15
no
22:15
'a is the argument
22:15
and the returned
Avatar
Yeah ok whatever, this is just hypothetical hypothetical ...
Avatar
let b = "a"; { let x = "c"; let a = longest(b, x); drop(x) // a is implicitly dropped by this } drop(b)
22:17
u could say a is just a alias
22:17
idk
22:17
im a bad teacher
22:17
i guess i couldnt explain it to u
22:18
pepeH
Avatar
a is dropped after the 4th line because it's never used xD (edited)
22:19
a is not dropped directly
22:19
cuz its just another references
22:19
i imagine it as the compiler only dropping the original references
22:19
idk
22:19
im rly bad explaining it
Avatar
stuff is always dropped implicitly after it's last use
Avatar
yeah thats not what im trying to say
Avatar
if reference or not
Avatar
a in this case can be x or b
22:20
a isnt dropped as is
22:20
x or b will be dropped
22:20
when their lifetime ends
Avatar
ah ok yeah what i just said was wrong, just noticed they all have the same type
22:22
the brackets are just confusing, they don't change anything, right?
Avatar
they define a scope
Avatar
but in this case they don't change anything, right?
22:23
xd
22:24
22:24
Avatar
I think what makes the example dumb is that x and y have static lifetime
22:25
22:25
his works
22:25
cuz it has static lifetime
22:25
but
22:25
22:25
22:26
if u put the print inside it works
22:27
the compiler knows this thanks to lifetimes
22:27
xd
Avatar
btw this let b = "a"; does something similar to my brain as
Avatar
yeah sry
22:27
my examples xddd
Avatar
what r u tryna do btw?
Avatar
I was just reading the book and thinking this sentence is wrong xD
Avatar
this book is actually reviewed
22:29
there even is a beta version of the book iirc
22:30
the book is released for stable beta and nightly
22:30
i dont think they would miss something that important
22:30
specially in the lifetimes section
Avatar
All your examples have only static lifetimes, they can't possibly get to the core of my problem with the second sentence (edited)
Avatar
my last
22:34
doesnt have
Avatar
ah sry
22:35
Okay so my problem with that second sentence will also be a problem with only one argument, so I'll make a function with only one argument
Avatar
btw with 1 argument u can omit the lifetime
22:35
but its there
Avatar
Yep, I will keep it for now just so we have a name for it
Avatar
@timakro btw i think 2021 will be the year a new edition of rust is released
Avatar
What's new?
Avatar
This RFC proposes revised rules and plans for editions: Announce plans for a Rust 2021 Edition, and for a regular cadence of editions every 3 years thereafter. We will roll out an edition regardl...
22:39
this is the rfc
22:39
well wait
22:40
this section here keeps track of changes
22:41
its there in nightly already
22:41
xd
Exported 630 message(s)