Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2022-07-17 00:00:00Z and 2022-07-18 00:00:00Z
Avatar
How can i expand a NetMessage and still be able to connect to older server versions that dont have it? (edited)
Avatar
e977bbc A Campotle 1, A Campotle 2, A Campotle 3 - ddnet-maps
Avatar
Avatar
cauldron
servelist is refreshing, when you switch tabs, but not when you come from ingome to server browser. is it worth to add a refresh there?
Can't hurt i guess
Avatar
network.py (edited)
06:28
^This compiles (edited)
06:30
but this does not:
06:30
06:31
06:31
why
Avatar
i assume u didnt initialize the variable
Avatar
Avatar
Jupstar ✪
i assume u didnt initialize the variable
its automated
Avatar
Avatar
bluesky
network.py (edited)
this compiles and its the same just a different message
Avatar
not really
06:59
u pass a pointer over it
07:00
if u dont pass a pointer over it, its uninitialized
Avatar
DDraceNetwork, a cooperative racing mod of Teeworlds - ddnet/gameclient.cpp at 3c6402830d0792d285852f5cd1159c7e4d558017 · ddnet/ddnet
07:01
show me this code in ur version
Avatar
see
07:03
skinbody missing
Avatar
i know
Avatar
Avatar
bluesky
network.py (edited)
this still compiles
07:04
well let me initialize it
Avatar
but compile != runtime
Avatar
yeah i mean the upper one doesnt give me an error
Avatar
ignore the python stuff, its just to generate structs
07:04
imo also useless for network structs
Avatar
i cant judge that i dont know enough about it
Avatar
Avatar
bluesky
yeah i mean the upper one doesnt give me an error
doesnt or does?
Avatar
I want to pass an aditional bool and 4 strings to every player as soon as one changes his skin
07:05
how would you do that
Avatar
Avatar
Jupstar ✪
doesnt or does?
doesnt
Avatar
Avatar
bluesky
how would you do that
u'd use a different packet anyway, bcs this rn destroys vanilla compability and the ddnet admins will roast u
jaouis 1
07:06
but generally, i'd do it similar to your version, u just need to initialize the variables
07:06
everything else was correct
Avatar
okay i will try it
Avatar
Avatar
Jupstar ✪
doesnt or does?
its weird because i only get the error when i add a string to ChangeInfo, not StartInfo
Avatar
what error does it display?
07:08
maybe someone added a sizecheck or smth
Avatar
Avatar
Jupstar ✪
u'd use a different packet anyway, bcs this rn destroys vanilla compability and the ddnet admins will roast u
i will just use updateskin packet like in 0.7
07:08
for skinchange
Avatar
Avatar
bluesky
Click to see attachment 🖼️
this error on adding a string in ChangeInfo
Avatar
Avatar
bluesky
this error on adding a string in ChangeInfo
then its just luck
Avatar
uninitilaized values can be anything
Avatar
Avatar
Jupstar ✪
uninitilaized values can be anything
it works now obviously after initializing it
07:13
but i still wonder why the StartInfo works without initializing it
Avatar
set a breakpoint, see what value m_pSkinBody has
07:14
then u know it
Avatar
i searched references but didnt find any so i might do the brakpoint
07:15
yes
07:15
thank you
07:15
i hope it get it to work
Avatar
Avatar
bluesky
i searched references but didnt find any so i might do the brakpoint
u wont find anything. Imagine it like this: RAM consists of random bytes at the start, bcs always setting all bytes of your whole RAM to zero at the computer start would be useless, u dont use all RAM most of the time now c++ allows you to use uninitialized memory. This is basically the RAM as is. This can in some situations be useful if you dont care about initializing it to zero before using it
Avatar
yeah memzero before using big data
07:22
I found out why the behaviour seemed weird
07:23
ChangeInfo gets used before StartInfo "OnRender" calls SendInfo(false) (edited)
Avatar
i will make a pr soon and i hope its gets good constructive critic because i really wanna optimise and learn how to do things better (edited)
Avatar
After doing this, you can't change teams or start the race. The only way to get out is to unlock the team, kill your tee, and rejoin the team.
Avatar
^ really annoying imo
09:17
sometimes i need to show how to do something in a speedrun when none of us have started racing, but as soon as i do it we have to rejoin team again cus i forget this bug
09:18
tbqh didnt know how it worked exactly until now xd
09:18
okay why cant i reproduce it suddenly
09:19
there is SOMETHING broken about it, i thought for sure this was the way to produce it
09:19
grrr
Avatar
oh i see what codedev said
09:51
makes sense then
Avatar
Avatar
Jupstar ✪
Can't hurt i guess
well i was just wondering.
10:59
terraria in scratch
Avatar
Avatar
bluesky
How can i expand a NetMessage and still be able to connect to older server versions that dont have it? (edited)
Not possible
Avatar
Avatar
cauldron
well i was just wondering.
then transform your wondering into a pr xdd
Avatar
@Jupstar ✪ @Tater I'm thinking about implementing a tilemap optimization, because the performance in browsers isn't optimal yet (apart from tilemap optimizations I could 1. add mipmaps or 2. add more stuff to the renderer like entities or smth) I currently can think of 2 things that could be big optimizations: 1. render the tilemap to a texture first and for each next frame only render the difference (this would make tilemaps basically a no-op if the camera doesn't move), as explained in the factorio blog here https://steamcommunity.com/app/387290/discussions/0/1694924244565179392/ 2. reduce how much of the screen we render for each tilemap each frame. maybe split the screen into multiple quads and calculate on the cpu which of the quads actually have tiles on them, or just calculate how much clipping we can do by kinda calculating a bounding box of the visible tiles on the screen for 2. there might be more options but I don't see them yet which of the two do you think will be the better improvement?
14:45
oop, wrong link
Avatar
Avatar
Patiga
@Jupstar ✪ @Tater I'm thinking about implementing a tilemap optimization, because the performance in browsers isn't optimal yet (apart from tilemap optimizations I could 1. add mipmaps or 2. add more stuff to the renderer like entities or smth) I currently can think of 2 things that could be big optimizations: 1. render the tilemap to a texture first and for each next frame only render the difference (this would make tilemaps basically a no-op if the camera doesn't move), as explained in the factorio blog here https://steamcommunity.com/app/387290/discussions/0/1694924244565179392/ 2. reduce how much of the screen we render for each tilemap each frame. maybe split the screen into multiple quads and calculate on the cpu which of the quads actually have tiles on them, or just calculate how much clipping we can do by kinda calculating a bounding box of the visible tiles on the screen for 2. there might be more options but I don't see them yet which of the two do you think will be the better improvement?
im interested in 1., but i think you shouldnt underestimate that waiting for the previous frame can cost lot of idle time, so if you not runnning into a bigger GPU bottleneck it might work out even worse, how often does the camera actually stand still? and has no animations etc.
Avatar
I'd do that for each tilemap individually, there are no movement animations for tilemaps and I'd render it in the normal color and add the envelope color in the fast simple render step
Avatar
that sounds like a lot of memory. it seems you could batch tilemaps with same parallax together
Avatar
Avatar
Patiga
I'd do that for each tilemap individually, there are no movement animations for tilemaps and I'd render it in the normal color and add the envelope color in the fast simple render step
ok but the whole layer?
Avatar
same parallax and same color envelopes etc.
Avatar
or your tilemap as you have them now?
Avatar
@Jupstar ✪ I'm not sure what you mean, each layer would be rendered individually, yes
14:55
@heinrich5991 yea that would be a good optimizations, but I'd rather do that at the end, because I think thats quite some added complexity
Avatar
Avatar
Patiga
@Jupstar ✪ I'm not sure what you mean, each layer would be rendered individually, yes
yeah but u want to render the full layer?
Avatar
I think the full list of things that have to be the same is parallax, envelope, envelope offset
Avatar
like 4000 x 4000 tiles? XD
Avatar
no, only what the camera sees
Avatar
or just apply it per layer
14:56
ok
14:56
but still, how often does ur camera stand still
14:56
especially when in an "editor" mode
Avatar
well also if it moves, the amount of tilemap calculations is much much less I think
Avatar
but anyway, please try it out, i am interested in it
👍 1
Avatar
for each frame you probably move less than a pixel I'd guess
14:57
maybe thats a little exaggerated
Avatar
well for zooming out far it might give some nice performance extras ^^
Avatar
Avatar
Jupstar ✪
then transform your wondering into a pr xdd
sure, i guess thats an easy one
Avatar
Avatar
Jupstar ✪
well for zooming out far it might give some nice performance extras ^^
but actually maybe not
Avatar
Avatar
Jupstar ✪
but actually maybe not
why not?
Avatar
Avatar
heinrich5991
why not?
his method already kinda is linear
15:01
and doest require to wait for the last frame
15:02
zooming out or not doesnt make a big difference in his method
15:02
bcs it doesnt rely on the vertex shader
15:10
Many people report this, not only on my server but als others
15:11
They say they need to connect multiple times to fix it
15:11
This doesnt seem to have arrived perfectly ^^
15:11
Whatever it is made for
Avatar
@Jupstar ✪ ah, another thing I'm wondering about is if there is a difference between doing many render passes in a command buffer or simply doing a new command buffer for each render pass and submitting them together
Avatar
Avatar
Patiga
@Jupstar ✪ ah, another thing I'm wondering about is if there is a difference between doing many render passes in a command buffer or simply doing a new command buffer for each render pass and submitting them together
i dunno, but many render passes might be a problem ofc, at least if you load the previous framebuffer
15:14
OP_LOAD vs OP_DONT_CARE
Avatar
Avatar
Patiga
@Jupstar ✪ ah, another thing I'm wondering about is if there is a difference between doing many render passes in a command buffer or simply doing a new command buffer for each render pass and submitting them together
the idea behind multiple command buffers is really more for multi threading, or if you are able to have completly static command buffers
15:15
for ddnet i use them only for multi threading
Avatar
oh, to be able to record them faster?
Avatar
yeah kinda, you can build a signle frame in many threads
Avatar
I don't think I need to load the previous framebuffer, though I also don't have DONT_CARE, only clear with a color
15:18
ah right, I do need load for the tilemap render textures
Avatar
mhh, i assume the opengl backend doesnt support it
Avatar
load? eh :c
Avatar
but yeah u need to load anyway
15:20
ah
15:20
that also doesnt exists?
Avatar
load exists
Avatar
ok
Avatar
ah right, my message there is confusing
Avatar
anyway, my prediction is, fast GPUs will not gain anything might even loose FPS, very slow GPUs might gain from it. Let's see how it turns out 😄
15:23
and i assume web performs bad bcs of other reasons than your renderer, it simply sucks xdd
15:23
maybe too many fallbacks for GLES3 compability
Avatar
Avatar
Patiga
heh ^^
btw it ran quite ok for me, do u use firefox?
Avatar
yes, but not at 144 fps as on chromium :d
15:33
mostly at 80 iirc
15:35
ah before I start trying that out, can one of your tools figure out how much time is spent in the tilemap fragment shader opposed to the rest?
Avatar
on the browser?
Avatar
that would be best
15:36
but shouldn't the native time distribution be about the same?
Avatar
if webgl doesnt fallback to software rendering or smth
Avatar
sooo, do you happen to have such a tool? ^^
Avatar
Avatar
Patiga
sooo, do you happen to have such a tool? ^^
i looked a bit, i'd say the wgpu backend does lots of useless state changes
Avatar
Avatar
Patiga
sooo, do you happen to have such a tool? ^^
lots of repeated webgl state changes
15:47
2303 commands for map "tutorial" on default zoom
15:47
sounds insane 😄
Avatar
that is the amount of commands inside of the command buffer per frame?
Avatar
@Patiga ddnet with GLES 3 does 603 for everything(HUD, text, etc.)
Avatar
Avatar
Patiga
that is the amount of commands inside of the command buffer per frame?
yes
15:49
at least i assume it is?
15:49
or is that a record of multiple frames, let me see
Avatar
how is that tool called?
Avatar
spectate.js or smth i alraedy gave it to you a while ago
15:50
but it also crashes my firefox often rn xD
Avatar
but yeah i'd say single frame
15:51
Laden Sie Spector.js für Firefox herunter. Easily explore and debug any WebGL context.
Avatar
when I go to the Information tab up there it says
Commands Summary total: 2301 draw: 61 clear: 0
15:58
so maybe its actually the total amount of commands?
Avatar
i assume so
15:58
but ddnet uses 603 commands for everything
15:58
hud, text and ingame rendering
Avatar
but then I'd only use
15:59
~37 each frame, right? but that sounds too little
Avatar
what?
Avatar
is each draw call a frame?
Avatar
no
16:00
1 frame 603 commands
Avatar
ah, each draw is a draw call on the pipeline
Avatar
ddnet has more drawcalls anyway, you cannot directly compare it, but it doesnt call random opengl commands for no reason xD
Avatar
Avatar
fokkonaut
Click to see attachment 🖼️
these messages are just troubleshooting tips when you don't connect to the game server instantly
16:01
they're not stopping you from connecting
Avatar
@Patiga i get > 600 fps btw
16:02
on firefox
16:03
chrome sadly forces vsync, dunno how i can disable it
Avatar
Avatar
heinrich5991
they're not stopping you from connecting
Ahhhh
Avatar
Avatar
Jupstar ✪
@Patiga i get > 600 fps btw
oh that would be more than enough, what graphics card do you have?
16:03
I have nvidia 1060 3GB
Avatar
rx 6900 xt xd
Avatar
Avatar
Jupstar ✪
anyway, my prediction is, fast GPUs will not gain anything might even loose FPS, very slow GPUs might gain from it. Let's see how it turns out 😄
my GPU probably isn't fast, but zooming out very far goes down to just a couple of FPS
Avatar
so maybe little OP
Avatar
that might be a tiny bit OP
Avatar
that's probably going to be fixed by not re-rendering everything
Avatar
Avatar
heinrich5991
my GPU probably isn't fast, but zooming out very far goes down to just a couple of FPS
on patigas renderer?
Avatar
no, in ddnet
Avatar
yes ddnet has vertex shader overhead
Avatar
ah sorry, didn't read the whole conversation
Avatar
I gtg off for now, will look into it more later
Avatar
ok
Avatar
Avatar
Patiga
I gtg off for now, will look into it more later
540 commands on ddnet web edition
Avatar
171c114 Keep builds directory but delete content - def-
Avatar
@Jupstar ✪ can I also see how long the rendering took / how long each fragment shader took?
17:03
or can you see that information on native maybe?
Avatar
renderdoc has that but not per stage, but its defs ur fragment shader anyway
Avatar
why is it definitely the fragment shader?
Avatar
bcs ur vertex shader makes basically nothing
Avatar
I guess I could test it by seeing how performance scales with the amount of tilemap layers
17:05
well it could maybe also just be slow in general, no? I'm not sure how big the wgpu abstraction overhead is
Avatar
yes could be, i have to compile without vsync for my version, then i can see how much fps i get 😄
Avatar
@Jupstar ✪ my measurements on native: empty map - 40,000 fps 16 tiles layers - 6750 fps 32 tiles layers - 3700 fps 64 tiles layers - 2050 fps 16 quads layers - 36550 fps 32 quads layers - 35950 fps 64 quads layers - 33300 fps
17:43
so yea, the tiles layers are quite heavy
Avatar
lmao, but ur broken fps
Avatar
ah right
17:46
did I ask already how to properly count fps? ^^
Avatar
take the average xd
17:49
or just use external tools
Avatar
average of what exactly?
Avatar
the frame times
Avatar
and can I measure the frame time on the cpu?
Avatar
i assume ur whole code is single threaded?
Avatar
so every new render call is a new frame basically
17:51
it doesnt buffer for ever
Avatar
but how is that different from my approach? counting the frames and dividing by the amount of seconds
Avatar
i dunno u did that for like 5 seconds
17:53
the average for 5 seconds xd
Avatar
buts thats what I do
17:53
for 5 seconds I increment a counter
17:53
and divide that counter by 5 to display the fps
Avatar
but 40k fps never xD
17:57
I forgot to divide by 5 xd
17:58
it seems I neglected that tool a bit too much
18:03
adjusted fps counts: empty map - 8,000 fps 16 tiles layers - 1350 fps 32 tiles layers - 740 fps 64 tiles layers - 410 fps 16 quads layers - 7310 fps 32 quads layers - 7190 fps 64 quads layers - 6660 fps
Avatar
Avatar
Patiga
adjusted fps counts: empty map - 8,000 fps 16 tiles layers - 1350 fps 32 tiles layers - 740 fps 64 tiles layers - 410 fps 16 quads layers - 7310 fps 32 quads layers - 7190 fps 64 quads layers - 6660 fps
mhh, what do u think is the bottleneck, GPU cores?
18:07
VRAM usage is also relativly high with this rendering technique right?
Avatar
hm I'm not sure, we'd need to measure that
Avatar
normally textures and vertex buffers are highly optimized, but ofc u access the textures for every single fragment
18:10
u basically have a texture lookup more than ddnets renderer
Avatar
well the vram usage of each tilemap is easy to calculate with this rendering technique, how many does the ddnet version use for each tile on this map?
18:11
width * height * 4 * 4
18:11
I could reduce it by a factor of 2 by using f16 instead of f32 for the tilemap
Avatar
do u need more than u8?
18:13
uint 8
Avatar
I don't know what the bottleneck is
Avatar
its just tile index right?
18:13
or other stuff in it?
Avatar
yes, I used floats so that it is less work for the fragment shader
18:14
its index, flip_x, flip_y, rotate
Avatar
mh ok
Avatar
index has to be (index + 0.5) / 256 in the fragment shader
18:15
and flip_x, flip_y, rotate would need to be cast to float
18:16
the index calculation coz it has to index into the mapres 3d texture
Avatar
yeaj
18:17
yeah
18:17
well anyway, vram isnt biggest issue, its really just about how much overhead comes from sampling
18:17
f16 might be lighter too ofc
Avatar

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 (especially base/) or added coverage to integration test
  • [ ] 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-addres...
20:25
e38df14 σℓí♡ as FNG mod - murpii 4d10d36 Merge pull request #205 from murpii/patch-11 - def-
Avatar
4970a61 Remove dead code - Robyt3 5f7d19d Use sizeof instead of hardcoded value - Robyt3 b594a32 Change return type of CNetBase::IsSeqInBackroom from int to bool - Robyt3 989dda7 Merge #5636 - bors[bot]
Avatar
if(DoButton_CheckBox(&m_Dummy, Localize("Dummy settings"), m_Dummy, &Dummy)) { m_Dummy ^= 1; }
21:15
menu_settings.cpp why is it ^= instead of =
Avatar
^ is bitwise XOR
21:19
so this means m_Dummy = m_Dummy ^ 1
21:20
it's equivalent to m_Dummy = !m_Dummy
Avatar
oh okay now i get it
21:21
damn everything is so extra in cpp when there is a more common solution to most stuff
21:21
xD
Avatar
^ is not extra its a common lang feature
22:27
what other symbol would you use?
Avatar
XOR is an operation lost to users of newer languages
Exported 268 message(s)