IRC logs for #openttd on OFTC at 2016-10-03
⏴ go to previous day
00:25:07 *** Biolunar has joined #openttd
02:43:52 *** tokai|noir has joined #openttd
02:43:52 *** ChanServ sets mode: +v tokai|noir
08:14:59 *** sla_ro|master has joined #openttd
09:00:45 *** Progman has joined #openttd
09:47:48 *** Biolunar has joined #openttd
11:25:38 *** frosch123 has joined #openttd
11:30:15 *** umgeher has joined #openttd
12:14:14 *** gelignite has joined #openttd
13:18:49 <Samu> question about multi-threading openttd: is it possible for each individual AI to have his own thread?
13:22:16 <Samu> treat an AI instance as a client that joins a multiplayer game - it has to download the map and has his own "openttd" environment?
13:25:36 <Samu> because currently, 15 AIs all share the same 1-thread
13:44:34 <planetmaker> samu: each AI *has* its own thread
13:44:59 <Samu> oh, well then i dunno what's slowing them down to 1-core usage
13:46:41 <Samu> openttd is barely above 12.5% cpu
13:47:22 <planetmaker> they're not granted unlimited CPU. Their computation time is controlled by openttd
13:50:45 <Samu> and with 240 companies patch, same thing occurs, 12.5% cpu t.t
13:53:53 <Wolf01> Samu, it's like a card game, every player must wait its turn and has limited time to play a move
13:58:40 <Wolf01> So if you have 240 players, every player must wait 239 others so do its move again
14:03:03 <Samu> what would be an easy way to speed multiple ais?
14:05:34 <Samu> wish something could be done about this
14:08:03 <Samu> "AI-as-a-multiplayer-client"
14:09:24 <Samu> they would be able to play asynchronous
14:37:38 *** andythenorth has joined #openttd
14:37:40 *** andythenorth has left #openttd
14:38:00 <peter1138> with their own full state of the game
14:39:53 <Wolf01> frosch123, are you here?
14:41:05 <Eddi|zuHause> you still did not understand the topic...
14:42:52 <Wolf01> It's for coordination, if he doesn't have time I'll do something else
14:45:14 <Wolf01> Ok, then how should I proceed with the patch? Should I wait for a proper grf or just duplicate almost all what I've done?
14:45:48 <frosch123> next thing is, we need some RoadSubType enum or so
14:46:05 <Wolf01> I already did that yesterday evening
14:46:20 <Wolf01> I'm going to change the usages of the RoadType
14:47:52 <frosch123> next, GetRailTypeByLabel and AllocateRailType need a RoadType parameter, so that they can allocate a subtype correctly
15:03:25 <Wolf01> for (int i = 0; i < numinfo; i++) {
15:03:25 <Wolf01> RoadType rt = _cur.grffile->roadtype_map[id + i][?what_here?];
15:04:12 <Wolf01> RoadTypeByte roadtype_map[ROADTYPE_END][ROADSUBTYPE_END]; <-
15:08:00 <frosch123> _cur.grffile->roadtype_map[feature == NF_ROADTYPE ? ROADTYPE_ROAD : ROADTYPE_TRAM][id + i]
15:13:08 <Wolf01> Uhm, I should change all handlers for that
15:13:33 <Wolf01> ChangeInfoResult cir = handler[feature](engine, numinfo, prop, buf); <-
15:13:48 <Wolf01> Or duplicate the handler
15:15:56 <frosch123> imho remove the handler[]
15:16:07 <frosch123> just switch-case as in ReserveChangeInfo
15:16:55 <Wolf01> That's the handler loop which loops through all the reserve change info of the various features
15:18:27 <frosch123> or are we talking about something else?
15:19:22 <frosch123> i don't see a point in "static const VCI_Handler handler[]". same can be done with a switch
15:19:26 <frosch123> it's only used once
15:20:47 <Wolf01> It's also in FeatureChangeInfo()
15:21:04 <frosch123> it's only in FeatureChangeInfo, is it?
15:21:52 <Wolf01> No, there are FeatureChangeInfo and ReserveChangeInfo which both call RoadTypeReserveChnageInfo
15:22:12 <frosch123> yes, but ReserveChangeInfo already has a switch
15:22:19 <frosch123> so you can just add the RoadType parameter
15:22:47 <Wolf01> Yes, I'm doing that, but FeatureChangeInfo uses a loop instead of a switch
15:23:26 <Wolf01> while (numprops-- && buf->HasData()) {
15:23:26 <Wolf01> uint8 prop = buf->ReadByte();
15:23:26 <Wolf01> ChangeInfoResult cir = handler[feature](engine, numinfo, prop, buf);
15:23:26 <Wolf01> if (HandleChangeInfoResult("FeatureChangeInfo", cir, feature, prop)) return;
15:23:30 <frosch123> it uses the array of function pointers, which is just a fancy way to writing a switch
15:23:59 <frosch123> ChangeInfoResult cir = handler[feature](engine, numinfo, prop, buf); <- so that line becomes a switch
15:24:03 <frosch123> instead of using handler[]
15:24:07 <Wolf01> I don't know if that's because they need to be in order
15:24:30 <frosch123> the same loop is in ReserveChangeInfo btw
15:30:46 <Wolf01> uint8 *roadtypes = AllocaM(uint8, idcount); <- how do I change this?
15:31:17 <Wolf01> Oh, it's internal, no need to change
15:31:46 <frosch123> yep, only a local variable
15:38:09 *** HerzogDeXtEr has joined #openttd
15:39:02 *** supermop has joined #openttd
15:40:32 <Wolf01> Bah, I wanted to pass RoadType as optional parameter but I need to overload instead
15:44:56 <frosch123> why so complicated?
15:45:22 <frosch123> why not pass the RoadType directly from ReserveChangeInfo?
15:46:11 <Wolf01> To keep it uniform with RoadTypeChangeInfo
15:46:58 <Wolf01> And to avoid calling it with wrong roadtype
15:47:23 <Wolf01> For example trying to allocate a tram with roads
15:51:04 <argoneus> good afternoon train friends
15:58:11 *** Alberth has joined #openttd
15:58:12 *** ChanServ sets mode: +o Alberth
16:03:35 <Wolf01> The sorting of roadtypes is a bit... I don't know how to handle it :P
16:04:24 <Wolf01> It uses GetRoadTypeInfo(), which now needs a base road type to get info for the subtype
16:09:42 <Alberth> you also with actual road types I guess, can't you use those?
16:09:54 <Milek7_> UpdateWidgetSize is used inside Window constructor?
16:10:56 <Wolf01> What do you mean Alberth?
16:11:40 <Alberth> Milek7_: sounds a bit low-level, constructor usually handles the tree as a whole, but I have forgotten where UpdateWidgetSize exactly fits in the picture
16:13:10 <Alberth> Wolf01: probably mostly that I don't understand your reasoning :p If you sort roadtypes, you have actual roadtypes, to get subtype information about?
16:13:29 <Milek7_> yes, constructor calls InitNested
16:13:58 <Alberth> Wolf01: which contradicts your conclusion, so somewhere there is a hitch
16:14:27 <Wolf01> No, I don't have the actual roadtype, only the subtype, and since they are just numbers I'm not able to get the info from the right subtype
16:15:12 <Alberth> Milek7_: ah, right. Yes, it traverses bottom-up to get size information from the leafs to the root of the window, and then top-down to propagate position+size back to the leafs
16:15:44 <Wolf01> I have _roadtypes[][] = {{1,2,3,4}, {1,2,3,4}}, the function arguments are "1 and 2", which ones?
16:16:56 <Alberth> aside that the name should perhaps be _road_subtypes, sorry, no idea
16:17:19 <Wolf01> I could also have 2 variables instead of a multi dimensional array, but it does not change that the compare function needs the base RoadType
16:17:41 <Milek7_> bit misleading, it isn't obvious that when UpdateWidgetSize is called constructor didn't complete ;p
16:22:14 <Alberth> trying to construct a window in a base class?
16:23:10 <Milek7_> no, i just wanted to access scrollbar in UpdateWidgetSize
16:23:23 <Milek7_> and GetScrollbar was at end of constructor
16:24:24 <Milek7_> had to split InitNested to CreateNestedTree and FinishInitNested with GetScrollbar in between
16:24:30 <Alberth> Wolf01: or you need a combined (base road-type, sub road-type) pair or so
16:25:00 <Wolf01> Maybe an offset in the enum?
16:25:32 <Wolf01> ROADSUBTYPE_START = 0, TRAMSUBTYPE_START = 16?
16:26:56 <Wolf01> Or just do "SUBTYPE_BEGIN + rt * 16" in loops
16:27:20 <Alberth> make a function to compose and extract the numbers
16:28:00 <Alberth> can do that to/from an enum if you like
16:28:21 <Alberth> I think we have something with a combined number for vehicle windows
16:29:25 <Alberth> vehiclelist.h:31:struct VehicleListIdentifier { <-- I think this one
16:41:07 <Alberth> like like a safe bet :)
16:50:07 *** JacobD88 has joined #openttd
16:50:28 <Wolf01> I think I'm doing too many things at once
16:51:03 <Alberth> yeah, first type all "q", then all "w", then all "e", etc
16:53:40 <Wolf01> return this->basetype << ROADSUBTYPE_END | this->subtype; <- is this right?
16:54:25 <Alberth> needs parentheses around the <<
16:54:51 <Alberth> and constant name is a bit weird, but it looks like the right idea
16:55:47 <Alberth> assuming you want the subtype in the lower bits, and basetype in the higher bits (doesn't really matter, unless you exploit that eg for sorting or so)
17:05:28 <Samu> conversion from 'unsigned long' to 'int' requires a narrowing conversion openttd D:\OpenTTD\trunk\src\economy.cpp 96
17:06:40 <Alberth> unsigned long has more data bits than an int, so it you put the former in the latter, some bits may fall off
17:06:42 <Samu> 2560000000 is this number too big ?
17:08:34 <Alberth> it's hex 0x98968000 8 characters, so that's ok, but biggest is 0x7FFFFFFF
17:09:18 <Alberth> 0x9.... represents a negative value in an int
17:10:09 <Alberth> so the compiler uses unsigned value, but obviously that won't fit in a signed integer of the same size
17:13:48 <Samu> interesting, i indirectly came into my reported bug
17:19:10 <Alberth> that would work for your number
17:21:16 <Samu> what's the biggest amount of money a company can store?
17:22:27 <Samu> typedef OverflowSafeInt64 Money;
17:23:18 <Alberth> MAX_INT64 or INT_MAX64, I always forget which one it is
17:24:16 <Samu> typedef OverflowSafeInt<int64, INT64_MAX, INT64_MIN> OverflowSafeInt64;
17:25:38 <Samu> #define INT64_MAX 9223372036854775807i64
17:27:32 <Samu> i wonder what would happen once a company gets this much in the bank
17:27:55 <Milek7_> 64bits is "really long"?
17:28:09 <Milek7_> it is one register on most modern architectures
17:28:10 <Alberth> compared to 32 bits? yep :)
17:29:14 <Samu> do you have an inflation calculator?
17:30:08 <Samu> what would be 2 560 000 000 with an inflation ratio of 4% over 100 years
17:34:14 <Alberth> Samu: amount = 256.... ; for year in range(100): amount = amount + amount * 0.04
17:34:43 <Wolf01> Alberth, so now I could pass the RoadTypeIdentifier and use Extract If I just need the base RoadType? (or ::Unpack() if I need all)
17:36:37 <Alberth> Wolf01: no idea what VehicleListIdentifier does in detail, so "Extract" and "Unpack" have no meaning to me, but I would guess you can
17:38:36 <Wolf01> TBH I should pack also the sort order, maybe if has catenary... maybe all
17:38:41 <Samu> 170 years is when inflation stops, interesting
17:40:52 <Alberth> Wolf01: doesn't the type itself have that information already?
17:41:29 <Wolf01> I need to do GetRoadTypeInfo(RoadType) to have all the informations
17:41:30 <Alberth> I clearly have no understanding of "type" in road types, then
17:41:34 <Wolf01> And that was the problem
17:42:26 <Wolf01> Eh, in vanilla OTTD is easy... you have 2 types so you can just check if 0 or 1, all the other is hardcoded
17:42:31 <Alberth> I wouldn't store redundant information in the packed integer, it can only cause trouble
17:42:58 <Alberth> yeah, always a problem when you make a non-trivial extension :)
17:43:25 <Wolf01> Now I only need to change every single _roadtype array around in the code
17:43:26 <Alberth> they never prepared for the general case that you're making :p
17:48:10 <Wolf01> But I still think I need to do 2 different sorting functions, one for roadtypes and one for tramtypes
18:17:50 <Wolf01> I think I didn't understand how to use the RoadTypeIdentifier
18:28:09 <Samu> > openttd.exe!`dynamic initializer for '_score_info''() Line 94 C++
18:30:41 <Samu> the _score_info is set before the main menu is even reached?
18:32:38 <Samu> was trying to scale the performance rating based on map size
18:33:27 <Samu> and wanted to account inflation into it
18:37:08 <Milek7_> and set it to other values somewhere in map loading
18:41:27 <Samu> inlfation happens every month
18:43:25 <Milek7_> then set it every motnth
18:43:29 <Milek7_> i think it should work
19:05:03 <Samu> generating 4096x4096 and 240 ais map
19:05:26 <Samu> also trying 250k ops so i can burn my house
19:08:00 <Samu> i better create a dedicated server, I can barely move the mouse
19:15:05 <Samu> this is too darn impossible
19:18:07 <Milek7_> what are you trying to achieve? :)
19:18:52 <Samu> a tick is advancing every 4 seconds
19:19:07 <Samu> and we're still on 7th january
19:21:16 <Samu> this would need a supercomputer as a server
19:21:24 <Samu> and even then, i doubt it
19:24:26 <Samu> ticks are taking 7 seconds now
19:27:05 <Alberth> Milek7_: he runs lots of AI games on the server, and spams the channel with years of the servers every couple of hours, with complaints on how slow it all is :)
19:30:10 *** Kurimus has joined #openttd
19:30:53 *** Flygon_ has joined #openttd
19:34:07 *** ParanoidPrincess has joined #openttd
19:34:21 *** ParanoidPrincess is now known as Etherische_Fluister
19:57:01 *** andythenorth has joined #openttd
19:57:51 <Samu> 10 AIs died unexpectedly
20:25:18 <supermop> no good shoes out there
20:25:31 <supermop> underwhelmed by mens fashion this season
20:25:53 <supermop> and everyone is still wearing stan smiths after like 2 years
20:26:10 <supermop> going to just start wearing a suit every day to no think about it
20:26:25 <andythenorth> supermop: can’t share your pain
20:26:30 <andythenorth> shoes I have sorted
20:28:04 <supermop> all my tretorn sneakers are falling apart
20:28:17 <supermop> cant walk on wet sidewalks as ill get my sock wet
20:28:55 <supermop> and they all really smack of 2009 - but whatever is the look now is stupid
20:29:34 <Wolf01> andythenorth, then share my pain, this subtypes thing is discouraging
20:29:51 <andythenorth> supermop: nike pre-montreal, always classic
20:29:56 <andythenorth> dates from about 1972
20:30:03 <andythenorth> Wolf01: what is pain?
20:30:25 <supermop> andythenorth: nikes dont fit me, so i wear addidas or puma usually
20:31:10 <andythenorth> supermop: ok, can’t be helped :D
20:31:10 <supermop> tretorns being owned by puma
20:31:20 <supermop> but shit quality apparently
20:32:42 <supermop> need ferragamo but architecture doesn't pay the wage for the style it expects
20:32:59 <supermop> did you guys finish the SV game?
20:33:01 *** sla_ro|master has joined #openttd
20:42:21 <Alberth> I was thinking about a new freight challenge, small long map, and a big city across the map where you cannot tunnel under
20:42:21 <Alberth> factories at either side of the city
20:44:54 *** supermop has joined #openttd
20:47:19 <andythenorth> ships round the edge :P
20:56:07 <Wolf01> (patch against my dev branch)
20:58:18 <Alberth> andy: tramz and RVs :)
21:15:39 <andythenorth> Wolf01: I looked at the patch, but eh
21:15:42 <andythenorth> out of my depth there
21:16:20 <Wolf01> It's even out om my capabilities
21:17:08 <Wolf01> I just put there things in a way to not trigger syntax and compile errors :D
21:19:36 <Wolf01> Meanwhile I tried to keep an apparent feel of "it works"
21:47:13 <Alberth> at least one of them is wrong, is my guess
21:50:24 *** Webster has joined #openttd
21:50:50 <Alberth> it's a wiki, people write anything, sometimes it holds, sometimes it doesn't, or only partly
21:51:13 <Milek7_> Samu: huh, do you want even more companies?
21:52:49 <Alberth> not sure why you bother calculating payments, you get too much money anyway, who cares how much exactly
21:54:09 <goblin> Alberth, because I just created a very very long route across my entire map, and delivering valuables gives me less money than delivering goods across 3/4ths of the map, and I'm wondering why
21:54:54 <Samu> the new version of AIAI is a damn cheater
22:02:30 <andythenorth> Wolf01: tonight I have nothing to offer on NRT :P
22:07:54 <goblin> so I'm kinda wondering what's the optimum distance to transport cargo for
22:08:21 <goblin> I guess it's also a function of train speed
22:10:06 <Alberth> yes, and speed of loading
22:10:46 <goblin> yees, valuables are produced much more slowly than goods
22:11:01 <goblin> should I perhaps shorten the train length for valuables to get them loaded faster?
22:11:03 <Alberth> ie transit days start counting when they get on the train
22:11:36 <goblin> that's what I was wondering as well, couldn't find that on the wiki :-)
22:15:05 <Alberth> I use a terribly simple rule, as long as it's not negative, it's ok :)
22:16:15 <goblin> so you only optimize flow?
22:16:15 <Alberth> I get money faster than I can spend it, how much faster isn't that relevant
22:16:59 <Alberth> yep, I like building networks transporting lots of cargoes
22:17:26 <Alberth> typically sharing tracks, under servicing and breakdowns
22:17:42 <Alberth> causing major havoc if you're not careful
22:18:53 <goblin> ah, the breakdowns. Last time I played, someone said to disable them entirely because they break the flow and there's nothing you can do to alleviate that. Is that still the case? I.e. is it possible for trains to pick a different path if there's a broken train in front of them?
22:19:16 <Alberth> they do avoid each other yes
22:19:49 <Alberth> breakdowns effectively make your network have less capacity
22:20:13 <Alberth> you need more room around a train so it can break down for a while without total disruption
22:20:38 <Alberth> so you need to expand to more tracks earlier
22:20:57 <goblin> hmm, ok, sounds interesting
22:21:13 <Alberth> they also make reliability and age a useful notion
22:21:20 <goblin> so a lot of lanes and a lot of lane switching options
22:21:28 <goblin> yeah, I always like them
22:21:45 <goblin> just wasn't sure how to plan for them, but maybe it's different these days :-)
22:21:50 <Alberth> not much switching options, in my experience
22:22:09 <Alberth> otherwise they constantly switch track which also reduces throughput
22:22:47 <goblin> but then if one breaks down, it'll block possibly very many other trains behind it
22:22:58 <Samu> i wonder how would a GS handle computations for 240 companies
22:23:01 <Alberth> then you have too many trains on that track
22:23:44 <goblin> well, it's a mainline... so it's meant to carry a lot
22:23:47 <Alberth> with high enough reliability, it's not a disaster to have a broken train for a while
22:24:42 <Alberth> you need a more distributed approach :)
22:25:20 <Alberth> you can't just dump a zillion trains onto one track and it runs
22:25:53 <goblin> well, the coop guys do it like that I think
22:25:55 <Alberth> the concept of "too full" arrives a lot earlier
22:27:14 <Alberth> although at their scale it makes sense to not get disruptions in the flow
22:27:37 <Alberth> but it's a matter of wht you like to play
22:28:10 <Alberth> some people do precise time tabling, etc. breakdowns make that impossible
22:28:47 <Alberth> others just want to have a massive transport over one big line, breakdown also make that impossible
22:29:12 <Alberth> I like to find out how to transport stuff with breakdowns
22:29:31 <Alberth> or transport all cargo all over the map, using cargo-dist
22:29:52 <goblin> I was thinking how to play with breakdowns, but still have high-throughput lines
22:30:04 <goblin> i.e. how to make trains not switch lanes constantly, but only if there's something broken in front
22:30:41 <Alberth> I think it should be allowed to change as it wants, but the other trains should not get into trouble for it
22:30:58 <Alberth> I haven't yet figured out how to do that
22:32:50 <goblin> expose the signal changes via a scripting API and have the crowd think up a solution ;-)
22:34:04 <Alberth> tbh, not knowing the answer is much more fun
22:35:07 <Alberth> I spent 4 years or so figuring out how to distribute all cargoes over all industries with cargodist
22:35:19 <Alberth> once I had the solution, all fun was gone
22:36:22 <Alberth> although there are a few things I can still try
22:36:28 <fonsinchen> so, what is the solution? I never figured that one out ...
22:36:39 * goblin reads up about that cargodist
22:38:06 <Alberth> easy, you transport cargo from source industry to destination industries, or some other way where you visit more than single source+destination
22:38:42 <Alberth> cargo-dist will do the rest in distributing cargoo over the routes that you provide
22:39:11 <goblin> the other problem that was always nagging me is that why on earth would a power station pay $70k for coal from the other end of the map when they can have it much cheaper from a local mine
22:39:12 <Alberth> and you can do that for every single cargo on a separate network
22:39:41 <Alberth> goblin: not all coal is equal :p
22:40:08 <Alberth> but you're projecting real life ideas into the game, which generally doesn't work
22:40:23 <goblin> no I thought maybe this cargodist thingy makes it more reasonable
22:40:42 <goblin> seeing as passengers want to go to a specific place, for instance
22:40:51 <goblin> maybe the coal would only want to go to specific power stations too ;-)
22:41:07 <Alberth> only partly, pax still stay in your network
22:41:20 <Alberth> they don't want to go to another town
22:42:04 <Alberth> ie if you make point-to-point connections only, cargodist doesn't do anything
22:42:20 *** FLHerne has joined #openttd
22:42:56 <Alberth> where each point is connected to 1 other point only
22:43:28 <Alberth> for that you need cargodest :)
22:43:40 <Alberth> which we also had as patch for a while
22:45:22 <Samu> TownPool::MAX_SIZE = 64000
22:45:33 <Samu> hmm max number of towns is 64000? must test
22:53:23 <Samu> wow it really is generating 64000 towns
22:54:03 <FLHerne> That sounds like too many
22:54:31 <FLHerne> Who invented the NFO spec for RV speeds?
22:55:43 <sim-al2> Reading the wiki page on vehicle speed is fun
22:55:53 <sim-al2> like how the units are km-ish
22:56:13 <FLHerne> I'd assume "bodging after the fact", except both properties claim to be introduced in the same version
22:56:15 <Alberth> FLHerne: probably early in ttdpatch development, so very original game compatible
22:57:01 *** andythenorth has left #openttd
22:58:13 <Samu> the map generator doesn't scale that well
22:58:38 <Samu> 64k towns is an absurd amount either way
22:59:05 *** V453000 has joined #openttd
22:59:27 <Samu> 64k easily fit on a 4kx4k map, let's try a smaller map
23:00:40 <Samu> or maybe i'm being mislead
23:00:47 <Samu> i'd like to count the total
23:16:47 <fonsinchen> nice. I was expecting more trains though. It seems to be easier for cargo than for pax and mail. I always lose patience when trying to cram more tracks into growing cities.
23:22:23 <goblin> is it my imagination, or is there something preventing the existence of oil wells after a certain date?
23:24:12 <Samu> they won't spawn from 1960 i think, not sure
23:24:40 <Eddi|zuHause> they get phased out so you need to service oil rigs instead
23:25:20 <goblin> are there any other industries with that behaviour?
23:25:41 <Eddi|zuHause> also, this only applies to the temperate climate
23:25:51 <FLHerne> Some FIRS ones, but only secondaries
23:25:55 <goblin> yeah, I'm on temperate
23:26:06 <FLHerne> So at least the ones you're using don't vanish
23:26:55 <Eddi|zuHause> that's not true at all
23:27:47 <Eddi|zuHause> well, let's say "it's complicated"
23:30:13 <Samu> ah, the 4kx4k map did not generate 64000 towns, it generated 24009
23:30:17 <FLHerne> Don't vanish unless you serve them badly and use non-default parameters?
23:30:41 <FLHerne> Samu: Might have run out of town names
23:31:27 <Samu> town names English (original)
23:31:34 <Samu> how many names does that allow?
23:36:51 *** Kurimus_ has joined #openttd
23:37:31 <FLHerne> I tried to estimate it and got about 2m
23:40:23 <Samu> 2 million? wow that's huge
23:42:55 *** Kurimus has joined #openttd
23:59:51 *** FLHerne_ has joined #openttd
continue to next day ⏵