IRC logs for #openttd on OFTC at 2018-12-23
            
00:02:04 *** Progman has joined #openttd
00:19:54 <Zuu> First of all, ensure you didn't disable scp in NoCarGoal parameters.
00:30:24 *** Wacko1976 has quit IRC
00:37:32 <Samu> https://imgur.com/jKw6wx1
00:37:48 <Samu> the other AI is CluelessPlus
00:37:58 *** nielsm has quit IRC
00:39:57 *** Flygon has joined #openttd
00:41:28 <Zuu> Do you use SCPClient_NoCarGoal or did you try to write your own NoCarGoal client?
00:42:00 <Zuu> The details of scp logging is beyond my knowledge.
00:42:24 <Zuu> It is low level stuff about packaging data into signs.
00:43:22 <Samu> i imported SCPClient_NoCarGoal
00:44:05 <Samu> import("Library.SCPLib", "SCPLib", 45); import("Library.SCPClient_NoCarGoal", "SCPClient_NoCarGoal", 1);
00:44:05 <Zuu> You can unpack the SCPClient_NoCarGoal tar and uncomment line 292 to get a log message when the AI receives its goals.
00:44:30 <Samu> ok
00:44:44 <Zuu> I did that and for me (tm) CluelessPlus get the goals.
00:45:14 <Samu> AILog.Info("Received cargos: " + s);
00:45:20 <Samu> ok restarting ai
00:46:06 <Zuu> Also, if you haven't open the settings of NoCarGoal and verify that scp is enabled.
00:46:34 <Zuu> And there is a similar setting in CluelessPlus, but if you are debugging your AI then that is not relevant.
00:46:38 <Samu> it's enabled
00:46:58 <Samu> https://imgur.com/J0zETLF
00:47:03 <Samu> received cargos is there
00:47:25 <Zuu> So then it works
00:49:17 *** Wolf01 has quit IRC
00:49:36 <Samu> hmm, nice ?
00:49:40 <Samu> im confused anyway
00:49:54 <Samu> so let me try now for my gs
00:49:56 <Zuu> Then you can use eg. GetGoalCaragoList() or IsGoalCargo() to give higher score to decisions that takes you towards transporting goal cargos.
00:50:15 <Zuu> But if you only do passengers, then it doesn't make much difference. :-)
00:50:33 <Samu> yeah, nocargoal is bad for ludi
00:50:47 <Samu> just wanted to check if i could get it to communicate
00:51:08 <Zuu> But you could use IsNoCarGoalGame() as well as checking if PASS is goal cargo, and bingo you can focus on transporting as much passenger as possible rather than company value.
00:51:27 <Samu> it's not like it does anything else
00:51:59 <Samu> but gonna try do ask those questions
00:53:15 <Zuu> I agree though it is a good step in debugging and now you can try to port the code from the library to your AI and then switch over to your GS command set, or you can support both command sets if you want.
00:55:04 <Zuu> I don't know how CluelessPlus would play differently if it was gonig for company value, but if I had an idea I could add support for your GS by adding support for your command set as well.
00:57:39 <Samu> terron wastes much money on exclusive transport rights
00:57:48 <Samu> same about statues
00:57:55 <Samu> that kind of money wasting
00:57:56 <Zuu> Statues is not waste of money
00:58:45 <Samu> it's a race towards being the first to reach target company value
00:59:06 <Samu> so, building statues may be a bad idea
00:59:15 <Samu> depends on the target value maybe
01:00:05 <Zuu> A statue gives you a bonus to the station ratings in the city.
01:00:29 <Zuu> For a one-time fee.
01:01:04 <Zuu> But for short term company value it may not be the best investment.
01: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.
01:10:43 <Samu> https://imgur.com/Tvsn6Ho
01:10:55 <Samu> heh
01:11:05 <Samu> seems to be working
01:11:22 *** frosch123 has quit IRC
01:11:23 <ekcja> how to get the money the most efficient way possible?
01:11:32 <Zuu> Great
01:11:48 <Zuu> ekcja: cheat
01:12:04 <ekcja> without cheating*
01:12:25 <Zuu> It depends on which NewGRFs that are in use, map settings etc.
01:12:53 <Zuu> But in general tranport goods at optimal distance fast.
01:13:10 <ekcja> but let's say it's a bland, quite flat map with no seas, but only few rivers and lakes
01:13:18 <ekcja> with quite a lot of small cities and factories
01:14:05 <ekcja> Also, how does it count, with the distance?
01: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.
01:14:27 <ekcja> Can like road mazes "increase" the distance also increasing the paycheck?
01: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)
01:15:05 <Samu> aha, got a passengers goal, let's see if it detects it as goal
01:16:43 <Samu> PASS is a Goal cargo!
01:16:49 <Samu> ke
01:17:49 <Samu> i better create a library for CompanyValue akin to what NoCarGoal is doing, ya?
01:18:06 <Samu> sounds "easy" (but it's not)
01:18:28 <Zuu> It is better with a library if you hope that AI authors should add support for it.
01:18:55 <Zuu> Eg. make it as simple as possible for them.
01: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.
01: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.
01:21:27 <Zuu> IIRC the internal name of Town is _SuperLib_Town.
01:25:10 <Samu> oh, it's an AI library, i was searching in GS
01:26:57 <Samu> libraries also need a unique shortname?
01:27:18 <Zuu> Probably.
01:28:39 <Samu> "scpV"
01:28:52 <Samu> this will run out of names if everyone stats making clients
01:28:56 <Samu> quickly
01: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.
01: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
01:35:10 <Samu> version can't be a string? ... t.t
01:36:53 *** gelignite has quit IRC
01: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. :-)
01:42:24 <Zuu> Version should be an integer.
01: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.
01:54:42 <Zuu> And there is some code like IsSameScript that use short name/uniqueid. But the savegame format stores the longer names.
01: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
02:00:31 *** Progman has quit IRC
02:33:55 *** ekcja has quit IRC
02:55:03 *** Zuu has quit IRC
04:07:04 *** lugo has quit IRC
04:24:29 *** glx has quit IRC
04:26:21 *** Samu has quit IRC
06:32:28 *** Compu has joined #openttd
07:12:25 *** HerzogDeXtEr has joined #openttd
07:32:49 *** HerzogDeXtEr has quit IRC
07:44:46 *** Wacko1976 has joined #openttd
08:15:34 *** lugo has joined #openttd
08:17:19 *** Wacko1976 has quit IRC
08:24:00 *** andythenorth has joined #openttd
08:27:23 *** lugo has quit IRC
08:38:12 *** sla_ro|master has joined #openttd
09:07:40 *** tokai|noir has joined #openttd
09:07:40 *** ChanServ sets mode: +v tokai|noir
09:12:11 *** chomwitt has joined #openttd
09:14:39 *** tokai has quit IRC
09:17:09 *** rocky1138 has quit IRC
09:17:32 *** rocky1138 has joined #openttd
09:21:02 *** Wolf01 has joined #openttd
09:22:57 <Wolf01> Moin
09:27:16 *** Progman has joined #openttd
09:53:40 <andythenorth> moin
10:32:36 *** nielsm has joined #openttd
10:46:17 <nielsm> morning
10:50:57 *** erratic has joined #openttd
10:56:33 <TrueBrain> goooooood morning
10:57:41 <TrueBrain> lets see if I can get OpenTTD compiled with vcpkg on Azure :D
10:59:39 <TrueBrain> hmm .. I tell it to do x64, and it does x86 .. that is annoying :P
10:59:54 <TrueBrain> owh, subprojects are always 32bit
10:59:57 <TrueBrain> well, that is not nice
11:05:10 <TrueBrain> right, glx also already concluded that .. 64bit works, 32bit fails in linking .. weirrrrdddd :(
11:27:23 *** andythenorth has quit IRC
11:42:42 *** lugo has joined #openttd
11:47:57 *** Wacko1976 has joined #openttd
12:01:24 *** Zuu has joined #openttd
13:02:55 *** Laedek has joined #openttd
13:43:16 *** frosch123 has joined #openttd
13:54:18 <Eddi|zuHause> anyone wanna help me clean the house?
14:05:07 <nielsm> you can't just type 'make clean' ?
14:19:23 <Eddi|zuHause> seems nobody implemented that
14:19:55 <Eddi|zuHause> can alexa/siri/whatever do it?
14:25:01 <Heiki> just create a NewGRF with house-cleaning vehicles and an AI that uses them
14:43:24 *** Wacko1976 has quit IRC
15:00:45 *** andythenorth has joined #openttd
15:02:49 <andythenorth> o/
15:03:17 <nielsm> https://github.com/OpenTTD/nml/blob/master/setup.py <- I think this needs some updating
15:03:27 *** Wacko1976 has joined #openttd
15:03:30 <nielsm> the description text is also extremely vague
15:03:47 <nielsm> (it needs to mention the relationship to ttdpatch/openttd)
15:04:58 <andythenorth> readme needs work too https://github.com/OpenTTD/nml/blob/master/README.md
15:05:03 <andythenorth> mentions the wrong repo
15:05:48 <andythenorth> and the buildout packaging never worked
15:06:12 * andythenorth can fix those
15:06:21 <nielsm> made a PR for fixing the url :P
15:07:01 <andythenorth> merged
15:07:28 <nielsm> also should the development status be updated to beta or maybe production?
15:07:34 <nielsm> rather than pre-alpha
15:11:18 <andythenorth> what rev are we at? 0.4.5
15:11:22 <andythenorth> might be beta
15:11:36 <andythenorth> arguably it's just 1.0 imho
15:11:40 <andythenorth> but eh
15:13:04 <nielsm> 1.0 should indicate feature complete
15:13:16 <nielsm> which it isn't since not all newgrf features are supported
15:13:52 <nielsm> but that can't mean it's not "production ready"
15:15:49 <andythenorth> +1
15:17:28 <planetmaker> nielsm, nml is only related to OpenTTD. TTDP cannot digest its output
15:17:37 <nielsm> ok
15:18:34 <planetmaker> I'd call its status beta
15:18:50 <planetmaker> next release... I'm pondering calling it 0.5.0
15:18:59 <planetmaker> some things changed since. And its URL :P
15:19:08 <andythenorth> I did a PR for the readme, but there's more to change
15:19:26 <andythenorth> dunno how to format the args section properly, markdown is not rendering it as needded
15:19:37 <andythenorth> linebreaks are being dropped
15:19:44 <nielsm> I'm thinking about how exactly to do the production cb syntax
15:19:56 <andythenorth> also do other people install it with 'make install'?
15:19:59 <andythenorth> or is that just me
15:20:05 <nielsm> it needs much more knowledge of the parser structure and control flow in the program than I have atm
15:20:20 <nielsm> so trying to read top to bottom now, from main.py and in
15:20:24 <andythenorth> :)
15:20:32 * planetmaker never installs nml
15:21:10 <planetmaker> I've a symlink from ~/bin/nmlc to my nmlc in my development dir. And that's it
15:22:22 <planetmaker> andythenorth, the commit messages for NML should follow OpenTTD style... so like Doc: bla bla. Or Change: blub bluh
15:22:36 <andythenorth> oh yes, sorry
15:22:40 <andythenorth> I did it through the web UI
15:22:49 <andythenorth> I'm not even sure where the commit message went in
15:23:33 <andythenorth> let's see if I can update it through the web UI
15:23:36 <planetmaker> I'm myself not entirely thorough with that. Easier to be thorough when others do the work :P
15:24:09 <andythenorth> can't see how to change it in the web UI
15:24:12 <planetmaker> I should fiture out how to install the commit hook
15:24:21 <planetmaker> or however it is called with github
15:25:11 <andythenorth> oof I'm going to close that PR
15:25:21 <andythenorth> can't see how to edit the commits in the browser
15:27:51 <peter1138> I've always got to the editor by accidentally pressing a random key.
15:28:14 <peter1138> Which is nicer than closing PRs ;)
15:30:58 *** glx has joined #openttd
15:30:58 *** ChanServ sets mode: +v glx
15:36:31 <LordAro> there's no webeditor support for rebasing
15:37:27 <andythenorth> how the hell do I rebase -i in a sane environment?
15:37:56 <andythenorth> it's opening nano, and just about every key I press does something that sounds horrible and destructive
15:39:36 <LordAro> that doesn't sound like nano
15:39:41 <LordAro> sounds like vi
15:39:59 <andythenorth> GNU nano 2.0.6
15:40:20 <LordAro> well, typing in nano.. just types
15:40:22 <andythenorth> keeps telling me I've enabled backups, or multiple file editing or other stuff
15:40:26 *** Flygon has quit IRC
15:40:32 <Wolf01> At least is easier to quit from nano than from vi
15:40:42 <andythenorth> :
15:40:43 <andythenorth> :q
15:40:54 <andythenorth> oh FFS my q key has stopped working
15:40:58 <andythenorth> Apple keyboards ftw
15:41:06 <Wolf01> Lol
15:41:23 <andythenorth> oh
15:41:27 <andythenorth> auto-repeat is broken for all keys
15:41:29 <andythenorth> awesome
15:41:56 <Wolf01> Mmmh, games I really want are still too much near the bottom of the wishlist :(
15:42:29 <andythenorth> time to restart this computer :(
15:42:33 <andythenorth> it's only been up 18 days
15:42:37 <andythenorth> this is frigging ridiculous
15:42:58 *** andythenorth has quit IRC
15:44:54 <Eddi|zuHause> how is "my keys are doing random stuff" a thing that could be fixed by rebooting?
15:47:39 *** andythenorth has joined #openttd
15:48:14 *** Wacko1976 has quit IRC
15:49:00 <andythenorth> better https://github.com/OpenTTD/nml/pull/12
15:51:48 <nielsm> github still makes some weird separator lines that shouldn't be there
15:53:29 <Wolf01> I think I already asked that: is there a good tank game with no internet?
15:54:25 *** Samu has joined #openttd
15:54:35 <Samu> hi
15:56:35 <nielsm> hmm, to make accept_cargo() and produce_cargo() into syntax elements rather than function calls...
15:56:37 <nielsm> :(
15:56:48 <nielsm> it's probably a bad idea
15:57:03 <Samu> there is a limitation with SCPLib about int values
15:57:13 <Samu> i can't use big numbers :(
15:58:23 <Samu> a Company Value of £500000000 is a too large int to pass around
16:00:20 <Samu> im gonna need a strategy to pass big values
16:00:41 <Wolf01> Pass it as $500M
16:00:46 <andythenorth> ha ha
16:00:52 * andythenorth is getting better at cleaning up git
16:00:59 <andythenorth> just don't ever depend on my repo :P
16:01:52 <Samu> https://imgur.com/3BMGAej
16:07:06 <andythenorth> spurious horizontal separators are removed from nml README https://github.com/OpenTTD/nml/pull/12
16:07:09 <Samu> but in ranking mode, it passes the value of the company with the highest value
16:07:21 <Samu> which could be even larger
16:07:52 <Samu> its doomed
16:09:53 <Samu> or i could fool around
16: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
16:11:00 <Samu> hopefully AIs are allowed to get info of other companies
16:12:15 <nielsm> okay, found the stuff I was looking for, might be able to rework produce() statements now
16:14:27 <Samu> @calc 0xFFFFFFE
16:14:27 <DorpsGek> Samu: 268435454
16:14:52 <Zuu> Samu: try pass it as string?
16:15:17 <Zuu> But there is probably also a max length to strings after I tried to flood scp in a test-AI :-p
16:15:58 <Zuu> But isn't company value available through APIs, or do you have a custom way to calculate it?
16:16:30 <Samu> ((500000000).tohex).tostring
16:16:36 <Samu> what could go wrong
16:17:11 <Samu> or just 500000000.tostring?
16:17:44 <Zuu> SuperLib has a base 84-ish int to string converter.
16:18:18 <Zuu> using alphabet, numbers and some printable special chars.
16:18:46 <Zuu> If you "zero-pad" to 2 digits it produce smileys on lower numbers.
16:20:33 *** Progman has quit IRC
16:21:31 <Samu> what if the value is something like 543828465
16:22:53 <Samu> toint does not exist, well hmm
16: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.
16:23:01 <Samu> what is it named then
16:23:35 <Zuu> local i = (int)s; ?
16:23:49 <Samu> oh, jsut that? heh, ok
16:24:12 <Zuu> I don't know. Just a random suggestion based on C++ :-p
16:24:33 <Samu> nop, doesn't like that
16:24:33 <Zuu> In JavaScript and PHP it is parseInt(str, 10)
16:24:51 <Samu> brb googling squirrel doc stuff
16: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
16:26:04 <Samu> string.tointeger([base])
16:26:10 <Samu> base is optional
16:26:13 <Samu> ok lets try
16: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.
16:27:53 *** Progman has joined #openttd
16:34:32 <Samu> response_value = (self._main_ptr.best_value).tostring();
16:34:37 <Samu> on the GS side
16:35:12 <Samu> local value = message.GetStringData(1).tointeger();
16:35:15 <Samu> on the AI side
16: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?
16:35:21 <Samu> it works!
16:37:48 <Samu> maybe SCPLib should do this convertion itself
16:40:17 *** Wacko1976 has joined #openttd
16:43:16 <Samu> let me try a bigger string
16:44:07 <Zuu> Eddi|zuHause: Not sure that squirrel2 has that. But yes, for other places than AI/GS I'd use base64.
16: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"
16:47:22 <Samu> let's see what happens
16:49:40 <Samu> 2147483647
16:49:42 <Samu> bah
16:51:18 <nielsm> andythenorth, now I'm considering a much more insane produce() syntax... https://0x0.st/sdpy.txt
16:52:15 <nielsm> (maybe with = instead of * to separate cargo from register)
16: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
16:52:53 <Zuu> Is there a reason you want to send it via scp?
16:53:37 <Samu> for ranking mode, no, but for goal mode, i'm gonna have to
16:54:42 <Zuu> Why?
16:54:57 <Samu> so that AI know which is the target
16:55:12 <Zuu> Ah, so not the company value, but the target value?
16:55:59 <Samu> best_value becomes the target value in goal mode
16:56:17 <Samu> best_value is the best company value of all companies in ranking mode
16: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.
17:00:10 <Samu> i have an idea
17:00:13 <Samu> brb
17:02:23 <Samu> if (self._goal_mode == true) { local value = (message.GetStringData(1).tointeger() / 1000);
17:02:30 <Samu> else
17:02:41 <Samu> manually retrieve the best value myself
17:03:09 <Samu> which may not be in sync with what the GS has at the moment, but meh... should be okay
17:03:42 <Samu> self._goal_value = value;
17: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.
17:05:36 <Zuu> Or write a patch for GS<->AI communication in OpenTTD so it doesn't have to communicate over signs. :-)
17:18:14 <Eddi|zuHause> how about AI<->GS communication via ingame chat?
17:18:54 <Eddi|zuHause> (and then port supybot to GS :p)
17:21:40 *** Wormnest has joined #openttd
17:23:09 *** gnu_jj has joined #openttd
17:32:04 *** gnu_jj has quit IRC
17:48:51 <andythenorth> hmm
17:49:36 <nielsm> (I scrapped that syntax idea again)
17:49:42 <andythenorth> :P
17:50:00 <andythenorth> impedance mismatch? o_O
17:50:25 <nielsm> feels silly to add a new syntax element when it's not strictly needed
17:53:01 <andythenorth> alternative proposal? o_O
18:02:28 *** gnu_jj has joined #openttd
18:11:19 *** gnu_jj has quit IRC
18:13:37 *** Zuu_ has joined #openttd
18:15:25 <planetmaker> <nielsm> andythenorth, now I'm considering a much more insane produce() syntax... https://0x0.st/sdpy.txt <-- that is... complicated
18:16:12 *** gnu_jj has joined #openttd
18:16:30 <nielsm> planetmaker yeah, not doing that
18:17:01 <planetmaker> We really don't need to tie NML syntax closely to NFO syntax
18:17:15 <planetmaker> we can where NFO is easy. But... here it isn't
18: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
18:18:34 <planetmaker> And setting a NewGRF (NML) flag which produce syntax is being used
18:19:18 <andythenorth> sounds plausible
18:20:23 *** Zuu has quit IRC
18: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 :)
18:22:23 <planetmaker> well... not sure I actually understand it (better), but my understanding is such:
18: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)
18: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)
18: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
18:25:16 <andythenorth> it runs on cargo delivery and periodically
18:25:18 <planetmaker> (which is stored internally in some register)
18:25:53 <andythenorth> it's agnostic about industry type: prod. cb is same for secondary / primary / black hole
18:26:20 <planetmaker> andythenorth, yes. But it behaves differently wrt input cargoes. That's all I said (so far) :P
18:26:33 <planetmaker> anyhow, the interesting one is the secondary industry which consumes cargo
18:28:58 <planetmaker> that CB for input and output cargo is called with the input cargoes and their amount (in registers)
18: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
18:30:27 <nielsm> (in the resolver code in newgrf_industries.cpp)
18:30:38 <andythenorth> it doesn't need to
18:30:42 <nielsm> or well, one of the many things I don't understand about it
18:31:01 <andythenorth> they're either zero-ed or overflow to negative, can't remember which :)
18:31:15 <nielsm> they clamp to range 0-0xffff
18:31:17 <planetmaker> iirc zeroed. But yes
18:31:22 <andythenorth> like a few other nfo things, it's remarkably simple, but seems complex
18:31:31 <andythenorth> most of the cbs are really brutally simple
18:31:51 <nielsm> the thing I don't understand is how the cb can succeed when the required inputs aren't availeble
18:32:45 <andythenorth> it just invents output
18:33:02 <andythenorth> there's no connection between the input and output
18:33:23 <andythenorth> it's really crude and effective, author just specifies how much to consume, and how much to produce
18:33:29 <andythenorth> :)
18:33:31 <planetmaker> the amount subtracted is given to the CB
18:33:46 <planetmaker> it just returns output. And returns whether it wants to produce more
18:34:21 <planetmaker> iirc
18:35:27 <nielsm> before each iteration it also resolves something about some sprite group, and I have no idea what that means either
18:35:38 <nielsm> const SpriteGroup *tgroup = object.Resolve();
18:35:38 <nielsm> if (tgroup == NULL || tgroup->type != SGT_INDUSTRY_PRODUCTION) break;
18:39:49 <planetmaker> well. everything in NewGRFs is sprites... so also the CB definition
18:40:01 <planetmaker> But I don't quite know the code inside OpenTTD
18:41:51 <planetmaker> https://newgrf-specs.tt-wiki.net/wiki/Action2/Industries
18:42:04 <planetmaker> but... you know that one, I guess :D
18:49:21 <nielsm> I've implemented parsers for the syntax, and more or less cargo-culted the prod cb version 2 support in
18:49:38 <nielsm> but still don't understand the overall control flow of how any callbacks work in newgrf
18: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.
18:53:30 <planetmaker> I'm not entirely clear how it initializes the parameters it is called with, though.
18:53:37 <planetmaker> the dynamic parameters
18:54:54 *** Wacko1976 has quit IRC
19:04:30 <planetmaker> question for my understading of production CB, version 2:
19: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
19:05:13 <planetmaker> right?
19:05:19 *** gnu_jj has quit IRC
19:05:27 <nielsm> yes
19:05:49 *** gelignite has joined #openttd
19:05:58 <nielsm> it consumes all the listed inputs and produces all the listed outputs as a single operation
19:07:07 <planetmaker> https://paste.openttdcoop.org/pvekrsvxs
19:07:23 <planetmaker> ^^ my syntax suggestion. It implicitly also covers blackhole and primary industries
19:09:51 *** Wacko1976 has joined #openttd
19: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
19:11:45 <planetmaker> hm, yes
19:11:57 <planetmaker> name usually goes as 1st param. The again should go last
19:13:27 <nielsm> produce(name, againflag) { generate { CRG1: expr; CRGx: expr; } consume { CRG1: expr; CRGx: expr; } }
19:13:43 <nielsm> similar to item definitions
19:14:55 <frosch123> https://paste.openttdcoop.org/phqik4jng
19:15:09 <frosch123> i don't think you need an option to select between old and new syntax
19:15:22 <frosch123> you can tell by the amount of parameters, or use a new keyword
19:15:49 <nielsm> there's no precedent for "dictionary" syntax anywhere in nml yet, as far as I can tell
19: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
19:16:22 <nielsm> so [ IDENTIFIER: expression; ... ] needs a new syntax element
19:16:25 <planetmaker> the switch statement
19:16:26 <frosch123> there are multiple
19:16:37 <frosch123> they all agree on ":" as separator between key and value
19:16:52 <frosch123> but they disagree on "", ",", ";" as item separator
19:17:23 <nielsm> those don't use [] to surround the expression, and don't occur in a location that usually expects an expression
19:17:39 <frosch123> yes, only switch does [] for a list of things
19:17:58 <frosch123> inside the ( )
19:18:04 <nielsm> right now the produce() statement is defined as PRODUCE LPAREN expression_list RPAREN
19:20:04 <planetmaker> I very much would like python bindings for NewGRFs :P
19:26:47 <andythenorth> frosch123: your format doesn't need cargotype()?
19:28:17 <planetmaker> hm, interesting
19:28:32 <planetmaker> prod_cargo_types and accept_cargo_types doesn't eat labels out-of-box
19:28:37 <planetmaker> why? :|
19:29:45 <planetmaker> no person would ever use it without
19:30:08 <andythenorth> is it just nobody made it work that way?
19:30:21 <planetmaker> yeah... and probably more complex to write the parser
19:31:05 <planetmaker> as it would require a special function for these properties
19:31:25 <andythenorth> the frosch123 syntax is what I expected this to be
19:31:27 <andythenorth> two arrays
19:31:35 *** gnu_jj has joined #openttd
19:31:46 <planetmaker> well, yes...
19:36:04 *** Progman has quit IRC
19:38:00 <frosch123> andythenorth: cargotype() sounds like a technical detail... i do not know nml code to know whether that would be needed somewhere
19:38:34 <frosch123> i just looked at all the nml syntax and extrapolated how i think the produce syntax would appear most natural
19:39:22 <planetmaker> it would likely be needed there. For consistency's sake
19:40:24 *** gnu_jj has quit IRC
19:40:25 <nielsm> hmm there aren't quite any productions in the parser that can produce an empty "assignment_list"-like thing
19:40:50 <nielsm> assignment_list is a sequence of "ID COLON expression SEMICOLON" productions
19:41:46 <frosch123> planetmaker: the cargotype is a constant value, so you cannot use expressions there. so there is no point in "cargotype()"
19:42:23 <frosch123> well, ok, you can with action6, but i don't think people will use expressiosn for cargo types
19:42:53 <planetmaker> frosch123, I totally agree. Yet... that's what currently is used there in other cases
19:43:03 <frosch123> not really
19:43:21 <frosch123> cargotype() is used in places where nml expects and integer expression
19: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.
19:43:41 <planetmaker> in the definition of the property
19:43:44 <andythenorth> oh is it just labels directly here?
19:43:48 * andythenorth looks
19:44:05 <planetmaker> https://newgrf-specs.tt-wiki.net/wiki/NML:Industries
19:44:33 <planetmaker> I very much would prefer to use labels directly wherever I need a cargo
19:45:33 *** gnu_jj has joined #openttd
19:52:53 <nielsm> well, I wrote something that parses this:
19:52:53 <nielsm> produce(test_produce, [COAL: 5; IORE: 7;], [STEL: 5;], 1)
19:53:13 <nielsm> it errors after parsing, but the syntax is accepted :)
19:58:25 <planetmaker> yay
20:02:05 <nielsm> just two new production functions: https://0x0.st/sdOB.png
20:05:43 <Samu> Zuu_: i dont understand why this happens :(
20:10:51 <Samu> https://paste.openttdcoop.org/pgd6yvzjo
20:12:04 <Samu> i'm receiving a null
20:13:12 <Samu> https://imgur.com/a/vfH9r8S two images
20:13:35 <Samu> the GS seems to be sending the right number
20:13:48 <Samu> the client receives it as null, why
20:16:01 *** Wormnest has quit IRC
20:16:22 <Samu> what's the difference between self and this?
20:18:08 <Samu> if (self._goal_mode == true) {
20:18:42 <Samu> apparently self._goal_mode is false, i was expecting it to be true
20:18:47 <Samu> why
20:19:03 <Samu> or at least it's not true
20:24:39 <Samu> self._goal_mode = 1
20:24:46 <Samu> is there a difference between 1 and true?
20:25:21 <Samu> oh, wow, that was it
20:25:31 <Samu> lol
20:25:34 <Samu> so 1 is not true
20:25:42 <Samu> sometimes it is
20:25:52 <Samu> this time it wasn't
20:25:56 <Samu> pff
20:25:59 <Zuu_> In squirrel 1 != true
20: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.
20:28:15 <Zuu_> However looking at the source code of scp it looks like it will return boolean true/false or null.
20:28:32 <Zuu_> return this.Data[index] == 1; <--- scp source code in Message.GetBoolData(index)
20:28:44 *** Wormnest has joined #openttd
20:29:59 <Zuu_> Full source of GetBoolData: https://paste.openttdcoop.org/prssnyno1
20: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. :-)
20:35:30 <Samu> GetBoolData(1) then?
20:35:37 <Samu> or (2)
20:35:43 <Samu> gonna try
20:36:57 <Samu> self._goal_mode = message.GetBoolData(1);
20: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.
20:39:38 <Samu> it works! thx
20:40:16 *** Wormnest has quit IRC
20:40:38 <Samu> i'm afraid of what could happen if _goal_mode is null
20:40:48 <Samu> better make sure it doesn't pass null
20:46:03 <Samu> goal_mode is null the moment the player clicks the Continue button after the goal is reached
20:46:50 <Samu> it is null for that loop, until it becomes false in that same loop
20:46:55 <Samu> then continues to be false forever
20:47:51 <Samu> must think
20:50:05 <Samu> so it's only null for 1 tick
20:51:09 <Samu> the game is paused by the GS
20:51:16 <Samu> AI's can't run code
20:51:23 <Samu> but the GS can
20:51:55 <Samu> GS must not answer with a null :(
20:52:05 <Samu> yeah i still have to be careful
21: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?
21:01:33 <Zuu_> I don't remember there being any broadcast function.
21:01:53 <Samu> t.t
21:02:24 <Zuu_> You could of course try to specify null companyId or COMPANY_INVALID and see what it does.
21:02:54 <Zuu_> scp is from around 2012 so it is many years ago..
21:03:56 <Samu> TellCompany
21:03:59 <Samu> brb
21:12:04 <Samu> have to send to all of them
21: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.
21:17:40 <Zuu_> Technically deity can own signs, but I don't know if AIs can read them.
21:17:55 <Zuu_> Deity is by the way the "player" of GS.
21:18:17 <Zuu_> s/"player"/"company"/
21: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.
21:29:45 <andythenorth> Horse 86%
21:29:51 <andythenorth> 200 done, 32 to do
21:40:05 <LordAro> 86%? is that a new record?
21:41:36 <andythenorth> yup
21:41:39 <andythenorth> high water mark
21:41:49 <andythenorth> somewhat aided by deleting about 20 vehicles
21:46:03 <frosch123> what defines the 32? are they some specific type, or are they scattered over all generations and types?
21:59:09 <andythenorth> somewhat they're the engines
21:59:12 <andythenorth> especially the steam engines
21:59:26 * andythenorth doesn't know how to draw steam engines yet :P
21:59:36 <andythenorth> but eh, they're tank wagons with a funnel, right?
21:59:47 <andythenorth> chimney / funnel /s
22:05:03 <frosch123> http://www.douglas-self.com/MUSEUM/LOCOLOCO/chimney/chimney.htm
22:05:11 <frosch123> you can also use pipes
22:08:29 <frosch123> preheaters are weird
22:29:39 <andythenorth> wow all the weird trains
22:31:24 <Wolf01> Why not just build the cab forward?
22:34:19 <Samu> Zuu_: what do I need the scp.nut file in my AI folder for?
22:34:29 <Samu> seems that I don't require it
22:35:03 <Zuu_> I don't know what scp.nut contains.
22:35:15 <Zuu_> Or more precisely your scp.nut file§
22:35:27 <Samu> i deleted it
22:35:30 <Samu> and it still runs
22:35:31 <Samu> weird
22:36:11 <Samu> import("Library.SCPLib", "SCPLib", 45); import("Library.SCPClient_CompanyValue", "SCPClient_CompanyValue", 1);
22:36:42 <Zuu_> Maybe you have that import in main.nut too?
22:37:12 <Zuu_> But you ideally need to provide your package in order to get help if you need file A or not.
22:37:54 <Samu> sec, let me copy paste
22:42:21 <Samu> https://paste.openttdcoop.org/pciylxx8w well yeah, the relevant part of what I have
22:43:38 <Zuu_> Looks good.
22:44:07 <Samu> so i dont require a scp.nut in my ai?
22:44:14 <Samu> i'm confused
22:44:26 <Zuu_> scp.nut is just a file name.
22:44:33 <Samu> what if it's NoCarGoal
22:44:37 <Samu> what would happen?
22:44:48 <Zuu_> The only magical file names are main.nut and info.nut.
22: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.
22: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.
22: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.
22:47:29 <Zuu_> Or for building building blocks and focus on one thing at the time.
22:48:14 <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.
22:48:23 *** sla_ro|master has quit IRC
22:57:41 <Samu> I see
23:26:09 <Samu> i still have a problem
23:26:38 <Samu> if i send two requests, i can sometimes receive them in the wrong order which can cause problems
23:28:07 <Samu> https://paste.openttdcoop.org/pgd6yvzjo?/pgd6yvzjo imagine line 49 disabled, and lines 52 and 53 enabled
23:28:32 <Samu> if i receive the answer to 53 first, i get a crash
23:28:50 <Samu> what can I do about it?
23:29:12 <Samu> in sum, 53 is dependant on the answer of 52
23:29:37 <Samu> otherwise, the code will go run wrong stuff
23:29:40 <Samu> :(
23:29:47 <Zuu_> Store the answer of both in an intermediate location and process them only once you received both?
23:30:52 <Zuu_> Or make a command that returns both in the same packet.
23:31:51 *** frosch123 has quit IRC
23: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?
23: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.
23:36:20 <Samu> hmm that seems like a good idea
23:36:44 <Zuu_> AI -> GS: "GetGoalData". GS -> AI respond with [goal_mode, goal_value]
23:37:48 <Samu> seems that I'm reducing the number of commands to just 2 then
23:38:08 <Samu> or 1, not sure
23: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.
23: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.
23: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.
23:42:21 *** andythenorth has quit IRC