IRC logs for #openttd on OFTC at 2024-11-20
⏴ go to previous day
02:02:12 *** herms has quit IRC (Quit: bye)
02:32:14 *** tokai|noir has joined #openttd
02:32:14 *** ChanServ sets mode: +v tokai|noir
02:38:59 *** tokai has quit IRC (Ping timeout: 480 seconds)
03:16:00 *** debdog has quit IRC (Ping timeout: 480 seconds)
04:46:47 <DorpsGek> - Update: Translations from eints (by translators)
08:28:06 <peter1138> it depends on allowed_cargo_classes being set.
08:41:44 <peter1138> kuhnovic: oh yeah, I looked at the one, there is another save someone that I dug out that does crash. Because a ship is ON a dock tile, which has no track bits.
08:42:34 <truebrain> and you didn't add that information to the ticket?! 😛
08:42:48 <peter1138> No I did the usual thing of muttering in chat.
08:43:00 <truebrain> We need an AI that spots these conversations and adds it to the ticket
08:43:04 <truebrain> I am sure that solves this problem
08:43:09 <truebrain> and not at all introduce thousands of others 😛
08:43:18 <peter1138> And I've done it again.
08:50:54 <kuhnovic> Yeah she's proper stuck
08:51:15 <kuhnovic> Doesn't seem to assert though
08:58:21 <peter1138> Both trt03.sv1 and trt04.sv1 assert for me.
09:01:19 <peter1138> Ah, performance testing.
09:02:40 <kuhnovic> You should never do that
09:04:36 <truebrain> I have different build-folders for that exact reason 😄
09:04:44 <truebrain> also clang vs gcc and stuff 🙂
09:10:51 <LordAro> almost like that's what cmake was designed to be able to do :)
09:11:03 <peter1138> I've got a build-gcc and a build-mingw
09:11:13 <peter1138> Actually there's a build-arm but I don't think that ever worked.
09:11:37 <peter1138> The mingw binary is 635MB
09:14:33 <peter1138> Sometimes I load Wentbourne and cry that it's slower these days.
09:14:56 <peter1138> But part of that was 30ms to 27ms per tick... 😄
09:17:32 <LordAro> i'm still surprised how few people actually noticed that
09:26:21 <peter1138> Hmm, 836ms down to 51ms.
09:33:59 <truebrain> (I am just here today for the entertainment)
09:36:17 <Rubidium> shouldn't it be less? ;)
09:53:24 <xarick> kuhnovic: hmm... don't ignore start tile might solve?
09:54:03 <xarick> im not fully commited to looking into it yet
09:56:17 <kuhnovic> That won't solve it. We don't consider reversal of the ship to be an option. In these cases reversal is the only way out, so the PF doesn't find a path.
09:56:57 <kuhnovic> I tried always including reversal in the PF search, but that caused more issues than it solved. I need to have another try at this.
10:01:08 <truebrain> Rubidium: yeah, but LESSS LESSS LESSSSSSS, sounds weird 😛
10:08:46 <kuhnovic> What are you optimizing? Still the industry creation?
10:08:54 <xarick> after all this work I get disappointing results 😦
10:10:40 <LordAro> but yeah, that do happen sometimes
10:11:18 <kuhnovic> Especially if you just try stuff without properly understand what it does and how it's supposed to make things faster
10:11:50 <LordAro> but often even when you (think you) do understand it
10:12:31 <kuhnovic> Hehe those are the worst. When it should be faster on paper, but instead it became worse.
10:12:53 <yiffgirl> computers are haunted.
10:16:38 <peter1138> truebrain: Sadly this only affects loading performance. It's kinda irrelevant.
10:16:59 <peter1138> And to reduce time throws memory at the problem, although that memory can be released once loaded.
10:22:32 <peter1138> Or maybe not, it might help during the game too.
10:42:40 <xarick> IsAnyContained shouldn't be slower 😦
10:44:14 <peter1138> And you making it slower by TicTocing it every go?
10:45:50 <xarick> if I don't TicToc, how would I measure
10:56:11 <kuhnovic> Tictoc 1000 runs instead, or some other number that makes sense
10:56:56 <kuhnovic> Measuring something in the microsecond / nanosecond scale generally doesn't work, the clocks aren't precise enough and the overhead of timing becomes significant
10:57:59 <xarick> I'm going to do the unthinkable
10:58:54 <xarick> almost the same code without the added fluff to suit both original needs (which is fast), and my needs (slow)
11:01:18 <xarick> FindNearestExcept in GetClosestIndustry actually got a gain
11:01:49 <pickpacket> Looking at my donations account now. At the end of the year I'll be donating almost £40 to the project :) Feels good
11:03:34 <xarick> IsAnyContained in FindTownForIndustry went from 96159623 to 54734253
11:04:06 <xarick> but then... you have TypeList with 148804 , absolutely murdering kdtree
11:05:02 <xarick> 148804 is kinda on the too low side... seems suspicious
11:05:12 <xarick> but maybe it is what it is
11:07:03 <xarick> why don't I have results for TownIndustries pairs 😦
11:17:22 <johnfranklin> BAD FEATURE of UK: any good weather goes away in hours
11:27:05 <belajalilija> Are you just finding that out?
11:33:43 *** reldred has joined #openttd
11:33:43 <reldred> UK has no good features.
11:39:59 <LordAro> did we get rid of version specific release pages?
11:40:12 <LordAro> /latest would suggest not...
11:48:23 <peter1138> Oh, I've broken things again.
11:49:03 <peter1138> ln -s changelog.md changelog.txt?
12:23:31 <LordAro> how much extra memory usage? :p
12:31:44 <kuhnovic> This is where you realize no industries are generated 😛
12:32:36 <peter1138> That would be surprising.
12:35:20 <xarick> I can't do any better than this with kdtree solo
12:36:32 <xarick> so... kdtree as a solo solution ... rip
12:37:01 <xarick> but as a combination with another, not sure you're willing to have this much complexity
12:38:00 <peter1138> Reason: Out of sprite memory
12:42:20 <peter1138> Okay, master did the same.
12:43:02 <peter1138> Memory-wise it's... quite a bit. Hmm.
12:55:57 <kuhnovic> Time to download some more RAM
12:56:17 <peter1138> I think it's some interaction with -v null.
13:28:02 <peter1138> Recolour sprites are loaded on load.
13:28:45 <peter1138> My NewGRF selection has 3856 recolour sprites for whatever crazy reason. It might be Iron Horse.
13:29:37 <peter1138> Sorry, that's how many it sees before the game crashes.
13:30:01 <peter1138> (257 + some padding) * 3856 is filling the sprite cache on load.
13:40:31 <peter1138> Nice, it's full of bugs.
13:45:06 <peter1138> 360KB of iron horse recolours.
13:46:09 <peter1138> The different sets of xUSSR use a few too.
13:46:35 <peter1138> Okay, so when using -v null the sprite cache is minimal size.
13:46:43 <peter1138> Because... there's no video, why would you load sprites?
13:46:48 <peter1138> Except recolours are always loaded.
13:47:05 <peter1138> Current sets treat recolours as a disposable resource, so they have thousands of them.
13:47:12 <peter1138> This fills up the sprite cache.
13:47:50 <peter1138> Recolours are loaded on load, and never purged, so the sprite cache is filled with thousands of recolours, leaving less space for actual sprites.
13:50:02 <peter1138> My solution... cache recolours just like any other sprite.
13:50:11 <peter1138> Don't load on load, and allow them to be unloaded.
13:50:30 <_glx_> one recolour sprite per variant probably
13:51:06 <peter1138> Which also fixes the other bug: If you replace a recolour sprite, the original recolour sprite is load, but its data is in the sprite cache and never released because recolours are not released from the sprite cache.
13:51:59 <peter1138> Maybe. There's probably some scope for reuse at least
13:52:44 <peter1138> With my rgba colour patch recolours can be 1280 bytes too...
13:53:27 <peter1138> Or maybe it was 1024. M + RGB
13:53:51 <_glx_> nml tends to hide the recolour size, as only the modified slots are in the file
13:54:07 <_glx_> but any unmodified is also written in grf
13:54:53 <_glx_> and with 2cc recolours it's even worse
14:08:44 <peter1138> Making ReadRecolourSprite seek to the correct place might help.
14:18:46 <peter1138> It does spritecache churn a bit. A lot. I prresume that's the code that scans for the largest sprite on load to work out the depot size.
14:19:04 <peter1138> IIRC JGRPP can load the size separately.
15:10:22 *** XYZ has quit IRC (Remote host closed the connection)
15:17:43 <xarick> there's something wrong in the kdtree imo
15:18:04 <xarick> DistT... it isn't defined anywhere
15:20:00 <mnhebi> a lot of compilers will assume int if nothing is defined
15:20:13 <mnhebi> there are some that are evil however and go "string" and you got mayhem
15:20:16 <LordAro> only in C, and even then it'll shout about it
15:20:37 <LordAro> and no C compiler in the universe assumes strings
15:20:56 <mnhebi> LordAro: i've used some very custom compilers :3
15:20:59 <xarick> ``` DistT ManhattanDistance(const T &element, CoordT x, CoordT y) const
15:20:59 <xarick> return abs((DistT)TxyFunc()(element, 0) - (DistT)x) + abs((DistT)TxyFunc()(element, 1) - (DistT)y);
15:20:59 <xarick> this is the only thing that is attempting to define it: "abs"
15:21:45 <LordAro> also you seem to be conflating "define" and "use"
15:22:58 <peter1138> Yeah, it should really be Tdist.
15:23:05 <peter1138> But, uh, it's definitely defined.
15:24:58 <xarick> I wanted to make it uint32_t
15:25:31 <xarick> but it's a misterious "int" out of whatever abs does there
15:25:45 <peter1138> There's nothing mysterious about it.
15:26:03 <mnhebi> I vote we open up a Xarick rubber duck donation fund.
15:27:32 <xarick> it's int, because only of abs
15:28:13 <LordAro> why do you want to pass in an unsigned in into abs?
15:28:17 <LordAro> what would you expect it to do?
15:28:29 <LordAro> why do you insist on wasting everyone else's time by posting such nonsense?
15:40:27 <xarick> I don't understand the magic happening here
15:41:08 <merni> `abs` is a C function that returns an int
15:41:14 <merni> You can't expect it to return something else
15:41:34 <merni> xarick: This tells you as much
15:42:22 <xarick> I'm talking about who decides what DistT becomes underneath 😦
15:42:52 <LordAro> have you looked at line 34 yet?
15:43:10 <mnhebi> where can I look up line 34, I wanna see this.
15:43:16 <xarick> template <typename T, typename TxyFunc, typename CoordT, typename DistT>
15:43:35 <xarick> typename makes things int?
15:44:34 <LordAro> you've definitely done templates before
15:44:50 <mnhebi> I mean excuse my ignorance, but doesn't typename except something after the name of the thing you want to type?
15:45:40 <peter1138> Here's another clue: station_kdtree.h:25
15:45:55 <peter1138> I shouldn't spoonfeed but it's painful.
15:46:10 <peter1138> (But also this isn't ##c on IRC)
15:46:15 <LordAro> ask copilot to tell you about templates
15:47:02 <peter1138> It always made sense.
15:47:29 <peter1138> -v null:ticks=0 doesn't quite do much 😄
15:47:48 <peter1138> It quits before it gets to processing the -g
15:48:07 <xarick> my lack of experience is showing
15:50:54 <xarick> so, for industries, I want this to be uint32_t, now I know where to set it
15:53:58 <peter1138> You don't because ManhattanDistance won't work properly.
16:01:49 <peter1138> I'm not sure why you'd want to do it.
16:02:04 <peter1138> int32_t should be more than enough for all distances.
16:02:15 <peter1138> If it isn't enough there is int64_t, but I find that unlikely.
16:03:45 <xarick> it's for GetClosestIndustry
16:04:04 <mnhebi> yeah but why does it have to be uint32_t?
16:04:21 <xarick> I have a FindNearestExcept... but the "except" part is complicated to deal with
16:05:11 <xarick> so when the node it is comparing against is the "except" one, i want the max value of dist for it, uint32_t would be ideal
16:05:15 <_glx_> most likely doing it wrong
16:05:16 *** HerzogDeXtEr has joined #openttd
16:05:43 <xarick> to match the same as best_dist in the main function
16:05:45 <mnhebi> whats so ideal about uint32_t compared to the other standardized int types?
16:10:55 <xarick> I replaced the abs with Delta in kdtree, wondering if this is fine
16:11:13 <xarick> will it deal with the sign/unsign issue
16:26:29 <_glx_> can't you just do something like `DistT thisdist = (n.element == <the except one>) ? std::numeric_limits<DistT>::max : ManhattanDistance(n.element, xy[0], xy[1]);` ?
16:27:42 <_glx_> of course if there's only 1 element it will be returned
16:27:54 <xarick> yes, that's the one thing I'm trying to deal with
16:28:28 <peter1138> Get the nearest element, then test its distance.
16:29:44 *** Wormnest has joined #openttd
16:29:53 <_glx_> yeah check distance in FindNearest() and return invalid in this case
16:30:59 <_glx_> might need an extra template param for invalid value
16:31:03 <xarick> returning invalid is complicated too
16:31:25 <xarick> because invalid is also passed to GetClosestIndustry valid
16:31:58 <xarick> sec, let me show my code
16:33:16 <xarick> oops, conflicts i need to solve
16:33:46 *** gelignite has joined #openttd
17:26:53 <xarick> Kdtree_ViewportSignXYFunc uses inline int32_t operator()
17:37:24 <xarick> hmm, some of these industries producing passengers seems odd
17:37:45 <xarick> or is this how ECS works?
17:41:56 <xarick> nevermind, wrong newgrf
17:55:34 *** XYZ has quit IRC (Ping timeout: 480 seconds)
18:40:30 <peter1138> Even more things to go wrong when andy rewrites newgrfs mid game 😉
18:41:52 <peter1138> Betting there's a size_t issue there somewhere...
18:47:31 <xarick> almost looks like it's broken
18:53:13 <xarick> this call stack is quite deep now with kdtree doing recursives on top of NewGRF Resolves
18:59:12 <_glx_> yes, if there's too much you trigger a stack overflow
20:16:28 <xarick> the first usage of GetClosestIndustry that does not involve INVALID_INDUSTRY
20:16:47 <xarick> and it is to tell the world they're going to close
20:19:13 <xarick> FindNearestExcept is called, maybe to see if there were others of the same type around?
20:28:31 <xarick> is std::optional overhead bad?
20:29:01 *** virtualrandomnumber has joined #openttd
20:29:29 *** virtualrandomnumber has quit IRC ()
20:30:50 *** gelignite has quit IRC (Quit: Stay safe!)
21:08:56 *** Flygon has quit IRC (Read error: Connection reset by peer)
21:11:28 *** nielsm has quit IRC (Ping timeout: 480 seconds)
21:43:31 <LordAro> what's paramc used for? could it be removed by using a vector?
21:46:58 <xarick> I'd like to make a pointless refactor
21:47:23 <LordAro> unless you can justify it
21:47:28 <LordAro> in which case it would not be pointless
21:47:45 <LordAro> working code should not be touched without good cause
21:47:53 <xarick> it's just so I could debug easier :9
21:48:15 <LordAro> then probably not, no
21:48:29 <LordAro> again, unless you can justify it
21:50:29 <LordAro> that does feel like a long if condition
21:50:47 <LordAro> but no, i wouldn't change that without other cause to do so
21:50:50 <peter1138> LordAro: Yes, that also removes the arbitrary limit of 20 parameters.
21:51:19 <peter1138> (In fact, I was doing that change first, but wanted to remove the usage of ZeroedMemoryAllocator)
21:51:47 <LordAro> xarick: you are of course welcome to make the changes for your own debugging
21:52:00 <LordAro> there's no need for anyone else to see it though
21:52:56 <xarick> it would involve a tuple, so i guess bad for performance
21:54:51 <peter1138> Pointless refactors you say?
21:55:17 <LordAro> code is cleaner/more efficient is perfectly valid
21:55:24 <LordAro> it is a sliding scale though :p
21:55:57 <peter1138> There's some that doesn't make to switch.
21:56:01 <peter1138> This is about it for now.
21:57:00 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
22:01:20 <xarick> I better leave it as is
22:04:51 <xarick> I have a tendency to make tiny changes, only then to revert them
22:05:12 <xarick> but by hand because I don't commit
22:05:47 <LordAro> i recommend `git restore -p`
22:05:56 <LordAro> whatever UI you're using might have an equivalent
22:07:44 <LordAro> squashing can happen at the end
22:19:13 <peter1138> I'll try testing it ;p
22:24:51 <peter1138> Funny. -1 is the default value of that parameter.
22:25:00 <_glx_> oh it's from the char* time
22:25:08 <peter1138> Nearly every caller uses -1.
22:25:48 <_glx_> yeah the char* version requires the len, while std::string has a default
22:27:17 <_glx_> and most of the code was written before we added std::string support
22:28:09 <_glx_> it's rare, but I think some parts of script API use it
22:28:46 <xarick> You guys don't use @brief right?
22:28:46 <xarick> copilot likes to put @brief in function descriptions
22:29:20 <_glx_> ah no, only one outside json stuff: * @brief MIDI music player for MacOS X using CoreAudio.
22:35:19 <xarick> pondering whether I want to keep a global kdtree or just remove it and just accept the performance loss which in the grand scheme, is basically 1 second
22:35:35 <xarick> cus it's already too fast
22:36:12 <peter1138> Hmm, ScriptText fills parameters up to 20 to "match FormatString"
22:43:44 <xarick> a variable with a static storage duration cannot be captured in a lambda
22:43:59 <xarick> then why does it work?
22:46:04 <kuhnovic> xarick: Some wisdom is starting to seep through
22:47:10 <_jgr_> xarick: If it is static storage duration it does not need to be captured
23:01:17 <xarick> did you create a separate commit?
23:04:04 <xarick> I'm about to create the PR for Kdtree
23:04:26 <xarick> but it has a fix that was made on 13094
23:05:16 <xarick> that fix would also apply for the kdtree, but not much on the current master, it can live without it
23:05:45 <xarick> not sure how to proceed
23:10:05 <xarick> [CheckIfFarEnoughFromConflictingIndustry] 63539 us [avg: 0.0 us] that's funny
23:10:19 <xarick> I thought I was gonna make it slower, turns out it's faster
23:11:23 <xarick> 200929 it's faster! but it's meaninglessly faster
23:12:53 <xarick> well, the FindNearest with the exclusion became slower... hmm
23:13:57 <xarick> and this change is goin to affect everywhere kdtree is used 😦
23:16:57 <xarick> tomorrow I'll think about what to do
23:20:26 <_glx_> peter1138: it could use more parameters, but when it was written there was only _global_string_param IIRC
23:24:13 <_glx_> ah no it was always separate array of the same size
23:24:36 <peter1138> Yeah, when we had all those script string issues I thought it was SetDParam related...
23:24:43 <peter1138> But, uh, it's not using that at all it seems.
23:26:58 <_glx_> I wonder if we could have a VectorStringParameters
23:27:43 <peter1138> I've got a branch to allow Script to have more than 20 parameters, which is why I was wondering about the filling-to-20 bit 🙂
23:28:01 <peter1138> Not sure what purpose that's serving.
23:29:37 <peter1138> I've also got a few... stashes... towards making normal strings more roust.
23:31:12 <_glx_> IIRC it fills up to max because some broken strings may try to read not set values
23:31:47 <peter1138> And that's possible with GS?
23:32:16 <_glx_> everything is possible with GS, that's why I added validation
23:32:36 <peter1138> I mean... is it possible to have a test case? heh
23:33:22 <_glx_> and the filled values are only read during validation, they are not actually put in encoded string if not needed
23:36:41 <_glx_> so ScriptText uses a vector like an array of 20 elements
23:37:58 <_glx_> but maybe I added too much safety 🙂
23:41:00 <_glx_> could be to not trigger "not enough parameter" too much, because old pre-validation and unmaintained scripts are still available on bananas
23:41:24 <_glx_> that way they still "work"
23:42:33 <peter1138> Okay, so if I'm extending it to be variable size, then I could fill parameters up to 20 "just-in-case", but if the real paramaters are longer than that then it's doesn't matter, no filling happens.
23:43:18 <LordAro> what if there's an old prevalidation script that does GetParam(999) or something really daft?
23:43:51 <_glx_> they don't have GetParam
23:44:13 <LordAro> something that attempts to get >20 params
23:45:10 <_glx_> they gain a bonus of not crashing
23:45:28 <peter1138> They create 999 parameters, for no reason.
23:46:05 <_glx_> but pre-validation was always limited to 20 params
23:46:12 <peter1138> I can add a new limit, but who's to say what a good limit is?
23:46:23 <peter1138> Authors are hitting 20 and "complaining" 🙂
23:51:50 <_glx_> as long as validation eats params like FormatString would do it should be fine
continue to next day ⏵