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 2023-02-07 00:00:00Z and 2023-02-08 00:00:00Z
Avatar
I am trying to run DDNet client as fast as KoGAI can handle (x10, x100). I am facing problems with it though. How often does game/client/prediction/entitites/character.cpp run?
01:42
I speed up the server and the client here return std::chrono::nanoseconds(1s).count() / 10; under int64_t time_freq() in base/system.cpp (edited)
01:43
Is this correct or am I missing something?
Avatar
Avatar
Mr.Gh0s7
Is this correct or am I missing something?
TICK_SPEED
Avatar
bc36a09 M Barren, M Behemoth, M Cerulean, M Exhale, M Flux 2, M Flux, M Lotus, M Polarity, M Apex, M Momentum, M Smash, M Stellar, M Binary, M Grim Reaper, M Crimson Woods, M Slippy Slide Up, M Spoon, M oco, M Orion, M Sketch, M Sunny Side Up, M Disposition, M Dodge, M Rapid, M Zap - ddnet-maps
Avatar
Avatar
Mr.Gh0s7
Is this correct or am I missing something?
Have u tried multiplying the time
Avatar
Avatar
Matodor
TICK_SPEED
xD doesn't work like that
Avatar
Avatar
Jupstar ✪
Have u tried multiplying the time
nah this wasn't the problem. It was using std:chrono::otherstuff to toher places too so I had to change it there accordinly also.
Avatar
Avatar
Mr.Gh0s7
nah this wasn't the problem. It was using std:chrono::otherstuff to toher places too so I had to change it there accordinly also.
But dividing sounds wrong tho xd
09:53
1 second will take 10 times longer
Avatar
Avatar
Mr.Gh0s7
nah this wasn't the problem. It was using std:chrono::otherstuff to toher places too so I had to change it there accordinly also.
Ah u doing it in time freq
09:55
Soz
Avatar
ye xD
09:56
in other places was *10
Avatar
Better change it the other tho
👍 1
09:56
Time freq is not used everywhere
09:56
But besides that . Multiplying it at that one position should be enough actually
Avatar
Hmm didn't seem to be though idk xD
Avatar
Mh. I'm pretty sure it is
09:58
Can u show Ur diff
Avatar
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Avatar
Don't change it in other places. Simply use cl refresh 0 Have u compiled the server with that change too?
10:04
And yeah remove it from freq call.
Avatar
Yeah I have. Ok will try it out ;)
Avatar
Dividing can be scary (10*10)/10/10 is 1
10:06
It can quickly happen that u divide your result instead of the freq valley
10:06
Values
Avatar
Avatar
Jupstar ✪
Don't change it in other places. Simply use cl refresh 0 Have u compiled the server with that change too?
That seemed to do the trick ty. Idk why the other way also "worked". My metric for working or not is it/s (iterations/second). This time it's 480-490. Without speedup is 60-70 it/s.
10:14
I would expect it to scale lineary though (should be 600-700 it/s) with that line of thought
Avatar
Sounds a lot. It can probably not keep up
10:16
A better design would be to not rely on a server anyway
10:17
And just run as much ticks as possible
Avatar
ah lemme check something. I (zogtib) had put a limit to only run once per tick so it's closer now to 500 (as it should be). I wanna see what changes if I remove this limit
10:21
Yeah it runs with 500 now too. I'll put it back up.
Avatar
Avatar
Jupstar ✪
A better design would be to not rely on a server anyway
How would that work though?
Avatar
Make server part of the client source. Increment the time every time u finished the current loop cycle
10:24
Or sync the server time with a network packet
10:24
But don't use system time
10:24
That sounds very unreliable
Avatar
Avatar
Jupstar ✪
Make server part of the client source. Increment the time every time u finished the current loop cycle
Hmm sounds a lot of work and it works well rn. If I face problems I'll do so ;).
10:25
Yeah it's unreliable but reliable enough ig. For speed of x100 or smt bigger it's starting to rise as a problem
Avatar
Ok. Good that we have 1 trillion fps xd
kek 1
Avatar
But my cpu is already at it's max with x10 and 20 envs
Avatar
@Mr.Gh0s7 here is the thing. it catches up if the server somehow takes too long and slows it down if it goes too fast. https://github.com/ddnet/ddnet/blob/master/src/engine/server/server.cpp#L2741 while(t > TickStartTime(m_CurrentGameTick + 1)) (edited)
DDraceNetwork, a free cooperative platformer game. Contribute to ddnet/ddnet development by creating an account on GitHub.
13:08
if you were to replace it just with while(true) it would not check for map changes or anything else and just go as fast as it could. ofc you couldnt join the server anymore if you were to do that but im not sure. (edited)
Avatar
He has to keep server and client in sync tho. So the time workaround is legit xd
Avatar
just remake ddnet physics and maploading in the language you are dealing with xd (edited)
Avatar
Avatar
Teero
just remake ddnet physics and maploading in the language you are dealing with xd (edited)
im pretty sure it would be faster and easier since it would just be translating. (edited)
13:16
exept with python....
15:56
I recently realized that all the various programming philosophies are concerned with state, and can be boiled down into a simple statement about how to work with state.
>
Object-Oriented - Modifying a lot of state at once is hard to get correct; encapsulate subsets of state into separate objects and allow limited manipulation of the encapsulated sub-state via methods.
>
Functional - Modifying state is hard to get correct; keep it at the boundaries and keep logic pure so that it is easier to verify the logic is correct.
>
Declarative - Modifying state is hard to get correct; use a language to describe how state should be manipulated and allow the machine to determine the steps required.
>
Imperative - Modifying state is hard to get correct; minimize the number of conceptual layers between how the computer operates and how the code is written.
>
Monolith - Modifying state distributed among many services is hard to get correct; keep it centralized.
>
Service-Oriented-Architecture - Modifying all of the state in one service is hard to get correct; distribute it among multiple services.
>
MicroServices - Modifying any state in a service is hard to get correct; have many services that are primarily stateless.
15:56
makes sense tbh
15:56
xd
Avatar
data oriented?
16:23
seems like it mixes different levels
Avatar
Well a CPU is at it’s core a state machine. Instructions take us from one state to another. At the end of the day programming is technically navigating inside the state space of the cpu, in that sense technically all programming is “concerned with state”
Avatar
I don’t think mixing different levels is an issue when you think about it like that. At every level/layer of abstraction we constrain the transitions of state allowed, which gives rise to smaller and smaller subsets of the state space of the entire cpu.
Avatar
Hello, what i'm doing wrong? char *CAccount::GenerateID() { char aBuf[8]; FormatUuid(RandomUuid(), aBuf, sizeof(aBuf)); return aBuf; } ?
17:46
dbg_msg("GenerateID()", pSelf->m_pAccount->GenerateID()); print nothing
Avatar
did u verify that the code path is reachable
17:48
also a char is not directly a string
17:48
what u want is to print it as hex values probably
Avatar
Avatar
Jupstar ✪
did u verify that the code path is reachable
i think yes
Avatar
Avatar
Jupstar ✪
also a char is not directly a string
if i do same thing but inside GenerateID it print right
Avatar
Avatar
newlesstee
Hello, what i'm doing wrong? char *CAccount::GenerateID() { char aBuf[8]; FormatUuid(RandomUuid(), aBuf, sizeof(aBuf)); return aBuf; } ?
u also return a stack variable
17:50
this is wrong, how does your compiler not throw a warning?
Avatar
Avatar
Jupstar ✪
u also return a stack variable
what?
Avatar
char aBuf[8] is allocated on the stack
17:50
as soon as you call return its dead
Avatar
How do I make it correct?
Avatar
pass aBuf as parameter
17:51
GenerateID(char(&aBuf)[8])
17:54
note u can still return aBuf then
17:54
its just important that u increase the lifetime of the array
Avatar
@Jupstar ✪ oh thanks, thats worked 🙂
Avatar
it will probs not work for all cases tho
17:56
ok nvm formatuuid is probs what u want anyway lol
Avatar
Avatar
newlesstee
dbg_msg("GenerateID()", pSelf->m_pAccount->GenerateID()); print nothing
account = for ddnet?^^
Avatar
Avatar
Jupstar ✪
account = for ddnet?^^
my server
Avatar
any cool mod?
Avatar
i'm trying to code an city
Avatar
ok xd
Avatar
what do you think?
Avatar
i hoped it was fng gores or ddnet xd
Avatar
Avatar
newlesstee
Hello, what i'm doing wrong? char *CAccount::GenerateID() { char aBuf[8]; FormatUuid(RandomUuid(), aBuf, sizeof(aBuf)); return aBuf; } ?
ur returning a stack allocated array
Avatar
Avatar
Jupstar ✪
i hoped it was fng gores or ddnet xd
xD
Avatar
Avatar
Ryozuki
ur returning a stack allocated array
yes
Avatar
Avatar
Ryozuki
ur returning a stack allocated array
3 2 1
17:59
in rust u would get a error
Avatar
xd
Avatar
Avatar
Ryozuki
in rust u would get a error
mania of others languages
Avatar
Avatar
Jupstar ✪
xd
Hi! I texted u in dm. I need a little help.
Avatar
i hate dev related dms
18:01
its better to ask in public
18:01
everyone helps
18:01
u dont depend on 1 person
Avatar
oh okay im sorry
Avatar
others see the answer
Avatar
Avatar
Raks
Hi! I texted u in dm. I need a little help.
i am also not very good with ddrace code (edited)
Avatar
How can I create projectiles that don't move?
Avatar
Avatar
Jupstar ✪
i am also not very good with ddrace code (edited)
xd
Avatar
but yeah just ask here
Avatar
I can ask it over here?
Avatar
Avatar
newlesstee
How can I create projectiles that don't move?
tune their speed i guess
Avatar
set the speed to 0 or smth
Avatar
tuning params
Avatar
Avatar
Raks
I can ask it over here?
u can ask anything here
Avatar
Avatar
Raks
I can ask it over here?
if its not about bot clients or coding bots
Avatar
its about voting system
Avatar
i'm trying with new CProjectile but dont work like expected
Avatar
Avatar
Jupstar ✪
its about voting system
It's about ye..
Avatar
best is u tag heinrich or learath or robyte
18:02
they probs know about this kind of stuff
Avatar
I try to make almost the same voting system wich one is the ddddnet using.
18:03
Like if i choose Novice vote
18:03
that will only show up my novice maps
18:03
I tryed like this:
Avatar
check the ddnet repo
18:03
ddnet-maps
18:03
it has cfgs
18:04
ddnet scripts too
18:04
Where can i find that?
Avatar
CProjectile::CProjectile(CGameWorld *pGameWorld, int Type, int Owner, vec2 Pos, **vec2 Dir** , int Span, bool Freeze, bool Explosive, int SoundImpact, int Layer = 0, int Number = 0)
18:04
CProjectile has Dir
18:04
all have motion
18:05
i dont know how to create static projectiles
Avatar
Avatar
Raks
Where can i find that?
18:06
hmm how to remove embeds?
Avatar
< link >
Avatar
Avatar
newlesstee
i dont know how to create static projectiles
set Dir as vec2(0.f, 0.f) maybe
18:27
idk
Avatar
@gerdoe all projectiles go down
Avatar
then you should change Tick function
18:28
afair there's part related to any movement
Avatar
on GetPos() if you set Speed = 0.f; before return CalcPos(m_Pos, m_Direction, Curvature, Speed, Time); it works serverside
Avatar
@Mr.Gh0s7 dont worked
Avatar
if you test with grenade you can see that the explotion happens where you shot so it works but the client predictions are wrong. At least I think so
18:49
ig if that's true you'd have to sent tunings for each projectile but idk if that's possible. It probably is though
Avatar
lol nah
18:50
client will not predict projectiles in such straight wa
18:50
y
18:50
it shouldn't atleast
Avatar
i think thats client side, but i want to know how to create an static projectile
18:50
like others mods
Avatar
you can actually pass some kind of flag Static and check it in tick function
Avatar
i want to create this: CNetObj_Projectile
18:59
but i dont know how
18:59
i have tried and its so hard
Avatar
you should ask snapbuilder to snap you new item
19:00
static_cast<CNetObj_EntityEx *>(Server()->SnapNewItem(NETOBJTYPE_ENTITYEX, GetID(), sizeof(CNetObj_EntityEx))); kind of
19:01
static_cast<CNetObj_Projectile *>(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, GetID(), sizeof(CNetObj_Projectile))); this one is what you actually need i think
19:01
it returns cnetobj_projectile
Avatar
@gerdoe i will try
Avatar
god helps me, c# developer, after seeing this code
Avatar
Avatar
Gewinum
god helps me, c# developer, after seeing this code
Avatar
Avatar
Ryozuki
?
i got depressed
Avatar
Avatar
Learath2
Click to see attachment 🖼️
Avatar
Usually you don't want to create a CNetObj directly from just anywhere in the code
Avatar
Avatar
Gewinum
god helps me, c# developer, after seeing this code
are you dissing c# devs?
19:50
because as a C# dev I could reproduce that
Avatar
@default i do
Avatar
Usually you'll want to extend CProjectile or CEntity directly and in the snap function of that you snap a new CNetObj_*
Avatar
Avatar
default
because as a C# dev I could reproduce that
i just confused with that
19:50
got*
Avatar
i dont think on c# u need to remember the circular read rule to know how a complex type involving pointers is read
19:51
idk the name of the thing
19:51
xd
19:52
void *(*foo)(int *);
19:52
function pointers
19:52
what was the name
19:52
to describe how to read these
Avatar
weird function to return a void *
Avatar
value of foo cast from address
19:52
would be my guess
Avatar
Avatar
default
value of foo cast from address
?
Avatar
you mean functor?
Avatar
Avatar
Ryozuki
to describe how to read these
dereferencing?
Avatar
Avatar
Chairn
you mean functor?
no, there is like a know method to read these
19:53
known
19:53
u do circles
19:53
imaginary
19:53
i read it somewhere
19:54
If you are having problem with deciphering complex pointer declarations like int (*(*foo[10])(void))(int) then you are at the right place. In this tutorial, you would learn to decipher any complex pointer declarations. To decipher complex declarations, remember these two simple rules: Always read declarations from the inside out: Start from the innermost, if any, parenthesis. Locate the identifier that's being declared, and start deciphering the declaration from there. When there is a choice, always favor [] and () over *: If * precedes the identifier and [] follows it, the identifier represents an array, not a pointer. Likewise, if * precedes the identifier and () follows it, the identifier represents a function, not a pointer. (Parentheses can always be used to override the normal priority of [] and () over *.)
19:54
this
19:55
Avatar
poggers gif
19:55
ah it doesnt load
Avatar
my brain hurts
19:57
however, they defined Void as void 😄
Avatar
Avatar
default
Click to see attachment 🖼️
oof code existential crisis
20:06
ive got interestijg question
Avatar
Avatar
Ryozuki
i dont think on c# u need to remember the circular read rule to know how a complex type involving pointers is read
spiral rule?
Avatar
how IDEs are being developed?
Avatar
Avatar
Learath2
spiral rule?
y
Avatar
Avatar
Gewinum
how IDEs are being developed?
most are a compiler frontend for the target language
Avatar
There is a better rule that always works. Declaration follows use
Avatar
Avatar
Gewinum
how IDEs are being developed?
type code on your keyboard
Avatar
but nowadays IDEs use LSP
Avatar
Avatar
Jupstar ✪
type code on your keyboard
i thought they write it with assembly
Avatar
they do
20:07
why not 1 and 0
20:08
optimisation is the main thing
Avatar
actually unless ur a asm expert a compiler will do a better job
Avatar
but wait seriously
20:08
how ides are being developed
20:09
how are they debugged
Avatar
u know thats a bit of a stupid question
Avatar
what if i run visual studio from visual studio
20:09
i got two visual studio instances
Avatar
Avatar
Gewinum
what if i run visual studio from visual studio
yeah why not
Avatar
u could
Avatar
tho vscode is javascript
Avatar
what if i run one more visual studio
Avatar
what if u right click the discord tray icon and click close?
20:10
trollet
Avatar
generally i assume debugging is very event driven
20:10
not so much put your breakpoint here and there
Avatar
Avatar
Ryozuki
trollet
im on phone
Avatar
lot of logging etc
Avatar
throw it
Avatar
Avatar
Gewinum
im on phone
Wipe it
Avatar
Avatar
Gewinum
how ides are being developed
In notepad.exe greenthing
Avatar
@Learath2 the life of a thinkpad
Avatar
Avatar
Mʎɹ シ
Wipe it
sure buddy
Avatar
Avatar
Gewinum
sure buddy
Yea, it is what I mean
Avatar
Avatar
Ryozuki
throw it
i threw it on my bed
20:12
is that enough
Avatar
for now yes
Avatar
how vim was developed
Avatar
with vi
20:14
and vi with ex
20:14
and ex with ur mom
Avatar
i got cyberbullied
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
How linux users install browser
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
Avatar
Avatar
Ryozuki
@Learath2 the life of a thinkpad
inaccurate, I'm not a femboy
Avatar
Avatar
default
Click to see attachment 🖼️
Wait until you hear that those ()s there actually imply those functions can take an unspecified amount of arguments too
Avatar
Can I share my crazy ideas here?
Avatar
as if they are crazy enough to convince me that they are crazy
Avatar
see
21:09
21:10
and an webhook mention my in discord
Avatar
mhh weird solution
Avatar
yes, CRAZY
Avatar
Avatar
Mʎɹ シ
How linux users install browser
Windows users: winget install chrome
Avatar
you could use a secure password instead :p
Avatar
Avatar
heinrich5991
you could use a secure password instead :p
i already use
22:55
I know I already asked, but how can I add the D++ library (Discord library) to DDNet? wanted to create a bot instead of sending webhooks
Avatar
too complicated to walk you through
22:55
for me
Avatar
I just wanted to know how to add it to CMakeLists, the rest I could do
22:57
there are many things in CMakeLists, it is very complicated to try to understand
Avatar
and it's equally if not more difficult for us to explain tbf
Avatar
but no documentation? Or anything like that?
23:05
An example?
Avatar
You can look at how we link to sdl maybe, there are no docs on the specific way we use cmake
Avatar
There is in the D++ documentation how to use it in CMake but it is different
23:09
A lightweight C++ Discord API library supporting the entire Discord API, including Slash Commands, Voice/Audio, Sharding, Clustering and more!
Avatar
It's just use a different language
Exported 278 message(s)