IRC logs for #openttd on OFTC at 2023-02-23
โด go to previous day
01:14:05 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
01:26:06 *** TROILUS5 has quit IRC (Read error: Connection reset by peer)
01:26:06 *** TROILUS has joined #openttd
01:30:23 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
01:35:19 *** WormnestAndroid has joined #openttd
01:41:02 *** Wormnest has joined #openttd
02:25:19 *** TROILUS8 has joined #openttd
02:30:03 *** TROILUS has quit IRC (Remote host closed the connection)
02:30:04 *** TROILUS8 is now known as TROILUS
02:33:15 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
02:56:39 *** TROILUS has quit IRC (Read error: Connection reset by peer)
02:56:52 *** TROILUS has joined #openttd
03:06:49 *** tokai|noir has joined #openttd
03:06:49 *** ChanServ sets mode: +v tokai|noir
03:11:29 *** Wormnest has joined #openttd
03:13:37 *** tokai has quit IRC (Ping timeout: 480 seconds)
03:26:43 *** TROILUS has quit IRC (Remote host closed the connection)
03:26:49 *** TROILUS has joined #openttd
03:42:47 *** debdog has quit IRC (Ping timeout: 480 seconds)
03:51:21 *** D-HUND is now known as debdog
04:04:38 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
04:13:41 *** TROILUS0 has joined #openttd
04:19:05 *** Wormnest has joined #openttd
04:19:20 *** TROILUS has quit IRC (Ping timeout: 480 seconds)
04:19:21 *** TROILUS0 is now known as TROILUS
04:24:18 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
05:11:38 *** WormnestAndroid has joined #openttd
07:07:14 *** WormnestAndroid has quit IRC (Read error: No route to host)
07:25:53 *** sla_ro|master has joined #openttd
10:57:31 *** WormnestAndroid has joined #openttd
11:24:24 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
11:35:32 *** WormnestAndroid has joined #openttd
12:05:07 <glx[d]> Ah yes it's old, saveload code changed since
12:29:46 <Samu> i was hoping i could make it save then load all kind of lists, not just GSList and AIList
13:24:12 *** TROILUS has quit IRC (Quit: Ping timeout (120 seconds))
13:24:36 *** TROILUS has joined #openttd
14:13:03 <Samu> how do i detect the correct class name
14:15:51 <Samu> trying to detect whether it's GSList or GSTileList, and it always finds both
14:16:04 <Samu> seems the detection method is flawed
14:22:02 *** TROILUS has quit IRC (Quit: Ping timeout (120 seconds))
14:22:08 *** TROILUS has joined #openttd
15:22:24 <Samu> I give up, this is way too complex
16:15:25 *** TROILUS has quit IRC (Read error: Connection reset by peer)
16:15:25 *** TROILUS8 has joined #openttd
16:15:36 *** TROILUS8 is now known as TROILUS
16:20:09 *** TROILUS has quit IRC (Remote host closed the connection)
16:20:09 *** TROILUS4 has joined #openttd
16:20:10 *** TROILUS4 is now known as TROILUS
16:35:06 <andythenorth> I don't understand squirrel inheritance
16:35:15 <andythenorth> but isn't GSTileList a subclass of GSList?
16:35:40 <andythenorth> so won't GSTileList duck-type as GSList when asked that way?
16:48:55 *** supermop_toil has joined #openttd
16:55:26 <Samu> this requires an expert coder
16:56:25 <Samu> I know that these classes are named with a string
16:57:11 <Samu> "GSTileList", "GSList", but one is a subclass of the other
16:58:28 <Samu> if I could find a way to get the real one, and not what it is based on, I could make save/load work
16:59:01 <Samu> but squirrel code is incredibly illegible
16:59:12 <Samu> I don't understand 90% of it
17:09:16 *** Wormnest has joined #openttd
18:40:03 <Samu> why is visual studio so stupid at times..
18:43:59 <FLHerne> Does the Steam version use different directories to the usual install?
18:47:14 <glx[d]> minor difference is opengfx/sfx/msx included in the setup
18:47:37 <Samu> why is that when i click Debug, i get a version from 3 days ago?
18:50:32 <Xarick> i'm on branch slow-valuate, and i clicked debug, and it comes up with a different build from 3 days ago
18:50:41 <Xarick> level-crossing-tests...
18:50:46 <glx[d]> date is from commit IIRC
18:51:48 <Samu> visual studio is misbehaving :(
18:53:24 <andythenorth> GSArbitraryAchievement
18:53:44 <glx[d]> so if latest commit in your branch is from 3 days ago, the build will use this date
18:53:52 <Samu> i can't build an openttd.exe with the current branch, it's always coming up with a build from 3 days ago
18:54:06 <Samu> from a whole different branch, my visual studio is acting up
18:56:03 <Samu> nop, the stupid level crossing branch comes up again
18:56:37 <glx[d]> then you are in this branch
18:57:00 <Xarick> no im not, it's in slow-valuate, but it always executed that openttd version
18:58:40 <Samu> maybe another visual studio update that broke it? i dunno, might reinstall
19:00:56 <Samu> the openttd.exe (Install) is broken
19:01:03 <Samu> the openttd.exe normal one works fine
19:01:53 <Samu> i need the compat files, so i need the install one
19:02:22 *** Flygon has quit IRC (Quit: A toaster's basically a soldering iron designed to toast bread)
19:24:13 <frosch> dP: are you by chance familar with openttd-polska and the polish train set?
19:25:12 <frosch> which would be fine for me, if they are all coauthors, and it would cause no drama ๐
19:31:21 <dP> I've heard about openttd-polska but that's about it
19:35:16 <Brickblock1> frosch: I don't see how it would be any different from making it its own entry whit a new author
19:35:35 <Brickblock1> Most of the changes were however made by mw
19:36:05 <frosch> a new entry would have a new grfid
19:38:12 <frosch> basically: if this is a fork -> use new grfid, create new content. if this is a continuation from the same group of authors -> keep grfid, add more authors to bananas
19:38:56 <Brickblock1> I did fork it but no content changed tho some cargoes got better sprites
19:39:19 <Brickblock1> I only redid railtypes to work with 13
19:42:40 <Samu> i broke visual studio and i dont know how to fix it
19:43:04 <andythenorth> ok what do we prefer?
19:43:04 <andythenorth> 1. I copy GSTown.ChangeRating to be GSTown.ChangeRatings and give it a list of towns
19:43:04 <andythenorth> 2. redesign GS completely?
19:43:20 <andythenorth> 1s to set 30 town ratings on a small map is ridiculous
19:45:44 <dP> making individual commands for batch processing will just make it worse imo
19:46:03 <dP> though having a method to set all towns to the same rating may make sense
19:46:34 <andythenorth> well I considered also having GSTowns, which is all the same methods, but they take a list
19:46:43 <andythenorth> and then I considered dropping GSTown, and passing a list of 1
19:46:50 <andythenorth> for backwards compatibility
19:47:41 <frosch> do companies even have a rating in towns they are not present? can gs set one anyway?
19:48:03 <andythenorth> oh I mean growth rate oops ๐
19:48:11 <andythenorth> searched rating copied the wrong thing ๐
19:48:27 <frosch> setting the same rating in all towns makes little sense to me, sounds like "remove TTD game mechanics, until nothing is left of the game"
19:48:45 <frosch> setting the same growth rate for all towns makes even less sense :p
19:48:55 <andythenorth> different calls though?
19:49:00 <andythenorth> lists wouldn't be all towns?
19:49:13 <frosch> anyway, I read the command-limit was meant for AI to keep things fair
19:49:26 <frosch> so, make a PR to remove the command-limit for GS :p
19:49:45 <andythenorth> I thought it was baked into network protocol?
19:50:18 <andythenorth> probably I misunderstood?
19:50:18 <andythenorth> that _never_ happens
19:50:31 <dP> it's not baked in that hard
19:51:05 <dP> but a bit of rearrangement of command queues will be needed for gs to execute commands immediately
19:51:24 <TrueBrain> andythenorth: Don't quote me on things I never said ๐ I think you confuse opcode-limit ๐
19:52:25 <andythenorth> oh ๐ what is the command limit vs. opcode limit?
19:52:29 <andythenorth> how do they relate?
19:52:36 <frosch> TrueBrain: i gave up on that. the things i have said according to andy...
19:53:01 <TrueBrain> just rephrase: the ether said ... ๐
19:53:08 <andythenorth> I should prefix everything with 'as I understood it' ๐
19:53:23 <andythenorth> some massive amount of communication is misunderstood, somebody told me
19:54:56 <andythenorth> I think that's what they meant anyway
19:55:56 <andythenorth> anyway goes it throw something out?
19:56:50 <dP> I already threw something out
19:58:52 <TrueBrain> andythenorth: I dunno. I don't know what "command limit" refers to
19:59:02 <TrueBrain> there is a command limit of 1 when in multiplayer, I guess ..
19:59:15 <TrueBrain> best guestimation I can give to the meaning of those two words ๐
19:59:46 <dP> there is also a limit off how many network commands server can execute per tick
20:01:57 <TrueBrain> (and in case it wasn't clear, I wasn't following the conversation, my "I AM BEING MISQUOTED" alarm went off, that is all :P)
20:02:23 <andythenorth> I looked where I thought you said the thing ๐
20:02:28 <andythenorth> I had completely imagined it
20:02:40 <TrueBrain> there is an opcode limit for the script engines
20:02:46 <TrueBrain> and a script can only have a single command pending
20:02:57 <TrueBrain> dunno where the conversation was about .. pick one of the two ๐
20:05:01 <TrueBrain> the first is of course to avoid scripts consuming 100% CPU, making for a bad human-play experience; pretty sure the amount of opcodes was never actually tuned, and just some random value was picked that "looked good" back-in-the-days. There actually isn't a good value, so what-ever ๐
20:05:15 <TrueBrain> the second is of course because in multiplayer you only know the result of a command after it has actually been executed
20:05:22 <TrueBrain> now you can quote me ๐
20:07:43 <TrueBrain> hihi, can we introduce promises in Squirrel?
20:07:59 <TrueBrain> I can't see how that possibly goes wrong ๐
20:08:21 <frosch> maybe Mevva is alive and reads github notifications
20:09:07 <TrueBrain> I will not be trigger-happy this time ๐
20:09:46 <Samu> who can help me, i tried deleting the folder, redownloaded again from fresh
20:10:08 <Samu> i can't build openttd.exe (Install)
20:10:20 <Samu> Target missing executable
20:11:24 <TrueBrain> I guess a more fair solution would be to make a fire&forget command structure, where you can just fire commands, not minding what the return-value is
20:11:57 <TrueBrain> now I am curious if anyone ever wrote something like this in the script engine ..
20:12:52 <michi_cc[d]> Samu: Maybe you should build OpenTTD, and not some installation target.
20:13:07 <TrueBrain> ah, no, it is still suspending when in networking ๐
20:13:14 <Samu> it used to work 3 days ago
20:13:30 <Samu> it would create an install folder, now it's missing
20:13:51 <TrueBrain> owh, also in non-networking ofc, as people were having issues with "it works in singleplayer but not in multiplayer"
20:14:01 <TrueBrain> hihi, that part I forgot ๐ So amend my quotation please to include this ๐
20:15:11 <Samu> can i see your CMakeSettings.json?
20:16:33 <LordAro> sounds like your run command is wrong
20:17:06 <michi_cc[d]> I generate a VS project with Cmake and don't use the "Open folder" variant, so I don't have a CMakeSettings.json
20:19:22 <andythenorth> whose idea was GS anyway?
20:19:27 <andythenorth> was it TrueBrain ?
20:20:00 <TrueBrain> darn it, I did make the commit ๐ฆ
20:20:24 <TrueBrain> looking at the content, I even was the author
20:20:27 <andythenorth> "Yes 960ms is an acceptable time to set a value on 32 towns"
20:20:28 <TrueBrain> still doesn't mean it was my idea ๐
20:23:59 <michi_cc[d]> andythenorth: What would a good parameter form for a multi-set function be? I actually thought about adding some after the command rework, but got stuck on deciding if it should be like e.g. a table as a dict, two arrays, a GSList or something else. An API that takes something you never can just create in the GS isn't of much use.
20:24:42 <frosch> squirrel2 has coroutines, so one could issue commands in async coroutines and collect the results from there
20:24:45 <andythenorth> michi_cc[d]: pass an arbitrary function and an arbitrary array ๐
20:24:50 <andythenorth> like we would in python
20:25:07 <TrueBrain> frosch: coroutines are also a nice solution
20:25:29 <TrueBrain> or .. we just make a "brain" per town .. but now I am at the point of quoting gists again, and XarothBrook will laugh at me when I do ..
20:25:40 <TrueBrain> he says I am the "I have a gist for that" where peter is the "I have a patch for that" guy ..
20:25:42 <andythenorth> with embedded WASM ๐
20:25:50 <frosch> commandtestrun is global state though, so potentially disruptive ๐
20:26:05 <XarothBrook> TrueBrain: That's because you are!
20:26:11 <andythenorth> I am not mentioning Squirrel again, I assumed we're killing the Squirrel and burying it ๐
20:26:17 <XarothBrook> and it is not a bad thing!
20:26:25 <TrueBrain> frosch: fire&forget would be a nice solution for GSTown related stuff I am sure .. easier to implement ๐
20:26:40 <andythenorth> "Town is just a class of region"
20:26:51 <XarothBrook> "Town is just a different type of road".
20:26:56 <frosch> TrueBrain: probably, i think the requested commands cannot even fail :p
20:27:06 <TrueBrain> frosch: even worse! ๐
20:27:10 <andythenorth> "Everything is an instance of a prototype"
20:27:10 <dP> region-oriented programming
20:27:21 <andythenorth> all things tend to crabs?
20:27:48 <XarothBrook> I'm pretty sure there's a yo momma joke in there somewhere.
20:27:52 <TrueBrain> well, fire&forget ... fire&test&forget might be a tiny bit safer? Dunno .. might also be unexpected
20:27:58 <TrueBrain> could send an event if the command actually failed
20:27:59 <frosch> i should use chatgpt in my wasm blog. ask it to write a paragraph why wasm doesn't solve andy's problems, no matter what they are ๐
20:28:28 <andythenorth> "there is a constant number of problems"
20:28:32 <andythenorth> "just the names change"
20:28:47 <TrueBrain> frosch: does using ChatGPT make it more or less likely you publish it? ๐
20:29:12 <andythenorth> "I have a blog for that"
20:30:09 <TrueBrain> well, ChatGPT no longer wants to load
20:30:34 <glx[d]> andythenorth: no it's "I started to write a blog for that"
20:30:43 <frosch> well, i don't use it often enough to warrant 20โฌ/month
20:30:51 <TrueBrain> soon you can use bing
20:30:51 <andythenorth> I think mine is "I have an unreleased grf for that"
20:31:07 <andythenorth> or maybe "I have a FIRS economy for that"
20:31:12 *** HerzogDeXtEr has joined #openttd
20:31:16 <TrueBrain> also on Chrome, completely empty
20:31:21 <TrueBrain> someone fucked up a deployment ๐
20:31:38 <andythenorth> maybe it's depressed and won't get out of bed
20:31:44 <andythenorth> AI mental health day
20:31:55 <frosch> usually i get at least the cloudfront page, saying it's down
20:32:16 <TrueBrain> page load, Next is called, but ... there is a CSS file that is send as text/html? Dunno .. weird ๐
20:32:53 <TrueBrain> `Uncaught SyntaxError: expected expression, got '<'` .. doesn't sound good ๐
20:33:24 <TrueBrain> lol, all files return the frontpage HTML
20:33:48 <Samu> glx did you update visual studio today? i suspect that is the cause
20:34:29 <Samu> it used to create an Install folder and put an installation of openttd there
20:34:44 <Samu> without all those test files and temporary stuff
20:34:53 <Samu> just like a portable openttd
20:34:53 <glx[d]> I updated yesterday and it works fine, but I don't use "install"
20:35:05 <Samu> now it doesn't create the install folder
20:36:44 <glx[d]> and it created out/install/x64-debug as expected for me
20:37:02 <Samu> then why is it failing for me :(
20:38:48 <andythenorth> I asked Bing and it said we're blaming me today, but TrueBrain tomorrow
20:38:53 <andythenorth> frosch: gets blamed on Saturday
20:39:59 <frosch> but then it's the weekend ๐ฎ
20:40:09 <andythenorth> Sunday we have a day off
20:40:30 <glx[d]> I stopped using CMakeSettings.json when they introduced CMake Presets (because it's easier that way with wsl)
20:41:11 <andythenorth> how about one GS command that lets me write some big structure to memory ๐
20:41:24 <andythenorth> and then grf can read it on the normal scheduled callbacks ๐
20:41:32 <andythenorth> * we might need some new town callbacks
20:42:05 <glx[d]> access to persistent storage would be simpler
20:42:24 <andythenorth> well...writing the persistent storage for every town on the map
20:42:27 <andythenorth> would one command per town
20:42:35 <andythenorth> so back to.....sloooooow ๐
20:43:39 <andythenorth> did we like JSON for grf <-> GS communication? ๐
20:46:38 <Samu> how do i use cmake presets or so
20:46:59 <glx[d]> samu: I retested after removing install dir, I needed to manually "install", same menu as build
20:47:33 <glx[d]> but install was never automatic for me as far as I remember
20:49:38 <Samu> i see the Install openttd under build menu, i tried it, and now it worked, but I never did it this way before
20:50:24 <Samu> must have changed recently?
20:50:40 <Samu> like from 3 days ago it used to work
20:50:48 <glx[d]> I never used install to debug
20:51:33 <glx[d]> install is only useful to make a zip to share
20:51:52 <glx[d]> and checking no file is forgotten
20:53:01 <Samu> used to be so automatic, i clicked the Play button and it would build and install and launch it attached to the debugger
20:54:32 <TrueBrain> lol, Squirrel commands works with throwing .. that is a performance hit ๐
20:57:50 <TrueBrain> Completely untested. "it compiles". As far as I got. But something like this possibly works. You instantly will hit other limits, as there are some internal queues. But okay .. you get the idea ๐
20:58:37 <Samu> how do i automate the install?
21:00:56 <andythenorth> Opcode limit is per tick?
21:01:08 <andythenorth> I did know thisโฆ.but fogot
21:01:19 <TrueBrain> so yeah, every tick, I think
21:01:31 <LordAro> urgh, CI systems are hard when the build takes 4 hours
21:02:12 <andythenorth> I might write my own scheduling framework in squirrel
21:02:35 <andythenorth> Put all commands needed for behaviour into table slots
21:03:23 <andythenorth> My GS town-stuff ideas all have quite stable monthly behaviour
21:04:08 <andythenorth> I can predict how many commands will be needed and whether the performance will be met or not
21:04:47 <andythenorth> Then notify the user or drop some features if the commands donโt fit in one month
21:04:55 <TrueBrain> updated my branch to have a better chance of actually working ๐ Still no clue .. guess it is more the question: do we want such broad commands to exist ๐
21:05:15 <TrueBrain> it might be better to have a "batch" command .. or "transaction" scope
21:05:58 <andythenorth> I sketched a few batch ideas before, but what to return?
21:05:59 <TrueBrain> this solution is only so very lightweight ๐ So cute!
21:06:02 <glx[d]> I would not allow fire&forget to AIs
21:06:19 <andythenorth> And does all batch need to bd transactional?
21:06:38 <andythenorth> I.e rollback all changes if one item fails
21:06:57 <glx[d]> there's no rollback in openttd ๐
21:07:01 <andythenorth> Oof phone typing in 4 degree weather
21:07:09 <andythenorth> Test theb execute?
21:07:28 <andythenorth> Cold fingers ๐ฅถ
21:07:48 <glx[d]> even testmode can pass while execmode will actually fail
21:07:49 <TrueBrain> glx[d]: good point, so no "transaction" scope it is ๐
21:08:13 <glx[d]> because actual changes may affect next command
21:08:20 <TrueBrain> andythenorth: in my fire&forget branch, it now simply returns the test-result .. but it means you cannot see the ID of a new vehicle, for example
21:08:27 <TrueBrain> a batch would do the same
21:08:49 <TrueBrain> the difference between fire&forget and batch is simply the moment of execution .. "execute as they come" vs "all at once"
21:09:35 <TrueBrain> but if you do what michi_cc[d] suggests, at least, how I choose to read it, we could make an AIList where we add all the commands in order, and we assign the results after the executed all commands
21:09:44 <TrueBrain> so you could read back what the commands actually did there
21:10:35 <TrueBrain> so you can actually also get back IDs of new stuff you made
21:11:26 <TrueBrain> I kinda see that working .. bit like the ScriptAccounting
21:11:57 <TrueBrain> but a ScriptCommandBatch, and every next command you execute returns instantly, but the actual result value you can retrieve after calling a ->GetResults() on it, which waits for all commands to actually being executed
21:12:47 <frosch> AIList is only list of ints, isn't it?
21:12:52 <dP> why all the horrible solutions when you can just do the simple thing and execute command instantly? :p
21:12:58 <TrueBrain> frosch: it still is? Bah
21:13:04 <glx[d]> Lists are int only yes
21:13:18 <TrueBrain> so I like my fire&forget in that case ๐
21:14:14 <glx[d]> but really it should be for GS only, else AIs could abuse the no sleep when firing
21:15:14 <TrueBrain> updated PR to better reflect that ๐
21:15:24 <glx[d]> and maybe only for commands not affecting the map
21:15:37 <TrueBrain> that would be hard to explain to the user and to code
21:16:00 <TrueBrain> in that case we could better add another parameter to some commands, where you can toggle this
21:16:01 <glx[d]> well GSTown, GSGoal, ...
21:16:02 <TrueBrain> which I wanted to avoid ๐
21:16:34 <TrueBrain> glx[d]: ` static bool ExpandTown(TownID town_id, int houses);`
21:18:29 <frosch> can leaving ScriptFireForget scope wait for all commands to finish?
21:18:40 <TrueBrain> bit of bookkeeping, but yes
21:19:06 <glx[d]> an extra CMD_ flag maybe to (dis)allow some commands
21:19:17 <TrueBrain> glx[d]: not the worst idea
21:19:23 <dP> frosch: that would actually make it worse
21:19:27 <frosch> i guess the GS wants to know when it can do the next logical step, instead of running in circles and overtaking its own commands
21:19:27 <glx[d]> but again hard to explain in the doc
21:19:42 <TrueBrain> frosch: yeah, it makes sense .. so it is a batching-light ๐
21:19:57 <frosch> dP: why? wait once for 100 commands, instead of waiting 100 times
21:20:25 <dP> but it's even better to not wait at all
21:20:43 <TrueBrain> glx[d]: I think that is okay. We can add "yet-another-note" stating it doesn't work with fire&forget .. which is a bit different than how I was thinking before, where the user wouldn't see the difference, but it would behave different
21:20:51 <TrueBrain> but just failing if you try a command in fire&forget, that is not bad
21:20:57 <dP> in what I do if I don't need the result there is no point waiting
21:20:57 <frosch> there could also be a ScriptFireForget.wait() function :p
21:21:08 <dP> so I just send the command and forget
21:21:26 <dP> as a separate function, it's alright I guess
21:21:37 <TrueBrain> okay, a proper solution should hook into the `SetDoCommandMode`, that makes a lot more sense
21:21:37 <frosch> i expect scripts to loop all towns, check some things, and then change things relatively
21:21:45 <frosch> that breaks if there are still pending changes in the queue
21:21:48 <TrueBrain> I just added a hack next to an existing one ๐
21:22:29 <TrueBrain> but at least seeing some code always helps ๐
21:22:35 <dP> f&f is just a kludge in general though :p
21:23:44 <andythenorth> is it a kludge we could replace in future?
21:24:00 <TrueBrain> we have TestMode, ExecMode, so this would be .. BatchMode?
21:24:01 <dP> yeah, at least it's harmless afaict
21:24:04 <andythenorth> currently performance is demotivating me from writing actual GS ๐
21:24:21 <andythenorth> and we know that real content is a good way to identify what the design _should_ have been
21:24:23 <TrueBrain> we could hold back all the commands, and execute them when BatchMode goes out-of-scope .. might be more clear to the user what is happening and when
21:24:58 <TrueBrain> as when opcodes run out while creating a batch, it will still not execute
21:25:34 <glx[d]> like create a temp command queue to be merge in the real command queue
21:26:09 <TrueBrain> it fits at least better in the current modes
21:27:05 <dP> frosch: for most actions there is nothing to check and no way to handle the error. What is the script supposed to do if setting growth rate fails, for example? send it again?
21:27:34 <glx[d]> setting growth rate can't fail ?
21:27:49 <TrueBrain> hmm, guess we could add a `.GetResult(0)` on the batch .. so you can fetch the result .. to avoid the "AIList is a list of ints" issue
21:27:52 <frosch> dP: i mean the case: settownrating(company, gettownrating(company) + 5)
21:27:53 <glx[d]> unless parameters are wrong
21:28:00 <dP> glx[d]: who knows, it's not in the api
21:28:15 <frosch> that only works if the result of gettownrating is up to date
21:28:37 <frosch> if the gs cannot force the previous batch to finish, all incremental updates behave random
21:29:06 <glx[d]> GS should know what it's doing in this case
21:29:08 <TrueBrain> doing a ScriptBatchMode also resolves the issue of excluding some commands of working in a fire&forget
21:29:23 <TrueBrain> as any command can be executed in a batch mode
21:30:02 <dP> frosch: yeah, in that case you need to wait, but you can do it without f&f already.
21:30:07 <TrueBrain> we could even make all functions return a "batch-id" in that case, which is a number which they can use to look up the result when the batch is executed
21:30:17 <dP> wait is useful in some cases but not all
21:30:50 <frosch> TrueBrain: that changes the return value to something else :p
21:31:12 <TrueBrain> basically, it will return a promise
21:31:14 <TrueBrain> instead of the value
21:31:22 <TrueBrain> and .. full circle, back to my initial suggestion of using promises ๐
21:31:50 <TrueBrain> well, if we go fancy, we could wrap it in an actual ScriptPromise
21:32:07 <TrueBrain> am I pushing it now? ๐
21:32:28 <TrueBrain> iterative design? us? NEVAH
21:33:12 *** nielsm has quit IRC (Ping timeout: 480 seconds)
21:33:14 <glx[d]> at least the code is extra safe
21:34:05 <frosch> how is AIVehicle::BuildVehicle supposed to work in batch mode? currently it returns a VehicleID. i would expect it returning 0 in batch mode (as in test mode). but returning a PromiseID would be weird
21:34:42 <TrueBrain> well, we could make it return `ScriptPromise(0)` (where 0 is the ID), and after the batch closes, you can do `.GetResult()` on it, which returns the VehicleID
21:35:06 <glx[d]> and sleep if return value is not ready ?
21:35:26 <TrueBrain> or an error, as you requested it before closing the batch ๐
21:35:38 <TrueBrain> what do we return if the command fails to execute?
21:36:00 <glx[d]> fail is detected early I think
21:36:16 <TrueBrain> in the test-round, sure, but what if it fails during execution?
21:36:41 <TrueBrain> no, before we queue a command
21:36:45 <TrueBrain> in the script handling
21:36:48 <TrueBrain> then we send it to the queue
21:37:23 <TrueBrain> as executions are always done a tiny bit after the queue, it happens that the execution actually fails
21:39:22 <TrueBrain> the internal state is updated properly that the command failed
21:39:25 <glx[d]> the result is set in command callback
21:39:41 <TrueBrain> but what is actually returned in the variable .. hmm
21:41:32 <glx[d]> hmm looking at ScriptInstance::DoCommandCallback() some care will be needed around ScriptObject::SetLastCommand() for batch to actually work
21:43:20 <glx[d]> a lot of stuff really suppose one command by tick
21:43:44 <TrueBrain> yeah, but it is all callback based, so that is just a manner of some administration
21:43:58 <TrueBrain> I am now just a bit worried what is returned with BuildVehicle if it fails to execute ๐
21:46:20 <TrueBrain> we have a function called `Unsafe` with the comment `Top-level network safe command execution without safety checks.`
21:46:25 <TrueBrain> there is some irony in that sentence ๐
21:47:36 <TrueBrain> ah, okay, finally traced how that works .. CmdBuildVehicle always returns INVALID_VEHICLE if it fails
21:47:47 <TrueBrain> which is picked up by the script, and inserted on the stack as return value
21:48:14 <Samu> must have been a recent change in visual studio
21:48:15 <TrueBrain> did not know a command could return more than one value these days .. that is pretty sweet ๐
21:48:32 <Samu> now i need to manually build before pressing the debug button
21:48:58 <glx[d]> your workflow is broken, why install to debug ?
21:49:03 <TrueBrain> so yeah, the only weird thing in BatchMode would be that it returns promises instead of the mentioned return value .. but that is I guess expected for any batch-mode?
21:49:13 <Samu> because it has always worked
21:49:18 <Samu> and i needed the compat files
21:49:20 <TrueBrain> frosch: which brings me back to this .. is this actually a problem? ๐
21:49:57 <glx[d]> compat files are copied to build folder
21:50:17 <Samu> really? they used not to
21:52:17 <Samu> nice! someone must have fixed that
21:52:54 <frosch> TrueBrain: i never used an API, where changing a global changes the return type of some other function :p
21:53:11 <frosch> dynamic-typing side-effects
21:53:16 <TrueBrain> not as much as a global, but as long as a local variable lives, yeah ๐
21:53:22 <TrueBrain> normally you get this with a keyword
21:53:25 <andythenorth> is it a mode? ๐
21:53:34 <TrueBrain> like `local a = sync ScriptVehicle::BuildVehicle(..)`
21:53:48 <TrueBrain> that would make it more explicit in that sense
21:54:23 <TrueBrain> but as we cannot do that .. but I guess that is the trade-off
21:54:26 <frosch> anyhow, i am not sure whether the return values are needed
21:54:32 <frosch> the mass commands have no return values
21:54:59 <TrueBrain> well, if I want to make 5 vehicles, why can't I do that in a batch? ๐
21:55:14 <glx[d]> why would a GS build vehicles ?
21:55:20 <frosch> even clearing a tilearea does not tell you how many tiles succeeded, and which did not
21:55:25 <TrueBrain> we were going with the BuildVehicle idea glx[d] ๐
21:55:51 <andythenorth> glx[d]: mostly because 'why not'?
21:56:08 <TrueBrain> frosch: even so, it changes the return-value of those commands to .. what do we return? ๐
21:56:13 <glx[d]> SignID is more generic ๐
21:56:45 <glx[d]> GS placing signs seems more probable
21:56:52 <TrueBrain> my current branch returns the value as it would in TestMode btw
21:57:06 <TrueBrain> so okay, yes: I want to place 20 signs
21:57:11 <TrueBrain> and I want to know their IDs
21:57:19 <frosch> TrueBrain: yes, that's what i would expect, return value of testrun
21:58:11 <TrueBrain> not sure how much of a problem changing the value to a promise is, if you enable batch mode .. I get it is not the prettiest, but .. meh ๐
21:58:24 <TrueBrain> makes it more practical ๐
21:58:59 <TrueBrain> for syntax-sugar we could fake it a bit, by doing something like:
21:58:59 <TrueBrain> `local batch = ScriptBatchMode(); batch.queue(ScriptSign::BuildSign(..));`
21:59:08 <glx[d]> it's just pushing an instance instead of an integer
21:59:09 <TrueBrain> where the queue returns the promise
21:59:47 <andythenorth> what does GS do? Unpack the values?
22:00:07 <frosch> can you fake it into "batch.invoke(ScriptSign::BuildSign, ...)" ?
22:00:22 <TrueBrain> I like that idea, hmm ...
22:00:26 <TrueBrain> I don't see a reason why not
22:00:26 <frosch> pff, this is getting silly complicated :p
22:01:01 <glx[d]> on openttd side batch.invoke() is not hard to do
22:01:06 <TrueBrain> alternative: `local batch = ScriptBatchMode(); ScriptSign::BuildSign(..); local promise = batch.GetLastPromise();`
22:01:25 <glx[d]> we already have valuate with varargs ๐
22:01:25 <TrueBrain> where `BuildSign` returns the same value as TestMode would
22:01:31 <frosch> hmm, isn't there some getlasterror already?
22:01:34 *** sla_ro|master has quit IRC ()
22:02:14 <TrueBrain> hmm, but is it public to the script .. hmm
22:03:00 <TrueBrain> so we can even offer both, with little effort honestly
22:03:12 <TrueBrain> would be the more verbose way of doing this, I guess .. batching
22:03:22 <dP> frosch: I just realized that can never work reliably with delayed execution. because there can always be player command that changes rating in between.
22:03:51 <frosch> i like the GetLastPromise. then users can write their "invoke" stuff around it, and keep the variadic and function pointer stuff inside squirrel
22:04:05 <Samu> reverting visual studio to 17.4.5
22:04:27 <TrueBrain> hmm .. guess we could allow AIs to use the same, honestly
22:04:51 <TrueBrain> we could give a penalty to the opcode used for every command, to limit the damage ๐
22:05:47 <frosch> how about giving ais an opcode bonus for every year they do not crash? :p
22:06:07 <TrueBrain> does Squirrel have lists .. I forgot how Squirrel works ๐
22:06:23 <glx[d]> don't they mostly crash when valuating ?
22:06:30 <frosch> it has tables, so it will also have lists
22:06:49 <glx[d]> tables and arrays for sure
22:06:57 <frosch> glx[d]: it's like sysadmins, you only notice them, if something breaks
22:07:42 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
22:08:07 <glx[d]> Arrays are simple sequence of objects, their size is dynamic and their index starts always from 0.
22:08:22 <glx[d]> ah yes, and you can put whatever you want in them
22:09:02 <TrueBrain> still no clue about the syntax ๐ It is fine, I will write without mentioning lists ๐
22:12:41 <TrueBrain> updated with a mention to nesting execmode/testmode in a batchmode ๐
22:14:53 <TrueBrain> ScriptPromise will be an extension of ScriptError, I guess. So you can also query for errors ๐
22:16:11 <TrueBrain> do we now also have a PIRS industry set? (reading the new Event)
22:16:38 <frosch> it's probably pikka's firs fork ๐
22:16:58 <frosch> "firs" starts with "f", so it is easy to "fork"
22:17:09 <frosch> Forking industry replacement set
22:17:24 <TrueBrain> Forkable Industry Replacement Set, ofc ๐
22:17:59 <Samu> glx[d], it works now! reverted to version 17.4.5
22:18:08 <frosch> i am used to adjectives starting with f ending in ing
22:18:19 <TrueBrain> I think a BatchMode like that could work fine, and isn't that much code from what I can tell now. Mostly bookkeeping.
22:18:40 <dP> pirs is written in nfo so it's hardly a fork
22:18:50 <dP> even if it uses some graphics (which I'm not sure)
22:19:07 <frosch> i hope it did not fork from the decompiled pynml code ๐
22:19:26 <frosch> forking andy's generated nml is already insane, but imagine forking the generated nfo
22:19:47 <andythenorth> @Pruple#1144 probably wrote it from scratch ๐
22:19:48 <TrueBrain> now I want an example of looping over all towns .. let's see ... where is andy's github ... ๐
22:19:51 <dP> nah, it's a genuine hand-crafted nfo afaict xD
22:19:55 <andythenorth> oh no pikka in this channel?
22:20:24 <dP> TrueBrain: lol I just did exactly that:
22:20:24 <dP> class MainClass extends GSController {
22:20:24 <dP> GSText.STR_TITLE_ENGINEER,
22:20:24 <dP> GSText.STR_TITLE_ENGINEER,
22:20:26 <dP> GSText.STR_TITLE_TRAFFIC_MANAGER,
22:20:26 <dP> GSText.STR_TITLE_TRAFFIC_MANAGER,
22:20:28 <dP> GSText.STR_TITLE_TRANSPORT_COORDINATOR,
22:20:28 <dP> GSText.STR_TITLE_TRANSPORT_COORDINATOR,
22:20:30 <dP> GSText.STR_TITLE_ROUTE_SUPERVISOR,
22:20:30 <dP> GSText.STR_TITLE_ROUTE_SUPERVISOR,
22:20:32 <dP> GSText.STR_TITLE_DIRECTOR,
22:20:32 <dP> GSText.STR_TITLE_DIRECTOR,
22:20:34 <dP> GSText.STR_TITLE_CHIEF_EXECUTIVE,
22:20:34 <dP> GSText.STR_TITLE_CHIEF_EXECUTIVE,
22:20:36 <dP> GSText.STR_TITLE_CHAIRMAN,
22:20:36 <dP> GSText.STR_TITLE_CHAIRMAN,
22:20:38 <dP> GSText.STR_TITLE_PRESIDENT,
22:20:40 <dP> function GetPerformanceTitle(value) {
22:20:42 <dP> return this.performance_titles[min(value, 1000) >> 6];
22:20:44 <TrueBrain> please never ever do that again
22:20:46 <dP> local start_date = GSDate.GetCurrentDate();
22:20:48 <dP> GSLog.Info("Start setting towns... " + GSTownList().Count());
22:20:48 <dP> foreach(tid, _ in GSTownList()) {
22:20:50 <dP> GSTown.SetGrowthRate(tid, 123);
22:20:52 <dP> GSLog.Info("Done! " + (GSDate.GetCurrentDate() - start_date));
22:20:53 *** reldred has joined #openttd
22:20:53 <reldred> andythenorth: I can't tag him in discord either?
22:24:00 <andythenorth> you might need to build the grf from the same rev though, the GS looks for it
22:24:02 <TrueBrain> yeah, you went a bit apeshit there
22:24:20 <andythenorth> oh I did that? ๐ฎ
22:24:47 <TrueBrain> pynut ... pfff ๐
22:24:51 <TrueBrain> such a crazy person ๐
22:25:02 <andythenorth> what even is that town experiments GS?
22:25:07 <andythenorth> I have no memory of that ๐
22:25:13 <TrueBrain> I dunno .. I just browsed your public repos ๐
22:25:49 <TrueBrain> okay, updated gist with an example of where batching should help (a lot) ๐
22:26:23 <TrueBrain> now we just need to rate-limit how many commands you can do in a tick .. so in other words: create a command limit ๐
22:26:35 <TrueBrain> which has just some nice irony in it, looking back at the start of the night ๐
22:27:17 <andythenorth> maybe it should test your CPU ๐
22:31:49 <TrueBrain> so no reaction to my gist is a good sign I guess? I never know ๐
22:34:11 <TrueBrain> andythenorth: would that solve all your GS troubles?
22:34:17 <andythenorth> I am looking for the right gif
22:34:19 <andythenorth> it takes time ๐
22:34:42 <andythenorth> that's not the right one, but I wanted to be encouraging
22:34:54 <andythenorth> yes the gist looks great
22:35:27 <TrueBrain> good; will look at it this weekend or so ๐
22:35:52 *** keikoz has quit IRC (Ping timeout: 480 seconds)
22:37:29 <XarothBrook> And the list of gists increased by one.
22:39:14 <andythenorth> presumably some batchable commands might actually be really expensive?
22:39:24 <andythenorth> so GS authors can still shoot themselves in the head?
22:39:35 <TrueBrain> ofc! You can always! ๐
22:39:47 <andythenorth> just like javascript!
22:40:06 <andythenorth> "One or more scripts in this page is running slowly. Would you like to close it?"
22:40:49 <TrueBrain> like I said, some limit on the amount of commands you can execute in a single tick would be wise .. but that limit can than be more than one ๐
22:41:09 <TrueBrain> we could even make it weighted, depending on the command executed ๐ ๐ ๐
22:44:17 <Xarick> is the script suspended until the batch is finished?
22:44:46 <Xarick> when would i be able to check the command results?
22:47:41 <Xarick> will AI's be able to use it?
22:48:02 <Xarick> super mega fast pathfinders ๐
22:51:26 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
23:00:42 <andythenorth> I want a city-city road builder that isn't dog slow ๐
23:16:17 *** TROILUS has quit IRC (Quit: Ping timeout (120 seconds))
23:16:37 *** TROILUS has joined #openttd
23:31:12 *** Samu has quit IRC (Ping timeout: 480 seconds)
23:32:10 <dP> horrible implementation ofc but works
23:46:43 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
23:50:18 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
23:50:48 <michi_cc[d]> Hmm, I should be the "has a git branch for this" one I guess. Let's clean out some (potentially) useless stuff.
23:52:08 *** WormnestAndroid has joined #openttd
continue to next day โต