Config
Log for #openttd on 23rd December 2018:
Times are UTC Toggle Colours
00:00:05  <Zuu> A statue gives you a bonus to the station ratings in the city.
00:00:29  <Zuu> For a one-time fee.
00:01:04  <Zuu> But for short term company value it may not be the best investment.
00:04:58  <Zuu> But it is cheap in planning and once you have more money than you have cpu power to spend, it is a good thing to put your money into.
00:10:43  <Samu> https://imgur.com/Tvsn6Ho
00:10:55  <Samu> heh
00:11:05  <Samu> seems to be working
00:11:22  *** frosch123 has quit IRC
00:11:23  <ekcja> how to get the money the most efficient way possible?
00:11:32  <Zuu> Great
00:11:48  <Zuu> ekcja: cheat
00:12:04  <ekcja> without cheating*
00:12:25  <Zuu> It depends on which NewGRFs that are in use, map settings etc.
00:12:53  <Zuu> But in general tranport goods at optimal distance fast.
00:13:10  <ekcja> but let's say it's a bland, quite flat map with no seas, but only few rivers and lakes
00:13:18  <ekcja> with quite a lot of small cities and factories
00:14:05  <ekcja> Also, how does it count, with the distance?
00:14:11  <Zuu> There is a window that shows payment of different cargos. Coal IIRC is the best one but on the downside you often run your vehicle empty on the way back. For passenges you can transport both ways usually.
00:14:27  <ekcja> Can like road mazes "increase" the distance also increasing the paycheck?
00:15:02  <Zuu> Distance is from A to B (not sure if it is x+y or exactly how, but it is not network distance)
00:15:05  <Samu> aha, got a passengers goal, let's see if it detects it as goal
00:16:43  <Samu> PASS is a Goal cargo!
00:16:49  <Samu> ke
00:17:49  <Samu> i better create a library for CompanyValue akin to what NoCarGoal is doing, ya?
00:18:06  <Samu> sounds "easy" (but it's not)
00:18:28  <Zuu> It is better with a library if you hope that AI authors should add support for it.
00:18:55  <Zuu> Eg. make it as simple as possible for them.
00:19:49  <Zuu> The main difference with libraries is that info.nut is library.nut and that you should in general only have one class in libraries.
00:20:45  <Zuu> SuperLib cheats using obscure internal names for its many classes that you probably won't use in your AI and then expose it nicely using SuperLib.Town etc. that points to the internal obsucre name that ends up in your global scope.
00:21:27  <Zuu> IIRC the internal name of Town is _SuperLib_Town.
00:25:10  <Samu> oh, it's an AI library, i was searching in GS
00:26:57  <Samu> libraries also need a unique shortname?
00:27:18  <Zuu> Probably.
00:28:39  <Samu> "scpV"
00:28:52  <Samu> this will run out of names if everyone stats making clients
00:28:56  <Samu> quickly
00:31:11  <Zuu> The shortname becomes the uniqueid in bananas so it will be enforced there. The actual text is nice if it means something, but the important thing is that it is unique.
00:34:21  <DorpsGek_II> [OpenTTD/OpenTTD] glx22 updated pull request #6987: Fix: [Win32] WIN32 may not be defined, always prefer the compiler pre… https://git.io/fp9vd
00:35:10  <Samu> version can't be a string? ... t.t
00:36:53  *** gelignite has quit IRC
00:42:05  <Zuu> The more horific thing is that some parts of OpenTTD rely on the long name to be a unique indentifier too. Those some parts involve save/load for example. :-)
00:42:25  <Zuu> Version should be an integer.
00:53:52  <Zuu> I'm not sure it is that bad though. Because released scripts don't change name at the same version. But if someone rename their AI or GS and a user doesn't have the exact version, it looks like OpenTTD will use the long name to find a compatible version of the script to take over.
00:54:42  <Zuu> And there is some code like IsSameScript that use short name/uniqueid. But the savegame format stores the longer names.
00:55:50  <glx> ok that's weird, building 64bit with vcpkg x64-windows-static works, building 32bit with vcpkg x86-windows-static fails to link against zlib and freetype
01:00:31  *** Progman has quit IRC
01:33:55  *** ekcja has quit IRC
01:55:03  *** Zuu has quit IRC
03:07:04  *** lugo has quit IRC
03:24:29  *** glx has quit IRC
03:26:21  *** Samu has quit IRC
05:32:28  *** Compu has joined #openttd
06:12:25  *** HerzogDeXtEr has joined #openttd
06:32:49  *** HerzogDeXtEr has quit IRC
06:44:46  *** Wacko1976 has joined #openttd
07:15:34  *** lugo has joined #openttd
07:17:19  *** Wacko1976 has quit IRC
07:24:00  *** andythenorth has joined #openttd
07:27:23  *** lugo has quit IRC
07:38:12  *** sla_ro|master has joined #openttd
08:07:40  *** tokai|noir has joined #openttd
08:07:40  *** ChanServ sets mode: +v tokai|noir
08:12:11  *** chomwitt has joined #openttd
08:14:39  *** tokai has quit IRC
08:17:09  *** rocky1138 has quit IRC
08:17:32  *** rocky1138 has joined #openttd
08:21:02  *** Wolf01 has joined #openttd
08:22:57  <Wolf01> Moin
08:27:16  *** Progman has joined #openttd
08:53:40  <andythenorth> moin
09:32:36  *** nielsm has joined #openttd
09:46:17  <nielsm> morning
09:50:57  *** erratic has joined #openttd
09:56:33  <TrueBrain> goooooood morning
09:57:41  <TrueBrain> lets see if I can get OpenTTD compiled with vcpkg on Azure :D
09:59:39  <TrueBrain> hmm .. I tell it to do x64, and it does x86 .. that is annoying :P
09:59:54  <TrueBrain> owh, subprojects are always 32bit
09:59:57  <TrueBrain> well, that is not nice
10:05:10  <TrueBrain> right, glx also already concluded that .. 64bit works, 32bit fails in linking .. weirrrrdddd :(
10:27:23  *** andythenorth has quit IRC
10:42:42  *** lugo has joined #openttd
10:47:57  *** Wacko1976 has joined #openttd
11:01:24  *** Zuu has joined #openttd
12:02:55  *** Laedek has joined #openttd
12:43:16  *** frosch123 has joined #openttd
12:54:18  <Eddi|zuHause> anyone wanna help me clean the house?
13:05:07  <nielsm> you can't just type 'make clean' ?
13:19:23  <Eddi|zuHause> seems nobody implemented that
13:19:55  <Eddi|zuHause> can alexa/siri/whatever do it?
13:25:01  <Heiki> just create a NewGRF with house-cleaning vehicles and an AI that uses them
13:43:24  *** Wacko1976 has quit IRC
14:00:45  *** andythenorth has joined #openttd
14:02:49  <andythenorth> o/
14:03:17  <nielsm> https://github.com/OpenTTD/nml/blob/master/setup.py  <- I think this needs some updating
14:03:27  *** Wacko1976 has joined #openttd
14:03:30  <nielsm> the description text is also extremely vague
14:03:47  <nielsm> (it needs to mention the relationship to ttdpatch/openttd)
14:04:58  <andythenorth> readme needs work too https://github.com/OpenTTD/nml/blob/master/README.md
14:05:03  <andythenorth> mentions the wrong repo
14:05:48  <andythenorth> and the buildout packaging never worked
14:06:12  * andythenorth can fix those
14:06:21  <nielsm> made a PR for fixing the url :P
14:07:01  <andythenorth> merged
14:07:28  <nielsm> also should the development status be updated to beta or maybe production?
14:07:34  <nielsm> rather than pre-alpha
14:11:18  <andythenorth> what rev are we at?  0.4.5
14:11:22  <andythenorth> might be beta
14:11:36  <andythenorth> arguably it's just 1.0 imho
14:11:40  <andythenorth> but eh
14:13:04  <nielsm> 1.0 should indicate feature complete
14:13:16  <nielsm> which it isn't since not all newgrf features are supported
14:13:52  <nielsm> but that can't mean it's not "production ready"
14:15:49  <andythenorth> +1
14:17:28  <planetmaker> nielsm, nml is only related to OpenTTD. TTDP cannot digest its output
14:17:37  <nielsm> ok
14:18:34  <planetmaker> I'd call its status beta
14:18:50  <planetmaker> next release... I'm pondering calling it 0.5.0
14:18:59  <planetmaker> some things changed since. And its URL :P
14:19:08  <andythenorth> I did a PR for the readme, but there's more to change
14:19:26  <andythenorth> dunno how to format the args section properly, markdown is not rendering it as needded
14:19:37  <andythenorth> linebreaks are being dropped
14:19:44  <nielsm> I'm thinking about how exactly to do the production cb syntax
14:19:56  <andythenorth> also do other people install it with 'make install'?
14:19:59  <andythenorth> or is that just me
14:20:05  <nielsm> it needs much more knowledge of the parser structure and control flow in the program than I have atm
14:20:20  <nielsm> so trying to read top to bottom now, from main.py and in
14:20:24  <andythenorth> :)
14:20:32  * planetmaker never installs nml
14:21:10  <planetmaker> I've a symlink from ~/bin/nmlc to my nmlc in my development dir. And that's it
14:22:22  <planetmaker> andythenorth, the commit messages for NML should follow OpenTTD style... so like Doc: bla bla. Or Change: blub bluh
14:22:36  <andythenorth> oh yes, sorry
14:22:40  <andythenorth> I did it through the web UI
14:22:49  <andythenorth> I'm not even sure where the commit message went in
14:23:33  <andythenorth> let's see if I can update it through the web UI
14:23:36  <planetmaker> I'm myself not entirely thorough with that. Easier to be thorough when others do the work :P
14:24:09  <andythenorth> can't see how to change it in the web UI
14:24:12  <planetmaker> I should fiture out how to install the commit hook
14:24:21  <planetmaker> or however it is called with github
14:25:11  <andythenorth> oof I'm going to close that PR
14:25:21  <andythenorth> can't see how to edit the commits in the browser
14:27:51  <peter1138> I've always got to the editor by accidentally pressing a random key.
14:28:14  <peter1138> Which is nicer than closing PRs ;)
14:30:58  *** glx has joined #openttd
14:30:58  *** ChanServ sets mode: +v glx
14:36:31  <LordAro> there's no webeditor support for rebasing
14:37:27  <andythenorth> how the hell do I rebase -i in a sane environment?
14:37:56  <andythenorth> it's opening nano, and just about every key I press does something that sounds horrible and destructive
14:39:36  <LordAro> that doesn't sound like nano
14:39:41  <LordAro> sounds like vi
14:39:59  <andythenorth> GNU nano 2.0.6
14:40:20  <LordAro> well, typing in nano.. just types
14:40:22  <andythenorth> keeps telling me I've enabled backups, or multiple file editing or other stuff
14:40:26  *** Flygon has quit IRC
14:40:32  <Wolf01> At least is easier to quit from nano than from vi
14:40:42  <andythenorth> :
14:40:43  <andythenorth> :q
14:40:54  <andythenorth> oh FFS my q key has stopped working
14:40:58  <andythenorth> Apple keyboards ftw
14:41:06  <Wolf01> Lol
14:41:23  <andythenorth> oh
14:41:27  <andythenorth> auto-repeat is broken for all keys
14:41:29  <andythenorth> awesome
14:41:56  <Wolf01> Mmmh, games I really want are still too much near the bottom of the wishlist :(
14:42:29  <andythenorth> time to restart this computer :(
14:42:33  <andythenorth> it's only been up 18 days
14:42:37  <andythenorth> this is frigging ridiculous
14:42:58  *** andythenorth has quit IRC
14:44:54  <Eddi|zuHause> how is "my keys are doing random stuff" a thing that could be fixed by rebooting?
14:47:39  *** andythenorth has joined #openttd
14:48:14  *** Wacko1976 has quit IRC
14:49:00  <andythenorth> better https://github.com/OpenTTD/nml/pull/12
14:51:48  <nielsm> github still makes some weird separator lines that shouldn't be there
14:53:29  <Wolf01> I think I already asked that: is there a good tank game with no internet?
14:54:25  *** Samu has joined #openttd
14:54:35  <Samu> hi
14:56:35  <nielsm> hmm, to make accept_cargo() and produce_cargo() into syntax elements rather than function calls...
14:56:37  <nielsm> :(
14:56:48  <nielsm> it's probably a bad idea
14:57:03  <Samu> there is a limitation with SCPLib about int values
14:57:13  <Samu> i can't use big numbers :(
14:58:23  <Samu> a Company Value of £500000000 is a too large int to pass around
15:00:20  <Samu> im gonna need a strategy to pass big values
15:00:42  <Wolf01> Pass it as 0M
15:00:46  <andythenorth> ha ha
15:00:52  * andythenorth is getting better at cleaning up git
15:00:59  <andythenorth> just don't ever depend on my repo :P
15:01:52  <Samu> https://imgur.com/3BMGAej
15:07:06  <andythenorth> spurious horizontal separators are removed from nml README https://github.com/OpenTTD/nml/pull/12
15:07:09  <Samu> but in ranking mode, it passes the value of the company with the highest value
15:07:21  <Samu> which could be even larger
15:07:52  <Samu> its doomed
15:09:53  <Samu> or i could fool around
15:10:25  <Samu> i'll have the AI only know of the company with the highest value, but have the AI to get the value of the company directly
15:11:00  <Samu> hopefully AIs are allowed to get info of other companies
15:12:15  <nielsm> okay, found the stuff I was looking for, might be able to rework produce() statements now
15:14:27  <Samu> @calc 0xFFFFFFE
15:14:27  <DorpsGek> Samu: 268435454
15:14:52  <Zuu> Samu: try pass it as string?
15:15:17  <Zuu> But there is probably also a max length to strings after I tried to flood scp in a test-AI :-p
15:15:58  <Zuu> But isn't company value available through APIs, or do you have a custom way to calculate it?
15:16:30  <Samu> ((500000000).tohex).tostring
15:16:36  <Samu> what could go wrong
15:17:11  <Samu> or just 500000000.tostring?
15:17:44  <Zuu> SuperLib has a base 84-ish int to string converter.
15:18:18  <Zuu> using alphabet, numbers and some printable special chars.
15:18:46  <Zuu> If you "zero-pad" to 2 digits it produce smileys on lower numbers.
15:20:33  *** Progman has quit IRC
15:21:31  <Samu> what if the value is something like 543828465
15:22:53  <Samu> toint does not exist, well hmm
15:23:00  <Zuu> Then it won't be a nice smiley. But the thing is though that IIRC SCPLib does something similar to transmit integers in fewer chars than just base 10 in a string.
15:23:01  <Samu> what is it named then
15:23:35  <Zuu> local i = (int)s; ?
15:23:49  <Samu> oh, jsut that? heh, ok
15:24:12  <Zuu> I don't know. Just a random suggestion based on C++ :-p
15:24:33  <Samu> nop, doesn't like that
15:24:33  <Zuu> In JavaScript and PHP it is parseInt(str, 10)
15:24:51  <Samu> brb googling squirrel doc stuff
15:25:31  <Zuu> For JS you especially want to specify base 10 or some older browser versions may parse it as hex if it starts on zero. :D
15:26:04  <Samu> string.tointeger([base])
15:26:10  <Samu> base is optional
15:26:13  <Samu> ok lets try
15:27:19  <Zuu> Base is usually optional, but it is important to watch out if it tries to determine base by the string or if 10 is default.
15:27:53  *** Progman has joined #openttd
15:34:32  <Samu> response_value = (self._main_ptr.best_value).tostring();
15:34:37  <Samu> on the GS side
15:35:12  <Samu> local value = message.GetStringData(1).tointeger();
15:35:15  <Samu> on the AI side
15:35:19  <Eddi|zuHause> <Zuu> SuperLib has a base 84-ish int to string converter. <-- or you could do it like normal people and use base64?
15:35:21  <Samu> it works!
15:37:48  <Samu> maybe SCPLib should do this convertion itself
15:40:17  *** Wacko1976 has joined #openttd
15:43:16  <Samu> let me try a bigger string
15:44:07  <Zuu> Eddi|zuHause: Not sure that squirrel2 has that. But yes, for other places than AI/GS I'd use base64.
15:47:17  <Samu> the maximum value of target company i can input on the GS is 999999999 which is then multiplied by 1000 then passed as string as "999999999000"
15:47:22  <Samu> let's see what happens
15:49:40  <Samu> 2147483647
15:49:42  <Samu> bah
15:51:18  <nielsm> andythenorth, now I'm considering a much more insane produce() syntax... https://0x0.st/sdpy.txt
15:52:15  <nielsm> (maybe with = instead of * to separate cargo from register)
15:52:29  <Zuu> Samu: AIs can access their company value via API and according to docs, also other company values. http://noai.openttd.org/api/1.8.0/classAICompany.html#328dc60526bcbaba3ea8129a17ebaf86
15:52:53  <Zuu> Is there a reason you want to send it via scp?
15:53:37  <Samu> for ranking mode, no, but for goal mode, i'm gonna have to
15:54:42  <Zuu> Why?
15:54:57  <Samu> so that AI know which is the target
15:55:12  <Zuu> Ah, so not the company value, but the target value?
15:55:59  <Samu> best_value becomes the target value in goal mode
15:56:17  <Samu> best_value is the best company value of all companies in ranking mode
15:58:18  <Zuu> Seems like you solved it using string. Another possibility is to split it into two numbers that the AI multiply, or a variable length array terminated by 0.
16:00:10  <Samu> i have an idea
16:00:13  <Samu> brb
16:02:23  <Samu> if (self._goal_mode == true) { 				local value = (message.GetStringData(1).tointeger() / 1000);
16:02:30  <Samu> else
16:02:41  <Samu> manually retrieve the best value myself
16:03:09  <Samu> which may not be in sync with what the GS has at the moment, but meh... should be okay
16:03:42  <Samu> self._goal_value = value;
16:04:08  <Zuu> Yes unless you want to support really smal goal values, send it in milions or thousands instead of single dollars/euros/coins.
16:05:36  <Zuu> Or write a patch for GS<->AI communication in OpenTTD so it doesn't have to communicate over signs. :-)
16:18:14  <Eddi|zuHause> how about AI<->GS communication via ingame chat?
16:18:54  <Eddi|zuHause> (and then port supybot to GS :p)
16:21:40  *** Wormnest has joined #openttd
16:23:09  *** gnu_jj has joined #openttd
16:32:04  *** gnu_jj has quit IRC
16:48:51  <andythenorth> hmm
16:49:36  <nielsm> (I scrapped that syntax idea again)
16:49:42  <andythenorth> :P
16:50:00  <andythenorth> impedance mismatch? o_O
16:50:25  <nielsm> feels silly to add a new syntax element when it's not strictly needed
16:53:01  <andythenorth> alternative proposal? o_O
17:02:28  *** gnu_jj has joined #openttd
17:11:19  *** gnu_jj has quit IRC
17:13:37  *** Zuu_ has joined #openttd
17:15:25  <planetmaker> <nielsm> andythenorth, now I'm considering a much more insane produce() syntax... https://0x0.st/sdpy.txt <-- that is... complicated
17:16:12  *** gnu_jj has joined #openttd
17:16:30  <nielsm> planetmaker yeah, not doing that
17:17:01  <planetmaker> We really don't need to tie NML syntax closely to NFO syntax
17:17:15  <planetmaker> we can where NFO is easy. But... here it isn't
17:18:19  <planetmaker> I'm considering to really create a new produce syntax. Which could be introduced with 0.5.0. And the old removed 0.6.0
17:18:34  <planetmaker> And setting a NewGRF (NML) flag which produce syntax is being used
17:19:18  <andythenorth> sounds plausible
17:20:23  *** Zuu has quit IRC
17:21:46  <nielsm> planetmaker, if someone who actually understands how the prod cb works and is used can design a better syntax I'm all for that :)
17:22:23  <planetmaker> well... not sure I actually understand it (better), but my understanding is such:
17:23:17  <planetmaker> there is a CB FLAG which sets when the production CB is run: periodically. Or on reception of cargo. (is both possible? dunno right now)
17:24:03  <planetmaker> there are other CB FLAGS which determine whether it's a secondary industry (needs input in order to produce) or whether it's a primary (produces stuff out of thin air)
17:25:01  <planetmaker> so... primary is easy: it can only be called periodically. And produce stuff. each production call has a flag which indicates whether it should be called again immediately
17:25:16  <andythenorth> it runs on cargo delivery and periodically
17:25:18  <planetmaker> (which is stored internally in some register)
17:25:53  <andythenorth> it's agnostic about industry type: prod. cb is same for secondary / primary / black hole
17:26:20  <planetmaker> andythenorth, yes. But it behaves differently wrt input cargoes. That's all I said (so far) :P
17:26:33  <planetmaker> anyhow, the interesting one is the secondary industry which consumes cargo
17:28:58  <planetmaker> that CB for input and output cargo is called with the input cargoes and their amount (in registers)
17:30:09  <nielsm> the one thing I don't understand about the prod cb is that it never checks whether the "subtract" cargos actually exist in the amounts wanted
17:30:27  <nielsm> (in the resolver code in newgrf_industries.cpp)
17:30:38  <andythenorth> it doesn't need to
17:30:42  <nielsm> or well, one of the many things I don't understand about it
17:31:01  <andythenorth> they're either zero-ed or overflow to negative, can't remember which :)
17:31:15  <nielsm> they clamp to range 0-0xffff
17:31:17  <planetmaker> iirc zeroed. But yes
17:31:22  <andythenorth> like a few other nfo things, it's remarkably simple, but seems complex
17:31:31  <andythenorth> most of the cbs are really brutally simple
17:31:51  <nielsm> the thing I don't understand is how the cb can succeed when the required inputs aren't availeble
17:32:45  <andythenorth> it just invents output
17:33:02  <andythenorth> there's no connection between the input and output
17:33:23  <andythenorth> it's really crude and effective, author just specifies how much to consume, and how much to produce
17:33:29  <andythenorth> :)
17:33:31  <planetmaker> the amount subtracted is given to the CB
17:33:46  <planetmaker> it just returns output. And returns whether it wants to produce more
17:34:21  <planetmaker> iirc
17:35:27  <nielsm> before each iteration it also resolves something about some sprite group, and I have no idea what that means either
17:35:38  <nielsm> 		const SpriteGroup *tgroup = object.Resolve();
17:35:38  <nielsm> 		if (tgroup == NULL || tgroup->type != SGT_INDUSTRY_PRODUCTION) break;
17:39:49  <planetmaker> well. everything in NewGRFs is sprites... so also the CB definition
17:40:01  <planetmaker> But I don't quite know the code inside OpenTTD
17:41:51  <planetmaker> https://newgrf-specs.tt-wiki.net/wiki/Action2/Industries
17:42:04  <planetmaker> but... you know that one, I guess :D
17:49:21  <nielsm> I've implemented parsers for the syntax, and more or less cargo-culted the prod cb version 2 support in
17:49:38  <nielsm> but still don't understand the overall control flow of how any callbacks work in newgrf
17:53:12  <planetmaker> OpenTTD checks the list NewGRF item (i.e. an industry) for whether its callback is applicable in the map loop. If so, it executes the CB.
17:53:30  <planetmaker> I'm not entirely clear how it initializes the parameters it is called with, though.
17:53:37  <planetmaker> the dynamic parameters
17:54:54  *** Wacko1976 has quit IRC
18:04:30  <planetmaker> question for my understading of production CB, version 2:
18:05:11  <planetmaker> you "only" define the consumed cargoes and their amount. And the generated cargoes and their amounts. Not the generated cargo for each input cargo
18:05:13  <planetmaker> right?
18:05:19  *** gnu_jj has quit IRC
18:05:27  <nielsm> yes
18:05:49  *** gelignite has joined #openttd
18:05:58  <nielsm> it consumes all the listed inputs and produces all the listed outputs as a single operation
18:07:07  <planetmaker> https://paste.openttdcoop.org/pvekrsvxs
18:07:23  <planetmaker> ^^ my syntax suggestion. It implicitly also covers blackhole and primary industries
18:09:51  *** Wacko1976 has joined #openttd
18:10:21  <nielsm> as far as I can tell it also needs a way to specify a name (which is used to reference it elsewhere) and an indicator for the 'again' flag
18:11:45  <planetmaker> hm, yes
18:11:57  <planetmaker> name usually goes as 1st param. The again should go last
18:13:27  <nielsm> produce(name, againflag) { generate { CRG1: expr; CRGx: expr; } consume { CRG1: expr; CRGx: expr; } }
18:13:43  <nielsm> similar to item definitions
18:14:55  <frosch123> https://paste.openttdcoop.org/phqik4jng
18:15:09  <frosch123> i don't think you need an option to select between old and new syntax
18:15:22  <frosch123> you can tell by the amount of parameters, or use a new keyword
18:15:49  <nielsm> there's no precedent for "dictionary" syntax anywhere in nml yet, as far as I can tell
18:16:21  <frosch123> https://newgrf-specs.tt-wiki.net/wiki/NML:Spriteset https://newgrf-specs.tt-wiki.net/wiki/NML:Switch https://newgrf-specs.tt-wiki.net/wiki/NML:Tilelayout
18:16:22  <nielsm> so [ IDENTIFIER: expression; ... ] needs a new syntax element
18:16:25  <planetmaker> the switch statement
18:16:26  <frosch123> there are multiple
18:16:37  <frosch123> they all agree on ":" as separator between key and value
18:16:52  <frosch123> but they disagree on "", ",", ";" as item separator
18:17:23  <nielsm> those don't use [] to surround the expression, and don't occur in a location that usually expects an expression
18:17:39  <frosch123> yes, only switch does [] for a list of things
18:17:58  <frosch123> inside the ( )
18:18:04  <nielsm> right now the produce() statement is defined as PRODUCE LPAREN expression_list RPAREN
18:20:04  <planetmaker> I very much would like python bindings for NewGRFs :P
18:26:47  <andythenorth> frosch123: your format doesn't need cargotype()?
18:28:17  <planetmaker> hm, interesting
18:28:32  <planetmaker> prod_cargo_types and accept_cargo_types doesn't eat labels out-of-box
18:28:37  <planetmaker> why? :|
18:29:45  <planetmaker> no person would ever use it without
18:30:08  <andythenorth> is it just nobody made it work that way?
18:30:21  <planetmaker> yeah... and probably more complex to write the parser
18:31:05  <planetmaker> as it would require a special function for these properties
18:31:25  <andythenorth> the frosch123 syntax is what I expected this to be
18:31:27  <andythenorth> two arrays
18:31:35  *** gnu_jj has joined #openttd
18:31:46  <planetmaker> well, yes...
18:36:04  *** Progman has quit IRC
18:38:00  <frosch123> andythenorth: cargotype() sounds like a technical detail... i do not know nml code to know whether that would be needed somewhere
18:38:34  <frosch123> i just looked at all the nml syntax and extrapolated how i think the produce syntax would appear most natural
18:39:22  <planetmaker> it would likely be needed there. For consistency's sake
18:40:24  *** gnu_jj has quit IRC
18:40:25  <nielsm> hmm there aren't quite any productions in the parser that can produce an empty "assignment_list"-like thing
18:40:50  <nielsm> assignment_list is a sequence of "ID COLON expression SEMICOLON" productions
18:41:46  <frosch123> planetmaker: the cargotype is a constant value, so you cannot use expressions there. so there is no point in "cargotype()"
18:42:23  <frosch123> well, ok, you can with action6, but i don't think people will use expressiosn for cargo types
18:42:53  <planetmaker> frosch123, I totally agree. Yet... that's what currently is used there in other cases
18:43:03  <frosch123> not really
18:43:21  <frosch123> cargotype() is used in places where nml expects and integer expression
18:43:31  <planetmaker> prod_cargo_types 	array of up to 2 ints 	Types of cargo produced. Use the cargotype(<label>) built-in function to specify a label from the cargotable.
18:43:41  <planetmaker> in the definition of the property
18:43:44  <andythenorth> oh is it just labels directly here?
18:43:48  * andythenorth looks
18:44:05  <planetmaker> https://newgrf-specs.tt-wiki.net/wiki/NML:Industries
18:44:33  <planetmaker> I very much would prefer to use labels directly wherever I need a cargo
18:45:33  *** gnu_jj has joined #openttd
18:52:53  <nielsm> well, I wrote something that parses this:
18:52:53  <nielsm> produce(test_produce, [COAL: 5; IORE: 7;], [STEL: 5;], 1)
18:53:13  <nielsm> it errors after parsing, but the syntax is accepted :)
18:58:25  <planetmaker> yay
19:02:05  <nielsm> just two new production functions: https://0x0.st/sdOB.png
19:05:43  <Samu> Zuu_: i dont understand why this happens :(
19:10:51  <Samu> https://paste.openttdcoop.org/pgd6yvzjo
19:12:04  <Samu> i'm receiving a null
19:13:12  <Samu> https://imgur.com/a/vfH9r8S two images
19:13:35  <Samu> the GS seems to be sending the right number
19:13:48  <Samu> the client receives it as null, why
19:16:01  *** Wormnest has quit IRC
19:16:22  <Samu> what's the difference between self and this?
19:18:08  <Samu> if (self._goal_mode == true) {
19:18:42  <Samu> apparently self._goal_mode is false, i was expecting it to be true
19:18:47  <Samu> why
19:19:03  <Samu> or at least it's not true
19:24:39  <Samu> self._goal_mode = 1
19:24:46  <Samu> is there a difference between 1 and true?
19:25:21  <Samu> oh, wow, that was it
19:25:31  <Samu> lol
19:25:34  <Samu> so 1 is not true
19:25:42  <Samu> sometimes it is
19:25:52  <Samu> this time it wasn't
19:25:56  <Samu> pff
19:25:59  <Zuu_> In squirrel 1 != true
19:27:13  <Zuu_> But scp transmit booleans as 0/1 and there is Message.GetBoolData() to read booleans. The docs does not tell tohugh if the return type is true/false or 1/0.
19:28:15  <Zuu_> However looking at the source code of scp it looks like it will return boolean true/false or null.
19:28:32  <Zuu_> return this.Data[index] == 1;  <--- scp source code in Message.GetBoolData(index)
19:28:44  *** Wormnest has joined #openttd
19:29:59  <Zuu_> Full source of GetBoolData: https://paste.openttdcoop.org/prssnyno1
19:31:23  <Zuu_> IIRC scp will not just transmit an array of data items in a packet but also type information. Integer or string. Then there is GetBoolData() to fake include boolean support. :-)
19:35:30  <Samu> GetBoolData(1) then?
19:35:37  <Samu> or (2)
19:35:43  <Samu> gonna try
19:36:57  <Samu> self._goal_mode = message.GetBoolData(1);
19:37:33  <Zuu_> GetIntData(1) will return integer 0 or 1 (or any other number) or null. GetBoolData will do int => bool conversion for you.
19:39:38  <Samu> it works! thx
19:40:16  *** Wormnest has quit IRC
19:40:38  <Samu> i'm afraid of what could happen if _goal_mode is null
19:40:48  <Samu> better make sure it doesn't pass null
19:46:03  <Samu> goal_mode is null the moment the player clicks the Continue button after the goal is reached
19:46:50  <Samu> it is null for that loop, until it becomes false in that same loop
19:46:55  <Samu> then continues to be false forever
19:47:51  <Samu> must think
19:50:05  <Samu> so it's only null for 1 tick
19:51:09  <Samu> the game is paused by the GS
19:51:16  <Samu> AI's can't run code
19:51:23  <Samu> but the GS can
19:51:55  <Samu> GS must not answer with a null :(
19:52:05  <Samu> yeah i still have to be careful
20:00:47  <Samu> Zuu_: is there a way to send a message from the GS to all AIs in 1 message only?, or i have to send to all of them 1 by 1?
20:01:33  <Zuu_> I don't remember there being any broadcast function.
20:01:53  <Samu> t.t
20:02:24  <Zuu_> You could of course try to specify null companyId or COMPANY_INVALID and see what it does.
20:02:54  <Zuu_> scp is from around 2012 so it is many years ago..
20:03:56  <Samu> TellCompany
20:03:59  <Samu> brb
20:12:04  <Samu> have to send to all of them
20:16:30  <Zuu_> If there would be a broadcast it would still be a foreach and build signs for all companies. Because they have are probably built in the ownership of the AIs.
20:17:40  <Zuu_> Technically deity can own signs, but I don't know if AIs can read them.
20:17:55  <Zuu_> Deity is by the way the "player" of GS.
20:18:17  <Zuu_> s/"player"/"company"/
20:21:25  <Zuu_> So it might be that it could post it to all, but then the AIs cannot ack by deleting them but have to respond in their company posting individual ack signs.
20:29:45  <andythenorth> Horse 86%
20:29:51  <andythenorth> 200 done, 32 to do
20:40:05  <LordAro> 86%? is that a new record?
20:41:36  <andythenorth> yup
20:41:39  <andythenorth> high water mark
20:41:49  <andythenorth> somewhat aided by deleting about 20 vehicles
20:46:03  <frosch123> what defines the 32? are they some specific type, or are they scattered over all generations and types?
20:59:09  <andythenorth> somewhat they're the engines
20:59:12  <andythenorth> especially the steam engines
20:59:26  * andythenorth doesn't know how to draw steam engines yet :P
20:59:37  <andythenorth> but eh, they're tank wagons with a funnel, right?
20:59:47  <andythenorth> chimney / funnel /s
21:05:03  <frosch123> http://www.douglas-self.com/MUSEUM/LOCOLOCO/chimney/chimney.htm
21:05:11  <frosch123> you can also use pipes
21:08:29  <frosch123> preheaters are weird
21:29:39  <andythenorth> wow all the weird trains
21:31:24  <Wolf01> Why not just build the cab forward?
21:34:19  <Samu> Zuu_: what do I need the scp.nut file in my AI folder for?
21:34:29  <Samu> seems that I don't require it
21:35:03  <Zuu_> I don't know what scp.nut contains.
21:35:15  <Zuu_> Or more precisely your scp.nut file§
21:35:27  <Samu> i deleted it
21:35:30  <Samu> and it still runs
21:35:31  <Samu> weird
21:36:11  <Samu> import("Library.SCPLib", "SCPLib", 45); import("Library.SCPClient_CompanyValue", "SCPClient_CompanyValue", 1);
21:36:42  <Zuu_> Maybe you have that import in main.nut too?
21:37:12  <Zuu_> But you ideally need to provide your package in order to get help if you need file A or not.
21:37:54  <Samu> sec, let me copy paste
21:42:21  <Samu> https://paste.openttdcoop.org/pciylxx8w well yeah, the relevant part of what  I have
21:43:38  <Zuu_> Looks good.
21:44:07  <Samu> so i dont require a scp.nut in my ai?
21:44:14  <Samu> i'm confused
21:44:26  <Zuu_> scp.nut is just a file name.
21:44:33  <Samu> what if it's NoCarGoal
21:44:37  <Samu> what would happen?
21:44:48  <Zuu_> The only magical file names are main.nut and info.nut.
21:45:27  <Zuu_> Having a separate scp.nut is just a way to put all SCP stuff elsewhere separate from main.nut which is mostly needed if you don't have it in a library as you do now.
21:46:20  <Zuu_> And by needed I mean good practice. You don't tecnically need more than main.nut and info.nut. Separiting your AI into more code files than main.nut is for your organization. If you want to code all in one file that is possible.
21:46:54  <Zuu_> Separate files is good for things you code once and then don't want to have in the way when you focus on the main logic.
21:47:29  <Zuu_> Or for building building blocks and focus on one thing at the time.
21:48:15  <Zuu_> But in your case, if scp.nut contains the code to import SCPLib and SCPClient_CompanyValue, and you do this in main.nut, then you can delete scp.nut and do not need to require that file.
21:48:23  *** sla_ro|master has quit IRC
21:57:41  <Samu> I see
22:26:09  <Samu> i still have a problem
22:26:38  <Samu> if i send two requests, i can sometimes receive them in the wrong order which can cause problems
22:28:08  <Samu> https://paste.openttdcoop.org/pgd6yvzjo?/pgd6yvzjo imagine line 49 disabled, and lines 52 and 53 enabled
22:28:32  <Samu> if i receive the answer to 53 first, i get a crash
22:28:50  <Samu> what can I do about it?
22:29:12  <Samu> in sum, 53 is dependant on the answer of 52
22:29:37  <Samu> otherwise, the code will go run wrong stuff
22:29:40  <Samu> :(
22:29:47  <Zuu_> Store the answer of both in an intermediate location and process them only once you received both?
22:30:52  <Zuu_> Or make a command that returns both in the same packet.
22:31:51  *** frosch123 has quit IRC
22:35:03  <Zuu_> Looking at your ReceivedSettingCommand it seems that it currently only offer access to goal_mode and goal_value and then having one generic Setting command to access these two independent values is one level of abstraction too much?
22:35:57  <Zuu_> Just register a command eg. "GetGoalData" or similar that include both goal mode and goal value in the same packet, and scrap the request for speciifc settings.
22:36:20  <Samu> hmm that seems like a good idea
22:36:44  <Zuu_> AI -> GS: "GetGoalData".  GS -> AI respond with [goal_mode, goal_value]
22:37:48  <Samu> seems that I'm reducing the number of commands to just 2 then
22:38:08  <Samu> or 1, not sure
22:39:33  <Zuu_> 1 is enough but then you decide if AI or GS initates. 2 is neccessary if you want both to be able to initate.
22:40:41  <Zuu_> But the only thing that AIs cannot determine them self via AI API is goal mode and the target value. So that sounds like AIs want to ask GS when they start and then does not need to get updates pushed down from the GS every year or so.
22:41:49  <Zuu_> You could still offer in your client library some AI-side utility to get a leader bord or similar, but it would not require any roundtrip to the GS.
22:42:21  *** andythenorth has quit IRC
23:15:59  *** Wacko1976 has quit IRC
23:19:04  *** chomwitt has quit IRC
23:21:07  <Zuu_> Talking of communication, some time ago I and andythenorth collaborated on a patch that allowed GS:es to talk with NewGRF allowing GS to trigger actions in NewGRFs such as production boost or tech tree etc. :-)
23:24:02  *** ToBeFree has joined #openttd
23:24:31  <planetmaker> did that patch make it into trunk?
23:24:35  *** ToBeFree has quit IRC
23:24:46  <Zuu_> Unfortunately not.
23:25:04  <planetmaker> a pity
23:25:11  <Zuu_> It was fun, but quite complex to work on.
23:26:37  <Zuu_> There probably was unresolved issues, but I know I had a working demo with a fork of BusyBee that increased production when you completed goals.
23:27:02  <planetmaker> that sounds like a pretty fun application
23:27:09  <planetmaker> "build your own economy"
23:28:05  <nielsm> making it as a bunch of individual features would be good imo
23:28:14  <nielsm> GS control of industry production
23:28:35  <nielsm> and vehicle availability
23:28:55  <Zuu_> https://devs.openttd.org/~zuu/newgrf_gs_prod_change/ <-- there is my work files
23:29:44  <Zuu_> The source code patcch is quite short actually.
23:30:30  <Zuu_> But then it includes things like // TODO :-)
23:31:54  <nielsm> I actually working on my own patch for that earlier, got it sort-of working but then discovered there's all sorts of complications with smooth vs. traditional production change
23:32:12  <nielsm> and then there's newindustries with special rules per industry type
23:33:13  <Zuu_> There is the discussion on regarding should the GS just send messages to specially crafted NewGRF or should it more forcefully run over the NewGRF.
23:34:11  <nielsm> for vehicle types, it might be useful for a GS to be able to block vehicle ID's from being built by each company individually
23:34:30  <Zuu_> The hard part is that one need to understand how NewGRFs interact with OpenTTD which is beyond my knowledge as being someone mainly focused on AIs and GS and a bit of UI patches.
23:34:55  *** gelignite has quit IRC
23:35:58  <Zuu_> Yes some way of blocking engineId per company would be useful.
23:36:48  <Zuu_> One complication in this interaction is also how async GS are compared to NewGRFs that respond instantly and async and sync doesn't alwys play well togeather.
23:36:57  <nielsm> maybe also offsetting introduction dates
23:36:58  <planetmaker> hm. And honestly, whichever way one picks: there will be people who will complain. "my newgrf being nerfed! How dare you"
23:37:40  <nielsm> the answer is that it's the player's choice
23:38:03  <nielsm> you can ask the player to not change your intended gameplay but you can't force them
23:38:05  <planetmaker> :) *I* know. But not every realism fan
23:39:25  <_dp_> it's not just async, GS only works on server and NewGRFs work on both sides
23:39:29  <planetmaker> Ignoring that, we have the problem that we might end up with two entities (GS, NewGRF) trying to control the same thing (like introduction dates, production,...)
23:39:33  <_dp_> > Yes some way of blocking engineId per company would be useful.
23:39:38  <_dp_> patch I never did xD
23:40:10  <planetmaker> and _dp_ has a point: GS is server-side. NewGRF works locally.
23:43:38  <planetmaker> so there's two approaches... cooperative, like a CB flags inside cooperating NewGRFs for things like industries which allow a GS to provide input.
23:43:49  <planetmaker> But for company-restrictions... there is no such way
23:44:00  <nielsm> imo a GS should just override with the newgrf having no way of knowing
23:44:55  <nielsm> a GS would signal it wants to override vehicle data, and then all vehicles are default-unavailable until the GS explicitly enables them
23:45:40  <planetmaker> yes-ish. But "simply override" probably does not work easily. Especially for trains
23:46:12  <planetmaker> thinking of the "can attach wagon" callback, articulated vehicle composition and similar
23:46:30  <nielsm> I'm thinking only introduction/expiry dates and costs can be overridden, and costs only by a factor
23:46:58  <nielsm> i.e. you specify you want 2x cost over newgrf-supplied value
23:47:08  <planetmaker> even then. Articulated vehicles are a true bitch here. NewGRF might form it different for different dates etc
23:47:31  *** Progman has joined #openttd
23:50:21  <_dp_> We can have some gs api that only works without newgrfs
23:51:43  <_dp_> at least that's the best solution I can think of for features that are constantly blocked by newgrfs
23:53:32  <planetmaker> hm. I would aim for a slightly broader usability. No NewGRF is very limiting
23:53:38  <nielsm> another GS change I want to have made is allow the GS to detect whether it's running under scenario editor or real game, and allow some more direct communication between user and GS in the scenario editor
23:53:49  <_dp_> can be more specific too, e.g. it works if no articulated vehicles defined
23:53:53  <planetmaker> But we could introduce a NewGRF flag which allows cooperation with GS.
23:54:12  <planetmaker> hm... GS in *scenario mode*?
23:54:37  <planetmaker> anyhow, you can detect that already, can't you? You can query the game mode
23:54:57  <planetmaker> at least NewGRF can; but GS can, too, I'd recon
23:57:01  <_dp_> actually that may be a complete solution, newgrf flag for compatible newgrfs and features check for non-compatible
23:57:05  <planetmaker> via GSGameSettings::GetValue maybe?
23:57:45  <planetmaker> _dp_, it solves it. Somewhat. The backdraw is: it requires explicit NewGRF cooperation
23:58:28  <planetmaker> There is another solution: NewGRF version. Increase that - and any NewGRF written in the new version, automatically consents. And new NewGRF features are only available for that new version...

Powered by YARRSTE version: svn-trunk