Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2021-11-08 00:00:00Z and 2021-11-09 00:00:00Z
Avatar
5acf6e7 Fix spacing in HUD settings for 5:4 resolution - def- 959e65d Merge #4326 - bors[bot]
Avatar
The Intel 8086 microprocessor was introduced 42 years ago this month, 1 so I made some high-res die photos of the chip to celebrate. The ...
09:31
👀
Avatar
chillerdragon BOT 2021-11-08 09:54:15Z
does someone have a link to the mysql lib docs that ddnet uses?
09:58
i assume this?
Avatar
ddnets sqlite handler kinda sux
Avatar
Kinda sux is possibly an even worse bug report than "there is a problem"
Avatar
Its just unhandly to use, not a bug report D;
Avatar
chillerdragon BOT 2021-11-08 11:27:30Z
hater
11:30
man i am searching forever but idk how to get the mysql equivalent of sqlite3_column_name any ideas?
11:30
I am trying to retrive the column name of the query at offset x
Avatar
Column name of a query doesn't make sense
Avatar
chillerdragon BOT 2021-11-08 11:38:34Z
why not?
11:39
it works fine in sqlite
11:39
image.png
11:39
i want to retrive the string "Time" out of this query
Avatar
Ah, you want the column names from the result set of the query?
Avatar
chillerdragon BOT 2021-11-08 11:40:00Z
yes
11:40
thats what sqlite3_column_name does just fine but i can not find the mysql equivalent
11:40
can we drop mysql? :D
Avatar
yes, in favor of postgres
11:41
if we add that first
Avatar
The google search you are looking for is "mysql result set metadata"
Avatar
postgres is superior
11:43
im also for using postgres
Avatar
chillerdragon BOT 2021-11-08 11:43:19Z
in favor of sqlite3 :D
Avatar
sqlite should be used only for prototyping at most
Avatar
After all the things that broke in the last week I wouldnt think you all so bold :D
11:44
Don't even want to begin imagining how much everything would fall apart with a migration to postgres
Avatar
Avatar
Learath2
After all the things that broke in the last week I wouldnt think you all so bold :D
its not like we will migrate db rn
Avatar
chillerdragon BOT 2021-11-08 11:44:20Z
thanks good query @Learath2 :)
Avatar
@Learath2 but arent most of our problems due to windows incompetence
11:44
and c++ friendliness with memory unsafety
11:44
monkalaugh
Avatar
Well the last mysql patch also broke quite a lot
Avatar
well but imho it was a biggger rework
11:45
from what i've seen the code rn wouldnt be hard to port to postgres
11:45
but idk
Avatar
The lack of unit and e2e testing in ddnet makes it very annoying to properly test before we release
Avatar
we are missing testing
Avatar
but i need some postgres practice 😄
Avatar
what does ur practice entail
Avatar
porting official ddnet servers to postgres sounds like good practice
11:46
maybe we could even optimize some stuff postgres has plugins for time-series stuff
11:46
TimescaleDB is a time-series SQL database providing fast analytics, scalability, with automated data management on a proven storage engine.
11:47
Avatar
chillerdragon BOT 2021-11-08 11:48:17Z
yikes postgres
Avatar
Horizontally scale to petabytes doesnt sound like something we need :D
monkalaugh 1
Avatar
Postgres handles concurrency better than MySQL for multiple reasons:
>
Postgres implements Multiversion Concurrency Control (MVCC) without read locks Postgres supports parallel query plans that can use multiple CPUs/cores Postgres can create indexes in a non-blocking way (through the CREATE INDEX CONCURRENTLY syntax), and it can create partial indexes (for example, if you have a model with soft deletes, you can create an index that ignores records marked as deleted) Postgres is known for protecting data integrity at the transaction level. This makes it less vulnerable to data corruption.
11:48
poggers
Avatar
What would you want this for anyway? We dont really have time-series data. I guess the finishes maybe but those are so infrequent. Logs?
Avatar
log everything
11:49
spy on the tees
Avatar
Cellegen | HU 2021-11-08 11:49:38Z
monkaT
Avatar
Thats illegal
Avatar
just put teehistorian into db instead of on filesystem 😄
Avatar
(not serious)
Avatar
today the way to say its a joke for non obvious jokes is /s
11:50
u need to modernize deen
11:50
bluekitty
Avatar
chillerdragon BOT 2021-11-08 11:50:56Z
teehistorian :D
Avatar
will there be aday where teehistorian data is public
Avatar
chillerdragon BOT 2021-11-08 11:51:19Z
o gosh i hate reading docs send halp
Avatar
Avatar
chillerdragon
o gosh i hate reading docs send halp
well i would also hate reading that mysql crap docs
Avatar
chillerdragon BOT 2021-11-08 11:53:28Z
yes please i need the teehistorian data to feed my teeworlds AI so it can learn better on how to cheat finishes axaxax
11:55
i dont feel like the docs are bad but in general i prefer examples like on stackoverdlow over docs
Avatar
good docs should have examples
Avatar
and if your interface doesn't support short examples, you might have a bad interface (or overly complex software for some reason)
11:56
poggers
Avatar
chillerdragon BOT 2021-11-08 12:40:38Z
dafok is all this unique ptr magic do i have to use it or can i use normal pointers?
12:41
unique ptr is probs better
Avatar
chillerdragon BOT 2021-11-08 12:41:07Z
image.png
12:41
highlighted line is what i added
12:41
does it have to be a uniqe ptr too?
12:41
if u dont use a unique ptr
12:41
u have to delete the ptr urself
12:41
with their method
Avatar
chillerdragon BOT 2021-11-08 12:41:45Z
oh
12:41
i see
Avatar
that unique ptr uses a custom free function
12:41
as you can see
Avatar
chillerdragon BOT 2021-11-08 12:41:52Z
ok
Avatar
CStmtDeleter
Avatar
chillerdragon BOT 2021-11-08 12:42:13Z
class CStmtDeleter { public: void operator()(MYSQL_STMT *pStmt) const; };
12:42
where is the actual delete code? :D
12:42
just use unique_ptr
12:42
we should use them on our code too
Avatar
chillerdragon BOT 2021-11-08 12:42:30Z
ok
Avatar
its not 10998 anymore
12:42
xd
12:42
1998*
Avatar
chillerdragon BOT 2021-11-08 12:42:50Z
im not too sure how i delete it then
12:42
can i use the mysql free func?
Avatar
if you use the unique_ptr like they show you
12:43
you don't have to delete it
12:43
thats the power of smart pointers
12:43
it will delete when it goes out of scope
Avatar
chillerdragon BOT 2021-11-08 12:43:34Z
who shows me? :D
Avatar
you showed me a image
12:43
man
12:43
just show me the code
Avatar
chillerdragon BOT 2021-11-08 12:43:48Z
yes
Avatar
u are messing with me or what
12:43
xdxd
12:44
oh its in ddnet
Avatar
chillerdragon BOT 2021-11-08 12:44:23Z
Chillers contribution fork of DDraceNetwork, a cooperative racing mod of Teeworlds - ddnet/mysql.cpp at d7f0de3f2956136a1d7d34ab24271723eebe2e63 · ChillerDragon/ddnet
Avatar
what do u want to add
Avatar
chillerdragon BOT 2021-11-08 12:44:52Z
std::unique_ptr<MYSQL_RES, CStmtDeleter> m_pResult = nullptr;
12:45
but i guess i need something else than the stdmtdeleter
12:45
can i copy stmt deleted and replace type?
12:45
the deleter class just does not make too much sense to me
Avatar
CStmtDeleter is for allocated statements
12:45
idk how u allocate a MYSQL_RES
12:45
there is this boi
12:46
CStmtDelete is a wrapper around the c api
12:46
just copy CStmtDelete to CResDelete
Avatar
and use that instead
Avatar
chillerdragon BOT 2021-11-08 12:46:27Z
ok
Avatar
its ur specialty
Avatar
chillerdragon BOT 2021-11-08 12:46:34Z
sounds a bit too easy xd
Avatar
copy pasta
12:46
with 1 change
Avatar
chillerdragon BOT 2021-11-08 12:46:40Z
fakof
Avatar
chillerdragon BOT 2021-11-08 12:47:12Z
//static void DeleteResult(MYSQL_RES *pResult);
12:47
also ddnet has this trol comment
Avatar
chillerdragon BOT 2021-11-08 12:47:22Z
just to bamboozle m
Avatar
Allows to use strings instead of index for sql results. Tested with mysql and sqlite3 float Time = pSqlServer->GetFloat(1); float Time = pSqlServer->GetFloat(pSqlServer->GetID("Time"));

