IRC logs for #openttd on OFTC at 2023-02-10
⏴ go to previous day
00:18:22 *** herms123 has quit IRC (Quit: Leaving)
00:35:08 *** Alkel_U3 has quit IRC (Quit: maintenance)
00:36:09 *** Alkel_U3 has joined #openttd
00:49:01 <glx[d]> I guess we will need a 13.1 soon
03:09:52 *** Wormnest has quit IRC (Quit: Leaving)
03:26:19 *** felix has quit IRC (Read error: Connection reset by peer)
03:47:03 *** debdog has quit IRC (Ping timeout: 480 seconds)
04:14:43 *** TROILUS3 has joined #openttd
04:20:13 *** TROILUS has quit IRC (Ping timeout: 480 seconds)
04:20:13 *** TROILUS3 is now known as TROILUS
05:16:21 *** JohnFranklin has joined #openttd
05:30:47 *** John_Franklin has joined #openttd
05:36:55 *** JohnFranklin has quit IRC (Ping timeout: 480 seconds)
05:37:01 *** John_Franklin is now known as JohnFranklin
05:56:57 *** keoz has quit IRC (Ping timeout: 480 seconds)
06:02:50 *** JohnFranklin has left #openttd (Closing Window)
06:39:03 *** Smedles has joined #openttd
07:15:16 *** sla_ro|master has joined #openttd
07:22:11 <andythenorth> "For a long time, OpenTTD had only one type of road. I made a small patch, and in the short space of several years, NRT was in trunk."
07:37:00 <petern> For the new meme to work, you need to claim something you were completely uninvolved with, and claim a few hours.
07:39:00 <andythenorth> does it also have to mention TTDPatch?
07:41:35 <TrueBrain> "For a long time, OpenTTD had only one type of road. I made a small patch in a few hours, and in the short space of several years, NRT was in trunk."
07:41:44 <TrueBrain> petern: Fixed it for you
07:42:41 <TrueBrain> And this will be crawled soon, so in a few years people really believe it
07:43:40 <petern> Oh yes, I need to buy some pedals
07:44:25 <LordAro> what's the actual story? magicbuzz not involved at all? happened to make the patch right at the end of years of refactoring?
07:44:36 <kamnet> petern: Oh well, hell, I patched OpenTTD half a decade before that LOL
07:45:04 <kamnet> (actually should be documented somewhere on the forums when i asked about it)
07:46:49 <petern> Not involved at all, the engine pool stuff was just my experiment that went too far 🙂
07:46:57 <petern> Crankbrothers Candy 11 Pedals
07:53:23 <andythenorth> hmm just had a horrific idea
07:58:39 <TrueBrain> Put it next to the others on that pile over there :p
08:13:54 <andythenorth> regions could have counts of different tile types
08:14:13 <andythenorth> storing the exact tiles that are e.g. water will be horrible for memory use
08:14:33 <andythenorth> but statistics, e.g. 80% water etc
08:29:45 <TrueBrain> Or the exact count, also cheap
08:36:56 <andythenorth> I had a mad idea about probability vectors
08:37:50 <andythenorth> 'amount if water in direction n from tile o'
08:38:44 <andythenorth> I have been reading about random walks and monte carlo things
08:46:29 <petern> I did a random walk, it was quite muddy.
08:47:22 <andythenorth> step forward: mud
08:47:29 <andythenorth> step backward: mud
08:51:25 <petern> Hmm, router update time.
08:52:42 <petern> *) leds - fixed turning off LEDs after system shutdown
09:11:22 <andythenorth> I like my electronics to stay on after they're off
09:22:21 *** D-HUND is now known as debdog
09:34:40 <andythenorth> can we make a tree-hider that follows the cursor? 🙂
09:36:01 <andythenorth> I am now going to say words as though I understand the rendering pipeline
09:36:06 <andythenorth> I think we can assume I don't
09:36:37 <andythenorth> but the sprite sorter must have a check for item visibility
09:36:55 <andythenorth> so that could have a conditional check of distance to cursor
09:37:57 <andythenorth> IsInvisibilitySet might be a thing to search with
09:38:39 <andythenorth> ok so maybe DrawTile_Trees is the place
09:39:27 <andythenorth> wonder if we have a way to resolve which tile the cursor is currently over
09:42:30 <andythenorth> `LandInfoWindow(TileIndex tile) : Window(&_land_info_desc), tile(tile)` looks like it might give clues
09:44:07 <dP> andythenorth: that's an interesting idea
09:44:28 <andythenorth> I am trying to find cursor tracking currently
09:44:47 <andythenorth> land info tool etc must monitor cursor position
09:48:09 <andythenorth> ok how do I convert OTTD_Point to a TileIndex?
09:51:33 <andythenorth> ` Point pt = GetTileBelowCursor();
09:51:33 <andythenorth> if ((pt.x == ti->x) && (pt.y == ti->y)) return;
09:51:53 <andythenorth> is Point screen coords, and TileInfo map coords?
09:53:24 <andythenorth> no GetTileBelowCursor resolves that
10:04:36 <andythenorth> moving the cursor doesn't trigger a tree redraw currently
10:04:40 <andythenorth> so that's running on fast ffw
10:04:53 <andythenorth> ` Point pt = GetTileBelowCursor();
10:04:53 <andythenorth> if ((ti->x < pt.x + 64) && (ti->x > pt.x - 64) && (ti->y < pt.y + 64) && (ti->y > pt.y - 64)) return;
10:06:46 <dP> just add MarkWholeScreenDirty();
10:08:53 <andythenorth> ha that totally kills FPS 🙂
10:10:50 <dP> yeah, I guess it's a bit much xD
10:10:54 <dP> is that release build tho?
10:11:02 <andythenorth> not sure, might be
10:11:51 <dP> you can MarkTileDirtyByTile then
10:12:18 <andythenorth> MarkTileDirtyByTile(ti->tile); is less bad
10:13:01 <dP> but you need to mark all tiles in the area
10:13:35 <petern> Ah balls, 9 spd cassette with 8 spd shifter...
10:13:39 <dP> unfortunately there doesn't seem to be function for marking tilearea's
10:13:41 <andythenorth> ` if ((ti->x < pt.x + 64) && (ti->x > pt.x - 64) && (ti->y < pt.y + 64) && (ti->y > pt.y - 64)) {
10:13:41 <andythenorth> MarkTileDirtyByTile(ti->tile);
10:13:48 <andythenorth> is all I have currently
10:13:49 <dP> only `SetSelectionTilesDirty` that does selected area
10:14:17 <dP> ah, right, you do it in rendering code
10:14:47 <dP> though idk how it works if you mark dirty in rendering code
10:14:52 <andythenorth> tree_cmd.cpp DrawTile_Trees
10:14:54 <dP> would it try to redraw them again
10:15:10 <andythenorth> fps feels like it is now redrawing all tiles often
10:15:23 <andythenorth> the whole game lags, and the trees don't hide / show very quickly
10:15:52 <dP> you can try to move it out of render and only leave the check
10:16:08 <dP> you can look how cmclient implements land info or industry tooltips for that
10:16:22 <dP> `GuiPrepareTooltipsExtra` is the function to look for
10:20:12 <petern> Okay, buy 9 speed shifter for £86 or buy 8 speed cassette for £20...
10:21:13 <andythenorth> you go much faster with 9 speed though
10:21:29 <petern> That... isn't... no...
10:22:09 <reldred> My wheel no wanna do the wheel thing atm
10:22:12 <andythenorth> is the 9 speed more closely spaced, or wider ratio range?
10:23:02 <petern> It's 11-34T, I can get an 8 speed in 11-34T as well.
10:23:22 <andythenorth> is £20 more or less than £86?
10:23:25 <petern> But as the shifter is 8 speed, I can't properly use the 9 speed anyway 😄
10:23:40 <petern> And I'd need a new 9 speed cassette at some point anyway.
10:24:42 <petern> Hmm, maybe the chain though.
11:12:55 <Samu> actually line 707 included
11:13:16 <Samu> the is_ai check is unnecessary
11:13:44 <Samu> and if i'm the local company in the ai company, i'd still like to receive the popup message
11:16:47 <Samu> if the company is not AI, AI::NewEvent will deal with it accordingly and won't send the event anyway
11:35:16 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick updated pull request #10459: Fix: [Script] Use Money instead of int32 for presenting the value of a company to AIs and show buy company dialog window even when playing in the AI company https://github.com/OpenTTD/OpenTTD/pull/10459
12:08:38 <Samu> I keep forgetting that Game Scripts also deal with human companies
12:11:41 <Samu> if a vehicle type is disabled for AIs, and i switch to that AI company, can I still buy vehicles of that type for the company?
12:15:41 <Samu> the answer is yes, just tested
12:16:57 *** TROILUS has quit IRC (Read error: Connection reset by peer)
12:17:09 *** TROILUS has joined #openttd
12:53:03 *** WormnestAndroid has quit IRC (Remote host closed the connection)
13:02:37 <petern> Hmm, Twitch now shows you previous chat messages when you join a stream.
13:04:59 <andythenorth> is that a net positive?
13:06:13 <Samu> the code around engine availability is quite confusing
13:07:26 <andythenorth> railtype available, exclusive preview period, engines never expire, intro date with random factor
13:07:33 <andythenorth> what else is there?
13:07:46 <andythenorth> oh GS can allow / disallow engine also
13:08:10 <petern> It's quite simple: is the engine available? yes/no
13:08:48 <andythenorth> I have to go to the shops
13:08:58 <andythenorth> but can't we just ask chatGPT if the engine is available?
13:11:28 <andythenorth> nobody should play past 2021 anyway
13:11:40 <andythenorth> imagine if IRL got paused in 2021
13:24:24 <andythenorth> implementation is horrific, feature might be interesting
13:25:02 <andythenorth> using the ? tool just improves screen drawing speed in the horrible patch
13:25:12 <andythenorth> I haven't actually patched the ? tool
13:25:42 <andythenorth> just seems to trigger more redraws more often
13:25:51 <petern> Should I get road tyres?
13:26:08 <andythenorth> are you going on roads?
13:27:23 <petern> My trike has Schwalbe Black Jacks, which are somewhat knobbly.
13:27:46 <dP> andythenorth: after a bit of though I'm not sure there is a use for this feature
13:27:57 <dP> going full transparent mode is still better for building
13:28:06 <andythenorth> it's more of an 'inspect'
13:28:19 <dP> there isn't really a downside to just staying in transparent
13:28:24 <andythenorth> agreed for building
13:28:25 <dP> except when you need pretty screenshots
13:28:37 <andythenorth> I just miss the trees, because I always have them turned off
13:28:53 <andythenorth> also a trees implementation could be generalised later
13:28:57 <andythenorth> to more than trees
13:29:04 <andythenorth> and then to e.g. fog of war overlay
13:29:56 <dP> that sounds like a bit too much generalisation :p
13:30:08 <dP> it's not like fow magically dissipate around cursor :P
13:30:09 <andythenorth> tree hiding does follow e.g. autorail tool, and does aid building
13:30:32 <andythenorth> ha actual fog mode
13:30:32 <andythenorth> not fog of war 😄
13:31:05 <dP> fog disaster, move the mouse quickly to blow it away
13:31:28 <Samu> AIs can't answer script goal questions!
13:31:40 <andythenorth> dP: did you find a faster implementation?
13:31:41 <Samu> not sure how important that is for AIs, but
13:31:44 <andythenorth> my 3 line patch is lame
13:32:02 <dP> I could probably make it faster
13:32:11 <andythenorth> for the lolz of course
13:32:21 <andythenorth> stick it on a wasm build, see what people do with it
13:32:28 <dP> my lolz list as already owerflowing :P
13:32:51 <andythenorth> patreon funded openttd dev
13:33:02 <andythenorth> but only for the lolz
13:33:14 <andythenorth> I was always against the idea of paying people to work on 'useful things'
13:33:20 <andythenorth> because then it's just a job
13:33:25 <andythenorth> with deadlines and crap
13:33:43 <andythenorth> 1 month per year, pay someone to make stupid things
13:34:21 <TallTyler> Some of us make stupid things without being paid 😛
13:34:40 <andythenorth> for some of us that's due to less-than-ideal circs
13:34:54 <andythenorth> for some it's an aspect of privilege 😛
13:34:59 <petern> Hmm, BMX tyres are 20". That might be a bad idea.
13:35:08 <dP> integrate with streamlabs so stupid things can happen on donations
13:35:35 <dP> hm, kinda on my lolz list already xD
13:36:02 <andythenorth> petern: I have Big Ben tyres FWIW
13:36:08 <andythenorth> they seem to be bombproof
13:36:30 <andythenorth> they're quite fat and slow
13:36:53 <petern> Yeah, too fat for my trike.
13:39:08 <andythenorth> and I have pulled 2 inch metal staples out of them, no puncture
13:39:14 <Samu> there's no storyscript for AIs too :p
13:39:24 <andythenorth> nearly slick, but not quite
13:40:00 <andythenorth> samu AI should get a story book maybe?
13:40:07 <andythenorth> so it can explain its thinking? 😛
13:44:24 <petern> Ah, sjs have a wide range of 20" tyres.
13:45:12 <Samu> :) not sure how AIs would comunicate with GS's
13:46:42 <Samu> via events, but still, how would they read goal questions, what buttion would they "press", etc
13:46:55 <Samu> how would they know what question is being asked
13:49:48 <dP> normally AIs would need a dedicated api for communication with GS
13:49:57 <dP> but I doubt it's useful enough for anyone to bother making it
13:51:35 <dP> you basically need a dedicated ai for each gamescript anyway
14:15:21 <ag> Lot of work for nothing then
14:16:27 <LordAro> since when has that ever stopped anyone?
14:18:21 <Samu> i made a template! it's not quite like I wanted
14:18:49 <Samu> I wanted to avoid passing MAX_COMPANIES
14:22:15 <Samu> AI::BroadcastNewEvent has a skip_company
14:22:44 <Samu> there's a default value when ommited, but i don't know how to do that with template
14:28:39 <Samu> maybe the file name could be renamed to something else?
14:29:00 <Samu> I couldn't find a suitable file to place this template
14:33:50 <andythenorth> is that VAT, at 300%?
14:34:08 *** WormnestAndroid has joined #openttd
14:50:06 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
14:50:10 *** WormnestAndroid has joined #openttd
15:04:24 *** virtualrandomnumber has joined #openttd
15:08:12 *** virtualrandomnumber has quit IRC ()
15:31:50 <Samu> the engine availability code is still.... not good :(
15:33:02 <Samu> an engine preview is sent to AI
15:33:22 <Samu> a copy should also be sent to GS, about the company receiving the preview
15:34:17 <Samu> but if an engine preview is sent to an AI but the AI can't build vehicles of that engine type
15:34:26 <Samu> what should be done about GS?
15:34:48 <Samu> no copy sent to GS, i guess
15:35:43 <Samu> but if the company is Human...
15:36:01 <Samu> should the GS receive a copy of that event?
15:42:13 *** debdog has quit IRC (Quit: Initiating getting-the-hell-out-of-here maneuver!)
15:58:07 <Samu> I had it fine, made it broken, stupid me
16:23:27 *** HerzogDeXtEr has joined #openttd
16:51:25 <TrueBrain> Can we make this mandatory?
16:57:52 <andythenorth> the comments part is excellent
16:58:03 <andythenorth> I think we've all been and done that
16:58:44 <andythenorth> "Overly Descriptive Names" though, I feel seen 😦
16:58:54 <andythenorth> like the example is actually real code I wrote
17:02:51 *** Wormnest has joined #openttd
17:16:29 <Samu> now I'm wondering, what was the purpose of Clamping bankrupt company value?
17:17:10 <Samu> some sort of limitation?
17:17:19 <andythenorth> does it overflow to positive if it gets to a big enough negative value?
17:17:39 <Samu> I don't know, need to test
17:17:59 <glx[d]> at some point squirrel world could be 32bit or 64bit depending on target cpu
17:19:17 <glx[d]> now we force it to 64bit as the 32/64 mismatch may cause issues
17:23:31 <petern> TrueBrain: I don't need an AI for that 😄
17:28:23 <glx[d]> and we keep finding clamping issues since
17:30:19 *** TROILUS has quit IRC (Read error: Connection reset by peer)
17:30:28 *** TROILUS has joined #openttd
17:48:25 <Samu> but keep PR, since it has other things, or keep everything as is
18:08:33 *** crem has quit IRC (Ping timeout: 480 seconds)
18:12:18 *** ChanServ sets mode: +v tokai
18:14:08 *** Flygon has quit IRC (Quit: A toaster's basically a soldering iron designed to toast bread)
18:19:15 *** tokai|noir has quit IRC (Ping timeout: 480 seconds)
18:48:27 <DorpsGek> - Update: Translations from eints (by translators)
19:03:54 <frosch> I love that this was sent to abuse@ 🙂
19:04:22 <frosch> (it looks like an image, but it is actually text with weird background color and formatting
19:12:47 <Samu> how many scripts is it gonna break
19:29:16 <Samu> i see some AIs using Rand with %
19:33:41 <Samu> Search "Base.Rand" (1461 hits in 87 files of 358 searched)
19:34:27 <Samu> Search "Base.Rand()" (32 hits in 17 files of 358 searched)
19:34:37 <Samu> Rand() itself isn't used much
19:35:21 <andythenorth> are we all learning WASM yet?
19:36:25 <Samu> ChooChoo is using abs(AIBase.Rand() % TICKS_PER_DAY)
19:36:41 <Samu> so yeah, negative values are used, and unwanted
19:37:35 <Samu> i think having no compatibility layers for the random function is a big risky, way too many scripts use random
19:44:41 <andythenorth> I'm learning asdf
19:47:55 *** crem1 has quit IRC (Ping timeout: 480 seconds)
19:49:39 <Samu> well, what to do with my PR that tried to fix Rand
19:52:17 <andythenorth> I'm learning [cursors]
19:55:36 <frosch> the problem with WASM seems to be, that imports and exports are like C linkage imports/exports, so the keeping a stable/compatible API is just as complicated
19:56:10 <TrueBrain> just as complicated as?
19:56:40 <frosch> imports are just prototypes with N args of simple types
19:56:52 <frosch> so whenever you add another parameter, you have to make a new method
19:57:06 <frosch> which means essentially adding a version number to every symbol
19:57:13 <TrueBrain> yeah, I get what you mean, I was wondering to what you were comparing it
19:57:29 <TrueBrain> "just as complicated" as what? 🙂
19:58:14 <frosch> some C++ libraries add namespaces with "version number", so all symbols are distinct between different versions
19:58:29 <TrueBrain> or, maybe phrased differently: so no change with Squirrel 😉
19:58:33 <frosch> c libaries usually add new names, so you have foo1, foo2, foo3
19:59:33 <TrueBrain> so I wonder why you see it as a problem 😄
19:59:49 <TrueBrain> they didn't solve this particular problem for you, no 🙂 But neither did Squirrel 🙂
19:59:52 <frosch> hmm, good point, our squirrel api is similar
20:00:09 <TrueBrain> well, we use a global version number, instead of an per-API-endpoint
20:00:12 <TrueBrain> but tomato tomato 🙂
20:00:27 <frosch> i was comparing it to dynamically types languages, just add a new member to a dict/struct/etc, and nothing changes
20:01:01 <TrueBrain> the main thing that concerns me a bit, but I have to work with it a bit more to actually know, how different higher-languages are converted
20:01:08 <TrueBrain> I am afraid some really quickly want to use globals
20:01:19 <TrueBrain> which can be hard to save/load
20:02:05 <frosch> well, i am more on the newgrf track, so most things are pure functions without side effects
20:02:30 <TrueBrain> but do the compilers actually work like that, is what worries me somewhat
20:02:42 <TrueBrain> strings etc seem to be placed in the global space, which makes sense
20:02:43 <frosch> i want to make some performance tests. newgrf barely have any own code, and mostly call api methods to read "computed variables"
20:02:49 <TrueBrain> but can we differentiate between read-only and read-write?
20:03:26 <TrueBrain> in other words, can we guard that they actually are "without side effects"? 🙂
20:03:30 <TrueBrain> and does a user actually know
20:03:32 <frosch> squirrel only has strings for debug output 🙂
20:03:55 <frosch> for game texts we use stringids, and textstack, all integers, no strings
20:04:12 <TrueBrain> we, yes. But can we restrict that same usage for WASM? 🙂
20:05:49 <frosch> ok, so you want to check when wasm compilers start allocating memory?
20:06:12 <TrueBrain> it reads to me that we have far less control on what they do .. so that is a concern I have
20:06:20 <TrueBrain> one I am only going to discover by actually trying 😄
20:07:09 <frosch> i read it as: "globals" are fine for us, they are limited and known in advance. "memory" we can restrict to zero, so imports and grow-commands fail
20:07:54 <Samu> glx[d], are you still planning a worldwide change to SQIntegers? Need to decide what to do
20:12:14 <TrueBrain> frosch: : yeah, so as soon as you use a string, you will do a `(memory $0 1)`
20:12:36 <TrueBrain> on its own not an issue, but it does mean that it can be a bit tricky to know there are no side-effects
20:13:04 <frosch> it just means: no strings for newgrf. strings for gs are fine
20:13:04 <Samu> okay, can i safely close my pr then?
20:13:24 <Samu> you're not planning compatibility for old apis, it seems
20:13:30 <frosch> it that a deal breaker for you? do you want to parse json inside newgrf?
20:13:35 *** TROILUS has quit IRC (Read error: Connection reset by peer)
20:13:56 <TrueBrain> this is way too early to indicate if anything is a dealbreaker, in any way shape or form 😄
20:13:59 *** TROILUS has joined #openttd
20:14:28 <TrueBrain> one can always adjust the VM code to not allow silly stuff
20:15:22 <TrueBrain> owh, I misunderstood the WASM instructions .. a `global` can still have `(memory $0 0)`
20:15:36 <TrueBrain> no, I mean to say: this is more about collecting "how does it actually work" 🙂
20:15:48 <frosch> "global" are like "extern int", "memory" is actually heap with mallloc
20:16:15 <TrueBrain> that was what I was thinking
20:16:30 <TrueBrain> but it seems to be more nuanced or something ..
20:16:34 <TrueBrain> toying with new stuff is confusing 😉
20:16:57 <frosch> well, wasm developers also seem to be toying :p
20:16:57 <TrueBrain> I made a global `z` of type `int` .. the `wat` file now contains `(global $module/z (mut i32) (i32.const 0))`
20:17:56 <frosch> they started with "tables" to avoid mixing code addresses with data. and then they added "reference type", which seems to throw "tables" out of the window.
20:18:44 <TrueBrain> so it appears to me that globals can also be defined from WASM
20:18:54 <TrueBrain> where the documentation suggested they had to be defined outside first
20:19:07 <TrueBrain> (suggested to me, that is)
20:19:36 <Samu> glx[d], did you decide -1 ScriptAirport::GetMaintenanceCostFactor(AirportType type) randomly? are you also going to chance the GetMaintenanceCostFactor of rail and road to -1? Cus it's currently 0.
20:19:47 <frosch> "globals" can be either "extern" or "static", you can define a global without importing it
20:19:58 <frosch> then it's only known to your wasm module
20:20:02 <TrueBrain> so now the question .. can we iterate all globals 🙂
20:20:21 <Samu> glx[d], I prefer it changed to -1, honestly
20:20:32 <dP> why is the first thing you want to do with a potential modding framework is to cripple it? 😜
20:20:37 <frosch> haha, i tried reading the opcodes, they were incredibly hard to read
20:20:42 <glx[d]> 0xFFFF for uint16 is -1
20:20:51 <frosch> so no idea where indirect adressing is possible 🙂
20:21:57 <Samu> okay, when you get to ScriptRoad::GetMaintenanceCostFactor, and ScriptRail::GetMaintenanceCostFactor, don't forget to make it -1 too, for consistency :)
20:22:55 <frosch> hmm, alternative option could be: allow wasm modules to set up globals and memory during initialisation, but lock them readonly for functions which must be pure
20:22:57 <Samu> 0xFFFF for uint16 was actually returning 65535
20:23:11 *** gelignite has joined #openttd
20:23:15 <TrueBrain> frosch: which is why I am looking if we can iterate all globals
20:23:19 <TrueBrain> as if they are read-only, that is fine
20:23:20 <frosch> so, wasm modules can setup all the data they want, read it, but it throws if pure functions change them
20:24:10 <Samu> damn i'm so confused right now
20:24:28 <frosch> you could also scan the binary, whether it contains any "store" instructions 🙂
20:24:28 <TrueBrain> ah, yes, you can iterate them; so then it is easy
20:24:41 <TrueBrain> you can even check the type (read vs readwrite)
20:25:01 <Samu> (int32)(uint16)65535 = 65535
20:25:02 *** TROILUS has quit IRC (Remote host closed the connection)
20:25:08 <frosch> oh, with "iterate" you meant iterating from outside the vm?
20:25:10 <TrueBrain> `wasm_globaltype_mutability`
20:25:11 *** TROILUS has joined #openttd
20:25:30 <TrueBrain> yeah, with wasmer and other implementations, after reading the `.wasm`, you can just get a list of all globals
20:25:45 <TrueBrain> and during VM runtime, you can just check with `wasm_globaltype_mutability` whether those are mutable or not
20:26:10 <TrueBrain> it cannot be changed, it seems
20:26:20 <TrueBrain> but that is fine, in my opinion
20:27:26 <glx[d]> but it was supposed to be -1, and this value is only returned if `@pre` is not respected
20:31:54 <glx[d]> and all these auto type conversions are why I want to use SQInteger for all API functions
20:32:30 <glx[d]> and convert if needed in the functions
20:33:22 <glx[d]> also using SQInteger allows to check the ranges where needed
21:02:24 <Samu> I expected it to use something internal, not squirrel_helper
21:03:19 <glx[d]> squirrel_helper is what's doing the move from/to squirrel virtual machine
21:14:01 <glx[d]> if only people actually tested betas and RCs
21:16:04 <glx[d]> should be easy to reproduce, building master
21:18:25 <andythenorth> nightly and RC used to get tested a lot by coop
21:19:30 <andythenorth> the equivalent playerbase would be using JGRPP now
21:24:44 <FLHerne> frosch: wait, you're serious about wasm?!
21:25:47 <frosch> i want to check the implications
21:26:24 <frosch> even if we keep all newgrf api the same, and restrict wasm to what callbacks can do, it still solves the issue of action2 limits, callback result limit, and what not
21:27:20 <FLHerne> Are existing wasm interpreters compatible with the whole synchronous-lockstep thing?
21:27:28 <FLHerne> historically JS has a lot of floats
21:28:14 <glx[d]> this->CloseConnection(res) with this == nullptr
21:28:16 <FLHerne> "everything numeric is a double" (I know wasm itself lacks that problem, but aiui wasm interpreters have largely evolved from JS ones?)
21:28:29 <frosch> we have two options for floats 🙂 there is a wasm implementation on gh, which states it's being determinisitic, specifically talking about floats. but we can also just disable floats
21:29:44 <frosch> i just see it as: newgrf are reaching the limits what a2+va2+a3, if we need a new syntax, we can as well use one with existing infrastructure
21:30:21 <glx[d]> ah `myclient` is null at that point
21:31:10 <FLHerne> ok, I can see the appeal
21:31:12 <TrueBrain> it would mean we have to educate some people in how to do something like Rust, or Javascript, or one of those languages that can be translated into wasm 😛
21:31:35 <FLHerne> replace Squirrel too plz :p
21:32:31 <andythenorth> oh wait, that's running python, not compiling from it?
21:32:43 <TrueBrain> yeah, make no mistake, that is compiling Python, the interpreter, to WASM. Not Python-script alone 😛
21:33:44 <TrueBrain> frosch: I wonder if we can bring a C struct inside the WASM memory, so it can directly access, say, industry members
21:33:50 <TrueBrain> or do we have to wrap everything in functions? 🙂
21:34:17 <TrueBrain> function-based API is easier to maintain, I guess, but also requires a lot of wrappers 😛
21:34:55 <frosch> that's exactly what i am exploring 🙂
21:35:33 <frosch> expose a immutable memory segment, and have api methods for "get_cargospec(cargolabel)", which gives you a start-offset
21:35:37 <andythenorth> ok rust then 😛 I unsubscribed from javascript in 2002
21:35:54 <frosch> allows extending the cargospec at the end, without worries about compatibility
21:36:03 <frosch> kind of like virtual classes
21:36:49 <TrueBrain> would it also be a moment to rethink some of the NewGRF inner workings? 😛
21:37:23 <andythenorth> I type function foo() and it tells me to use fn foo()
21:37:30 <frosch> sure some, but don't get too excited 🙂 the hardest part of newgrf is still, that you have to deal with the arbitrary ttd mechanics
21:37:46 <TrueBrain> say, we leave the current API for what it is
21:37:50 <TrueBrain> and build a new one next to it?
21:37:54 <TrueBrain> would that be too ambitious? 😛
21:39:03 <frosch> i'll give you an example: industry stockpiles. industries can stop accepting cargo, when stockpile is full. ECS people complained that it does not work, industries get too much cargo
21:39:57 <frosch> reasons are: (1) cargo is delivered in packages, so if industry has 995 waiting, and you deliver a package of 10, you cannot deny 5 overshooting 1000. (2) ottd updates acceptance in station loop, so is delayed by up to 256 ticks
21:40:14 <frosch> similar "engine mechanics" apply to drawing tiles, sprites and more
21:40:25 <frosch> all those things do not become easier by switching to wasm
21:40:45 <frosch> you have to switch to factorio instead then :p
21:40:49 <TrueBrain> well, just to play devils advocate, one could say: also change how this new API works
21:41:06 <TrueBrain> so, in your example: when cargo is delivered, run a piece of WASM that handles the cargo handling for that industry, instantly
21:41:20 <TrueBrain> so yeah, much more factorio-style 😉
21:41:37 <TrueBrain> (including updating of station acceptance, I mean)
21:41:58 <frosch> it's an issue of optimisation vs. modability
21:42:07 <TrueBrain> but CPUs are more powerful now 🙂
21:42:14 <frosch> ottd does certain shortcuts for speed. that restricts what is possible to change
21:42:31 *** gelignite has quit IRC (Quit: Stay safe!)
21:42:41 <frosch> trains can change running cost depending on engine speed and slope, because ottd computes costs every day
21:42:57 <frosch> trains cannot adjust maxspeed depending on date, because ottd only recomputes max-speed on track-type change
21:43:26 *** berndj has quit IRC (Remote host closed the connection)
21:43:40 <TrueBrain> the weird little details 😛
21:44:38 <TrueBrain> this is also what I meant the other day with the remark: you can push a lot of game logic to WASM, if you go this route; and yes, I realise that is pushing it 😛
21:44:44 <andythenorth> can we embed a rust function in every tile?
21:45:14 <TrueBrain> at a certain point you are better off starting a new game 😄
21:45:14 <frosch> i don't believe wasm makes newgrf faster
21:45:22 <TrueBrain> no, it won't make it faster for sure
21:45:28 <frosch> newgrf are almost no own code, but mostly calling api methods in ottd
21:45:42 <TrueBrain> but did anyone suggest it would? 🙂
21:46:04 <frosch> your "move more game logic into wasm" implies it would :p
21:46:11 <TrueBrain> then you are missing the point
21:46:14 <andythenorth> did this arise because I keep whining about Squirrel? or was it just the correct time to look at it? 🙂
21:46:18 <TrueBrain> as performance was not the consideration for that remark
21:46:28 <TrueBrain> WASM has the unique position that it can be compiled from complex piece of code
21:46:32 <TrueBrain> say, the whole station-handling
21:46:44 <TrueBrain> we can just make WASM out of that, in like .. minutes of coding work
21:46:58 <TrueBrain> so it pushes the boundary of what wasn't possible, as writing it in NewGRF would be .. well .. impossible? 🙂
21:47:03 <Xaroth> andythenorth: if you want we can just blame you for it regardless? :P
21:47:22 <Xaroth> (that said, I think TB is onto something interesting)
21:48:09 <TrueBrain> so basically the question I am trying to ask: should the NewGRF API be at the same place? 🙂
21:48:31 <frosch> xaroth: can you change your nick to something not starting with X? i have a mental filter for people starting with X and about 6 letters
21:48:33 <TrueBrain> (and yes, I am pushing it, I know 😛 But sometimes it is just nice :P)
21:48:48 *** XarothBrook has joined #openttd
21:48:48 <XarothBrook> frosch: I can use my long name if that works better?
21:48:53 <andythenorth> imagine if there was some commonality in the API, where it's appropriate 😛
21:48:54 <bigyihsuan> ~~just casually port ottd to rust~~
21:48:54 <XarothBrook> also I had that name first.
21:49:10 <Xaroth> Look, now there's two of me!
21:49:15 <TrueBrain> take another example, town growth. If we add the different algorithms we have now in small WASMs, that would also allow for a mod to add new methods
21:49:19 <TrueBrain> that line of thought 🙂
21:50:25 <TrueBrain> I mention this as I think CPU is far less of a problem these days than when NewGRF was created; so we have more choices, I would guess
21:50:40 <TrueBrain> drawing our screen is mostly still the most expensive job 😛
21:50:43 <frosch> ok, so you want to port parts of ottd to wasm 🙂
21:51:00 <TrueBrain> well, one could argue that every train has its own WASM VM
21:51:12 <TrueBrain> not the train-type, or the engine, but the whole train
21:51:14 <frosch> so far attempts to reimplement original industries in newgrf failed, because original industries are such a mess with so many exceptions, that noone wants to deal with the arbitrary details :p
21:51:28 <TrueBrain> that is a true problem
21:51:30 <bigyihsuan> dP: tbf that's how factorio does it, vanilla is a mod
21:51:31 <TrueBrain> the old AI had the same
21:52:08 <dP> actually on big games simulation is still the most time-consuming
21:52:09 <TrueBrain> also something to just experiment with, honestly .. it might be horrible for reasons X / Y / Z 😛
21:52:37 <frosch> we mostly have to throw-out savegame compatibilty for a few years, until we have a stable api 🙂
21:52:41 <dP> and sometimes "big" is just an empty 4k map :p
21:52:48 <TrueBrain> frosch: haha, yes 😛
21:53:15 <TrueBrain> and for sure not something that can be reached in one day
21:53:35 <TrueBrain> but with WASM the line of NewGRF and GS can become blurry really easily 😛 So it can be iterative
21:54:12 <dP> imo api should never be fully cast in stone like newgrf or gs
21:54:23 <TrueBrain> which brings me back to the point: do you intent to replace the full NewGRF API, or do we part ways with some .. odd parts of the current NewGRF? (and leave the current NewGRF for those parts?). Not looking for an answer btw 😛
21:55:16 <dP> api stability is good until it makes adding things a pain
21:55:23 <TrueBrain> anyway, back to reality; curious what you figure out with shared memory frosch 🙂
21:57:35 <frosch> i am still scared that the add-on api would be specified by something like linux-headers, defining all the prototypes of imported things 🙂
21:57:55 <frosch> i am so used to defining asm-style "newgrf register X bit Y contains this"
21:58:20 <TrueBrain> new way of thinking 😄
21:58:28 <TrueBrain> for a game almost .. 30 years old .. 😄
21:58:30 <frosch> i am also used to python-style dynamic typing. but i never had to design a stable c/c++ api
21:59:13 <frosch> i encounter shared-object ABI problems only as a user of external libraries, not as a designer of them
21:59:26 <TrueBrain> well, we have Squirrel API as an example
21:59:37 <TrueBrain> so hopefully that helps a tiny bit 🙂
22:00:31 <frosch> like people downloading pyqt and some other packages with lots of libraries, and then encountering incompatible libcrypto :p
22:00:58 <frosch> TrueBrain: i did not have the impression, that our squirrel api was that successful :p
22:01:14 <andythenorth> for authors, or for core game?
22:01:16 <TrueBrain> the API itself is fine I think?
22:01:38 <frosch> i think for ai it works
22:01:47 <andythenorth> my $0.02 the API is fine, in narrow bounds
22:01:52 <frosch> but for gs the main-loop thingie with event-polling appears wrong
22:02:03 <TrueBrain> yeah, but that is not as much related to how the API is presented
22:02:12 <TrueBrain> but yeah, I get what you mean 🙂
22:02:16 <frosch> gs mostly react to game events, so some async event executor would be more fitting
22:02:27 <andythenorth> - the docs are basically fine, but lack examples
22:02:27 <andythenorth> - I have been able to extend the API, it seems clean
22:02:28 <TrueBrain> come to think of it, having an API with only functions can make things a lot easier for compatibility
22:02:39 <TrueBrain> having variables can be difficult to keep in sync
22:02:48 <TrueBrain> unless we can have setter/getter over them .. hmm
22:02:55 <frosch> oh, and of course, the biggest problem: gs only runs on server
22:03:09 <frosch> so it has to call weird setters, which send stuff to clients, and the actual logic is inside ottd again
22:03:12 <dP> gs api is basically just a wrapper for network commands
22:03:19 <frosch> like, the city growth rate disaster 🙂
22:03:21 <dP> at least in the part that actually does something
22:03:29 <frosch> a gs calling a command to update growth-rate of a single town
22:03:39 <andythenorth> the problems I've had with GS
22:03:39 <andythenorth> - the execution environment is basically just weird
22:03:39 <andythenorth> - it's trivial to write really pathological code
22:03:39 <andythenorth> - squirrel 2 is dead
22:03:56 <frosch> even if there was a bulk-command, it would still not be good
22:03:57 <andythenorth> the narrow part of the API is not where the problem is 🙂
22:04:17 <TrueBrain> glx[d]: something feels off in the logic you present .. line 239 also use `my_client`?
22:05:03 <TrueBrain> so `my_client` is deleted in `ReceivePackets`?
22:08:53 <glx[d]> just before Receive_SERVER_ERROR() returns NETWORK_RECV_STATUS_SERVER_ERROR which is then returned by HandlePacket() and finally returned by ReceivePackets()
22:09:16 <andythenorth> frosch: it only takes about 6 minutes real time on a large map, on fast forward
22:09:32 <andythenorth> 9999 towns or so
22:09:38 <TrueBrain> so isn't then the issue more that the window shouldn't be closed by `SERVER_ERROR`, I wonder?
22:09:57 <andythenorth> only 960ms in my 32 town test map
22:09:57 <TrueBrain> but instead, for example, by closeconnection?
22:10:46 <TrueBrain> seems a bit weird at least, your PR, with the reasoning behind it .. but I can't put my finger on it 😄
22:11:01 <frosch> is my_client set to nulltpr in the destructor?
22:11:25 <frosch> is this again some deferred-free magic? or is "this" also invalid in that method?
22:11:53 <glx[d]> oh client error closes the window
22:12:05 <TrueBrain> in general, this `my_client` is very weird
22:12:10 <TrueBrain> it is some kind of singleton, but not really
22:12:27 <TrueBrain> I blame young me or Rb or DV for writing this 😛
22:13:18 <TrueBrain> pointing fingers .. pff 😛
22:13:29 <TrueBrain> makes it easier to say: it is shit 🙂
22:13:31 <frosch> i see, CloseConnections calls "delete this"
22:13:40 <frosch> and every caller has to "return" afterwards 🙂
22:13:50 <TrueBrain> yeah, it is just bad
22:14:45 <glx[d]> but ClientError() seems to also close the window, so it might be better to not close the window too early
22:15:00 <TrueBrain> it only closes it with `CLOSE_QUERY`
22:15:06 <TrueBrain> in your case it is with `SERVER_ERROR`
22:15:12 <TrueBrain> but changing that ofc is easy 😛
22:16:38 <glx[d]> and we don't want the switch to menu in this case
22:17:15 *** keoz has quit IRC (Ping timeout: 480 seconds)
22:17:33 <TrueBrain> I am still missing why `CloseConnection` is already called, I have to admit
22:18:05 <TrueBrain> closing the window doesn't seem to call that?
22:18:37 <glx[d]> NetworkDisconnect() in query text handler
22:19:09 <TrueBrain> on `OnQueryTextFinished` I guess?
22:19:42 <TrueBrain> what a way to terminate the connection .. just yoink the whole network stack
22:20:48 <TrueBrain> lol, it even tries to send a Quit message to the server
22:21:24 <TrueBrain> so yeah, it seems it would be better to first close the connection, then call the CloseWindowById 😛 Far less side-effects 😄
22:21:30 <glx[d]> yes to be nice if user discard the password window before server timeout
22:21:32 <TrueBrain> and now I need a shower ... what a code ... 😛
22:22:06 <andythenorth> would we consider UI windows backed by WASM? 😛
22:23:19 <TrueBrain> glx[d]: : so I guess closing the window after line 214 and not closing it in `SERVER_ERROR` should also fix the issue? Well, I leave it to you; what a weird piece of code 😛
22:23:34 <frosch> andythenorth: have you ever used a ui framework with a C api?
22:25:10 <andythenorth> do we have to write our own widget toolkit? 😛
22:25:32 <frosch> oh even better, we could offer an X11 api :p
22:25:35 <andythenorth> I was just thinking of maybe a story book that didn't have button click latency of multiple seconds 😛
22:25:37 <glx[d]> well just not closing it in Receive_SERVER_ERROR() works, but returning to game menu is a bit too much 🙂
22:26:09 <glx[d]> so yeah I'll try to make it less "violent"
22:26:51 <TrueBrain> frosch: : what I guess would be fun with WASM, that we can have an API like: `get_industry_property(0x90)` or what-ever, and for a language like C++ or Rust have a header-file that makes something like `this.cargo_acceptance()` work, with some inline functions
22:27:04 <TrueBrain> didn't consider that yet, that the compiler will just optimize that out back to the API functions
22:27:12 <TrueBrain> sorry, might be obvious, but just now realise that 😄
22:27:59 <TrueBrain> glx[d]: : fun fact, there are 8 places that close the join window 😄
22:28:00 <frosch> did you notice the similarity to truegrf?
22:28:44 <frosch> you define these "high level variables" like nml, and then have a stack machine to write your code
22:29:04 <TrueBrain> yeah, indeed. But this time it can be done by an actual compiler
22:29:05 <frosch> i forgot what you called your stack-machine in truegrf
22:29:13 <TrueBrain> it is some RPN, all I remember
22:29:18 <andythenorth> the RPN stack thing?
22:29:21 <andythenorth> I was going to learn RPN 😛
22:30:00 <frosch> though wasm also has if/else, which is unsual for RPN :p
22:30:00 <TrueBrain> but with TrueGRF the issue was it had to be able to synth NewGRF .. so something like WASM isn't going to fly, as that cannot be encoded as a NewGRF 😛
22:30:36 <TrueBrain> and yes, I would be happy if I can burn that RPN with fire 😛
22:31:34 <TrueBrain> but yeah, the more I think about it, the more I consider it unavoidable to also have some boilerplate in the language used to compile to WASM 🙂 Which is honestly not even a bad thing .. means the API can stay simple
22:31:35 <kamnet> Queston for devs WRT Bananas. I'm working on a revision of George's Toyland to Mars Conversion, which contains graphics assets from TTO. Since Toyland to Mars has already been uploaded to Bananas, is there any objection to me adding my revisions?
22:32:24 <TrueBrain> are you now asking if it is okay to upload copyrighted material you don't have a license for, or am I misreading this? 😛
22:32:28 <frosch> kamnet: don't ask questions you don't want an answer for
22:33:11 <frosch> i never used the mars conversion set, no idea what it's about, i only had TTD, no TTO
22:33:57 <TrueBrain> so I gather from these remarks that TTO had a mars landscape? TIL 🙂
22:33:59 <kamnet> I'm asking that since there's already a known copy of the copyrighted assets, would it be permisable to add another which fixes what is broken in the previous one. It's very much a judgment call IMO, and if anybody has an objection then I won't add it.
22:34:27 <TrueBrain> sorry, but what a silly question .. you now force us to look into the other asset, and possibly take it down for copyright infringement?
22:34:33 <TrueBrain> you do understand we have a due diligents, right?
22:35:01 <kamnet> Yep. Thus my reason for asking.
22:35:14 <TrueBrain> so tnx, now you make me look into that ....... something I was not looking forward to
22:35:22 <TrueBrain> and no, it is not okay to upload any work you don't own the license of
22:35:28 <TrueBrain> which is common sense, sorry 😦
22:35:48 <TrueBrain> we even explicitly ask you when uploading to BaNaNaS 🙂
22:35:50 <kamnet> Nothing to be sorry for.
22:38:41 <TrueBrain> luckily for us, it only happens once a blue moon that someone reports uploaded content by someone who didn't own the license to do so 🙂 Running platforms in good-faith is always a bit tricky 🙂
22:38:50 <TrueBrain> many games had a lot more issues moderating these kind of systems
22:38:53 <TrueBrain> we have been lucky 🙂
22:39:35 <kamnet> The devs have always done an excellent job of protecting the community and doing what is right.
22:40:02 <Samu> glx[d], since you've reviewed https://github.com/OpenTTD/OpenTTD/pull/10458, I am about to undo the Script Settings move I've done, and go back to what you had done. I already have the branch ready. It will only have the minor changes requested. Do you aprove? Do I click "Force push origin"?
22:40:32 <Samu> I regretted having done the move
22:40:42 <glx[d]> which changes are you doing ?
22:40:56 <TrueBrain> kamnet: we try to 🙂
22:41:03 <glx[d]> because GSConfig as it is now is fine
22:41:56 <Samu> the minor changes like the simplification arastasis mentioned, some Config static function being removed, and call in constructor
22:44:02 <Samu> I will of course, have to rename the PR and the message, it's being undone
22:44:13 <Samu> that is, if I press the button
22:44:51 <glx[d]> maybe push it in another branch and mention it in #10458 first
22:45:26 <glx[d]> just in case #10458 is finally prefered 😉
22:45:26 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
22:51:21 <andythenorth> was I going to sleep?
22:51:30 <TrueBrain> only after counting 12 more sheep
22:52:26 <kamnet> You probably were but now I'm going to keep you awake all night, so soz.
22:52:30 <andythenorth> is it one sheep per tick?
22:52:35 <andythenorth> or can I batch them?
22:52:38 <frosch> you can also count trains
22:52:47 <frosch> livestock wagons with sheep
22:52:57 <TrueBrain> omg, this got out of hand quick
22:52:58 <glx[d]> hmm annoying NETWORK_ERROR_TIMEOUT_PASSWORD can happen at 2 different moments
22:52:58 <andythenorth> we can convert Train Whack! directly
22:53:10 <andythenorth> Train Whack! is just stupid client side javascript
22:53:19 <glx[d]> server password or company password
22:53:46 <andythenorth> I was going to make Train Whack! in GS, but it will take 10s to generate the trains
22:56:40 <andythenorth> ok 12 sheep counted 😄
22:57:13 <Samu> I'm going to sleep, take care everyone
22:57:19 *** Samu has quit IRC (Quit: Leaving)
continue to next day ⏵