IRC logs for #openttd on OFTC at 2023-12-19
⏴ go to previous day
00:24:21 <wensimehrp> peter1138[d]: underground view in loco/rct
03:34:05 *** Wormnest has quit IRC (Quit: Leaving)
03:53:05 *** debdog has quit IRC (Ping timeout: 480 seconds)
04:54:34 <locosage> is there some way to open newgrf debugging window for industry tile?
06:36:26 *** keikoz has quit IRC (Ping timeout: 480 seconds)
07:20:46 <brickblock19280> locosage: Inspect tile?
07:25:29 <locosage> oh, land info has debug button
07:27:56 <locosage> cmclient has hover info so button got missing
07:30:29 *** tokai|noir has joined #openttd
07:30:29 *** ChanServ sets mode: +v tokai|noir
07:37:25 *** tokai has quit IRC (Ping timeout: 480 seconds)
08:24:34 <peter1138[d]> Just add a hotkey
08:54:45 <locosage> I can make another tool
08:54:54 <locosage> or just handle clicks xD
09:44:57 <andythenorth> /me wonders if nml should just enforce the palette for 8bpp sprites
09:45:12 <andythenorth> it already wastes a lot of time opening them all and validating the palette, then complaining if it's wrong
09:45:30 <andythenorth> it's not going to be much more processing / IO to just force them to DOS palette
09:48:20 <peter1138> Does checking the palette during build make the NewGRFs slower?
09:50:08 <andythenorth> it makes producing them slower
09:50:15 <locosage> why is it validating them separately and not just when using the image?
09:50:31 <locosage> grf-py just gives the warning and converts palette automatically btw
09:53:24 <peter1138> Well. It can't load SVGs though.
09:55:29 <peter1138> I had a look at how to support embedding SVG and gave up :D
09:55:49 <peter1138> In all of grfcodec, nml and grf-py.
09:56:04 <peter1138> Although grf-py seemed to be most promising in terms of assumptions.
09:56:23 <locosage> in grf-py it's not hard you just need the code to handle conversion to pil image
09:57:14 <peter1138> I don't want to rasterise it.
09:57:29 <locosage> oh, you mean store in the grf itself...
09:59:04 <locosage> well, still not hard you just need ~go deeper~ inherit `ResourceAction` and do own encoding
10:00:56 <locosage> assuming you want real sprite with id in data section
10:02:33 <locosage> hm, not data section, whatever is it called where pseudo sprites go
10:02:56 <peter1138> No it needs to be a realsprite.
10:03:17 <locosage> yeah, ResourceAction is pseudo sprite (id ref) + real sprite
10:03:43 <locosage> like any raster graphics
10:04:20 <peter1138> In fact if I mix it up as an alternative sprite (so give the ability to embed alongsize pixel versions) even better.
10:06:13 <peter1138> (That could satisfy your "but svg at small sizes would bad" critism from last time I was playing with SVG)
10:06:22 <locosage> in that case `Sprite` is the one to inherit
10:06:36 <locosage> like ImageSprite / ImageFile do
10:07:29 <peter1138> Hmm, lost my mug :(
10:09:20 <locosage> `get_real_data` is the main function to override
10:09:33 <LordAro> peter1138: is it down the back of the sofa?
10:11:32 <andythenorth> can we write a custom SVG rasteriser, that adds jaggy edges to vectors?
10:14:44 <peter1138> Render at only 4x zoom out?
10:14:53 <peter1138> SVG renderer in GS?
10:17:55 <peter1138> Oh, found it in the microwave, full of cold coffee... that I'd warmed up yesterday. Oops.
10:18:38 <locosage> the most useful svg would be for ui icons
10:18:49 <locosage> rendering at exact zoom requested
10:23:21 <peter1138> While we could move back to using glyph-rendered icons for window decorations, they don't allow colour, so not suitable for all the rest.
10:24:12 <peter1138> But the whole sprite cache system needs a bit of work to support a non-power-of-2 size.
10:24:54 <peter1138> It may be a case of adding an extra slot for interface-scale sprites.
10:25:41 <peter1138> Perhaps creating a new sprite cache for interface-scale sprites.
10:25:49 <peter1138> That way you can clear one without affecting normal sprites.
10:26:38 <locosage> doesn't even need to be a "cache" just load them all and keep
10:27:36 <locosage> well, depends on your definition
10:28:01 <peter1138> It's a cache because it has to load on demand.
10:28:12 <peter1138> Rather than loading up front.
10:28:32 <peter1138> And I'm sticking with existing terminology :)
10:28:51 <locosage> ui sprites don't seem to need load on demand
10:29:07 <peter1138> They do, because you have no idea what sprites are going to be used in the UI in advance.
10:29:50 <locosage> well, that if you count stuff like purchase menu sprites as ui
10:30:05 <peter1138> e.g. station picker preview sprites are definitely UI.
10:30:42 <Eddi|zuHause> cargo sprites, which can come from newgrfs?
10:31:30 <peter1138> And windows that render UI sprites that aren't part of the widget descriptions.
10:32:06 <peter1138> Way easier to load on demand that to try and work out what may or may not be used a UI sprite.
10:32:42 <peter1138> The "cache" storage may be as simple as "std::map<SpriteID, Sprite> ui_sprites" mind you.
10:32:56 <peter1138> (It'll be way sparser than the normal sprite cache.)
10:35:00 <peter1138> Hmm, it would also be possible to scale bitmap sprites too. I've tried scaling dynamically as they are drawn, but 1) it's slow 2) it requires every blitter to be modified 3) it suffers from pixel-offset issues.
10:35:35 <locosage> well, ofc gui sprites can come from newgrfs but it's a known set of sprites
10:35:57 <locosage> it's also a different type of sprites, like even if you show station preview in gui sometimes it's not gonna scale to 2.5x
10:36:59 <peter1138> It's not a known set of sprites.
10:38:29 <peter1138> Anyway, loading on demand is simple, I wouldn't even consider not doing it.
10:45:48 <locosage> hm, yeah, I guess there are gui-only sprites that use 3-2-1 chain
10:45:53 <locosage> like railtype cursors
10:55:25 <emperorjake> peter1138[d]: ok 🙂
10:55:46 <emperorjake> I hope I did that right, it's my first real PR
10:59:24 <peter1138> You inadvertantly invoked the R-word.
11:03:22 <xarick> how trains perform deceleration when approaching the platform?
11:03:45 <xarick> don't they need to reach the end for a nice slowdown effect?
11:05:28 <locosage> from pure efficiency pov middle is better than far but then near end is even better xd
11:06:26 <_jgr_> Unless your stations are extremely oversized the efficiency difference is negligible really
11:11:39 <emperorjake> xarick: The slowdown effect still works on [near end] plus it shouldn't make a difference if the train and platform are the same length
11:11:41 <peter1138> "Why are my trains not stopping at the end?" :)
11:12:37 <emperorjake> what reason is there for them to, apart from "that's how they've always done it"?
11:15:27 <peter1138> I'm just imagining potential bug reports. Don't mind me.
11:17:51 <xarick> I was trying something else, but this is funny either way
11:25:08 <peter1138> It seems to get a bit confused.
11:25:24 <peter1138> As much as I can see with that low-quality video :p
11:29:58 <xarick> Any integer that can be divided exactly by 2 is an even number.
11:29:58 <xarick> Lucky me, the min_d is always even. I can happily slap / 2 to min_d and not worry about excedents
11:38:13 <peter1138> I have never seen that word before.
12:09:23 <xarick> I need to somehow work with coordinates outside the map
12:10:02 <xarick> they need to be "valid" outside for measuring purposes
12:10:28 <xarick> not sure how to proceed
12:11:20 <merni> coordinates are just numbers, no? presumably you would just represent such 'outside' coordinates as negative or beyond the usual range
12:11:47 <xarick> I think I can't rely on TileIndex
12:11:50 <merni> of course they wouldn't work if you tried to actually do coordinate-y things with such coordinates
12:14:40 <xarick> virtual coordinates, maybe
12:15:04 <xarick> I've seen such functions in openttd code, but not sure that's what I need
12:15:31 <Eddi|zuHause> emperorjake: you're always going to get "this changed. i hate change" feedback.
12:16:34 <peter1138> I don't hate it, just stirring things up :)
12:18:20 <peter1138> For coordinates outside the map, just use separate x/y variables.
12:18:23 <emperorjake> I do anticipate at least a little backlash, but not too much since it's still a pretty inconsequential change
12:19:22 <Eddi|zuHause> don't we already have "outside map" coordinates? planes can circle around airports at map edges, and black tiles are drawn...
12:19:41 <peter1138> Yes. Guess how they're stored...
12:21:37 <peter1138> Hmm, maybe I should switch to decaf.
12:22:15 <Eddi|zuHause> coffeine only works if you don't consume it on a regular basis
12:22:48 <peter1138> I don't need it to work, I just enjoy the taste of coffee at this point.
12:23:45 <peter1138> Remember when the world was going to end with the modified cargo payment rates? Did it end yet?
12:24:29 <Eddi|zuHause> there was a wave of people complaining their savegames were "broken" when the acceleration was redone
12:25:54 <emperorjake> I'm so glad that realistic acceleration was made the default, the original model was pretty awful
12:26:42 <peter1138> I wonder if I still have my old manual train control patch.
12:26:45 <Eddi|zuHause> yes, but there were also changes within realistic acceleration, that made it overall slower
12:28:12 <emperorjake> I never noticed 😅
12:29:21 <peter1138> Ah, I guess 32bpp + mask images are combined together at newgrf compilation time.
12:30:39 <peter1138> Manager face background as SVG gradient...
12:33:29 <peter1138> _zephyris, The requested file, OpenTTD-SmallCaps.sfd, does not exist
12:33:42 <xarick> y = 50, x = -3 <=> TileIndex = 50 << 6 - 3 = 3197, pretty sure this is not right
12:33:59 <peter1138> xarick, you can't convert such coordinates to TileIndex.
12:45:41 *** Flygon has quit IRC (Quit: A toaster's basically a soldering iron designed to toast bread)
12:57:07 <Eddi|zuHause> a TileIndex is only ever useful for accessing the map array. for pretty much all other purposes, separate x/y coordinates are better suited
12:58:39 <Eddi|zuHause> and you cannot ever access the map array for tiles that aren't inside the map
13:00:07 <Eddi|zuHause> (trying this will probably not break horribly, but you'll likely get a tile on the other side of the map instead)
13:00:18 <_glx_> And it's easier to do maths on x/y
13:24:39 <peter1138> Oh, can't be a separate sprite cache :/
13:49:36 <locosage> why the heck is deity industry funding checking industry construction probability
13:49:56 <locosage> I want industry that can only be built by Gs
13:52:36 <locosage> do I really need to disable default industry generation and write my own?
13:59:16 <_glx_> When GSCompanyMode::IsDeity, prospection will not fail due to the general chance that prospection may fail. However prospection can still fail if OpenTTD is unable to find a suitable location to place the industry.
14:06:08 <locosage> I mean funding not prospection
14:06:21 <locosage> and I see it still checking the same chance as random generation
14:07:38 <_glx_> it's a callback, and often newgrf will allow the construction
14:08:17 <locosage> yeah, but if it allows it will generate randomly during the game
14:09:57 <locosage> and I don't want to set fund only because I want other industries to generate
14:30:31 <peter1138> Ask andythenorth about how GS don't get to control industries :)
15:19:30 <xarick> > ` local map_size1 = (GetTileX(_tile_S_inner + GSMap.GetTileIndex(-1, -1)) - GetTileX(_tile_N_inner + GSMap.GetTileIndex(1, 1)) + 1) * (GetTileY(_tile_S_inner + GSMap.GetTileIndex(-1, -1)) - GetTileY(_tile_N_inner + GSMap.GetTileIndex(1, 1)) + 1);
15:19:30 <xarick> > local map_size2 = (tile_Sx_inner - 1 - tile_Nx_inner + 1 + 1) * (tile_Sy_inner - 1 - tile_Ny_inner + 1 + 1);
15:19:30 <xarick> > assert(map_size1 == map_size2);`
15:19:30 <xarick> Why is this asserting?
15:19:55 <LordAro> probably because map_size1 is not equal to map_size2
15:22:10 <peter1138> What is "GetTileIndex(-1, -1)" supposed to be?
15:22:15 <xarick> map_size1 is 16, which is the number I wanted to also get with map_size2. They should be equivalent, but I'm failing
15:22:41 <xarick> I am walking from a circle to another
15:23:18 <peter1138> Hmm, it is apparently a valid thing. :o
15:24:03 <peter1138> I'm not sure why'd you'd not just to GetTileY(_tile_S_inner) - 1 though.
15:24:14 <peter1138> why you'd not just do
15:27:32 <xarick> must be a parentesis issue, gonna try adding some
15:27:58 <peter1138> I like all the -1 +1 +1. Very useful.
15:28:33 <LordAro> don't normally present it to other people in that state though
15:29:32 <xarick> local map_size2 = ((tile_Sx_inner - 1) - (tile_Nx_inner + 1) + 1) * ((tile_Sy_inner - 1) - (tile_Ny_inner + 1) + 1);
15:30:13 <LordAro> parenthesis issue / basic order of mathematical operations
15:30:33 <xarick> when I was a kid, I was a prodigy in math, how did I succumb so much with age
15:32:02 <peter1138> e.g. ((Sx-1)-(Nx+1)+1) == (Sx-Nx-1)
15:38:35 *** Wormnest has joined #openttd
15:41:32 <xarick> I'm going to have to do comparisons with virtual coordinates, so I thought I'd get all individual coordinates relate with each other somehow
15:41:57 <xarick> individual x and y for the inner and outer circles
15:45:15 <xarick> "tile" are inside the map, "virtual" are maybe inside, but could also be outside
15:45:24 <peter1138> coordinates are coordinates...
15:55:21 <peter1138> Hmm, nice example of needing to limit the width there.
15:56:57 <locosage> hm, is there no way to disallow funding secondary industries?
16:08:36 *** virtualrandomnumber has joined #openttd
16:09:14 *** virtualrandomnumber has quit IRC ()
16:33:13 <andythenorth> locosage: (1) insane cost multiplier (2) just ban them in location check cb if it's player funding
16:34:22 <locosage> problem with (2) is I need it for vanilla industries
16:34:42 <andythenorth> patch your client 😛
16:34:51 <andythenorth> or write a GS that instantly bulldozes them
16:34:55 <andythenorth> and penalise the player
16:35:11 <locosage> I can always patch server ;)
16:50:24 <LordAro> rau117: ^ i welcome your feedback (and skill in finding edgecases)
17:02:21 <truebrain> Wait, LordAro made a PR?! 😮
17:02:35 <LordAro> you can tell it's christmas
17:14:11 *** frosch123 has joined #openttd
17:14:11 <frosch123> how much do we charge for posting ad-links in the IRC logs?
17:25:38 *** gelignite has joined #openttd
17:27:40 <merni> LordAroviaGitHub: people would have to read them first 😆
17:53:24 <peter1138[d]> Is this lazy enough?
18:02:53 <andythenorth> docks need 'number of tracks'?
18:05:33 <xarick> `if ((_tile.N.r.o.x < _tile.W.r.o.x || _tile.W.r.o.y < _tile.S.r.o.y || _tile.S.r.o.x > _tile.E.r.o.x || _tile.E.r.o.y > _tile.N.r.o.y)) {`
18:05:33 <xarick> I'm getting creative with shortcutting variable names
18:25:35 <peter1138> Hmm, maybe I should at least make the selected label wrap.
18:28:31 <locosage> how the heck am I getting persistent storage wiped after map generation...
18:38:09 *** alfagamma7 has joined #openttd
18:38:22 <alfagamma7> That seems low ngl
18:58:45 <peter1138> _glx_, did we ever decide on switching widgets to use DrawStringMultiLine vs DrawString()? I can't remember if there was a reason not to.
19:02:57 <peter1138> Also I accidentally found out that all the Auz stuff is 32bpp, missing sprites everywhere :p
19:06:37 <peter1138> (And of course, it works with 32bpp-to-8bpp conversion.)
19:21:17 *** Hanicef has joined #openttd
19:55:43 <xarick> How ambiguous is this: `_tile.r.o.x + 1 > _tile.W.r.o.x`
19:55:57 <xarick> I need parentsis again?
19:56:30 <andythenorth> I love a single character variable name 😛
19:56:39 <andythenorth> it's so easy to find and replace without introducing error
19:57:12 <xarick> is it evaluating 1 > _tile... ?
19:58:39 <peter1138> andythenorth, never look at OpenTTD's code :)
20:01:03 <_jgr_> The + operator has a higher precedence than >
20:04:09 <xarick> yep :p, it was that, now it's working correctly
20:04:58 <xarick> I should've known this already... I keep falling to the same mistakes
20:10:11 <andythenorth> peter1138: remember javascript obfuscation? 😛
20:22:10 <xarick> i don't have a "paper" to look for coordinates outside the map
20:28:41 <_glx_> it's easy to use x/y and [0, MapSizeX/Y[ ranges
20:29:34 *** esselfe has joined #openttd
20:41:07 <_glx_> peter1138: I think the decision was it was translators' job
20:42:07 <peter1138> That's pretty much a different issue.
20:42:57 <peter1138> Deciding if long text should be broken vs making long text fit into a constrained space.
20:43:34 <peter1138> (Related sure, but I'm not waiting for translators to decide if e.g. some newgrf-controlled label should be split.
20:44:12 <peter1138> (And just using DSML won't make things wrap automatically)
20:46:38 <_glx_> ah yes for newgrf stuff we could probably handle multiline and don't rely on authors
20:48:54 <peter1138> Yeah, so I can replace a WWT_TEXT with WWT_EMPTY and manually draw it. But then I started wondering... :)
20:50:49 <peter1138> Ah ha, but perhaps I can't.
20:52:09 <_glx_> the hard part will be to determine the height based on width (if width can change with resize)
20:53:23 <peter1138> I already established the OnResize pattern for that. (OnResize is also called during initial set up.)
20:57:41 <peter1138> Bum. Switching the game options window from self-rendering to widget rendering of baseset descriptions is... more lines of code.
20:58:33 <peter1138> Mainly because it's necessary to override the calculated width, because ... it's too wide :)
20:59:04 <peter1138> I'll leave that for now.
20:59:12 <_glx_> yeah it's simple to get automatic width for single line
21:14:05 <_glx_> or even multiline if string contains {}
21:14:16 <_glx_> but the width can be huge
21:37:06 *** gelignite has quit IRC (Quit: Stay safe!)
21:37:59 <peter1138> Yes. Use DSLM vs DS does not affect that :)
21:48:29 *** toast_not_found has joined #openttd
21:48:29 <toast_not_found> Hello all, community server host here, have always just used my public IP to give to players who want to join as I have never gotten on well with the invite code system. I just wondered if any of you guys had a deeper understanding of how OpenTTD dedicated servers work and wether I can set up some sort of UDP/TCP magic to allow people to join using a custom domain?
22:00:30 *** nielsm has quit IRC (Ping timeout: 480 seconds)
22:02:01 <peter1138> I recommend... DNS?
22:10:15 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
22:11:36 *** keikoz has quit IRC (Ping timeout: 480 seconds)
22:17:30 <_glx_> no UDP/TCP magic needed, it you have a domain name it can replace IP easily
22:22:36 <peter1138> (Or just use the in game server list...)
22:26:53 <xarick> virtual tiles, it's way out there in the dark
22:27:24 <xarick> it's doing circles in the dark
22:28:09 <xarick> I'm getting rid of inner tiles
22:28:33 <xarick> seems I don't need those stored in variables
22:30:01 <xarick> some magic calculation with _map_size allows me to get rid of them
22:58:42 *** Hanicef has quit IRC (Quit: leaving)
continue to next day ⏵