Checklist

  • [X] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test if it works standalone, system.c especially
  • [ ] Considered possible null pointers and out of bound...
Avatar
when joining a server you see your tee at the position you was before you left for a second, it needs a short time to update where you actually are. Feels weird and happens with 15.6
Avatar
de2f820 DbgDummy check belongs to check ingame not to sql - ChillerDragon 210b3d1 Make control flow not depend on preprocessor macros - heinrich5991 455ee32 Merge #4337 - bors[bot]
Avatar
wasnt it already released
16:28
me confused
Avatar
chillerdragon BOT 2021-11-08 16:30:24Z
@Learath2: u made me cry> If we are not using this everywhere nor do we want the performance hit, I think there isn't much use to merging this :/ Took me all day to port the code to mysql I really need it downstream for readability working with indecies up to 91 is a mess and unmaintainable
Avatar
but why u add it to upstream
Avatar
chillerdragon BOT 2021-11-08 16:31:02Z
to avoid conflicts ofc
Avatar
u know u wont get this treatment anywhere else right
Avatar
chillerdragon BOT 2021-11-08 16:31:14Z
also other downstreams might like it too
Avatar
this is straight up rare for ddnet to do this stuff xd
Avatar
Avatar
chillerdragon
also other downstreams might like it too
i doub
16:31
t
Avatar
chillerdragon BOT 2021-11-08 16:32:07Z
All the high level languages support key lookups for sql query results why shouldnt the ddnet sql lib too?
Avatar
because it just needs to be for what ddnet needs
16:32
if you need it in ur fork just code it there
Avatar
chillerdragon BOT 2021-11-08 16:32:40Z
imo it also makes ddnet code way more readable
Avatar
no because it wont be used at all
Avatar
chillerdragon BOT 2021-11-08 16:32:57Z
it could be used a lot
16:33
image.png
Avatar
it wont be used
16:33
due to perf
16:33
u know it
16:33
i know it
Avatar
chillerdragon BOT 2021-11-08 16:33:21Z
perf?
16:33
like how much time is lost
16:33
it iterates over all columns and does a string compare
16:33
how long can that take?
16:34
u want to use this
16:34
specifically where there are lot of columns
16:34
where u will get the most perf impact
Avatar
chillerdragon BOT 2021-11-08 16:34:35Z
yea
16:34
i have way more cols than ddnet xd
16:35
i prefer working and bug free code over speed :D
16:35
but we are talking about non noticable spreed diff arent we?
16:35
or did i get something wrong?
Avatar
why u have so much columns
16:35
i would refactor it
16:36
Third normal form (3NF) is a database schema design approach for relational databases which uses normalizing principles to reduce the duplication of data, avoid data anomalies, ensure referential integrity, and simplify data management. It was defined in 1971 by Edgar F. Codd, an English computer scientist who invented the relational model for d...
Avatar
chillerdragon BOT 2021-11-08 16:36:05Z
yea i plan on refactor
16:37
but thats not the point i think named columns can be nice for 2 cols already
Avatar
im sure u can do preprocessor magic
Avatar
chillerdragon BOT 2021-11-08 16:37:52Z
yea that would be nice
16:38
but still i think it is not worth it
16:38
to add some complex ass pre processor just to save a split pikomicropokto second
16:38
also idk how to :D
16:38
kernel has lot of this macro stuff i think
16:38
xd
Avatar
chillerdragon BOT 2021-11-08 16:38:58Z
add some macro that parses the query string and computes a index
Avatar
so the C overlords like it
Avatar
chillerdragon BOT 2021-11-08 16:39:16Z
ok get some linux kernel dev to improve my pr :D
16:39
i wont hold u back
Avatar
i think the preprocessor is fast at compile time since its just text replacement
16:39
unlike rust ast preprocessor
Avatar
chillerdragon BOT 2021-11-08 16:39:31Z
the rustian speaking
16:39
yea sure long compile time and good runtime is nice
Avatar
A lot of non-noticable performance drops stack up into noticable ones. Why everyone throws around clock cycles willy nilly nowadays is beyond me
Avatar
9f89a12 Add GetInt64 - ChillerDragon 9bd3bc8 Merge #4334 - bors[bot]
Avatar
Just because modern computers are fast C compilers didnt start to not optimize code because no one would notice it
Avatar
chillerdragon BOT 2021-11-08 16:46:52Z
Why everyone throws around clock cycles willy nilly nowadays is beyond me
what does that mean?
16:47
u dont understand people that say there are enough cycles?
Avatar
It means in 2021 everyone seems to act like we already achieved infinite compute power
Avatar
On the other hand, not all code lives inside of a tight loop, and optimizing code can lead to higher complexity, a common source of bugs
16:47
So ideally you have benchmarks for your important use cases and optimize based on them
16:49
When you work on something high performance basically all bugs happen because someone added another optimized waying of doing the same thing 😄
Avatar
chillerdragon BOT 2021-11-08 16:50:25Z
right yea. I understood it more like "why do people complain about cycle optimazation" but that didnt make sense :D (@Learath2)
It means in 2021 everyone seems to act like we already achieved infinite compute power
Avatar
Surely, but doesnt mean we need to literally throw away performance. This is like a very complicated way to calculate an index we already know. Literally going from O(1) to O(n) for readability
Avatar
oh, didn't realize this discussion is about the getfoo("bar")
16:54
I guess the main argument for adding the feature is that you could add/remove columns in the query and have to update all the indices manually to access
Avatar
Anyway, likely doesnt make any difference given this all happens in a thread. I see it as wasteful, but I wont stop anyone from merging. If you do merge tho please use it everywhere, nit jjst randomly
Avatar
chillerdragon BOT 2021-11-08 16:55:41Z
i made one example
16:55
not knowing if it will merged or changed
16:56
to save useless effort
16:56
also i am not too well versed with those crazy sql queries did not want to break things
Avatar
Jupstar ✪ BOT 2021-11-08 17:00:40Z
if its only about readability, use enums or constexpr vulkan also doesn't know uniform names anymore, unlike opengl, so you have to know the layout of your code :D all in for performance, the best xdd
Avatar
chillerdragon BOT 2021-11-08 17:53:11Z
So i Need a set of enums for every query that does not sound like a improvement or more readability at all. Idk how to use constexpr
Avatar
Jupstar ✪ BOT 2021-11-08 18:03:33Z
why is it not more readable?
18:04
but yeah for every query
Avatar
i don'T see how constexpr helps here either
18:08
only static vars would work, but then calling it is not nice
Avatar
Jupstar ✪ BOT 2021-11-08 18:08:13Z
static constexpr COLUMN_TIME = 1
18:08
its safer
18:08
in strings you can do errors, in compile time variables you cant
18:08
"Tine"
Avatar
and then you add a new column and have to update all static constexprs
Avatar
Jupstar ✪ BOT 2021-11-08 18:09:10Z
yes, thats why enums
18:09
depending on the data
Avatar
FWIW, a lot of engines do SPIR-V reflection on the shaders so you don't have to perform duplicate work in multiple places. Once you get to bindless you are probably at the point where you aren't hard-coding values. Theoretically if you offload this to startup there is minimal overhead. just static uint32_t column_time and just lazily initialize/update it?
19:15
fun cpu bug debug story
Avatar
Add uint_to_bytes_be and bytes_be_to_uint functions from upstream and use them where applicable to reduce duplicate code.

Checklist

  • [X] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test if it works standalone, system.c especially
  • [ ] Considered possible null pointers and out of bounds array indexing
  • [ ] Changed no physics that affect existing map...
Avatar
Makes the server send the switch state of other players while spectating others, otherwise the switch state of your own player (including when spectating in freeview). Also changed the client a little to both handle situations where the server only sends one SWITCHSTATE netobject (then it just uses that team) or all (then it chooses the team that maintains the above behavior). I'm not sure if the latter would really be useful (but since the netobject contains a team it would be possible to...
Exported 245 message(s)