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-09-09 00:00:00Z and 2022-09-10 00:00:00Z
Avatar
you mean like this?
Avatar
it should just be pointing where his eyes are like normal
Avatar
So no weapon alteration?
00:03
hammer position is nice but default might work as well
Avatar
I'll wait until the other people comment as well
Avatar
Avatar
Ravie
hammer position is nice but default might work as well
Default is too high. If we do default I'd have to at least lower it
Avatar
ye maybe
Avatar
Avatar
Ravie
@Voxel now it just looks like this
The way I see it, the weapon is strapped to the tee's back as they rest, not just freely leaning on them
Avatar
Avatar
Voxel
you mean like this?
I meant flat on the ground next to the tee, but rendered in front of the tee
Avatar
Avatar
Skeith
The way I see it, the weapon is strapped to the tee's back as they rest, not just freely leaning on them
you mean stuck magnetically? or maybe by static charge
Avatar
happy Sure, it's a video game. Why not
00:33
If the weapon is rendered in front, it would cover the feet, making it kind of pointless, no?
Avatar
it could also be placed in a way that looks like the tee could possibly be holding it in a hand
Avatar
Avatar
Ravie
@Voxel now it just looks like this
i thought that was the point
00:41
like hes restinf on his weapon
00:41
or yeah like strapped to their back
Avatar
Having the weapon strapped to the tee's back is cute, looks fine as well
Avatar
Avatar
Ravie
you mean stuck magnetically? or maybe by static charge
Velcro greenthing
Avatar
Avatar
Ravie
you mean stuck magnetically? or maybe by static charge
Tees have a kangaroo pouch on their backs
Avatar
Avatar
Voxel
Is this better?
yea, but can you make the weapon render fully normal again (just for a screenshot?
Avatar
Oh wait, right. One second
Avatar
Avatar
fokkonaut
yea, but can you make the weapon render fully normal again (just for a screenshot?
05:52
Ravie did give an idea about there being a binded sit animation, where if you press a button you will be able to sit even if not AFK. But that would involve another packet in the server
Avatar
That wouldnt be a problem tho, since the sitting animation is only working for new clients anyways, we could easily add such packet
05:56
and such information to send to the clients. Voxel, hit me up I can helo you
Avatar
Want me to submit the PR as it is now, with the weapons as is?
Avatar
I think we should maybe keep the weapons normal btw. That would then also fit better to manual sitting
Avatar
Alrighty
Avatar
Avatar
Voxel
Want me to submit the PR as it is now, with the weapons as is?
Probably put it into one PR, as the info for sitting animation would then no longer require the afk info.
05:58
Then its polished from the beginning
Avatar
Ah cool.
05:59
So I did talk about this, and I think the best key to bind sitting would be S
05:59
at least for default
Avatar
Maybe, but s is taken for hookline
06:01
maybe c
06:01
at least for default :D
Avatar
Yeah, sure
Avatar
i'll check whether c is free
Avatar
It says here what binds are default
06:02
unsure if these are all of them
Avatar
these are all, was gonna check binds.cpp aswell :D
Avatar
s isn't shown as hookline though
Avatar
SetDDRaceBinds()
06:03
check that function
06:03
fuck, C is used by a useless command
Avatar
Wow, so many useless binds
06:04
im happy i dont use them
Avatar
i have my own config file, and the first line says unbindall
06:05
xD
Avatar
Which key would you suggest now toh
Avatar
lemme think
06:05
Z is my "lagg!!!" say bind
Avatar
just for a default, but Z is my team chat (y for qwerty)
06:06
you probably mean my Y then right? xD
Avatar
yknwo what why not change c bind to n,
Avatar
the bottom left
Avatar
Avatar
Voxel
yknwo what why not change c bind to n,
true
06:06
c fits for crouch
06:06
xd
Avatar
yea, and even if N and M are my deepfly binds, i think there's a solo button bind somewhere
Avatar
its just for the default, you can set ur bind however u want
06:10
@Voxel have you ever changed code on the server side? Do you want to do this or should I make a commit in your branch, same as for the DDNetLaser?
Avatar
Avatar
fokkonaut
@Voxel have you ever changed code on the server side? Do you want to do this or should I make a commit in your branch, same as for the DDNetLaser?
Can I try looking at it first? I think it should be rather straight forward and sort of similar to how +fire is treated
Avatar
of course I am here for quetions
Avatar
Avatar
Voxel
Can I try looking at it first? I think it should be rather straight forward and sort of similar to how +fire is treated
sure, but +fire or +showhookcoll are handled quite a bit differently
06:14
I am thinking right now, I think we should implement the sit (or similar?) command with an optional parameter 0 or 1, to allow using 0 or 1 for binds. If nothing is entered (as for the default bind), it would simply toggle, I think.
Avatar
@fokkonaut Is this a good start?
Avatar
You may not edit exisitng NetObjects, as they change network code. This one specifically is even a vanilla object.
Avatar
welcome to backwards compatibility
💀 1
Avatar
DDNet has a system (hey heinrich c:) that extends the normal NetObject system. You have to create a NetObjectEx and give it a paramter m_Sit
Avatar
alright ill try thaaaat
Avatar
@Voxel Look at MyOwnObject
06:32
ah, sorry
06:32
@Voxel NetObjects are only used by the server, they are a snapshot object. Dont use that to communicate client->server
06:32
instead, see Cl_ShowOthers, its a NetMessageEx
Avatar
ah nice (edited)
06:34
tho what does it mean by # Can't add any NetMessages here!? Can you not add it below that comment?
Avatar
Yes, you can, because you add a NetMessageEx. That is only meant for the normal NetMessages, as they are limited. You can't have infinite of them. Thats why this extended system was heavily required and is the foundation of what we can do right now. (heinrich!! c:)
Avatar
While you are working in network.py right now, you might wanna add a flag to CharacterFlags, called IS_SITTING or similar
06:38
That way we will tell the clients which client is sitting right now
Avatar
Alrighty
06:44
okay i think network.py is all set
Avatar
Looks good, yes
06:53
So now I add bool m_IsSitting; into CCharacterCore and then if(m_Core.m_IsSitting) pDDNetCharacter->m_Flags |= CHARACTERFLAG_IS_SITTING; in character.cpp?
06:55
wait nvm those relate to entities i think
Avatar
You can add it to CCharacter
06:56
The core does not need this information
06:56
Other than that, it was correct, yes
07:02
@Voxel make sure to reset m_IsSitting in CCharacter::DDRaceInit()
07:03
to false*
Avatar
Actually wait, would it be better inside void CCharacter::SnapCharacter(int SnappingClient, int ID)
Avatar
What do you mean?
Avatar
i don't know, i see a new similar
07:07
one second my brain shut off
07:08
im jjust saying like, since all the m_Flag things are linked to m_Core wouldnt it be weird for one to NOT be m_Core
Avatar
You should store m_IsSitting in CCharacter, because you are going to modify that variable when the net message arrives.
Avatar
Avatar
Voxel
im jjust saying like, since all the m_Flag things are linked to m_Core wouldnt it be weird for one to NOT be m_Core
They are not, it's just that the CCharacterCore is shared code, and if things like m_Super are required in the core, it is defined there
07:09
gamecore.cpp is used by the server and the client
07:09
But this information is not required there
Avatar
okay i broke it off a tiny bit so it's visually better to understand (i havent compiled it yet so thats why the IS_SITTING thing isnt blue yet
07:14
or should i not have that extra paragraph
Avatar
You can simply remove the line, it's not required :) It's not blue yet because it's not yet generated. Things added to the .py files will generate the matching code once you generate or build
Avatar
Yeah I know that (edited)
07:15
okayyy i removed the line i'm thinking about what to do next
Avatar
I would add the connection from the NetMessage to m_IsSitting now
07:16
Then you would have the serverside complete and can focus on the client implementation
07:17
You can use Cl_ShowOthers for reference
07:22
gamecontext.cpp?
Avatar
fokkonaut-sensei
07:23
greenthing
07:31
rn im just trying to read the entire block of text and trying to think of where to put thi
Avatar
just put it below CL_SHOWOTHERS :D
07:32
NETMSGTYPE_CL_SHOWOTHERS
07:32
now i see it
07:33
Thought you found OnMessage() already :D
07:40
Avatar
Avatar
Voxel
Click to see attachment 🖼️
again your issue
07:42
pChr not initialized
07:42
(+ the netmsg thingy issue) (edited)
Avatar
the red squiggles is just because its not built yet
Avatar
Don't forget so to initialize it before using pChr
Avatar
@Voxel you can simply use pPlayer->GetCharacter()
07:43
but you should check it first, so put it in an if case, and after it you can use it to access m_IsSitting
07:43
and: pMsg will not have m_Show, instead it will have m_Sit
07:46
Like this?
07:47
Or do I need to actually create a new if statement around the
Avatar
Avatar
Voxel
@fokkonaut Is this a good start?
better do a new packet with netintany for all animations
Avatar
i dont think that's needed though. those are just client side animations
Avatar
Avatar
Voxel
Like this?
why do you need pchr->is_sitting
07:51
check
Avatar
Avatar
Voxel
i dont think that's needed though. those are just client side animations
i mean maybe ddnet will have another ones troll
Avatar
then they can add it themselves
Avatar
another packet?
07:52
for same thing
Avatar
please dont pressure me right now this is hurting my head a bit LOL
Avatar
nah just want to hear other opinions about new packet
Avatar
i mean yeah i think the packet can be expanded, but as of right now it should be fine
Avatar
Avatar
Voxel
Like this?
Like that, but also check that pchr is not null
Avatar
Avatar
Voxel
Like this?
dont check for m_IsSitting
Avatar
And remove the if issitting
Avatar
Avatar
Ryozuki
Like that, but also check that pchr is not null
he does
07:54
Need coffee
07:54
CoffeeTime
Avatar
And just hit build man
07:54
xD
Avatar
removed is sitting check (edited)
Avatar
Dont u have ocd with red stuff
07:55
Ur build doesnt need to succeed
07:55
Just do it!
Avatar
Avatar
Ryozuki
Dont u have ocd with red stuff
im worried if i hit build something will go wrong with the servers and itll think im botting
07:55
it doesnt work like that troll
Avatar
ok the red stuff is gone
Avatar
and white is still here
Avatar
good
Avatar
is if-let statement a thing in cpp?
Avatar
Cl sit is a bit ambiguous imho, Cl character sit
07:58
Better
07:58
Mobile sux
Avatar
@Voxel now to the client side
08:02
sec
Avatar
@Voxel Design question: Should sitting be disabled once you move? You have implemented correct rendering on the clientside already, means a player could simply have IsSitting enabled all the time, and walking/jumping would work fine, until you stand still again then you sit?
08:16
or do you want it so that you manually have to enable sitting again after you walked?
08:16
i think thats a nicer solution
08:16
well, hard to say actually
Avatar
I think it would be nicer if it was, if your tee moves from when you're sitting you stand back up
08:17
This also means getting dragged
Avatar
yes, but imagine you get dragger 1 block :D
08:17
dragged*
08:18
Maybe stand up as soon as you walk, not as soon as you move in general/get moved?
08:18
I think thats good.
08:19
yeah, that sounds like a good compromise
08:19
@Voxel can you go to the server once again? :D
08:20
character.cpp
Avatar
alrighty im in
Avatar
go to OnPredictedInput()
08:21
wait
08:21
no.
08:22
Lets do this in Tick()
08:24
actually
08:24
@Voxel DDraceTick()
Avatar
Is there a DDraceTick() in character.cpp?
08:25
you can ctrl+f it
Avatar
its in character.h but not in the cpp file
Avatar
it is :D
08:25
ctrl+left click it
Avatar
oh im stupid
Avatar
im rly sorry u have to sit through this LOL
Avatar
okay what you see here is, that when you are frozen it resets your m_Input.m_Direction (left/right)
Avatar
Avatar
Voxel
im rly sorry u have to sit through this LOL
not yet sitting :P
Avatar
Avatar
fokkonaut
okay what you see here is, that when you are frozen it resets your m_Input.m_Direction (left/right)
aswell as hook and fire
Avatar
yea i see that
Avatar
hook and jump*
08:27
okay, so, you should add the check we are going to do below this.
08:27
So that when you are frozen, and press left or right, it doesnt impact starting to stand uip
08:28
I would add something like if (m_Input.m_Direction != 0) m_IsSitting = false;
08:28
lets do that for now, and later check if its all working, or if we want to adjust smth
08:29
do it here, or so
Avatar
Alright it's in
08:30
Now lets do the clientside?
Avatar
Have you worked with ddnetCharacter before?
08:31
Ah wait, one thing we forgot
08:31
where you send the ddnetcharacter flag
08:31
You should add a || m_pPlayer->m_Afk check
08:32
so is_sitting is either sent when afk or manually sitting
Avatar
oh right one second
08:34
wait shouldnt it be if Pchr AND if afk?
08:35
or does being AFK override it?
Avatar
i mean in CCharacter::Snap
08:35
where you send the IS_SITTING flag
08:36
if (m_IsSitting || m_pPlayer->m_Afk)
08:39
Avatar
i think you messed up both things
08:39
like
08:39
you mixed them together
Avatar
okay so, the first check you have, put that to where you send the CHARACTERFLAG_IS_SITTING
08:40
and the direction check you keep in DDraceTick
Avatar
okay i did that successfully
08:44
now the next step is to have there be a proper bind to it? or is that already taken care of?
Avatar
It's not yet
08:44
Do you want to start with that, or with actually receiving the Sitting information?
Avatar
well itd be better to have it receive what we want first so (edited)
Avatar
alright. you can check where the client receives the ddnetcharacter object
08:46
?
Avatar
hmm. when designing a game, you try to communicate information to the players
08:47
if you add a way to make the player communicate being afk without actually being afk, then that signal loses value, right?
Avatar
it does not include the afk bubble, and i personally think its a nice touch to be able to just sit down
08:47
Could also be used to indicate "hey guys, i go toilet 5 min"
08:47
And it suits teeworlds very much
Avatar
I'd imagine people would spam it like emotes, removing any kind of information from it
08:48
bind "+fire;sit"
Avatar
good point
Avatar
Well, the afk emote is not spamable
08:48
which is the main indicator for being afk
Avatar
"+fire;sit;emote 9"
08:48
i think its 9
Avatar
I guess maybe it's not as bad as we still have the zzz, and maybe no intention of removing it
Avatar
+ the inverted eyes
Avatar
the inverted eyes can be bound
Avatar
you cant bind the open eyes while being frozen tho
Avatar
yes (although that's more of a bug, I guess)
Avatar
no, i think thats perfect
Avatar
(although that happened more accidentally I guess, not intentionally) (edited)
Avatar
it indiciates very good that frozne people are speccing or afk
08:50
(which was one of the main intentions)
08:50
showing pause in freeze
08:51
to avoid fials
08:51
foails
Avatar
you think that it was intentional that you couldn't change your eyes to normal in freeze? ^^
Avatar
fails
08:51
definitely
08:51
they were supposed to be closed
08:51
or any other custom eyes
Avatar
it seems very unlikely to me. how could you be so sure of that?
Avatar
Well, because that is the way it was made :D
08:52
And if they would wanted it differently, it would have been done
Avatar
no, the current way is the "path of least resistance" if you don't think about the implications
08:52
you have default eyes where you change everything according to state
08:53
and you have non-default eyes where you don't change according to state
Avatar
anyways, i think the behaviour is absolutely perfect
Avatar
this has the happy accident of not being able to change your eyes to the open eyes because they're "default"
08:54
@heinrich5991 it should definitely not change, it avoids many fails for me personally, cuz i dont hammer out tees with open eyes in frz
08:54
huge gameplay+++
08:54
since it got implemented
Avatar
This now makes me think; was making sitting outside of AFK worth it?
Avatar
(this is an example of a clear signal, one which cannot be bound)
08:55
(and you say it's great that it cannot be forced)
Avatar
Yes, but sitting is a nice touch as i said, and I think its cool to be able to sit without being afk. as i said, it indicates clearly that you did not move or do not move right now
08:56
and: afk is more than visible with the emote
08:56
i wasnt the one who suggested manual sitting, just liked the idea since it suits ddnet
Avatar
Ravie also mentioned a possible sit cooldown, so people don't make sit bots that force them to sit throughout the entirety of their gameplay
Avatar
yes, that would belong to the server side
08:56
had that in mind too
Avatar
I mean you could perhaps extend sitting to /pause and you have a clearer indicator of not being able to respond
08:57
and you can suddenly "bind" /sit
08:57
but you actually can't move during it
Avatar
i wouldnt do that, if someone throws you somewhere and u want to react, its very bad gameplay
Avatar
Jump to quickly get out of /sit, That's my addendum (edited)
Avatar
currently it would be, that you automatically "stand up" once you move
08:58
(walk only)
Avatar
that's the point; sit indicates you're not able to respond
Avatar
I know what you mean, but you go around what players would actually really like
Avatar
(i.e. the /sit wasn't supposed to be a real command, it's just /pause that also sits)
Avatar
actually
Avatar
"what players would actually really like"
Avatar
sit being only smth visual when you're really afk or paused is the best
Avatar
= "what I actually really like" (I'd guess)
08:59
real signals are really good
08:59
we're trying to design a game
Avatar
I assume many players would like it, just look at how they liked the emote delay 0 from Chile servers
08:59
"it looks like they have so much fun"
08:59
people said
Avatar
to be honest, having it where you cant manually move out of sit is acceptable in my terms. i think people who just chill in maps like water lily would like just sitting down and everything
Avatar
Avatar
heinrich5991
real signals are really good
yeah, and we still have the afk emote + inverted eyes, which was always enough. I think sitting is just a nice touch to it, which is not a problem to show without being afk/paused
09:01
+ u can move ur weapon direction while ur sitting, there is definitely enough difference to actually having the afk flag
Avatar
we only have inverted eyes for /pause'd players
Avatar
So what I think I want to happen is: You sit when you're AFK, in Pause, or use the Sit command, which is like pause except you aren't spectating the map
09:02
would be useful for if someone is doing a part and you want to sit it out until they're done
Avatar
yea, but i dont think you should be able to move.
09:03
so, walking resets your sitting state and lets you stand up
09:03
how we have it right now
09:04
I think we should continue like this Voxel, and see other responses. As these design discussions are not much/hard to implement or change later on. They are even serverside mostly, so lets go for it for now I'd say
09:05
You can show the differences etc in the PR later on
Avatar
Yeah, we'll continue like this and then think about it more once we hear more voices on this (edited)
Avatar
Alright, so you fetched the sitting information already?
Avatar
thanks for teaching how to do network protocols btw, @fokkonaut
Avatar
No problem :)
Avatar
i think we all learned something LOL
09:07
oh wait u guys r talking about something different
Avatar
He means the teeworlds network protocol and how it works or how to add new things that are sent over the network
09:07
like, without breaking old clients compatibility etc
09:08
like right now the client sends whether it wants to sit or stand up, and the server sends information whether a tee is sitting or not
Avatar
breaking compat is a feature
09:10
justatest
Avatar
So i know I need to do something with pDDNetCharacter->m_Flags | CHARACTERFLAG_IS_SITTING (edited)
Avatar
Yes, on the clientside though
09:11
go to gameclient.cpp, and see how other elements of DDNetCharacter are being handled
09:11
e.g. m_HasTelegunLaser
09:12
You add a boolean to the CClientData m_IsSitting, which you then set based on whether the flag is included in the object.
Avatar
Did that. Also Removed the now obsolete boolean IsActive and did this, so that the hammer doesn't look too high when you're holding it while sitting (edited)
Avatar
I would remove the m_Afk checks around your sitting stuff entirely
09:20
Because m_IsSitting is always set to true when you are afk :)
09:20
(by the server)
Avatar
But would you want the hammer tilted back when you're sitting and not AFK?
Avatar
Ah, probably not. But then I would still do the checks the other way around. Everthing related to sitting, use m_IsSitting, and for afk specific stuff do a separate m_Afk check
09:22
because you can be sitting without being afk. but not being afk without sitting
09:24
And make sure to reset m_IsSitting to false in CClientData::Reset
Avatar
so only thing missing is the bind
09:26
?
Avatar
ok. first add the bind in binds.cpp
Avatar
So we agreed it would be key C?
Avatar
I guess, can also be discussed later
Avatar
I'll temporarily move the current C bind to N
Avatar
sure
09:29
How do we call the command?
Avatar
maybe just sit
Avatar
Console()->Register("+sit", "", CFGFLAG_CLIENT, ConKeyInputSet, (void *)&s_Set, "Sit");
Avatar
probably without +, it doesn't do anything on key up
Avatar
thats not correct
09:33
@Voxel first, you need to add the bind in binds.cpp i mean
09:34
in SetDDraceBinds
Avatar
okay, then you can remove this again
09:34
Go to gameclient.cpp again, and search for "kill"
09:34
with the qutoes
09:34
We bascially do the same as kill would do too
09:35
The kill bind also sends a simple packet telling the server it wants to kill
09:36
in the second, empty quotes you wanna add "?i['0'|'1']"
09:36
that's the optional parameter
Avatar
So i put this under kill?
Avatar
sure, anywhere there
09:38
Probably want to put it below cl_menu_map
09:38
but it doesnt really matter at all
09:38
wait sorry
09:38
leave it there
Avatar
do I need a ConSit as well?
Avatar
yes, that will be the function to get called once you execute the command
09:40
you need to add a ConSit in gameclient.h, just use ConKill as a preset
09:44
Avatar
You can remove the clientid parameter
09:48
c++ if (m_Snap.m_LocalClientID < 0) return; CNetMsg_Cl_Sit Msg; Msg.m_Sit = !m_aClients[m_Snap.m_LocalClientID].m_IsSitting; CMsgPacker Packer(Msg.MsgID(), false); Msg.Pack(&Packer); Client()->SendMsg(IClient::CONN_MAIN, &Packer, MSGFLAG_VITAL); if (g_Config.m_ClDummyCopyMoves) Client()->SendMsg(IClient::CONN_DUMMY, &Packer, MSGFLAG_VITAL);
09:49
1. We need to manually pack the message here, because there is no function to send an unpacked message as dummy. (thats also how its done for Cl_ShowDistance) (edited)
09:50
2. You need to set the m_Sit parameter. I would just toggle it by using the info we got provided by the server.
09:51
3. you should not use a separate function SendSit(), because we need to access the arguments. give me a second
09:53
c++ void CGameClient::ConSit(IConsole::IResult *pResult, void *pUserData) { CGameClient *pThis = (CGameClient *)pUserData; if (pThis->m_Snap.m_LocalClientID < 0) return; CNetMsg_Cl_Sit Msg; Msg.m_Sit = pResult->NumArguments() ? pResult->GetInteger(0) : !pThis->m_aClients[m_Snap.m_LocalClientID].m_IsSitting; CMsgPacker Packer(Msg.MsgID(), false); Msg.Pack(&Packer); pThis->Client()->SendMsg(IClient::CONN_MAIN, &Packer, MSGFLAG_VITAL); if (g_Config.m_ClDummyCopyMoves) pThis->Client()->SendMsg(IClient::CONN_DUMMY, &Packer, MSGFLAG_VITAL); }
09:54
This should do the trick. What happens now is, that since we have an optional parameter, we check whether there are arguments added to the command, if yes, we set m_Sit to the argument we passed. otherwise send the opposite of our current state.
Avatar
add pThis-> before
Avatar
before m_Snap
09:55
these are static functions, so they can get passed as a callback while we Register the command
09:55
thats why we cant directly access CGameClient
09:55
These callback functions are getting called from the back, when we execute these commands.
Avatar
okay did that
09:56
anything else?
Avatar
I think this should be it for now, try it out
09:56
you have to run both, new server & new client
09:57
just compile everything, and then start both from the folder
Avatar
i cant compile, because a bunch of dll files didnt come with my clone fsr
Avatar
git submodule update --init --recursive
Avatar
through git bash right? (edited)
Avatar
yes, from the root of your project
10:00
where cmakelists.txt is
Avatar
they literally did nothing KEKW
Avatar
can you show the errors
Avatar
you can try copying them from the folders in ddnet-libs to the execution directory
10:02
(although that should happen automatically?)
Avatar
@Voxel re generate your code
10:03
projectÜ
10:03
*
Avatar
Avatar
Voxel
i cant compile, because a bunch of dll files didnt come with my clone fsr
did it compile or not? cuz it looks like it did, and you simply cant open it
Avatar
Avatar
fokkonaut
did it compile or not? cuz it looks like it did, and you simply cant open it
well i cant see the exe
Avatar
how did you open this then? :D
Avatar
there's 2 options in visual studio one for ddnet.exe, and one for ddnet.exe install
Avatar
dont use the install
10:06
and try to not build via the Play button, but build via the top menu where you can select "Build" -> build all
Avatar
oh wait the server now actually works ok (edited)
Avatar
Avatar
fokkonaut
and try to not build via the Play button, but build via the top menu where you can select "Build" -> build all
oh o k
Avatar
because you need server & client. build all, open them manually from folder
10:09
whee! it works!
Avatar
walking should stand up, right?
10:11
now i'm just debugging things
Avatar
and f1: sit 0 or sit 1 should also work?
Avatar
Also, did you make sure to render it correctly based on the sitting information, and add additional stuff only related to being afk to the m_Afk condition?
Avatar
Avatar
fokkonaut
Also, did you make sure to render it correctly based on the sitting information, and add additional stuff only related to being afk to the m_Afk condition?
thats what im doing right now (edited)
Avatar
alright, nice
10:13
I like the behaviour how it is right now, also that you can move your cursor while sitting, and shoot :)
10:14
You could add || m_pPlayer->IsPaused() to the condition on the server, when you send the CHARACTEFFLAG_IS_SITTING
10:14
heinrich suggested that i think
Avatar
Ah, and Voxel, one thing
Avatar
We should add a delay of at least 0.25 seconds between sitting/unsitting
Avatar
good idea
Avatar
you can see how its implemented for kill, in gamecontext
10:20
search for "CL_KILL"
Avatar
i was gonna say im confused as to how to remove the need for m_afk in this segment in this code
Avatar
how did it look before
Avatar
what does the m_IsSitting thing do
10:22
+= 10
Avatar
it makes the hammer lower down with you
10:23
because if you sit the hammer looks way too high
10:23
sec
Avatar
what are the quadrotations for?
Avatar
for weapons
10:24
on a back
Avatar
ah, yea
Avatar
quad rotations are for when you're AFK
10:24
or if you're not
10:24
i mean
10:24
what do they rotat xd
Avatar
the hammer
Avatar
ahhh
10:25
then keep the afk check there
10:25
correct?
Avatar
then add if (!afk && sitting) y += 10
10:26
exactly\
Avatar
cuz if ur afk ur sitting anyways, but the hammer gets put in the other state already
10:26
u dont wanna lower it more
10:26
actuallöy
10:26
just put the += 10 thing in the else
10:27
i am not sure if i understood everything of the code correctly xd
Avatar
Avatar
Voxel
Click to see attachment 🖼️
but then you get this when you're not afk
Avatar
ah lol, yes wait
10:28
you have to put the issitting check INTO the if
10:28
yes
Avatar
@Voxel soo you are adding ability to sit when you are not afk?
👍 1
10:29
ah okey
Avatar
waiting on huge t0 maps will finally be fun
Avatar
yes, but you need to do it where you are not afk
10:30
in that if block
Avatar
Avatar
Voxel
Click to see attachment 🖼️
it would be funny to see sitting tee midair
10:31
like its just falling
10:31
and sitting xd
Avatar
wait, not necessarly, you just need to make sure its !afk && !inair && sitting @Voxel
10:32
NO
Avatar
just put it in the if block
10:32
should be correct
10:32
in the normal hammer block
Avatar
thing is hammer would need to go down for both roatation states
10:33
since it's so far up when you're standing
10:33
mh?
10:33
ah, it also needs to go down for when ur afk?
Avatar
didnt know that, yes, then its correct there
10:34
yup
Avatar
so now i'm trying to add a sit delay
Avatar
yes i know
Avatar
instead of * killdelay use / 4 i think
10:36
0.25 sec sounds to be enough
10:40
@Voxel is 8.f the amount you put down the tee when its sitting? or why did you choose 8
10:41
for the hammer
Avatar
10 felt like too much
Avatar
how much down does the tee go?
10:41
when its sitting
Avatar
also that piece of code is PURELY for the hammer only
Avatar
you should put down the hammer by that exact amount i think
10:42
idk
Avatar
let me check
Avatar
at least when not afk but sitting
Avatar
yup. you dont need to add the paused check tho, its quite irrelevant because the server sends the tee is sitting down anyways while IsPaused
10:46
it wont harm tho :)
10:46
but wait, where is the rest of the code!
10:46
xD
10:49
wdym
Avatar
the code of the CL_SIT where you actually unpack the message and set m_IsSitting xDDD
10:49
one second
Avatar
Avatar
Voxel
Click to see attachment 🖼️
.
10:50
@Voxel
Avatar
fokko you pinged me twice
Avatar
oh, forgot answers ping too
10:51
srs
10:51
sry
10:51
what happened to that code tho xD
Avatar
i forgot i already defined thaaaat
10:52
its ok i fixed it
Avatar
for some reason the delay has it where the hammer lowers down before the actual body does
Avatar
An extended message for sitting? Do we need that? I thought the client had enough info to figure out whether it’s afk
Avatar
rendering order
Avatar
Avatar
Learath2
An extended message for sitting? Do we need that? I thought the client had enough info to figure out whether it’s afk
its the other way around
Avatar
they want to add a way to manually enter the sit mode
Avatar
Ah, that makes more sense
Avatar
Avatar
Voxel
for some reason the delay has it where the hammer lowers down before the actual body does
due to the delay?
Avatar
Avatar
Voxel
Click to see attachment 🖼️
ah and, did you initalize m_LastSit in CPlayer::Reset()=?
Avatar
@Learath2 Sitting will most likely also be used when speccing
Avatar
And chairs!
❤️ 1
Avatar
@heinrich5991 I want to make bans more robust, do you have any idea how best to structure the propagation behind the scenes?
Avatar
Avatar
Voxel
And chairs!
do you lower all weapons by the amount you lower the tee when sitting?
Avatar
do you want to avoid custom protocols? ^^
10:59
by default, I'd try making the game servers connect to a central server that has a current view of the bans that should be there
Avatar
It needs to be resilient to network outages by leaf servers. It needs to be in the memory of each server so no mysql. We could maybe use shared memory as gameservers would only be reading
Avatar
it can then push updates via that channel
Avatar
Avatar
fokkonaut
do you lower all weapons by the amount you lower the tee when sitting?
No, just the hammer. If I did the bullets would be out of sync
Avatar
if the connection drops, the server gets the complete view again
Avatar
Avatar
Voxel
No, just the hammer. If I did the bullets would be out of sync
true
11:00
how much do you lower the tee tho?
11:01
and i switched the hammer to 3 as well
Avatar
and why do you lower the hammer by 8 then
Avatar
Avatar
heinrich5991
it can then push updates via that channel
So send the current view on first connect, send updates as long as the connection is alive. Maybe a serial number so the leafs can figure out they missed stuff and request the whole thing
Avatar
because i was accounting for ravie's art (edited)
Avatar
for the laying hammer its good probably, but is it also good for the sitting hammer without afk?
Avatar
what's the stuff that could be missed without a serial number?
Avatar
Avatar
fokkonaut
for the laying hammer its good probably, but is it also good for the sitting hammer without afk?
Not really for when you're not AFK
Avatar
but it is applied currently, no?
11:02
as i saw, you took out the +8 of the else block
11:02
and made it trigger on !inair && issitting
Avatar
I added an extra +5 for the AFK hammer
Avatar
i mean, why do you lower the hammer at all when sitting && !afk
Avatar
because the tee lowers
11:03
when it sits
Avatar
but it lowers by 3
11:03
not by 8 (edited)
Avatar
so the hammer lowers by 3
Avatar
i thought by 8 😄
11:04
OH wait
11:04
you mean, you have 3 in general for sitting now, and +5 when also afk?
11:05
because it might look too high angled that far back
Avatar
okay, but doesnt it look weird if only the hammer drops down and up while other weapons dont?
11:05
but ur right, its not possible in another way :D
11:05
its 3 only anyways
11:05
shouldnt make a big difference lol
11:06
but thats why im thinking, maybe also keep the hammer where it is, or you tried that?
Avatar
Avatar
heinrich5991
what's the stuff that could be missed without a serial number?
I was hoping the server could avoid a full redownload if it didn’t miss anything during the disconnect
Avatar
sounds like extra complexity 😛
11:06
how long is our ban list these days?
Avatar
Avatar
heinrich5991
how long is our ban list these days?
500 or so
Avatar
well lets try to see what hammer looks like afk and only 3
Avatar
ah, that's quite long… hm
Avatar
Avatar
heinrich5991
sounds like extra complexity 😛
Especially if I don’t have a central process on each leaf node doing the request and letting the gameservers themselves do it it might become a huge storm
Avatar
Avatar
Voxel
well lets try to see what hammer looks like afk and only 3
i think the switch from sitting to standing might be ugly, cuz other weapons dont drop down or go up, only hammer
Avatar
It might be worth having a single process keep the list in sync in some shared memory and the gameservers could just read that
Avatar
shared memory sounds hard to get right
11:11
i.e. I don't even know how to design it. can you give an exemplary design?
Avatar
That's weird, you don't sit when you're afk anymore
Avatar
Do you send sitting flag for being Afk? :)
11:11
from the server
Avatar
Yeah i thinkn so
Avatar
check it
Avatar
m_IsSitting || m_pPlayer->m_Afk || m_pPlayer->IsPaused()
Avatar
Oh, I know why. Cuz you force afk players clientside right now
Avatar
no i removed that
Avatar
So the server doesnt recognize u as afk
11:13
@Voxel how do you set urself afk?
11:13
by not moving when joining?
Avatar
Avatar
heinrich5991
i.e. I don't even know how to design it. can you give an exemplary design?
I was thinking of googling around for a lock-free vector implementation which sounds plausible with there being one writer. Then it;s just shm_open
Avatar
mh, thats weird then. can you check if pause works?
Avatar
this is the part where I say that this looks impossible
11:15
just like establishing a shared secret via an open channel 😉
11:15
I mean the listener would know everything the two parties said, right?
Avatar
Avatar
fokkonaut
mh, thats weird then. can you check if pause works?
it does not
11:15
uhh
11:15
whatd i do
Avatar
did you build again?
11:16
i fixed it x d dd
Avatar
what was it?
Avatar
Avatar
heinrich5991
just like establishing a shared secret via an open channel 😉
Am I missing something? This one is possible no? Isn’t it like the entire point of DH?
Avatar
i didnt consider all the side effects of removing force_afk
Avatar
at most my irony
Avatar
yes pause works
Avatar
Avatar
Voxel
i didnt consider all the side effects of removing force_afk
xd
Avatar
Avatar
Learath2
I was thinking of googling around for a lock-free vector implementation which sounds plausible with there being one writer. Then it;s just shm_open
Do it in rust
Avatar
Avatar
Voxel
yes pause works
great
Avatar
cryptography gives answers to many problems I considered impossible before
11:18
this looked like a problem like that; it looks impossible to me, but I'm also not doubtful that someone can come up with a solution
Avatar
I have a better idea
Avatar
but now I'm reading the paper ^^
Avatar
I’ll make the central server, then I’ll just make proxies that speak the same protocol
Avatar
that works
11:20
increasing operational complexity a little
Avatar
So we can just host small proxies that keep themselves up to date on the leafs and the gameservers themselves only cause a storm on the server itself locally
Avatar
@fokkonaut do you think it's ready to commit?
Avatar
i didnt see it, but i think so and would test it out :)
11:25
And now all I need.... Is 8 hours... of interrupted sleep.
Avatar
Avatar
Voxel
And now all I need.... Is 8 hours... of interrupted sleep.
xD
11:26
Good night!
11:26
well deserved
Avatar
that's where you're wrong. it's 7:30 am LOLLLLL
11:26
but yea thanks for everything man
Avatar
ooof, i know that, late night coding into the morning :D
11:26
np <3
11:26
i'm gonna test it
11:27
it's ok, next PR won't be so much of a game changer
Avatar
i do have an idea for what i could do though. i want there to be a reload button for editor images. Like how there is Replace and Remove, I want there to be a button that automatically updates the image when it changed, or the autpmapper changed
11:28
even then that's probably too hard
Avatar
i probably cant help that much there tho :D editor coding is not my main area
11:31
how did you get to compile that?!
11:31
xD
Avatar
a = b = c; works in C (edited)
Avatar
oh, true
11:31
i didnt think about it going into next line
Avatar
Avatar
fokkonaut
Click to see attachment 🖼️
w h a t
11:32
HOW
11:33
i do not have the energy to fiz that right npw
Avatar
have a good 'night'
Avatar
no problem xd
Avatar
I wanted to ban that one 😦
kek 1
Avatar
ichliebesyrix. 2022-09-09 13:53:34Z
i need some mod or a smart guy to help me
13:53
my hook and hammer is bugged
13:53
i already reinstalled game
13:53
idk what to do its unplayable
Avatar
Bugged?
Avatar
ichliebesyrix. 2022-09-09 13:59:01Z
idk its really weird
13:59
i can stream it for u
Avatar
Fix it with glue
14:06
banhammer
Avatar
ichliebesyrix. 2022-09-09 14:10:43Z
:/
Avatar
turn on antiping
Avatar
ichliebesyrix. 2022-09-09 14:14:41Z
oh lol i didnt know i had it off (edited)
Avatar
Hello
Avatar
moin
Avatar
@heinrich5991 do you know how I can keep my rustup installation separate from my system rust installation?
15:13
I'd rather not mess around with portages copy of rust which it uses to compile packages
Avatar
rustup installs into ~ IIRC
15:14
does it not on your system?
Avatar
I'm not aware of the intricacies of rusts build system, do I need to purge my PATH of the system rust? Could cargo accidentally invoke that while compiling something
15:16
?
Avatar
tbf, I don't know. I've only ever had one of them installed
15:17
I think that cargo looks for its corresponding rust, not just one in PATH
15:17
I think this was the reason given for some performance problems recently
Avatar
Avatar
heinrich5991
tbf, I don't know. I've only ever had one of them installed
https://paste.pr0.tips/N59 this is why I was concerned
15:19
I can't really be careful with my PATH if idk what PATH is used for in rust 😄
Avatar
hmm
15:21
is there no rustup in gentoo's package repository?
Avatar
My guess is that ~/.cargo/bin being ahead of everything else in PATH should make sure only my user copy is being used but alas idk
Avatar
Avatar
heinrich5991
is there no rustup in gentoo's package repository?
There is but it replaces the system rust. I'd rather not mess with that
Avatar
I see
Avatar
I'll just install rustup to my user dir, put cargo/bin at the start of my PATH and hope for the best
Avatar
sorry. I don't like tools like rustup
15:23
unfortunately, rustup is kidna required to cross-compile
Avatar
Me neither, skipping the packaging mechanism of distros are sort of necessary though or you'll end up with debian having a decade old gcc
Avatar
the specific trouble in gentoo is that you also need the blessed rustc from gentoo to be sure that your packages are tested
15:25
in arch, I simply only either install rustup OR rust
Avatar
Yeah, you are not building all your packages rust/rustup is a tool for you. In gentoo it's an integral part of the system
Avatar
Avatar
Learath2
I'm not aware of the intricacies of rusts build system, do I need to purge my PATH of the system rust? Could cargo accidentally invoke that while compiling something
It installa on a dot folder at home iirc
15:38
Installs
15:38
.rustup
15:39
I love rustup
Avatar
u love anything that includes rust in its name xD
15:41
It rly makes it ez to compile
15:41
For other platforms
15:41
Microcontrollers
Avatar
@Ryozuki do you like rusty nails? 😛
15:41
(testing a theory)
Avatar
hm 🤔
Avatar
But i agree there is friction with rustup and distros
Avatar
ofc he likes rusty nails
Avatar
But i would always get rustup
15:42
Over the distro one
Avatar
I live on the edge
Avatar
also as far as i know rust is a mushroom isnt it?
15:42
not rust like rusty
Avatar
Rust mascot is a crab
15:43
Sticker
Avatar
Rusts are plant diseases caused by pathogenic fungi of the order Pucciniales (previously known as Uredinales). An estimated 168 rust genera and approximately 7,000 species, more than half of which belong to the genus Puccinia, are currently accepted. Rust fungi are highly specialized plant pathogens with several unique features. Taken as a group...
15:43
rust's name origin
15:44
I think a MVP of GATs is getting released soon
Avatar
too few TLAs
15:45
MVP of GATs is in the FCP on in the GH PR
15:46
Fcp is 10 days
15:46
Tracking issue: #44265 Initiative: https://rust-lang.github.io/generic-associated-types-initiative/ RFC: https://github.com/rust-lang/rfcs/blob/master/text/1598-generic_associated_types.md Version: 1.65 (2022-08-22 => beta, 2022-11-03 => stable).
15:46
11-03
15:47
does someone understand where the error might come from?
15:48
it seems that it tries to link syn (a procedural macro crate) using the target architecture, but it should link it using the host architecture IIUIC
15:49
linux x86's problem is fixed by a later commit; and macos seems to be a problem of multiarchitecture binaries which I'll look at later
15:49
deen's problem doesn't reproduce on my computer, unfortunately
Avatar
"building for macOS-x86_64 but attempting to link with file built for macOS-arm64"
15:49
isnt this a m1 issue?
Avatar
Avatar
heinrich5991
linux x86's problem is fixed by a later commit; and macos seems to be a problem of multiarchitecture binaries which I'll look at later
yes, probably
Avatar
i have rust 1.64 so i cannot help xd
Avatar
@Jupstar ✪ which version of rust did you use?
15:50
rustup or system?
Avatar
i used rustup nightly or smth
15:50
for patiga already
Avatar
rustup handles multiple rust installs easy
15:51
stable and nightly
15:51
and you can configure it on a per project basis
Avatar
i just always use the latest, if its broken i try stable
Avatar
what does
15:52
rustup default
15:52
say
Avatar
% rustup default git:master nightly-x86_64-unknown-linux-gnu (default)
Avatar
rustup show
Avatar
rustup show Default host: x86_64-unknown-linux-gnu rustup home: /home/jupeyy/.rustup installed toolchains -------------------- stable-x86_64-unknown-linux-gnu nightly-2020-03-04-x86_64-unknown-linux-gnu nightly-x86_64-unknown-linux-gnu (default) installed targets for active toolchain -------------------------------------- i686-unknown-linux-gnu x86_64-unknown-linux-gnu active toolchain ---------------- nightly-x86_64-unknown-linux-gnu (default) rustc 1.64.0-nightly (06754d885 2022-07-08)
Avatar
there u have the version
Avatar
(also in rustc --version)
Avatar
true xd
Avatar
thats what i used xD
Avatar
Avatar
Jupstar ✪
i have rust 1.64 so i cannot help xd
^
Avatar
Why do u have a old 2020 version
Avatar
probs compiled smth back then
15:54
i dunno
Avatar
you could try rustup default 1.62, deleting the win64 build directory and compiling again. if you have a couple of minutes
Avatar
ok
15:55
how do i install 1.62?
Avatar
rustup default 1.62 should do that 😮
Avatar
it says 1.62 was not found
Avatar
otherwise rustup toolchain install 1.62
Avatar
130kb/s can take a while
Avatar
oof
Avatar
just install stable
Avatar
stable is already installed (see the output above)
Avatar
then use it
15:59
why 1.62?
Avatar
deen uses it
Avatar
we're trying to find out where deen's error comes from
Avatar
is there some mirror xD
Avatar
its so slow
Avatar
maybe use 1.62.1 then
Avatar
I wonder why it's so slow
Avatar
must be smth with the svrs
16:00
its usually rly fast for me
Avatar
vali reads this chat
16:00
targets rust now
Avatar
I get more than 1MiB/s
16:01
still slow, but not 180 KiB/s
Avatar
apt gives full speed, but u live in berlin, i live on the opposite site of germany
16:01
or do u live in bayern?
16:01
still the opposite site xD
Avatar
I downloaded 1.62.1 10 minutes ago, I got 15MiB/s
Avatar
everywhere is the opposite side of Jupstar?
Avatar
yes
Avatar
living in ruhrgebiet?
Avatar
i live in the north of NRW
Avatar
though that was on a server with much better interwebs
Avatar
münsterland
Avatar
My problems might come from me using old Debian VMs
Avatar
At home it was more like 5MiB/s
Avatar
well, debian 10 now, so not so old anymore
Avatar
Avatar
Jupstar ✪
münsterland
heh, gotta visit you some time. I have friends in münster that I visit sometimes
Avatar
but i assume rustup is there so u dont have to care about your OS?
16:03
i mean rust is staticly linked isnt it
16:03
but i still live north from münster
16:03
i live basically directly next to netherlands and niedersachsen
Avatar
don't think that rust is statically linked, it'll still work the same everywhere, I guess; but it might still be the environment
16:04
rust is invoking system linker etc.
Avatar
Avatar
heinrich5991
don't think that rust is statically linked, it'll still work the same everywhere, I guess; but it might still be the environment
huh, is it not? I don't remember any dynamic linking involved in launching a rust binary
Avatar
$ ldd (rustup which rustc) linux-vdso.so.1 => linux-vdso.so.1 (0x00007fff981b4000) librustc_driver-3268cbc2eb745628.so => path/to/home/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-3268cbc2eb745628.so (0x00007f720da00000) libstd-91db243dd05c003b.so => path/to/home/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/libstd-91db243dd05c003b.so (0x00007f720d600000) libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f7212119000) librt.so.1 => /usr/lib/librt.so.1 (0x00007f7212114000) libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f721210f000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f720d419000) libLLVM-14-rust-1.64.0-nightly.so => path/to/home/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-14-rust-1.64.0-nightly.so (0x00007f7208217000) libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f72120ed000) libm.so.6 => /usr/lib/libm.so.6 (0x00007f720812f000) /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f7212145000) libz.so.1 => /usr/lib/libz.so.1 (0x00007f72120d3000)
Avatar
its getting slower over time xD
Avatar
rustup dump-testament oO
Avatar
it finished the download but is stuck at info: checking for self-updates info: downloading self-update it doesnt even start any download, or doesnt show any progress
16:18
but maybe i should just cancel it
16:18
doesnt sound related to the toolchain
Avatar
ye
Avatar
error[E0463]: can't find crate for std
16:20
so maybe it wasnt finished
Avatar
rustup install went through, but only half-way?
16:20
rustup toolchain uninstall?
Avatar
rustup default 1.62 now installs stuff, tried 1.62.0 before, and before that i tried 1.62 which showed an error xD
16:21
dunno its weird
Avatar
??!?
16:21
weird
Avatar
then i compiled
16:21
16:21
then i used 1.62 again and it started a download xD
16:22
i dunno its really weird
16:23
but still same error
Avatar
rustup default 1.62.0
Avatar
i tried both now
16:24
i can also try 1.62.1 now but the download is still slow af xD, for the above it was fullspeed for some reason
16:26
ah
16:26
do i have to install rustup target add x86_64-pc-windows-gnu for every toolchain?
16:26
i did that with nightly probably
16:26
thought it just adds it for all targets then
Avatar
ah yes, you need to do that
Avatar
well rip download again doest start
16:28
its really broken for me rn
16:30
ok finally, but seems to have worked
16:32
@deen do u even use debian for the windows builds? wasnt it arch?
Avatar
Windows build is Arch
Avatar
thats actually weird since i assume heinrich uses it too
Avatar
Because when building for Windows it doesn't matter what Linux you use
Avatar
yeah
Avatar
build ddnet with musl
16:46
then it doesnt matter too
16:46
on linux
Avatar
musl can't do dns lookups with long answers correctly
Avatar
time to make a pr
Avatar
(or more generally, doesn't use the system resolver)
Avatar
it's by design
Avatar
how about uclibc?
Avatar
relibc
16:47
BASED
Avatar
rust fanatic
16:48
libc is like a virus
16:48
u need to depend on it
Avatar
libc with MIT license sounds cool tho
Avatar
C is not a language, but a protocol
Avatar
if u can use it system wide
Avatar
at this point
Avatar
yep
16:49
see also: POSIX
Avatar
@Jupstar ✪ btw ryoOS code is here now https://github.com/edg-l/ryoOS
Toy project to learn OS dev with rust. Contribute to edg-l/ryoOS development by creating an account on GitHub.
16:51
although i left it some time ago and it has a panic (but handled within the kernel)
16:51
and i dont remember why
16:51
your self from 6 months ago is truly another person
Avatar
yeah ryo 6 month ago was just bill gates, now he's linus torvalds well done ryo xd
16:52
chad own allocator
Avatar
I was going to use clap for parsing args, noticed it adds an entire 700kb for an argument parser, that's insane
Avatar
Avatar
Learath2
I was going to use clap for parsing args, noticed it adds an entire 700kb for an argument parser, that's insane
maybe u can reduce it
16:56
by enabling only features u want
16:56
but yeah, clap is really feature complete
16:56
if u want something less feature complete
16:56
structops
16:56
or smth like that
16:56
This crate defines the StructOpt trait and its custom derive.
16:56
well its what clap uses under the hood
Avatar
bpaf looks interesting
Avatar
Main purpose is to control quads z index, but i like how this can be used to reveal how many quads a layer has just by placing a new one. Furthermore, it provides a way to reference quads, that's needed to make custom cli tools work on user selected quads.

Checklist

  • [x] Tested the change ingame
  • [x] Provided screenshots if it is a visual change
  • [x] Tested in combination with possibly related configuration options
  • [ ] Written a unit test (especially base/) or added coverage...
Avatar
Avatar
Ryozuki
@Jupstar ✪ btw ryoOS code is here now https://github.com/edg-l/ryoOS
new os have just dropped
Avatar
where do your cross compilers for windows come from? arch linux package mingw-w64-gcc, probably?
Avatar
@deen ^
Avatar
It's mind boggling how annoying implementing a parser for a custom type is in clap
Avatar
@Learath2 are you using the derive method of using clap?
22:31
with that one it was much easier for me
Avatar
I was using the builder method
22:32
How do you ever return a proper error from your custom parser?
Avatar
fn parse_tuple<T: FromStr, const SEPARATOR: char>( s: &str, ) -> Result<(T, T), Box<dyn Error + Send + Sync + 'static>> where T::Err: Error + Send + Sync + 'static, { if s.matches(SEPARATOR).count() != 1 { return Err(format!("Expected 2 values separated by '{}'", SEPARATOR).into()); } let mut values = s.split(SEPARATOR).map(|str| str.parse::<T>()); Ok((values.next().unwrap()?, values.next().unwrap()?)) }
22:33
#[clap(long, short = 'p', value_parser = parse_tuple::<f32, ','>)] position: Vec<(f32, f32)>,
22:33
thats all it takes with the derive method
22:34
(from one of my twgpu tools)
22:35
without the derive method it was a lot of hassle and at the end I didn't even have the clap coloring in my error. this way everything just worked
Avatar
I think I'll just try another library
22:36
I'm just very annoyed at it making something so trivial so long and insufferable
Avatar
yeah :/
22:37
but now that the derive thingy is integrated into the clap crate directly, I liked it
Avatar
But then I have to use the weird one off struct way of getting arguments which just feels wrong
Avatar
apart from a little weird first it is also very darn simple :p
22:42
and having it as an explicit type also gave the certainty that I didn't mess up some parameters somewhere
Avatar
I'm very much considering just calling out to getopt, that's how annoyed I am at wasting half an hour trying to parse a stupid uri properly
22:44
Okay, one last try, I'll give it a go with the derive version
👌 1
Avatar
= note: expected trait `for<'r> <for<'r> fn(&'r str) -> Result<URI<'r>, URIError> {parse_url} as FnOnce<(&'r str,)>>` found trait `for<'r> <for<'r> fn(&'r str) -> Result<URI<'r>, URIError> {parse_url} as FnOnce<(&'r str,)>>`
😬 1
23:06
I think this is enough rust for one night
23:06
The compiler seems to be smoking something
Avatar
I see no difference?
Avatar
neither
Avatar
Neither do I
23:07
I think I got the lifetime wrong somehow
Avatar
I see two 'rs
Avatar
I think it has sth to do with the weird way uriparse just doesn't have a version that takes ownership of the string
Avatar
can you show the code line that produces it?
Avatar
#[derive(Parser, Debug)]
Avatar
probably also a URI member?
Avatar
Avatar
Learath2
I'm very much considering just calling out to getopt, that's how annoyed I am at wasting half an hour trying to parse a stupid uri properly
use the url crate
23:15
from mozilla
23:15
they use it
23:15
on firefox iirc
23:15
URL parser for Rust. Contribute to servo/rust-url development by creating an account on GitHub.
23:16
cant get better than this
Avatar
I'm sure that'll work since it looks like it uses a clone of the string so it's lifetime doesn't look like it depends on the initial string
23:20
23:20
I just don't know how to tell the compiler that the argument will live long enough, any idea?
23:21
I'll just use mozilla's version, but at this point I'm just annoyed that it won't work
23:22
just clone
23:22
?
23:22
but why use urlparse
23:22
when url is better
Avatar
It's a learning opportunity that's why. I'll use url just as soon as I figure out why on earth clap wants this struct to be 'static
Avatar
probs because it wants the program options to live as long as the program
Avatar
cloning doesn't work since URI has string references to the original string
Avatar
The underlying OSString should live long enough for that
Avatar
yes, a cloned one in the function on the other hand shouldn't
Avatar
Hm, maybe the intermediate &str clap creates just doesn't live long enough
Avatar
fn parse_url(value: &'static str) -> Result<URI, URIError> { URI::try_from(value) }
23:26
then
23:26
clap will never
23:26
make a 'static str
23:26
from command line options
23:26
'static str are strs that are in the binary itself mostly
23:27
or String ones
Avatar
Avatar
Ryozuki
fn parse_url(value: &'static str) -> Result<URI, URIError> { URI::try_from(value) }
I tried that note: `fn(&'static str) -> Result<URI<'static>, URIError> {parse_url}` must implement `FnOnce<(&'0 str,)>`, for any lifetime `'0`...
Avatar
does clap::value_parser!(URI)
23:28
work?
23:28
xD
Avatar
Ofc not, I'm not retarded
Avatar
URI is not FromStr so it doesn't work
23:29
ur using a crate from 6 years ago
Avatar
Anyway, I understand the limitations of this library now. Why I expected a 700kb library to be conscious of the amount of times it forces you to copy shit around is beyond me
23:30
I'll just copy it like a good boy
23:30
6 months
23:30
i was looking at the wrong one
23:30
i think u just
23:30
dont understnad what ur doing
23:30
thats why
Avatar
I'm extremely sure stuff in argv lives way past the programs puny lifetime
23:32
u made me create this project
23:32
let me see
Avatar
It's probably not possible due to the way rust handles OsStrings without some platform dependent code, thus I'm guessing clap just creates a utf8 version of it during parse time which you are supposed to store yourself
Avatar
ostrings are no different than str
23:33
they just dont v alidate utf9
23:33
utf8
Avatar
Actually they wouldn't even be utf8 on windows, they'd be utf16 or ucs2
23:34
they dont validate encoding iirc
23:34
or smth like that
23:34
since paths can be invalid utf8
Avatar
Anyway, even all the way at std::env::ArgsOs I'm getting an OsString not an OsStr. It's not a reference to begin with, so no point messing around with this
Avatar
OsString is owned
23:40
so it can live as long as you want
Avatar
But I have to put it somewhere. The actual underlying string that's part of argv already lives long enough. I just thought a reference to that would be accessible
23:41
That doesn't seem to be the case
Avatar
honestly
23:41
if you ask me
23:41
your args should just be
23:41
String or PathBufs
23:41
and then u validate them
23:41
converting them to parsed urls
23:41
and returning errors otherwise
23:42
i recommend color_eyre
23:42
for error reporting
Avatar
I'm being punished for wanting nicely formatted errors that match with claps
Avatar
ur not
23:42
claps is not a error reporting tool
23:42
it just parses args
23:42
idk why uriparser
23:42
doesnt implement fromstr
23:42
they should
23:42
they are stupid
23:43
so u can implement it urself
23:43
or use url from mozilla
23:43
they know better
Avatar
Avatar
Ryozuki
it just parses args
Which does include validation in my opinion and given clap implements some validation they seem to atleast semi agree with me
23:44
23:44
url from mozzilla
23:44
works out of the box
23:44
its insane right?
23:45
use clap::Parser; #[derive(Parser, Debug)] #[clap( version = "0.0.1", about = "Provides bans to a compatible teeworlds server or proxy instance" )] struct Args { #[clap(short = 't', long)] auth_token: String, #[clap(short, long)] bindaddrs: Vec<url::Url>, } fn main() { let args = Args::parse(); dbg!(args); }
23:45
uriparser is just badly done
23:45
they suck
23:45
end of story
Avatar
Yes bossman, if you copy, it works just fine on it's own
Avatar
you rly want to optimize a copy done 1 time at the program init
23:46
well you go for it
23:46
i may figure it out tomorrow with a clear mind
23:46
but not rn xd
23:47
also vec needs to allocate always
23:47
no matter what
Avatar
Yes it's premature optimization, I already said I'll use a copy aswell. Why is me being curious about a tiny optimization so offensive to you?
23:48
its just me
23:48
im a bit annoyed cuz other reasons
23:48
dont mind me
23:54
i looked a bit
23:54
i dont think clap does zero cost parsing rn
23:54
it needs owned values
Exported 1,051 message(s)