IRC logs for #openttd on OFTC at 2024-11-14
            
00:50:26 *** Compu has joined #openttd
02:31:45 *** tokai|noir has joined #openttd
02:31:45 *** ChanServ sets mode: +v tokai|noir
02:38:28 *** tokai has quit IRC (Ping timeout: 480 seconds)
03:19:33 *** D-HUND has joined #openttd
03:23:05 *** debdog has quit IRC (Ping timeout: 480 seconds)
04:00:44 *** D-HUND is now known as debdog
05:01:35 *** keikoz has joined #openttd
05:38:18 <DorpsGek> [OpenTTD/OpenTTD] Release workflow was not successful https://github.com/OpenTTD/OpenTTD/actions/runs/11831122824
06:19:44 *** keikoz has quit IRC (Ping timeout: 480 seconds)
06:49:07 <truebrain> Pfff, no new translations is another failed nightly πŸ˜›
07:22:26 <DorpsGek> [OpenTTD/OpenTTD] felixprigge updated pull request #12683: Fix: Timetable precision https://github.com/OpenTTD/OpenTTD/pull/12683
07:32:58 *** keikoz has joined #openttd
08:36:53 *** HerzogDeXtEr has joined #openttd
09:34:43 *** mindlesstux has quit IRC (Quit: The Lounge - https://thelounge.chat)
09:35:43 *** mindlesstux has joined #openttd
09:47:12 <peter1138> reldred: we're both not very good at keeping misskey up to date, eh?
09:52:52 <reldred> peter1138: God no. I update it when someone yells at me loudly enough.
09:53:37 <peter1138> πŸ˜„
09:53:53 <peter1138> I'm not yelling this time, I just noticed mine...
09:54:59 <xarick> hi
10:58:18 <peter1138> Ok, seems moving chunks of data once a month is cheaper than maintaining a position. (ringbuffer style)
11:44:12 <xarick> what a joke ! How can I even find what's the error <https://gist.github.com/SamuXarick/c4643c3551415c8e2103bb6ce3570445>
11:49:32 <LordAro> it's the one right at the top, as usual
11:51:13 <xarick> oh, i found where the problem was
11:51:26 <xarick> `std::erase(counts[type], pair_it);`
11:53:01 <xarick> how can this generate a 6000 lines error message is beyond me
11:53:15 <LordAro> templates are real fancy
11:54:44 <andythenorth> generated code is the best code
11:56:20 <peter1138> It's not quite that many lines, it's multiple errors as it's compiling multiple files.
12:00:24 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1306589549392298105/image.png?ex=673737d7&is=6735e657&hm=c1715c6121f2321d990e87addbba01e26454467b3c481ab4faac2c7ae94a09d8&
12:00:24 <peter1138> Okay, that's quite special AI work there.
12:04:03 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1306590468590665798/image.png?ex=673738b2&is=6735e732&hm=9483b6865eee4042ec87f9a3e55c78c23fc35cda95d1856a4624a1becdc43cba&
12:04:03 <peter1138> More bloat
12:04:21 <xarick> wow, that on towns is interesting
12:05:02 <xarick> gives us a quick glance if it's growing
12:06:47 <xarick> ``` assert(std::ranges::all_of(pair_it->second, [&](auto &iid) {
12:06:47 <xarick> return Industry::Get(iid)->town == town;
12:06:47 <xarick> }));``` This is some kind of assert
12:07:06 <xarick> and is asserting 😦
12:09:39 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1306591878082334780/image.png?ex=67373a03&is=6735e883&hm=c80561f340cf22217510516206869eaa7cc54e81ab24eb3a42082a890b54071c&
12:09:39 <peter1138> Well, it's ... data. It's not all that interesting though.
12:13:43 <xarick> `counts[type].emplace_back(ind->town->index, ind->index);` this is not inserting the way I want
12:14:19 <peter1138> That looks like a very strange data structure.
12:14:52 <xarick> i wand to insert a vector containing ind->index on the primary vector
12:15:30 <xarick> std::pair<TownID, std::vector<IndustryID>>
12:15:49 <xarick> hmm must think
12:16:20 <xarick> `static std::array<std::vector<std::pair<TownID, std::vector<IndustryID>>>, NUM_INDUSTRYTYPES> counts; ///< Number of industries per type ingame in each town`
12:17:32 <xarick> i need to create a temp vector with the IndustryID?
12:18:02 <xarick> std::make_vector exists?
12:18:58 <xarick> nope
12:19:28 <peter1138> Yeah, arrays of vectors of pairs with vectors definitely indicates you are going about this the wrong way.
12:23:46 <xarick> crap, it created a vector of size 0, because the ind->index is 0, that's not what I want
12:24:33 <xarick> I want it to create a vector, then insert the ind->index into it, then emplace_back on the primary vector
12:25:13 <xarick> `counts[type].emplace_back(ind->town->index, std::vector<IndustryID>{ ind->index });` maybe?
12:27:18 <xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1306596318973657118/image.png?ex=67373e25&is=6735eca5&hm=1a7bd78edaa232777c6ca41028e2d4fb785ac6c23adcf5e76e1dde86c171af13&
12:27:18 <xarick> aha, it works!
12:28:29 <xarick> if only I could give names to these members
12:28:44 <xarick> first is TownID, second is vector of IndustryIDs
12:32:10 <xarick> nice, no more asserts
12:32:32 <xarick> oh got a crash instead, πŸ™‚
12:34:37 <xarick> oh I got it
12:34:48 <xarick> creating an industry but still didn't assign the town to it
12:35:19 <xarick> ez fix
13:11:29 <andythenorth> lunch?
13:15:01 <peter1138> Too late.
13:29:21 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1306611937429422151/image.png?ex=67374cb1&is=6735fb31&hm=943f1f7b0a993c610308117c7bd7ab701611ff6a68fdcae26ec8b3c76b20c884&
13:29:21 <peter1138> Hmm, what makes the town algorithms start off with a bump in supply?
13:30:33 <andythenorth> πŸ‘€
13:32:36 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1306612752877486132/image.png?ex=67374d73&is=6735fbf3&hm=c1361aa858e889ddc7f77bb0b5aca0e5684d014d9c8edd26281a46a0cd8ac1ad&
13:32:36 <peter1138> Ooh, an outlier!
13:33:05 <peter1138> (Probably because it's a tiny place with barely any production)
13:57:55 <xarick> > /* Count only those who match the same industry type and layout filter
13:57:55 <xarick> > * Unfortunately, we have to do it manually */
13:57:55 <xarick> If this was a function, what would be the name?
13:58:48 <andythenorth> CountIndustryMatchingTypeAndLayout
13:58:50 <andythenorth> or something
13:58:52 <andythenorth> ask GPT
13:58:57 <xarick> sounds about right
13:59:03 <andythenorth> or do what I do, call it CountIndustryCABBAGE
13:59:08 <andythenorth> then see if it's useful
13:59:13 <andythenorth> then find-replace later
14:00:28 <peter1138> MOAR STATS?
14:00:41 <peter1138> What's the point, eh?
14:02:13 <andythenorth> Stats GS
14:02:20 <andythenorth> VisualisationScript?
14:02:30 <andythenorth> NodeJS running in OpenTTD?
14:02:43 <andythenorth> lambdas for charts?
14:02:54 <xarick> okay so now I just don't want the number, I want a list of them
14:03:02 <xarick> let's see if I can do this
14:06:32 <peter1138> GS-charts?
14:07:04 <andythenorth> GS-chart-js
14:07:12 <peter1138> threejs?
14:09:28 <xarick> `static inline std::tuple<uint16_t, std::vector<IndustryID>> &GetIndustryTypeCount(IndustryType type, Town *town = nullptr)`
14:09:45 <xarick> returns the count and a vector with them
14:10:03 <xarick> or maybe just return the vector then count it
14:10:12 <xarick> must decide
14:40:55 <peter1138> Hmm.
14:42:42 <peter1138> Okay, with this town history data less memory is used, though performance is probably affected because there's necessarily more work to do.
14:44:10 <xarick> ```protected:
14:44:10 <xarick> /**
14:44:10 <xarick> * Array containing vectors of industry types.
14:44:10 <xarick> * Each vector corresponds to a specific industry type and
14:44:10 <xarick> * contains pairs of TownIDs and their associated lists of IndustryIDs.
14:44:10 <xarick> */
14:44:10 <xarick> static std::array<std::vector<std::pair<TownID, std::vector<IndustryID>>>, NUM_INDUSTRYTYPES> counts;```
14:44:28 <xarick> good english thx to Copilot
14:46:49 <xarick> how do I explain the rules I went for with the vectors?
14:49:28 <xarick> if a town has no industry of certain type, delete the pair
14:52:49 <xarick> the vectors corresponding to a specific industry type are at a minimum empty, not deleted
14:53:44 <mnhebi> If Xarick keeps going like this we'll be able to run our OpenTTDs on old Amigas at this rate.
14:59:32 *** nielsm has joined #openttd
15:05:21 <peter1138> Oh, that is beautiful. The Onion... bought Info Wars.
15:05:27 *** Flygon has quit IRC (Read error: Connection reset by peer)
15:06:17 *** belajalilija has joined #openttd
15:06:17 <belajalilija> i thought that was satire
15:06:19 <belajalilija> googled it
15:06:28 <belajalilija> that really is beautiful
15:18:51 <peter1138> The right wing are crying a bit...
15:19:09 <peter1138> Well, the part who paid attention to that lot.
15:24:31 <belajalilija> good
15:24:45 <belajalilija> going backrupt to be owned by the libs :kek:
15:26:17 <xarick> I'm too noob for templates
15:33:57 <xarick> ``` template <typename Func = decltype([]{})>
15:33:57 <xarick> static inline uint16_t GetIndustryTypeCount(IndustryType type, const Town *town = nullptr, Func func = []{})```
15:34:05 <xarick> Copilot failing me
15:34:27 <peter1138> Just spamming keypresses at this point.
15:34:29 <xarick> how do i make a default parameter of function
15:35:37 <xarick> wanna make a function that does nothing
15:35:56 <xarick> or a function that does things if I prove one
15:37:07 <peter1138> Hmm, tracking an average without keep all the past values?
15:41:31 <LordAro> peter1138: much chortling
15:48:22 <peter1138> <https://www.reddit.com/r/openttd/comments/1gr0rtw/tomorrows_the_big_day_join_us_live_for_the/>
15:48:33 <peter1138> Weird random 3rd party site to link to. But whatever.
15:49:30 <mnhebi> a function that does nothing is not a function.
15:49:34 <mnhebi> Its in the name, function
15:49:48 <mnhebi> eg has a purpose.
15:52:46 <xarick> missing default argument for parameter 3
15:53:39 <peter1138> If your Func has to be present, don't put it after the optional parameter.
15:54:13 <peter1138> (If Func doesn't need to be present then you have other issues...)
15:54:28 <mnhebi> :WHATdidyousay:
15:56:24 <xarick> it doesn't need to be present, I wanna make it optional
15:56:39 <xarick> but i need a default argument 😦
15:56:48 <mnhebi> then make one?
15:57:00 <_jgr_> peter1138: I tend to go for exponentially weighted moving averages for this sort of thing. You only need one value of state.
15:57:28 <mnhebi> https://www.geeksforgeeks.org/templates-cpp/ just read this Xarick
15:57:29 <mnhebi> please
15:57:40 <mnhebi> the whole thing
16:01:11 <johnfranklin> How to read x in xarick? Egzarik? Zarik? Tzarik? Harik?
16:01:49 <xarick> Sharik
16:02:51 <johnfranklin> Oh
16:19:47 <xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1306654825177550888/image.png?ex=673774a2&is=67362322&hm=e750430d15614a5d4e30ce4aa4a82f9fcbb2ed30df54066aec83197597600d90&
16:19:47 <xarick> hmm that's something
16:40:52 <_glx_> xarick: that kind of construct is definitely a big no
16:53:07 <xarick> how do I improve it?
16:53:16 <xarick> a struct?
16:54:45 <_glx_> the first step is too clearly define the objective, storing a bunch of stuff is usually not the solution
16:59:18 <xarick> I want to create a `CountIndustryMatchingTypeAndLayout` in the newgrf_industries.cpp file
16:59:33 <xarick> hopefully a fast one
17:21:47 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1306670427807940658/image.png?ex=6737832a&is=673631aa&hm=8b1b2681ddb3a7880a43168c56e4d0159ecc8b421cb49fa910c5e1572afe09e3&
17:22:00 <peter1138> Hmm, wonder what this slow memory release in LZMA is...
17:22:06 <peter1138> Am I backdoored? πŸ˜„
17:32:01 <xarick> may I have someone's attention?<https://gist.github.com/SamuXarick/c21cdc82d17a5da4dd84aef9d2dc0f19>
17:32:01 <xarick> I can't do it
17:52:42 <LordAro> peter1138: lol
18:10:34 <xarick> hallelujah!
18:11:05 <xarick> ``` template<typename Func = std::function<void(Industry *)>>
18:11:05 <xarick> static inline uint16_t GetIndustryTypeCount(IndustryType type, const Town *town = nullptr, Func func = [&](Industry *) { })``` this works
18:12:35 <xarick> not even Copilot could give a straight answer, I had to figure out myself
18:14:46 <LordAro> pretty sure the `&` should be unnecessary
18:15:23 <xarick> ok let me try without
18:16:18 *** brickblock19280 has joined #openttd
18:16:18 <brickblock19280> What is the reason for using cargo IDs for overriding other cargos instead of labels like with road and railtypes?
18:18:09 <peter1138> The NewGRF spec for cargoes predates anything to do with labels.
18:19:01 <peter1138> It also means that the 12 default cargo slots can be overridden easily.
18:20:18 <peter1138> Like, cargos have a label property, but it came way later which is why it's property 0x17, not 0x08 like rail/road types.
18:25:20 <brickblock19280> I guess the override would be a reason not to change it
18:26:11 <andythenorth> it's also kind of fine as is
18:26:46 <andythenorth> I think most of the issues might now be fixed
18:37:50 <peter1138> Not being able to get rid of the default rail/road types is a bit awkward.
18:38:44 <peter1138> Cargo types support GRM to allow cooperation, but that is fiddly.
18:39:22 <brickblock19280> andythenorth: It would be nice to be able to load multiple smaller industry sets together without coordination like ecs
18:39:51 <andythenorth> fair point
18:40:59 <peter1138> Another issue with the dynamic approach that rail/road types take is the NewGRF has no indication that there are not enough slots remaining.
18:41:03 <peter1138> (How would it)
18:41:51 <xarick> you were right peter1138 LordAro, thx
18:41:53 <brickblock19280> Having a variable for that would be cool but probably really hard to implement
18:42:21 <xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1306690706047504394/image.png?ex=6737960d&is=6736448d&hm=8806554d4621081bc7260a99c3f663c24f03de65b2330b3c23bc4fd42dfea7a8&
18:42:21 <xarick> testing for asserts now
18:44:25 <peter1138> Well, the game knows how many labels are going to be loaded.
18:44:54 <brickblock19280> Not if I make it conditional on the var
18:47:11 <peter1138> Solution: Infinite cargo types.
18:47:39 <peter1138> Of course, industries and industrytiles have another system that also has limits...
18:47:57 *** audigex has joined #openttd
18:47:57 <audigex> peter1138: AI generated cargo types, unique to each map seed
18:48:39 <peter1138> It would be relatively... possible... to make cargo slots per-GRF, and then combine them dynamically so that the actual ID used doesn't matter.
18:49:22 <peter1138> But there's need to be a new way to disable existing cargo types. And maybe you want some of them but not all. But different climates have different defaults.
18:49:40 <peter1138> And maybe it's a cargo type that looks like a default cargo type, but is actually one that was set up by a different cargo set.
18:51:09 <peter1138> Urgh, stop complaining about extension methods :/
18:51:18 <peter1138> (He can't mock them)
18:54:05 <DorpsGek> [OpenTTD/OpenTTD] glx22 commented on pull request #13072: Codechange: Limit industry default cargo label lists to original slot counts. https://github.com/OpenTTD/OpenTTD/pull/13072#pullrequestreview-2436958365
18:56:43 <DorpsGek> [OpenTTD/OpenTTD] glx22 approved pull request #13072: Codechange: Limit industry default cargo label lists to original slot counts. https://github.com/OpenTTD/OpenTTD/pull/13072#pullrequestreview-2436963250
18:56:51 <DorpsGek> [OpenTTD/OpenTTD] PeterN commented on pull request #13072: Codechange: Limit industry default cargo label lists to original slot counts. https://github.com/OpenTTD/OpenTTD/pull/13072#issuecomment-2477186749
18:56:51 <peter1138> Heh
19:05:22 <DorpsGek> [OpenTTD/OpenTTD] PeterN merged pull request #13072: Codechange: Limit industry default cargo label lists to original slot counts. https://github.com/OpenTTD/OpenTTD/pull/13072
19:26:31 *** Wolf01 has joined #openttd
19:31:47 <andythenorth> could we merge this? https://github.com/OpenTTD/nml/pull/343
19:32:16 <andythenorth> I want to base another PR on it, and I'm already stacking branches locally due to unmerged PRs πŸ™‚
19:33:11 <LordAro> not while #12979 is open
19:34:56 <andythenorth> why? πŸ™‚
19:35:46 <andythenorth> the bits don't care
19:39:42 <LordAro> i was under the impression they did
19:40:06 <andythenorth> strictly 12979 is needed
19:40:15 <andythenorth> for debug, script, and default vehicles
19:40:53 <peter1138> Undrafted at least.
19:41:04 <peter1138> It's now "is this the agreed way?"
19:41:24 <xarick> var67 and var68 in english plz
19:42:04 <andythenorth> industry var 0x67?
19:42:12 <xarick> yes, I guess
19:42:35 <andythenorth> https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Industries#Count_of_industry.2C_distance_of_closest_instance_.2867.2C_68.29
19:42:53 <andythenorth> peter1138: well you me and Pikka agree πŸ˜›
19:42:59 <andythenorth> and I tried dissenting
19:43:04 <xarick> oh, thx
19:43:05 <andythenorth> "probably fine"
19:43:06 <peter1138> You did.
19:43:36 <andythenorth> I think 12979 is pretty convincing
19:43:57 <peter1138> Such valgrind.
19:47:30 <xarick> ah... now I see why u Clamp the counting
19:47:36 <xarick> NewGRFs suck
19:47:39 <xarick> that's why πŸ™‚
19:47:43 <xarick> j/k
19:48:15 <xarick> it can't return big enough values
19:48:16 <peter1138> It's "emulate reading from memory wtihout reading from memory"
19:48:50 <peter1138> The spec says "this value is a byte/word" so we have to clamp it to match.
19:48:57 <peter1138> 256x256 is the one-true-mapsize.
19:49:13 <peter1138> Hmm, does reserving vectors on load make sense...
19:50:02 <xarick> I was seeing rrccdddd all over this place and wondering
19:50:06 <peter1138> 1) less reallocations but 2) probably going to reallocate on first tick as something is soon as something is added
19:50:51 <xarick> int64_t support for NewGRFs is in the plans?
19:53:31 <xarick> oh, qword
19:53:35 <xarick> my calculator has it
19:58:08 <xarick> https://newgrf-specs.tt-wiki.net/wiki/GRFActionsDetailed
19:59:15 <xarick> the rreserved are actually in use and can't be used?
19:59:30 <DorpsGek> [OpenTTD/OpenTTD] PeterN opened pull request #13078: Town psa https://github.com/OpenTTD/OpenTTD/pull/13078
20:01:01 <LordAro> peter1138: perhaps obvious question - do they still need to be pointers?
20:01:23 <peter1138> Reserved means "don't read those bits, they might be used later"
20:01:43 <_glx_> automatic title based on branch name πŸ™‚
20:02:06 <peter1138> LordAro: They point into the PersistentStorage pool, so ... no but yes.
20:02:08 <peter1138> Oops
20:03:40 <peter1138> The ID type is uint32_t, so using index instead of pointers would not particularly save anything.
20:03:59 <LordAro> fair
20:04:16 <LordAro> wasn't immediately clear who the owner was
20:04:17 <peter1138> Pools are a bit annoying in some ways.
20:04:57 <LordAro> also "psa_list" :p
20:05:02 <peter1138> Yeah sure.
20:05:13 <peter1138> It's still a "list" in English πŸ™‚
20:05:20 <LordAro> :p
20:06:09 <peter1138> If we'd started using std::unique_ptr a lot earlier some of the pool stuff could've been avoided.
20:07:11 <peter1138> This was turned into a pool because the original implementation had only 16 slots of storage and was directly built in to industries.
20:07:30 <peter1138> 64 bytes per industry/town wasn't so bad.
20:07:51 <peter1138> But 256 slots is 1KiB and that's... getting a lot for something that isn't often even used.
20:08:29 <peter1138> But converting from pool to non-pool again is probably more hassle than it's worth.
20:11:42 <xarick> * @brief doxxygen has this? never seen used in openttd
20:27:38 *** D-HUND has joined #openttd
20:29:41 <andythenorth> hmm
20:29:50 <andythenorth> remind me
20:29:56 <andythenorth> compiled docs should never be in a repo?
20:30:12 <peter1138> They can be in A repo.
20:30:22 <peter1138> But maybe not the source repo.
20:30:54 <andythenorth> mostly these can't be in the wiki, due to styles
20:31:00 <andythenorth> and also edit wars that will bore me
20:31:01 <andythenorth> https://grf.farm/polar_fox/vehicle_frax.html
20:31:11 <andythenorth> but if I get dead....grf.farm will go away
20:31:13 <andythenorth> github won't
20:32:34 *** Wormnest has joined #openttd
20:33:54 <andythenorth> "if only I already had a grf.farm repo with compiled docs in it" https://github.com/andythenorth/grf.farm-volume-2/tree/main/src
20:53:51 <xarick> `return Industry::Get(iid)->town == Town::Get(pair_it->first) == town;` smart coding?
20:55:06 <peter1138> Incorrect.
20:56:28 <xarick> 😦
20:56:53 <xarick> I have 3 towns, and they all must be the same
21:00:00 <xarick> thx Copilot for coding comments for my functions
21:00:19 <xarick> this looks professional!
21:00:29 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
21:01:20 <xarick> what's the difference between private: and protected:
21:03:05 <xarick> going with private
21:07:55 <xarick> is var67 and var68 good to put in a commit message?
21:07:59 <xarick> i guess not
21:08:21 <_glx_> <https://en.cppreference.com/w/cpp/language/access> that's basic c++ stuff
21:08:42 <xarick> oh really? for me that's the advanced part
21:19:51 <LordAro> peter1138: https://theonion.com/heres-why-i-decided-to-buy-infowars/
21:22:28 <andythenorth> bed is indicated?
21:23:03 <andythenorth> I am bored of writing dist scripts triggered by build scripts for docs about cargo classes πŸ˜›
21:23:16 <andythenorth> my work looks like a modern javascript project
21:23:22 <andythenorth> 3 files of content, and 200 build scripts
21:25:37 <xarick> moment of truth
21:25:48 <xarick> check whether there was any performance gains
21:27:04 <xarick> https://github.com/OpenTTD/OpenTTD/compare/master...SamuXarick:OpenTTD:industry-type-counts-tracks-towns
21:27:22 <xarick> I abused asserts
21:27:37 <xarick> it's running kinda slow in relwithdebinfo
21:34:12 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
21:37:16 *** Wormnest has joined #openttd
21:37:29 *** nielsm has quit IRC (Ping timeout: 480 seconds)
21:41:33 <xarick> the size of openttd.exe decreased by quite a chunk with your commit
21:44:08 <xarick> about 48 kb
21:48:31 <peter1138> I mean... that is nothing :p
21:52:13 <andythenorth> yair naptime
21:52:22 <andythenorth> more Fox tommorrow
22:18:32 <peter1138> Uh oh. The Mastodon users are crying that loads of people are switching from Twitter to Bluesky and how it's all Mastodon's fault or something.
22:21:59 *** keikoz has quit IRC (Ping timeout: 480 seconds)
22:42:29 <xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1306751137545850940/image.png?ex=6737ce55&is=67367cd5&hm=c4665544f506b2fda14e688eb79a5b9dcf7b975a6b9839a511c6c3de8cdad33b&
22:42:29 <xarick> Improved Town Industries is really really slow... 15 minutes
22:43:13 <xarick> it's a release build on both
22:43:21 <xarick> it is that slow
22:43:26 <peter1138> Have you tried using normal map settings?
22:43:32 <xarick> πŸ™‚
22:43:58 <xarick> nope
22:53:27 <talltyler> ITI is slow because industries have strict placement rules, so it needs to try each industry more times before it finds a suitable spot for each
22:54:49 <xarick> indeed, it's what I'm trying to boost
22:56:59 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
22:57:38 <peter1138> 1024x1024 with High is 1280 industries.
22:59:45 <xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1306755482911772822/image.png?ex=6737d261&is=673680e1&hm=5be8d7c7e53fcc0fc4b4f191d888a8f3fc12a1427d185144d8b6cf75d1ecfd93&
22:59:45 <xarick> mixing kdtree + industry counts with towns results in 10x faster gen
23:00:06 <xarick> or is it "takes 1/10 of the time"...
23:00:55 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1306755776248811681/Screencast_from_2024-11-14_23-00-21.webm?ex=6737d2a7&is=67368127&hm=b0aa2873c55824c64f7741ddbb871e217e49ef71552c9fd2adbd70039e382b39&
23:00:55 <peter1138> Took me 3 minutes to make it a bit quicker.
23:01:33 <xarick> dont forget to disable multiple industries per town
23:01:39 <xarick> make it painful
23:02:19 <peter1138> Right has finished
23:02:22 <peter1138> Left is on 5700
23:02:39 <peter1138> (Left started about 10-15 seconds before Right, but that's inconsequential)
23:02:58 <peter1138> Multiple industries is enabled, yes.
23:03:38 <xarick> so you're also doing a PR
23:04:24 <peter1138> No, I just wanted to try something simple that you seemed to be making overly complicated.
23:04:58 <talltyler> peter1138: Shouldn’t it be the other way? One industry per town has to check for duplicates, multiple industries does whatever it wants πŸ™‚
23:05:10 <peter1138> Perhaps.
23:05:18 <talltyler> (As I understand it, that’s what Xarick is working on)
23:05:20 <peter1138> Left is still going, 7800.
23:05:33 <peter1138> Right is 45 days into the game.
23:06:10 <xarick> I overcomplicated it 😐
23:06:29 <peter1138> Hmm, although it said it was generating 20,000+, there's only 12,654.
23:06:51 <peter1138> I guess that's some of them giving up?
23:08:11 <peter1138> Hmm, I can also get rid of IndustryTypeCounts.
23:08:21 <talltyler> Secondary industries only spawn in cities, so you might have hit a hard limit there πŸ™‚
23:08:48 <talltyler> So yes, giving up, but trying harder might not produce any results
23:08:53 <xarick> it generated 7777 for me
23:09:01 <xarick> alpinist terrain
23:09:06 <peter1138> Depends on your settings, yes.
23:09:11 <xarick> very rough
23:09:20 <xarick> very water
23:09:25 <peter1138> I've got 12661 now, some must have spawned since πŸ™‚
23:09:37 <peter1138> Left is at 10,000, still going.
23:10:11 <xarick> let me pass u my settings
23:10:35 <xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1306758210237235250/openttd.cfg?ex=6737d4eb&is=6736836b&hm=7fc1ba6efd057cb8dd15e91973d8fffc9140e4027755d7d2c160a851f6fb341e&
23:10:50 <peter1138> Ah, I can tweak FindTownForIndustry as well
23:12:00 <peter1138> Yeah, this is the test that isn't being used right now.
23:13:30 <peter1138> 12,300
23:13:41 <xarick> I tweaked `FindTownForIndustry`, `CheckIfFarEnoughFromConflictingIndustry`, `GetClosestIndustry` and the `else` part of `GetCountAndDistanceOfClosestInstance`
23:13:53 <peter1138> I think it's fair to say this is an improvement, even if it's not perfect.
23:14:40 <peter1138> CheckIfFarEnoughFromConflictingIndustry is difficult to improve as there are only up to 3 industry types to exclude.
23:14:59 <xarick> I kdtree'ed it
23:15:06 <xarick> then FindContained
23:15:51 <peter1138> It also scans the map, instead of the pool.
23:17:21 <xarick> I did it like this <https://github.com/OpenTTD/OpenTTD/commit/4d382707f55b9a4bc96b14f652e21ad676874c37#diff-ce2189a945a85c2aec8e107e2845ab769d2f107f4a22287366a972caf7d796aeR1725-R1742>
23:17:24 <peter1138> I think that scan might be a bit flawed, it will check each tile of each industry.
23:18:10 <peter1138> kdtree would be ideal if you could filter the tree.
23:18:14 <peter1138> (While searching)
23:18:25 <peter1138> I don't know if that's a modification that can be made.
23:19:06 <peter1138> 14,850
23:19:16 <peter1138> Still nearly 6000 attemps to go.
23:19:28 <peter1138> Right is in September already.
23:19:46 <peter1138> KISS?
23:22:36 <xarick> bed time for me
23:23:10 <xarick> good night
23:26:34 *** Wormnest has joined #openttd
23:30:38 <peter1138> 18,900
23:32:40 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
23:37:44 <peter1138> Hmm, 12,810 it ended up with
23:37:55 <peter1138> But that's basically 30 minutes to generate in master.
23:38:18 <peter1138> And... 2-3 minutes with my change.
23:44:02 <peter1138> 24 * 240, perhaps a bit excessive.
23:46:13 <peter1138> About 5 seconds faster on a 1024x1024/high map.
23:48:04 <talltyler> peter1138: I don’t think ITI uses this anymore, if I recall correctly I switched to just the callback
23:50:32 <peter1138> 2048x2048 is where it starts to get slow (in master)
23:54:10 <peter1138> For a full map generation, master: 2m 24s, my .. patch: 38s
23:54:18 <peter1138> So not instant, but... an improvement.
23:55:42 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1306769563207335977/2024-11-14_23-48-16.mkv?ex=6737df7e&is=67368dfe&hm=3edb738c1f3d83415cfcfb2f4b74ab11fba810b47b3b667857e68750a08dbcb2&
23:55:42 <peter1138> Well.
23:55:56 <peter1138> No MKV love here πŸ˜„
23:58:06 <peter1138> I broke the first rule of performance tweaks: steal whatever JGRPP changed first.