Guild icon
Teeworlds
discord.gg/teeworlds / general
Teeworlds Discord Server.
Between 2020-04-19 00:00:00Z and 2020-04-20 00:00:00Z
Avatar
that'd make sense
Avatar
well I guess teeworlds performs decent enough that we don't need to optimize this
08:21
If we did, we could first split the map into chunks, that'd be simpler to implement then a quadtree
Avatar
@heinrich5991 remember the guy with nazi symbols? apparently he is rly bored
GWgoaMonikaSmug 1
whooo 1
Avatar
@Learath2 you could split the map into chunks with a quadtree basically doing the same 😄
Avatar
@Assa an actual quadtree is more work to implement then splitting the entire map into 32x32 chunks
11:44
a quadtree is denser at some regions
Avatar
you will never need to go under 2x2 and parts of the map can be ignored like walls
Avatar
:0 50x50 map
Avatar
You don't get the point, it's not that a quadtree wouldn't be better, it's that it'd be more difficult to implement so no need to resort to it unless we need to
Avatar
There are no zero-cost abstractions 🙂
Avatar
@Dune hm, wouldn't divvying the map up into chunks (either a quadtree or just fixed size chunks) be zero cost?
13:14
Worst case scenario with a horribly unbalanced tree it'd perform the same as now
Avatar
I know, that there is overhead, you know characters and projectiles move through the tree/chunks? It's just a possible way, that might lead to improvements in the overall performance - I don't say anyone should implement this
Avatar
@Learath2 the cost is not always in performance 😛
Avatar
we had examples of zero-runtime-cost abstractions
13:58
e.g. std::unique_ptr, std::vector
Avatar
can you explain why the unique_ptr is zero cost?
Avatar
well what is the cost?
Avatar
it's a zero-cost abstraction over managing the pointer yourself with new/delete or malloc/free
13:59
the compiler inserts the calls for you, you don't have to care about it
Avatar
every time you use the pointer you need to derefence two pointers, that's the cost
Avatar
that's not true
Avatar
oh, if the compiler solves it for you then you are right
Avatar
no you don't, the compiler can optimize that out
Avatar
a unique_ptr has the same amount of dereferences as a normal pointer
Avatar
There is however a memory cost to unique_ptrs with custom deleters
Avatar
@Learath2 depends on how you use it
Avatar
I learned to increase performance by sacrificing memory - ofc a tree would take some mem
Avatar
huh, can you get a custom deleter without memory cost?
Avatar
yes, template arguments IIRC
Avatar
ah, no it's EBO
Avatar
EBO?
Avatar
You can pass a "function like object" as the deleter, so you just pass a struct with only overloaded ()
Avatar
yes
Avatar
an instance of it is constructed but because it's empty it won't use any storage at all
Avatar
EBO = empty base optimisation btw
Avatar
can you summarize the arguments? I don't like videos
Avatar
but in general, I argue that abstractions have a cost and must be sparingly used
Avatar
I think you overgeneralize - there are abstractions (and dataformats), that improve the overall performance
Avatar
void bar(int* ptr); // Takes ownership void baz(int* ptr); void foo(int* ptr) { if (*ptr > 42) { bar(ptr); *ptr = 42; } baz(ptr); }
void bar(int* ptr); // Takes ownership. void baz(std::unique_ptr ptr); void foo(std::unique_ptr ptr) { if (*ptr > 42) { bar(ptr.get()); *ptr = 42; } baz(std::move(ptr)); }
14:09
@Assa you cannot improve performance with abstractions, anything you do on an abstract level, you can do on a lower level
Avatar
that is incorrect
14:09
or at least misleading
14:09
there are things that you cannot reasonably do in C
Avatar
(obviously it's more tedious 🙂 )
Avatar
yes
14:09
but if that means that it won't be done
Avatar
but you can't say that abstracting improves performance
14:09
of course, that's why we use abstractions
Avatar
there are abstractions that improve performance in reality
Avatar
but we should keep in mind that they all come with a cost - sometimes less than the benefits, of course
Avatar
the same goes for coding low-level
14:10
that also comes with a cost
14:10
that might be performacne (because you don't use a hashtable with a proper hashing function, because you can't be assed to write it)
14:10
like Teeworlds, for example
Avatar
I'm only arguing against abstracting for the sake of abstracting
Avatar
Teeworlds does have the problem of too little abstraction in a few places
14:11
e.g. rolling their own, very bad, trivially DoSable hash function
14:11
that wouldn't have happened in a higher-level language
Avatar
Teeworlds pushes the ideology quite towards the "litte abstractions" side, and suffers from it on some aspects, yes
Avatar
interesting talk, didn't think about the implications of exceptions and the temporaries constructed
Avatar
(note that the example that @Dune posted is a bit nonrealistic, I think)
Avatar
It's a difficult slider, maybe Teeworlds does it too little, maybe other applications do it too much
Avatar
you don't usually pass unique_ptr around
14:13
@Dune now that's just relativizing everything
14:13
that's an empty hprase you can say about everything
Avatar
remember to program in reliability - you might lose some performance, but every second you don't have to spend at some code anymore is time you can spend on other maybe more usefull parts - so if you look at the overall efficiency of the development progress instead of the performance of teeworlds itself
Avatar
@heinrich5991 well the guy says it's a pretty common/idiomatic pattern to pass ownership of memory
Avatar
@heinrich5991 true
14:14
I don't really want to argue the list of benefits it has with Teeworlds and the list of inconvenients
Avatar
https://godbolt.org/z/apjjM_ @Learath2 I don't see the performance penalty
void bar(int* ptr); // Takes ownership. void baz(std::unique_ptr&& ptr); void foo(std::unique_ptr&& ptr) { if (*ptr > 42) { bar(ptr.get()); *ptr = 42; } baz(std::move(ptr)); }
14:14
I see one extra instruction, haven't investigated it furtherly
14:14
(dunno why it wouldn't use && for transferring ownership)
Avatar
it does use rvalue references though, no?
Avatar
the original one? no
Avatar
I'm not done with the talk yet btw, he is talking about those two instructions on the white lines
Avatar
ah
Avatar
the two white instructions there are memory loads, which is why he says it's worse then the move between registers in the raw pointer one (that one is only to match calling convention)
Avatar
hm, c++11 masterrace
Avatar
rust might be even better here, because it has proper move semantics (might fare better here than && references)
Avatar
there was this thread about zero-cost abstraction in rust https://users.rust-lang.org/t/not-quite-zero-cost-abstraction/11514
(co-authored by @bugaevc and @YaLTeR) Zero-cost abstraction is one of the major selling points of Rust, along with memory safety and others. In fact, it is listed first in the Rust features list on the rust-lang.org frontpage. Zero-cost abstraction means abstraction without ...
Avatar
from a quick glance, this is something different than the move semantics of unique_ptrs
Avatar
it seems like vitalyd argues that abstractions are only zero cost if the compiler is smart enough
Avatar
I don't see how the abstraction can never be zero-cost though, as long as you have a way to communicate your intent perfectly to the compiler it should be possible to get unique ptr to zero cost
Avatar
I don't know rust well enough though
Avatar
see how it got better with the c++11 example as you conveyed your intent better and better to the compiler?
Avatar
As long as you do something that is not too smart for the compiler, I guess
Avatar
@WingedTeam does that have any relation to teeworlds?
14:25
then please don't post it here without explanation
Avatar
@heinrich5991 I think ownership is indeed what's messing up the zero-costness of this abstraction
14:36
If you pass by value, you need to check whether the called function did indeed take ownership, you pass by rvalue and there is an indirection
14:39
Teeworlds would indeed benefit from a couple more abstractions though, like a proper hashmap
Avatar
ease of development is worth some abstraction:0
Avatar
obviously, otherwise we'd be writing assembly
Avatar
some more than now!
14:41
assembly masterrace
Avatar
btw @Dune I think his argument is that you can't have "total" zero-cost abstractions, as in it'd either have a cost while building, at runtime or a human cost (e.g. readability or complexity)
Avatar
Optimize when there is a need to optimize. Good ol' Donald
Avatar
@Learath2 I think you're right, though in particular unique_ptr seems to have some more issues because of shortcomings(?) of the ABI
14:50
I think the point is that you shouldn't take anything, and not weight the benefits, because it would be zero cost
Avatar
I'm not very fond of ownership mechanics to begin with, a little backwards that way. I prefer keeping track of that stuff myself
Avatar
going back to @Assa's kd-trees, I think you shouldn't introduce heavy abstractions like that without considering the costs and the benefits
Avatar
I would never go for kd-trees for teeworlds, too expensive to balance (edited)
Avatar
wdym?
Avatar
however a quadtree can indeed work decently well, or just divvying the map into chunks
Avatar
oh
14:52
I thought quadtree was a specialization of a k-d tree
Avatar
no, a quadtree just splits every dimension in half (in 2d = 2 splits = 4 chunks)
14:54
so a 32*32 chunk has 4 16x16 chunks, each of those has 4 8x8 chunks and so on
14:55
I said above, that I don't think you should implement this, I don't know if you gain something
Avatar
Well the discussion is more theoretical at this point then practical, I don't think anyone is considering doing quadtrees for teeworlds 😛
Avatar
(Ignore me when i bullshit)
Avatar
It could indeed be helpful to people like @fokkonaut who were trying to make 128 tee servers
Avatar
with enough players you WILL gain something! (edited)
14:59
It's like comparing quicksort and selection sort - selection sort is faster on very small arrays
Avatar
@Learath2 what?
Avatar
We were discussing quadtrees, it could help with coding servers that handle more then 128 players
Avatar
wow, linux have normal package manager
Avatar
manjaro >:O
Avatar
heh yea most linux dists have package manager :P
Avatar
my first linux dist
Avatar
some even accept payments for not-free apps
15:53
windows sucks
15:53
xd
Avatar
yea (edited)
15:56
its hard for me to think of some windows feature that you cant get on linux
Avatar
oh no...
Avatar
wine it
😂 1
Avatar
no more server crashing now?
Avatar
if you update or apply the commit as a patch, yes
Avatar
when will yall fix the tees
21:59
feet are still off
21:59
its literally a 1 line fix just move the right foot 5 pixels left
Avatar
was there a design change? @Zatline @Sonix
Avatar
@gerdoe i call people insane who WANT to work with vs (exception for vs-code, heard its okay) - I had to work with it and i hate it, i hate it so much, i want it to burn in hell forever, in painfull purgatory
Avatar
@Assa I can't understand it for the life of me either, but there are many people who enjoy it so I'm starting to think I'm the insane one
Avatar
no, you are not. vs is the result of wanting a one-for-everything application (edited)
Avatar
for teeworlds project it isnt good or bad, but as ide where you will make really big projects - yeah this is an peace of shit
22:07
qt creator much better
22:07
and
Avatar
teeworlds is so simple, i can code it with the command line in linux
Avatar
for teeworlds projects it isnt good or bad
22:08
vs code on windows always
22:08
always swear
Avatar
@Assa doesn't mean you should
Avatar
on linux - its much better because u can just download packages that you need and use (edited)
Avatar
I prefer codeblocks, i don't need a run button or fancy project stuff, just autocompletion
22:09
@Dune yeah you are right 😄
Avatar
vs on windows == vs code on linux for me
Avatar
@Assa the debugger is quite good
Avatar
Also it reduces the human cost of learning/customizing two IDE :)
Avatar
for a windows debugger, yeah
Avatar
no, for a debugger
22:10
IMO
Avatar
i still remember when i used valgrind on the MAIN product from that company i worked for
22:11
the first week i was just fixing memory bugs
Avatar
simple debugger?
Avatar
I have seen their code and my instinct told me: valgrind this bitch immediatly
Avatar
eeeeh, the debugger has been quite inadequate in my experience, especially after gdb and lldb, it's so hard to do what I want to do on it
22:12
(it could be that I'm just not used to it, but I really had trouble debugging mostly at lower levels)
22:12
like stepping in assembly, observing memory, conditions on breakpoints
Avatar
I'm not well versed in gdb actually
22:14
I can barely set breakpoints and step
22:15
conditions on breakpoints are beyond my level currently. if you have nice resources to read, please share 🙂
Avatar
my worst windows experience came with microsoft azure 🙂
Avatar
well it's literally condition <br#> <condition>
22:17
ngl gdb is not too easy to learn
22:18
maybe I could write something, I always wanted to get better at writing
Avatar
how do you delete a breakpoint?
Avatar
I gave up on VS while learning Unreal, a project of that size just makes VS cry
Avatar
I always struggle with gdb, can't remmeber all the things and have to resort to google again
22:19
I use it too rarely, I guess
Avatar
I do clear when I hit the breakpoint
22:20
but you can specify which breakpoint to clear the exact same way you specified the point to break on
Avatar
ah
Avatar
I never had used this but apparently you can delete them by breakpoint# too with delete
Avatar
ah yea
22:22
that's the command I can't remember all the time
Avatar
lldb is meh, but it's also very useful
Avatar
never used it before, I think
Avatar
Very close to the featureset of gdb
22:27
A bit saner of an interface :P
22:29
I should try a couple of gdb interfaces some day, cutter was nice to use for radare2
Avatar
@Dune Not since 0.7 iirc
Avatar
yeah, he's probably talking about a 0.7 change
Avatar
They were moved a bit to make the tee look a bit leaning
22:33
If my memory is correct
22:33
@heinrich5991 do you have access to the website files?
Avatar
yes
Avatar
Oh nice, i thought only minus did
Avatar
I think he gave me access because he didn't want to deal with this all the time ^^
Avatar
Then i might send you a .css file tomorrow with some style improvements
22:35
uni starts tomorrow, might not have a 5min response time 😉
Avatar
Can We do it now then?
Avatar
sure
Avatar
Like actually starts? Is germany rolling back the lockdown?
22:37
Or do you get online lessons like all of us?
Avatar
virtual
22:37
germany does want to roll back the lockdown a bit though
Avatar
Ours started on schedule
Avatar
they want to start schools again, soon
22:38
our semester started a week late
Avatar
yeah, i am not proud of my country belonging this
Avatar
@Dune notice anything different? https://www.teeworlds.com/?page=docs&wiki=client_settings (might still be cached lol)
Avatar
oh yeah, looks much better
22:51
looks like a doc now (edited)
Avatar
@Dune just completed the English -> Czech translation of teeworlds, hope it helps 😉
Avatar
When I update my code to the master now it still compiles but I cant start teeworlds anymore... last time I pulled was in january
Avatar
@Fudgy what happens when you start it? what's your OS
Avatar
wait I think it was the dll were not copied to the directory so it used the ones I had before
23:43
I copied them manually and seems like its working
23:43
it was crashing in Input->Init() when I debugged which is related to freetype
23:43
I'll say if another problem occurs..
23:43
also I dont remember how to force rebuild with bam
Avatar
bam -c to clear
Avatar
bam -c config for regenerating the config IIRC
Exported 225 message(s)