IRC logs for #openttd on OFTC at 2022-05-21
⏴ go to previous day
00:21:03 *** arikover` has quit IRC (Quit: ERC 5.4 (IRC client for GNU Emacs 28.1))
01:35:11 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
02:27:57 *** Wormnest has quit IRC (Quit: Leaving)
02:45:36 *** debdog has quit IRC (Ping timeout: 480 seconds)
02:56:44 *** D-HUND is now known as debdog
06:21:09 *** bryjen has quit IRC (Quit: Leaving)
06:27:20 *** andythenorth has joined #openttd
06:28:38 *** Speedy` has quit IRC (Ping timeout: 480 seconds)
06:43:53 <andythenorth> _dp_ I wonder what random varact2 does when the choices aren't power of 2
07:50:12 *** sla_ro|master has joined #openttd
08:52:19 *** sla_ro|master has quit IRC ()
09:09:12 *** WormnestAndroid has quit IRC (Remote host closed the connection)
09:29:53 *** snail_UES_ has joined #openttd
09:46:02 *** snail_UES_ has quit IRC (Quit: snail_UES_)
09:50:11 *** HerzogDeXtEr has joined #openttd
09:55:18 <_dp_> andythenorth, afaict it prints a warning when loading and segfaults when resolving
09:57:52 <_dp_> can regular va2 just read random bits and do its own math?
10:04:02 <andythenorth> don't see why not
10:04:11 <andythenorth> I read random bits for stuff
10:04:25 <andythenorth> nml random_switch is a PITA
10:04:28 <andythenorth> it's very magical
10:07:39 <_dp_> yeah, I already found it
10:08:14 <_dp_> took some time though as it's not in feature vars but a special case in va2 0x5f
10:09:16 <_dp_> with a kludge to read it via 0x61 for vehicles xD
10:15:10 <_dp_> yeah, found that already
10:15:34 <_dp_> but if you don't do random switch anyway why you still need to bother with powers of 2?
10:15:39 <_dp_> you can just do % length
10:16:23 <_dp_> and more bits you take more equal will be probabilities
10:45:01 *** Smedles has joined #openttd
11:02:09 *** aperezdc__ has joined #openttd
11:28:22 *** sla_ro|master has joined #openttd
11:34:52 *** WormnestAndroid has joined #openttd
12:17:00 <andythenorth> got bored choosing random types :P
12:34:30 <andythenorth> also I might run out of random bits on vehicles
12:34:33 <andythenorth> pls, can have more? :P
13:22:29 *** virtualrandomnumber has joined #openttd
13:27:11 *** virtualrandomnumber has quit IRC ()
13:28:12 <peter1138> Oh thanks for the line-breaks, copy & paste...
13:28:27 <peter1138> Such little changes, so many time.
13:31:18 <andythenorth> are these lyrics?
13:43:46 <glx> you have 8 bits so 256 values, should be more than enough
13:58:33 <andythenorth> something something independent choices
13:59:47 <Eddi|zuHause> you could do dependent choices and hide them with clever masks
14:05:28 <peter1138> Also means it changes when shuffle wagons around...
14:05:39 <peter1138> But that might be a "feature"
14:09:29 <Eddi|zuHause> a big part of "engineering" is using limited ressources creatively to maximise outcome
14:10:32 <Eddi|zuHause> you have to learn to discard the thought of "what if i had more <X>?"
14:11:23 <Eddi|zuHause> and only if that gets you nowhere you go back to asking for more <X>
14:11:45 <peter1138> Back in the day we had 32KB, shared with the screen...
14:12:15 <peter1138> Just use palette tricks to hide code in the screen area.
14:30:45 <andythenorth> I am considering what happens when IDs > 16k
14:30:50 <andythenorth> articulated stuff is going to break
14:31:07 <andythenorth> I'm considering just adding 16000 to all non-articulated IDs, then repeating :P
14:31:19 <andythenorth> better than manually changing them, right?
14:36:47 <Eddi|zuHause> you'll get horrible nightmares when you want to move a vehicle from the non-articulated to the articulated block
14:37:20 <Eddi|zuHause> which, by the frequency you completely revamp things will be in a week or two
14:38:01 <andythenorth> nah it will just subtract 16k
14:38:05 <andythenorth> I'll make a list of special cases
14:38:12 <andythenorth> and then a list of special case special cases
14:38:18 <andythenorth> everything is just configuration
14:39:16 <Eddi|zuHause> solving problems by adding layers of indirection is the equivalence of cleaning up by sweeping things under the sofa
14:56:57 <peter1138> I was trying to work out why a blue outline appeared recently...
15:00:55 <andythenorth> think webkit has done that for a while
15:05:14 <FLHerne> Eddi|zuHause: I'd say the outcome of 'creative' ways to exceed resource limits in OTTD has been mostly negative :-/
15:06:10 <peter1138> andythenorth, nope, this only shows in Firefox.
15:06:30 <andythenorth> FLHerne but the livery callback is so great!
15:06:51 <FLHerne> so many grfs have massive varaction2 chains that get evaluated constantly to work around the limited number of tiles or views or whatever
15:13:02 <peter1138> The entire point of varaction2 is to provide variety.
15:13:15 * andythenorth provides variety
15:13:49 *** Wormnest has joined #openttd
15:14:29 <peter1138> andythenorth, I pinged you in #off-topic on Discord, because I'm rood.
15:14:53 <peter1138> But I can't lazily post images here.
15:15:26 <andythenorth> "I didn't do it"
15:15:42 <andythenorth> but I have the same problem with focus outlines getting clipped in something I maintain
15:18:16 <andythenorth> took me so long to paint all those buy menu images :P
15:18:27 <andythenorth> every single one carefully blended by hand
15:18:56 <peter1138> Okay what. Now it's stopped doing it.
15:19:43 <_dp_> I would just merge two halves with PIL and call it done xD
15:22:22 <andythenorth> ok so if I want to make a choice from 13 items
15:22:29 <andythenorth> and I have to pick bits in powers of 2
15:22:35 <andythenorth> how do I modulo to drop the excess?
15:23:17 <Eddi|zuHause> FLHerne: well... i disagree with that statement. if we had made openttd without those design limitations, we would've got simutrans
15:29:41 <andythenorth> `getbits(0, 4) % 13` or something?
15:29:50 <andythenorth> no that gets me the remainder
15:30:30 <peter1138> andythenorth, to be unbiased, and give 'equal fairness', you need to either loop and call random until the value is < 13 (which is not going to work here) or come up with a multiple of 13 that is also a power of 2.
15:31:01 <_dp_> or just pick some more bits and call it good enough
15:31:01 <andythenorth> currently I just stuff the candidates list by copying items from the start
15:31:06 <andythenorth> until it reaches power of 2
15:31:16 <peter1138> (I don't think there is one)
15:31:26 <_dp_> andythenorth, that's the same as doing %
15:31:49 <peter1138> remainder is what you want.
15:32:18 <peter1138> But can't you just have 13 options and let openttd do the rest? Can't remember...
15:32:35 <andythenorth> I can use random_switch in nml but it's a pain in the arse
15:32:45 <andythenorth> it seems to over-write random bits and breaks other things
15:32:49 <peter1138> Oh, maybe that's only the original style of random reading.
15:32:57 <andythenorth> I just pick some bits out when I want them
15:33:31 <andythenorth> maybe I just keep stuffing the list
15:33:36 <andythenorth> seems to work fine :P
15:33:53 <peter1138> random_switch causes rerandomization depending on triggers and how it's used.
15:35:13 <andythenorth> fits the observed behaviour :P
15:35:59 <_dp_> andythenorth, you can pre-compute modulo into switch for same effect
15:36:11 <peter1138> That is it's purpose.
15:36:27 <_dp_> for i in range(1<<used_bits): option_i = choices[i%len(choices)]
15:37:07 <peter1138> To do things like graphical changes after unloading all cargo so you get different visuals on the next load.
15:37:31 <peter1138> And also to confuse MB when he puts them branches that aren't executed during the trigger.
15:38:34 <andythenorth> _dp_ what does the shift do?
15:39:39 <_dp_> well, I guess you can just do 2**used_bits in python
15:39:50 <_dp_> got too used to C lately xD
15:40:31 <andythenorth> I should really learn what this does :P
15:40:40 <andythenorth> but meanwhile I extended my stupid list extender
15:40:49 <andythenorth> didn't even use a loop
15:42:12 <andythenorth> 'ever heard of "while"?' :P
15:43:12 <_dp_> andythenorth, if len(result) > 8 result += result[:16-len(result)]
15:51:50 <_dp_> I got a bit carried away xD
15:51:52 <_dp_> result += result[:2**(len(result) - 1).bit_length() - len(result)]
15:53:19 <andythenorth> not going to play golf :P
16:11:13 * andythenorth might be doing bad things
16:11:24 <andythenorth> how many random bits do I need to pick for 16 choices?
16:11:27 <andythenorth> I thought it was 4
16:11:46 <andythenorth> but bin(16) gives me 5 bits in python
16:12:35 <_dp_> 16 is 17th choice so it's 5 bits
16:14:59 <andythenorth> CABBAGE 5 is the result of calling bit_length() on the list that also builds the switch options
16:15:18 <_dp_> that's why I had -1 there
16:15:21 <_dp_> 2**(len(result) - 1).bit_length(
16:16:11 <_dp_> basically, you need bit length of last choice which is 15, not 16
16:16:48 <andythenorth> going to delete my stupid dict
16:17:03 <andythenorth> {2: 1, 4: 2, 8: 3, 16: 4}[len(choice_list)] is funny
16:22:57 *** wallabra has quit IRC (Quit: ZNC 1.8.2 - https://znc.in - Stopping for maintenance... Leave messages at my XMPP (gustavo6046@anonym.im), or my Discord (Gustavo6046#9009), or possibly )
16:25:22 <andythenorth> all the random now
16:34:44 *** Smedles has joined #openttd
16:52:54 *** ChanServ sets mode: +v tokai
16:59:42 *** tokai|noir has quit IRC (Ping timeout: 480 seconds)
17:06:17 *** esselfe has quit IRC (Quit: brb)
17:17:35 *** esselfe has joined #openttd
18:48:54 <DorpsGek> - Update: Translations from eints (by translators)
19:12:54 *** Flygon has quit IRC (Quit: A toaster's basically a soldering iron designed to toast bread)
20:07:22 *** virtualrandomnumber has joined #openttd
20:07:37 *** virtualrandomnumber has quit IRC ()
20:10:54 *** arikover has joined #openttd
20:12:52 <arikover> Good evening everyone.
20:23:37 *** arikover has quit IRC (Remote host closed the connection)
20:23:39 *** gelignite has joined #openttd
20:25:22 *** arikover has joined #openttd
20:51:02 <andythenorth> I broke Train Whack! :D
20:51:25 <michi_cc> Oh no! Abort, abort, abort :p
20:53:17 *** gelignite has quit IRC (Quit: Stay safe!)
20:56:47 <andythenorth> yes, I broke the silly train randomiser by adding randomised trains
21:07:12 * andythenorth fixed Train Whack!
21:14:39 *** arikover has quit IRC (Quit: ERC 5.4 (IRC client for GNU Emacs 28.1))
21:40:42 *** nielsm has quit IRC (Ping timeout: 480 seconds)
22:10:37 *** virtualrandomnumber has joined #openttd
22:10:39 *** virtualrandomnumber has quit IRC ()
22:28:57 *** sla_ro|master has quit IRC ()
22:32:37 *** andythenorth has quit IRC (Quit: andythenorth)
22:42:12 *** snail_UES_ has joined #openttd
23:23:28 *** snail_UES_ has quit IRC (Quit: snail_UES_)
23:33:47 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
continue to next day ⏵