ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
rohitpaulk has joined #crystal-lang
<FromGitter> <aisrael> Is there a Crystal slack group? I'm finding Gitter to be harder and harder to follow (no "rooms", threads)
<FromGitter> <bew> How would slack be better? 'cause we' d all be in #general and yould have the same problem (and you)
<FromGitter> <bew> And also slack doesn't scale well
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <aisrael> At least we could have rooms for special interest, e.g. #web #windows etc.
<FromGitter> <bew> And what happens when you have a topic that can fit in 2 rooms?
<FromGitter> <aisrael> By "scale", if you mean the message limit for free groups (10,000) yes, I understand that. If you meant the Slack client is slow resource hog, that, too. Otherwise, am on the Kubernetes slack with over 37,000 active members and it seems to be holding up.
<FromGitter> <girng> what is slack?
<FromGitter> <aisrael> @bew Yeah. Either choose one, or, if folks don't mind, cross post. It's not perfect, but neither is a single, linear discussion thread
<FromGitter> <bew> When I hear slack for open communities, this https://medium.freecodecamp.org/so-yeah-we-tried-slack-and-we-deeply-regretted-it-391bcc714c81 comes to my mind, I know it was in 2015, maybe things changed though
chamar is now known as Guest60087
Guest60087 has quit [Killed (cherryh.freenode.net (Nickname regained by services))]
Guest60087 has joined #crystal-lang
<FromGitter> <aisrael> Yeah. Like I said, the Kubernetes slack has over 30,000 users and holding up. Am not sure if they *paid* for all of them, but I don't see any 10,000 message limit messages. In any case, in another group am on with over 3,00 members, not paid, in practice no one's really bothered by not being able to search/scroll 10,000 messages back
<FromGitter> <aisrael> (I certainly don't scroll past several hundred messages back in Gitter, and I don't think there's a "search in crystal" feature)
<Vexatos> Just use IRC, that has it :P
<FromGitter> <aisrael> Is it vintage enough to be hipster already? ;)
<FromGitter> <girng> you have to pay to use slack? rofl
<FromGitter> <girng> not over my dead body i aint paying for some chat system.
<Vexatos> I don't see any advantage it'd have over the gitter/IRC combination we are using right now
<FromGitter> <j8r> Don't know if Slack is better than Gitter, but what's sure is Open Source is better than Closed Source
<FromGitter> <bew> @aisrael my biggest issue with the 10,000 msg limit of the free version, is that when you go to a room, you might not see the old messages (even the 10 last), because other channels filled up the 10000 msg limit
<FromGitter> <bew> I have a slack with a friend (we're only 2!), and we have this issue for some rooms we don't use often
<FromGitter> <aisrael> That does happen
<FromGitter> <girng> one thing i do have to sayaobut gitter
<FromGitter> <girng> the search is garbage
<FromGitter> <bew> About the Kubernetes slack, iirc Kubernetes is a technology baked by some big company right? So they probably have the money to pay for a special version of slack or sth to allow that kind of huuge numbers
<FromGitter> <bew> @girng true ^^ you can't even see the search results correctly
<FromGitter> <j8r> I still don't get why they have chosen PHP to build Slack β­•
<FromGitter> <bew> @aisrael actually gitter could make rooms too, under the crystal-lang namespace there is only the `crystal`
<FromGitter> <bew> room*
<FromGitter> <girng> for example, im trying to find the old playground link that @oprypin posted with the game command enum method. i search "oprypin cmd" or "oprypin command", and i get results from September of 2017, LOL!
<FromGitter> <j8r> we can create how many we want yes
greengriminal has joined #crystal-lang
Guest60087 has quit [Quit: Konversation terminated!]
gizmore has joined #crystal-lang
gizmore|2 has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 250 seconds]
<FromGitter> <faustinoaq> @aisrael I prefer gitter because I can read messages without login πŸ˜„
<FromGitter> <faustinoaq> IRC can do that as well via https://irclog.whitequark.org/crystal-lang πŸ˜‰
<FromGitter> <faustinoaq> > actually gitter could make rooms too ⏎ ⏎ @bew @aisrael yeah, that's true, you can even create private roms ✨
<FromGitter> <faustinoaq> > I don't think there's a "search in crystal" feature ⏎ ⏎ @aisrael All these messages are indexed by google πŸ˜…
<FromGitter> <faustinoaq> I guess we need to enable it πŸ˜…
<FromGitter> <aisrael> ☝️ Didn’t know that. The Gitter native search isn’t very um... user friendly
<FromGitter> <faustinoaq> Yeah, I think so
<FromGitter> <faustinoaq> Well, I use https://irclog.whitequark.org/crystal-lang anyway 😎
<FromGitter> <girng> can't believe i never starred https://github.com/kemalcr/kemal
hightower2 has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
greengriminal has quit [Quit: Leaving]
rohitpaulk has joined #crystal-lang
<FromGitter> <girng> @faustinoaq i would use irc, but i don't like people knowing my ip
sz0 has quit [Quit: Connection closed for inactivity]
alex`` has joined #crystal-lang
<oprypin> i think there are two ways to prevent exposing the ip
<oprypin> 1. unaffiliated/ tag 2. VPS with IRC bouncer
<FromGitter> <bararchy> @hugoabonizio yeha it's MIT, and the ART is going to be "free to use but licensed to the authors"
<FromGitter> <girng> @oprypin or 3: use gitter
<FromGitter> <girng> im not using a vpn just so i can chat
<FromGitter> <girng> if you replace https://play.crystal-lang.org/#/r/41xi with a `struct`, what's the performance difference?
Ven`` has joined #crystal-lang
<FromGitter> <bew> benchmark it and you'll see
<FromGitter> <bew> checkout the `Benchmark` module
<FromGitter> <girng> kk
Ven`` has quit [Read error: Connection reset by peer]
Ven`` has joined #crystal-lang
Ven` has joined #crystal-lang
Ven`` has quit [Write error: Connection reset by peer]
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5af543dae1cf621dba0f5374]
<FromGitter> <girng> negligible difference?
<FromGitter> <girng> benchmark code: https://paste.ee/p/dxqgu
Ven` has quit [Read error: Connection reset by peer]
Ven`` has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
Ven` has joined #crystal-lang
Ven` has quit [Client Quit]
Ven`` has joined #crystal-lang
Ven`` has joined #crystal-lang
hightower2 has joined #crystal-lang
<FromGitter> <girng> updated code: https://paste.ee/p/xfK49 ⏎ looks like class is indeed faster. ran it a couple times, getting a range from up to 20%
<FromGitter> <ryankshah> I'm creating a program which involves JSON data which can have a variety of from (i.e. the data is a list which can have integers, string, etc.
<FromGitter> <ryankshah> I create a class to store this data, but cant use `@value = json['attr']` because i dont know the values it takes
<FromGitter> <ryankshah> Is there any way I can get around this?
zorp has quit [Ping timeout: 256 seconds]
zorp has joined #crystal-lang
zorp has quit [Remote host closed the connection]
zorp has joined #crystal-lang
zorp has quit [Ping timeout: 248 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
olbat has quit [Ping timeout: 260 seconds]
olbat has joined #crystal-lang
olbat has joined #crystal-lang
olbat has quit [Changing host]
p0p0pr37 has quit [Ping timeout: 264 seconds]
p0p0pr37 has joined #crystal-lang
p0p0pr37 has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 264 seconds]
<FromGitter> <cpunion> Hi, I’m reading https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists, it says: ⏎ ⏎ ```# Crystal ⏎ a = [1, 2, 3] ⏎ a[0] + a[1] #=> Error: undefined method `+` for Nil``` ⏎ ⏎ But I tested in https://play.crystal-lang.org/#/r/4203, it outputs 3. [https://gitter.im/crystal-lang/crystal?at=5af576705a1d895fae307c3d]
<FromGitter> <ryankshah> I think that may be outdated or incorrect
<FromGitter> <ryankshah> Crystal will evaluate `a[0]` and `a[1]` and see that they are both integers to then perform the addition
p0p0pr37 has joined #crystal-lang
<FromGitter> <epergo> it doesn't say that it should return that
<FromGitter> <epergo> ```code paste, see link```
<FromGitter> <epergo> it says that "if" it could return Nil, that wouldn't work
<FromGitter> <epergo> but because it doesn't return nil by default, it works
<FromGitter> <cpunion> Oh, I got it. Thanks!
<FromGitter> <ryankshah> @epergo I answered without reading the document πŸ˜†
<FromGitter> <epergo> πŸ˜„ no prob
<FromGitter> <ryankshah> @epergo think you got an answer for the question I asked previously?
<FromGitter> <epergo> if you know the object that you want to parse to, you could use json mapping
p0p0pr37 has quit [Read error: Connection reset by peer]
p0p0pr37 has joined #crystal-lang
p0p0pr37 has joined #crystal-lang
p0p0pr37 has quit [Changing host]
<FromGitter> <ryankshah> The code I'm using is here: https://pastebin.com/Zp6dHxE3
<FromGitter> <ryankshah> I'm reading a json in the format of this: https://pastebin.com/LkuARgfH - however the data values may be of different types
<FromGitter> <epergo> you can use something like this too
Ven`` has joined #crystal-lang
<FromGitter> <epergo> I've created a crystal play with your example https://play.crystal-lang.org/#/r/420w
<FromGitter> <epergo> with that setup, what's is what you can't do?
<FromGitter> <epergo> why do you need to extend self in ID3?
<FromGitter> <ryankshah> I extended self so people can use the `retr_json` method if they need to, it's mainly just for me
<FromGitter> <ryankshah> The issue is
<FromGitter> <ryankshah> I wish to use the `@` annotation for the variables like `attributes` and `data`
<FromGitter> <ryankshah> `attributes` is of type `Array(T)`, however since the type of the array can fluctuate and is not known until it is read into the json object
<FromGitter> <ryankshah> i dont know what i should use
p0p0pr37 has quit [Ping timeout: 246 seconds]
p0p0pr37 has joined #crystal-lang
<FromGitter> <epergo> mm maybe I'm doing things in a way that doesn't work for your use case, but check this, perhaps you find something useful πŸ˜‚ https://play.crystal-lang.org/#/r/422d
<FromGitter> <epergo> I think you should try to write the "specification" of your input json, using json mapping, and you can use alias to make it cleaner
<FromGitter> <ryankshah> @epergo Is it possible to use an alias with `Array(T)` or just use `Array(Int32 | String | ...)`?
<FromGitter> <splattael> Question about types: Why did so code work in `0.24.2` but does not work on `crystal:nightly`: https://play.crystal-lang.org/#/r/422h
<FromGitter> <splattael> Sadly, "play crystal" does not support nightly builds :(
<oprypin> just bisect it
<FromGitter> <splattael> The error on the nightly looks like: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5af5842fe1cf621dba102109]
<FromGitter> <splattael> @oprypin Good idea! Will do!
<oprypin> if you make it work on latest, it will work on .2
<oprypin> the change is likely the one eliminating + types by asterite
<FromGitter> <splattael> @oprypin Oh, there are gone now? Ok, should I cast explicitly now?
<FromGitter> <splattael> `BarFilter.new.as(Filter)` works
<FromGitter> <ryankshah> @oprypin So now it's not possible to do `Array(Type1 | Type2)` ?
<oprypin> why not
<FromGitter> <ryankshah> I think I'm misunderstanding the above conversation :s
<oprypin> d02c267ab4e6de983c283077790b331db47c96d4
<FromGitter> <ryankshah> @oprypin I have an array I retrieve from a `JSON.parse` but I do not know the types within the array beforehand. I want to use `@` for the variable storing this array but of course will throw an error because it needs a type - so would using `@var : Array(Type1 | Type2 | ...)` be the way to do this?
<oprypin> splattael, can try that one directly
<oprypin> ryankshah, i've seen your previous messages and all i can say is: you should not be doing this, and instead maybe you can explain your end goal
<FromGitter> <ryankshah> I'm trying to create some machine learning structures @oprypin
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <ryankshah> I want to use the array throughout the class but can't do so unless I have `@`
<oprypin> thats not the end goal
Ven`` has joined #crystal-lang
<FromGitter> <ryankshah> Well the end goal is to create the ID3 decision tree algorithm which can be run on training and testing data sets (which I have in JSON form)
<oprypin> ryankshah, so you need to process the JSON data into a structure that makes sense to your program and then store it
<FromGitter> <ryankshah> Yeah
<crystal-gh> [crystal] sdogruyol closed pull request #5864: Add \a escape sequence (master...patch-8) https://git.io/vxRbf
<oprypin> what i mean is, an array with a soup of different data types is NOT structure that makes sense to your program
<oprypin> a^
<FromGitter> <ryankshah> Oh yeah, you're right hm
<FromGitter> <ryankshah> Okay for a first implementation I guess I will have it work with integers as with my initial testing and training sets and then refactor later on if needed
<oprypin> ryankshah, is it true that in some cases you will have ONLY numbers and in other cases you will have ONLY strings, etc?
<oprypin> @epergo showed a very good example with steps in the right direction, why not use that?
Ven`` has quit [Ping timeout: 240 seconds]
<FromGitter> <ryankshah> In some cases that is true, but he used an example of where the json data is written directly into the crystal implementation
<FromGitter> <ryankshah> But consider that most machine learning applications use datasets that are immensely large
<oprypin> so how is your example better in that regard?
<FromGitter> <ryankshah> I guess I could still use his example but instead of using json mapping i can just use the file
<FromGitter> <ryankshah> Yeah I'll give that a go ^
<oprypin> please use json mapping, it can be used with a file
<oprypin> also note that even though it's a file, you're still putting the entire structure into memory
<oprypin> in both examples
<FromGitter> <ryankshah> Ahh so either way for large datasets its going to either overflow or be inefficient?
<oprypin> `.from_json(JSON::PullParser.new(file))`
<oprypin> ryankshah, likely so
<oprypin> i'm not sure if you're gonna have like 4 GB of data but if you do, then yeah, you need to think of something else
<FromGitter> <ryankshah> Hmm
<oprypin> in that case i would also say that json is a bad choice
Ven`` has joined #crystal-lang
<FromGitter> <ryankshah> Maybe sticking to CSV is better
<oprypin> maybe
<FromGitter> <ryankshah> However, using CSV means I wouldn't have access to the "benefits" of mapping
<oprypin> csv is much easier to reason about, you just deal with all strings. and use .to_i when it makes sense to you
<oprypin> it's so simple that you don't miss those benefit
<oprypin> s
<FromGitter> <ryankshah> yeah that's true
<FromGitter> <ryankshah> Alright i'll give the advice a go, thanks @oprypin + @epergo
<FromGitter> <splattael> oprypin, will try that commit directly. Thanks!
<FromGitter> <splattael> oprypin, nice shot! It's commit d02c267ab4e6de983c283077790b331db47c96d4 which broke https://play.crystal-lang.org/#/r/422h
rohitpaulk has quit [Remote host closed the connection]
<oprypin> probably intended behavior
<FromGitter> <splattael> oprypin, so the solution would be to downcase via `.as(Filter)`?
<FromGitter> <splattael> *downcast
<FromGitter> <splattael> Aeh, upcast?
<oprypin> let me check
<oprypin> splattael, `[FooFilter.new, BarFilter.new] of Filter` works
<FromGitter> <splattael> oprypin, oh of course, nice!
<FromGitter> <splattael> Work like a charm, thanks!
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duane has joined #crystal-lang
Ven`` has joined #crystal-lang
<travis-ci> crystal-lang/crystal#1ecc65b (master - Add \a escape sequence (#5864)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/377703269
<DeBot> https://github.com/crystal-lang/crystal/pull/5864 (Add \a escape sequence)
<RX14> we're going to have "fun" explaining that type system change to people
<jeromegn> :/ vs code's made me lose entire files of Crystal code. I wonder if the crystal extension is acting up.
<RX14> probably the formatter
<RX14> as in the file doesn't format
<RX14> the vscode extension handsles the formatter not returning any output suuuper badly
<RX14> and then it blanks your buffer
<RX14> although - if you can't ctrl-z out of the situation then vscode is pretty broken
<jeromegn> yea, I somehow had closed that file and could not undo
<jeromegn> git checkout for the win
<RX14> lol
<RX14> bad editor :P
That_Guy_Anon has joined #crystal-lang
rohitpaulk has joined #crystal-lang
Mead_ has joined #crystal-lang
Mead_ has quit [Client Quit]
hightower2 has quit [Ping timeout: 264 seconds]
rohitpaulk has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
<FromGitter> <wrq> there's a type system change coming?
<FromGitter> <wrq> I'm already having so much "fun"
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
olbat has quit [Ping timeout: 240 seconds]
olbat has joined #crystal-lang
olbat has joined #crystal-lang
olbat has quit [Changing host]
That_Guy_Anon has quit [Remote host closed the connection]
<oz> afk
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5af5c534862c5e33e9296029]
<FromGitter> <jwoertink> Can anyone see what I'm missing here?
<FromGitter> <jwoertink> If I pass `Runner(Handler)`, then shouldn't that make the initialize `stack : Array(Handler)`?
<FromGitter> <bew> Hmm yes but you don't pass instances of Handler, but classes
<FromGitter> <bew> A vs A.new
<FromGitter> <jwoertink> right
<FromGitter> <jwoertink> ah
<FromGitter> <jwoertink> so that would need to be `stack : Array(T.class)` ?
<FromGitter> <jwoertink> yeah, that's what it is
<FromGitter> <bew> ;)
<FromGitter> <jwoertink> thanks :D
<FromGitter> <jwoertink> sometimes it just helps to have a second pair of eyes :)
<FromGitter> <bew> Oh yeah I definitely agree ^^
<FromGitter> <bmulvihill> Runner(Handler).new([A.new, B.new]) ?
Cyrus has quit [Quit: WeeChat 2.1]
hightower2 has quit [Ping timeout: 276 seconds]
<FromGitter> <wrq> matching on enums is really painful. why is case not exhaustive? why is there ".variant?" methods that arent documented? what is going on with Enum?
andrewzah has quit [Ping timeout: 264 seconds]
andrewzah has joined #crystal-lang
<FromGitter> <wrq> so is case! eventually going to be part of crystal?
<FromGitter> <wrq> It's not clear from the privileged few core devs what the plan is despite the work done to implement exhaustiveness, twice...
<FromGitter> <bararchy> lol
<RX14> there is no plan
<FromGitter> <wrq> thats about what I figured
<RX14> this isn't a company it's an open source project
<RX14> you have exactly as much idea as I do just from reading github
<FromGitter> <paulcsmith> I'm trying to figure out how to conditionally run code if a library is available. I've tried this to no avail: `Gen::Migration.resolve?` but it gets an undefined constant. Is there a way to get the Macro Path for that constant instead?
<oprypin> for a long time i believed this to be impossible, but what do ya know
<FromGitter> <paulcsmith> Right on! Thanks @oprypin
<FromGitter> <drum445> I've been back on Go recently and I do very much miss the class structure of oop
<FromGitter> <drum445> Do we know why stored procs aren't available using the crystal mysql driver?
<FromGitter> <drum445> I know the same thing was present in ruby then they fixed it with mysql2 gem
<crystal-gh> [crystal] r00ster91 opened pull request #6089: Remove `ifdef` from the keywords list in playground (master...patch-1) https://git.io/vpyab
That_Guy_Anon has joined #crystal-lang
<jeromegn> is there still progress into parallelism? that branch where it used to happen is very stale.
<oprypin> jeromegn, well you answered it yourself
Groogy has joined #crystal-lang
<Groogy> Hey so working on a class that represents the objects in my game that pretty much make up the game. Back in C++ I did it with an Entity-component pattern. Though there were of course certain annoyances with it and I am rethinking things now since Crystal can potentially let me do things other ways
<Groogy> file that put together the entities looked like this essentially: https://gist.github.com/Groogy/17cf3a2f3a5de20616b66c0333d02434
<Groogy> wondering how others might put together an architecture that would let you "piece together" an object so to say
<OvermindDL1> Instead of EC I prefer ECS myself
<Groogy> Well second agent behaviour were added that had to take decisions and interact with other entities based on their components the complexity pretty much just ran away though
<jeromegn> oprypin: do you know why it's stalled? technical roadblocks?
<oprypin> jeromegn, literally just nobody working on it
<FromGitter> <drum445> any answers to my mysql driver question regarding stored procs
<Yxhuvud> groogy: I'd consider making a DSL to describe things. with blocks, macros and block evaluation in a specific context (ie `with x yield .. `) it is quite possible to make the result nicer to work with than a bunch of yml files. But that is my ruby background speaking :)
<Groogy> ah yeah I want it to be moddable though
<Groogy> this was pretty much the big badboy
<Groogy> as in most cause of my headaches
<Groogy> not writing it up just because of the agent_controller component
<Groogy> but just because of*
<Yxhuvud> a well thought through dsl can be extensible. A less well thought through dsl can be horrid, too. :)
<Groogy> wouldn't that require recompile though?
<Groogy> that's what I'm trying to avoid
<Yxhuvud> well, yes. if that is a design requirement, then it obviously isn't a good idea.
<Groogy> I've been trying to think how Dwarf fortress does it but Tarn Adams told me to definetly not copy DF :/
<Yxhuvud> because it is a mess?
<Yxhuvud> :)
<Groogy> yeah
<Groogy> but from what I get he has a "Tree class" I think....
<Groogy> that's what I got from him and I was considering using mixin modules and have predefined types that you can then tweak
<Groogy> Yxhuvud how would you have done a DSL for it though?
<Groogy> just from top of your head, always good to hear
<Yxhuvud> dunno, it is hard to find a good solution for something else than my own problems.
<Groogy> haha
<Groogy> well let's nevermind the need no recompile. It putting together the exact enttiy we want it at compile time is sort of cool thing to think about
<Groogy> or well constructing the factory I want specifically rather
<FromGitter> <drum445> anyone seeing my mysql question lol
<Yxhuvud> groogy: but for an actual example, see https://github.com/yxhuvud/cabbage/blob/master/spec/dsl_spec.cr for an example of dsl usage for a(n incomplete) parser I wrote. (https://github.com/yxhuvud/cabbage/blob/master/src/cabbage/dsl.cr) for the actual implementation.
<Yxhuvud> there are several parts I would redo in that one though, but then I'd have to get hte thumb out of my ass and actually finish my series of rewrites that I never got around to..
<Groogy> it's a generic way to define a language? πŸ€”
<OvermindDL1> Groogy: Again, I propose ECS. ;-)
<OvermindDL1> Pure data component containers
<OvermindDL1> An entity is just an integer (I do part idx and part generation in that integer)
<Yxhuvud> groogy: sortof, except it doesn't yet support character ranges.
<OvermindDL1> The components are tables that are indexed into
<Groogy> ECS as in Entity component system?
<Groogy> that is literally waht I was doing
<OvermindDL1> And systems that operate on 0-N component groups at a time
<OvermindDL1> Not Entity-Component systems, but Entity-Component-Systems
<OvermindDL1> Big difference
<Groogy> no but that is what I was doing
<OvermindDL1> Unity is pretty horrible EC, ECS is far better designed
<OvermindDL1> Groogy: What part of it did?
<Groogy> and the complexity grows as the amount of components they can interacti with increases
<Groogy> Mind you the agents could build a society by themselves, invent stuff, could figure out supply chains etc.
<OvermindDL1> But each interaction is very well self-contained into a system though, the complexity should not balloon unless doing something unusual
<Groogy> Doesn't matter
<Groogy> there could be a tree that doesn't feature one part
<Groogy> then it would have to cope with that
<OvermindDL1> Tree? Part?
<Groogy> or like things that gets scavenged from the ground
* OvermindDL1 is probing for examples
<Groogy> The system very much could support that the tree was immortal and could not get killed
<Groogy> and the agent had to deal with that missing component
<OvermindDL1> How do you define that it is 'immortal'?
<Groogy> by just not having the killable component
<Groogy> but the agent is still looking at it for it can provide woods
<Groogy> logs*
<OvermindDL1> Then why would the agent have to deal with the missing component since it wouldn't ever even iterate over it
<Groogy> and thne you just apply that for literally everything
<OvermindDL1> Have it match based on 'provide wood' and 'killable'
<Groogy> You really don't see the problem?
<Groogy> the growth of it in the long run?
<OvermindDL1> No, you only have it match on things that it cares to handle. If it is a pickup system that matches based on some providing thing and killable, then so be it.
<OvermindDL1> If the tree can provide wood in a way different than other providers, then make a new component to distinguish
<Groogy> and there you add more depth to the things it needs to handle
<OvermindDL1> Systems should be as minimal as possible, adding more is always fine
<Groogy> that new way might need a special axe
<OvermindDL1> more systems, not more 'to' a system
<Groogy> of obsidian materal
<Groogy> then it needs to handle that
<Groogy> it grows really fast
<Groogy> I know because it did
<OvermindDL1> That doesn't like a provider then, that sounds like a Harvestable component type
<Groogy> harvestable component for me were the ones that remained after getting used, like berries
<Groogy> or rather their flowers
<Groogy> trees are destroyed to be harvested
<OvermindDL1> I would have a harvestable component be on the entity that defines what can be harvested via a matching filter class (you could have multiple such listings)
<Groogy> and either way next step was for the agent to understand over harvest which it could do
<Groogy> where it would know the time it takes for plants to seed
<Groogy> Yes OvermindDL1 it is literally what I had
<Groogy> you are not saying anything new
<OvermindDL1> What was the complexity issue at though?
<OvermindDL1> What you are describing sounds precisely like how Terasology does ECS with a minecraft-like engine so far
<Groogy> terasology as far as I can see do not have autonomous agents
<OvermindDL1> An autonomous agent being...
<OvermindDL1> Like literally an ingame moving being, like a cow?
<Groogy> no
<Groogy> It's a zero player game
<Groogy> the inhabitants are autonomous
<OvermindDL1> So it's not something with AI, what is an autonomous agent then?
<Groogy> what no that is AI?
<Groogy> what you on about?
<OvermindDL1> You said 'no' though?
<OvermindDL1> Are you talking about your behaviour tree getting too complex, not components?
<Groogy> there's a difference between a cow walking around by random path pattern and an agent deciding it needs to first cut down a tree to acquire the logs it needs to build the carpentry that will provide it with arrows and bows to kill that cow
<Groogy> no I am talking about the interaction with entities of varying components
<Yxhuvud> hey, I have plenty of experience of cows. They don't walk random walks.
<OvermindDL1> Yeah that's the kind of stuff you would use a Behaviour Tree for
<Groogy> yeah no that's not the problem getting him to do that
<Groogy> the problem is the pain of dealing with the ECS
<Groogy> two animals might be very varying in their components
<Groogy> let's say an eagle vs a cow
<Yxhuvud> (I like the contrast btw - every other channel is now talking about ESC)
<OvermindDL1> Sure
<Groogy> but the hunter still needs to deal with them
<Groogy> you really don't see how the complexity has a really big growth?
<FromGitter> <drum445> is this a bug?
<OvermindDL1> Not really? I've done precisely those things before? I occasionally have to split up and/or combine components but it always flattens out well
<Groogy> hunter finds components that provide meat, it sorts out entities that it has tools to kill. It does not have tools to kill then find tools it needs somehow. If it has tools then we get into just the alright how do I get to that entity
<Groogy> you don't see how it doesn't grow?
<FromGitter> <drum445> No, I mean is my mysql issue a bug
<FromGitter> <drum445> it keeps getting spammed away lol
<OvermindDL1> That is part of the behaviour tree work
<Groogy> and when we get to that entity we have to check, is it flying? Is it grass walking? Is it an aggressive so I am in danger?
<Groogy> etc.
<OvermindDL1> The behaviour tree queries the ECS for the state of <whatever> for the given leaf in the behaviour tree
<FromGitter> <bew> @drum445 what do you mean by "procs aren't available using the crystal mysql driver" ?
<Groogy> No but every single step here means I need to check for tons of components
<OvermindDL1> You have to do that regardless of the system, but the fact there are many components means that you can prune what it looks for by a potentially *substantial* amount as well
<FromGitter> <drum445> @bew when I call a stored proc from using the mysql driver I get the following: ⏎ ⏎ ```can't return a result set in the given context``` [https://gitter.im/crystal-lang/crystal?at=5af6042d2df44c2d061edd5c]
<Groogy> also I don't use behaviour tree
<OvermindDL1> What do you use for AI?
<Groogy> because behaviour trees break down in these kind of scenarios
<Groogy> at work we use weighting for everything
<OvermindDL1> Eh, there are modifications that work well thoguh
<OvermindDL1> though*
<Groogy> fuzzy logic essentially
<Groogy> Well no you don't need that for every system
<OvermindDL1> Last time I saw someone say fuzzy logic they actually made an iterative behaviour tree. ^.^;
<Groogy> at work, though a completly different beast we do a lot more by commands which solve it.
<Groogy> I.e MoveCommand will resolve what the unit needs to do
<Groogy> Well our strategy games never have used behaviour trees
<FromGitter> <bew> @drum445 I have no idea what you're talking about... is it something specific about the mysql driver? the procs you're mentionning, are Crystal' Proc objects? or sth else?
<Groogy> Total WAr games uses behaviour trees and it is pretty obvious
<Groogy> also why it's so easy to break
<FromGitter> <drum445> stored procs
<FromGitter> <drum445> in mysql
<OvermindDL1> TW uses a very old style though, not a great example
<FromGitter> <bew> I don't know what that is sry
<Groogy> No they don't
<FromGitter> <drum445> seems to be an issue with the MySQL driver, similar to the issue ruby had many hears ago
<FromGitter> <drum445> years*
<Groogy> where are you pulling that from?
<OvermindDL1> Seeing how they work
<OvermindDL1> Still though, to your fuzzy logic thing, code?
<Groogy> So tell me then what's old about them?
<FromGitter> <bew> huh didn't know you could store some kind of "functions" in mysql Oo
<FromGitter> <drum445> Yeah, you don't really want to have sql queries in your code base
<Groogy> I think last GDC they called it.... weighted state machine?
<Groogy> though we've never called it anything
<Groogy> but what some companies talked about it ringed a bell
<FromGitter> <drum445> if you need to make a small db change it's much better just to amend the stored proc than have to redeploy your code
<Groogy> though not really a state machine, it's just a weight on what's important right now and then another AI delegates resources
<OvermindDL1> Decision trees? Those are just a refinement (though a good one) of behaviour trees that changes functionality slightly in how it is iterated, still hierarchical state machines though
<OvermindDL1> Weights sound like a decision tree
<Groogy> It's not a decision tree
<Groogy> unless you call a graph of one depth a tree
<OvermindDL1> That's just a flattened variant, it loses one form of optimization but gains another
<Groogy> No it's no
<OvermindDL1> Groogy: Code, code makes it all clear. ^.^
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5af60564a2d95136333251ee]
<Groogy> I can't provide you code
<oprypin> drum445, "much better just to amend the stored proc than have to redeploy your code" makes absolutely no sense
<Groogy> that would be extremly illegal
<FromGitter> <girng> now, my benchmark is saying struct is faster lol
<FromGitter> <girng> it was saying class was faster...
<OvermindDL1> Or are you talking about Utility AI's?
<FromGitter> <drum445> @bew yep
<Groogy> what no
<Groogy> It is property of Paradox Interactive
<OvermindDL1> Not that, but the style you are using
<OvermindDL1> Utility AI's are single level as well, then use a weighted scoring system based on checks to calculate a score to determine what to do
<FromGitter> <girng> glad to see @oveermindDL1 back. long time no see how u been doing
<OvermindDL1> girng: Being lazy at work since a new server is being installed.... ^.^;
<Groogy> Oh I thought you meant like libs that provide stuff like neurons n stuff
<Groogy> yeah I guess that is a bit closer
<Groogy> though not really checks on what to do
<FromGitter> <drum445> @bew thanks for the issue link, I've added my findings. Is that the correct flow?
<Groogy> it becomes "all potential actions, sort by weight/score, take all we can take"
<OvermindDL1> Neurons? Eh tenserflow stuff is cool but training is a pain and it's not too fast enough for games yet
<Groogy> no no I thought you meant that we were using AI libs
<OvermindDL1> No, just the style
<Groogy> and that's why I couldn't provide
<FromGitter> <drum445> @oprypin if you wanted to change a join to make a query more efficent, you wouldn't want to have to do a code release for that
<OvermindDL1> I don't even know what libaries are out there, I just write my own... >.>
<FromGitter> <bew> " in a very old version of the MySQL driver" you forgot to mention "Ruby"
<oprypin> drum445, yes you would
<FromGitter> <drum445> @oprypin also how are you supposed to reuse sql queries?
<Groogy> but like I said, kurzgesagt becomes "all potential actions, sort by weight/score, take all we can take"
<oprypin> make a function, u know?
<FromGitter> <girng> re-rrun the db.query method ?
<Groogy> it differs between games
<OvermindDL1> Groogy: I'm really wondering it that is just a bog standard Utility AI then
<FromGitter> <drum445> @oprypin Fair enough, but we would get some dodgy code reviews if we hardcoded sql queries into our code and pushed
<oprypin> drum445, if you wanted to change a join to make a query more efficent, you wouldn't want to have to do a database migration for that
<Groogy> Crusader Kings II have about 140k independent agents to simulate
<Groogy> so it has some tricks to that
<oprypin> drum445, so bypassing code review for queries is the solution?
<OvermindDL1> It has a set of actions, each of which has a set of checks that return a score, the score is added together to get the 'action' score, and the highest action score is the action that is performed
<FromGitter> <drum445> @oprypin No ofcourse not, you would get the stored proc change reviewed
<FromGitter> <drum445> @oprypin so then everyone that needs to use that query can simply call it, instead of having to hardcode it again in src
<oprypin> this sounds bizarre
<FromGitter> <girng> what'sgoing on
<oprypin> you dont hardcode, you include it as a dependency
<oprypin> you know, like, libraries and dependencies and stuff
<FromGitter> <drum445> @oprypin fair enough, just the way a few of the places I've worked at go about it. Each to their own. Either way the driver needs support for stored procs
<Groogy> either way from what I've seen in the game industry, behaviour trees in strategy put the AI very easily in sort of deadlocks. Where it doesn't know what to do. And even if you try and work around it you get into an immersion breaking scheme
<OvermindDL1> So say something has an Action called, oh, "Eat", it has a few checks, like hunger percentage you can map directly to a 0-100 score, distance to food you can map directly with distance negated with a lower cap at, oh, -90, so when something is hungry enough then regardless the distance it would be positive (you can add in other things to scale it higher if the hunger gets too low and so forth)
<Groogy> the main point for the AI is not for it to beat you but to always act to always act as if there is a brain behind it doing something
<Groogy> it doesn't need to be smart
<OvermindDL1> Groogy: Old style behaviour trees yes, decision trees have less issues, Utility AI's are generally used for things that have lots of possible 'branches' in a traditional tree
<Groogy> Yes which strategy games have
<FromGitter> <drum445> so please let me know if I should raise a seperate issue for it or is it fine just commenting on an old one?
<Groogy> decision trees and behaviour trees work for games like FPS
<Groogy> for strategy games, I've never ever seen it work well
<Groogy> it cna be super well implemented, the shortfal is always that it is limited by the player thinking of all the scenarios
<Groogy> but you know, one patch and the meta changes and that doesn't get updated and it all breaks
<Groogy> while what we do it just copes, even if suboptimally
<Groogy> which is always better for the majority of players
<Groogy> It's also partly why CK2 went so well
<Groogy> because our agents would just do crazy shit we never expected
hightower2 has joined #crystal-lang
<Groogy> if hundred of thousands of agents do dumb stuff, eventually one of them will do something interesting for the player to latch on to
<OvermindDL1> It also depends on what is being managed, like in a strategy game you generally don't want each unit to have it's own overarching AI, but rather have smaller trees that respond to an overall Dispatcher's directives (which also listens back to events from units)
<Groogy> No we just have a persistent evaluation and everything is multithreaded
<OvermindDL1> If there are 'many' things, I love Dispatcher systems (which internally usually has multiple styles at once for different functions)
<Groogy> which means each country knows what the other country will do and can cope with it that way
<Groogy> dispatcher still means you have thought of every single scenario of actions you can do
<Groogy> but we add new stuff for the AI to do every 4-6 months
* OvermindDL1 is curious at dumping tensorflow or tcnn or something into a mini-game to see how well and quickly it learns now...
<OvermindDL1> Groogy: New stuff being...?
<Groogy> features
<Groogy> full features
<OvermindDL1> An example?
<Groogy> it also depends on if the player owns the DLC or not if the AI should use those features
<Groogy> erhm.. like drilling your army to raise its quality?
<hightower2> Hey some weeks ago we were discussing how to use macros to fill a "buffer" and then dump it at desired location. I think it was bew providing a code example on play. Does anyone have it in the history?
<OvermindDL1> Drilling?
<FromGitter> <girng> p2w
<hightower2> (The key word is "dump")
<Groogy> Giving trade company provinces in the far east
<Groogy> @girng haha I guess in a way, but if you play multiplayer you all get all of the host DLC's for free during that session
<Groogy> so you always play on the same playing field
<FromGitter> <girng> @groogy i just giving ya shit haha. =]
<Groogy> either way TL;DR everyone are ECS evangelists so I'll have to figure out something better or a better way to cope with the growing complexity
<FromGitter> <girng> @Groogy what engine do ya'll use for the game? homemade?
<Groogy> Clausewitz
<Groogy> successor engine of our old Europa engine
<Groogy> yeh
<FromGitter> <girng> very cool
That_Guy_Anon has quit [Quit: Leaving]
<FromGitter> <girng> looking at the games dev by their engine: stellaris (https://www.youtube.com/watch?v=eoAkomMEFQo)
<FromGitter> <girng> looks like that reviewer doesn't even know the point of the game (from the comments) LOL
<Groogy> h that was an old one
<Groogy> no he had a lot of good points
<Groogy> which we've tried to address a lot and I hope the fans agree :)
<Groogy> last patch pretty much ripped out half of the game and remade it
duane has quit [Ping timeout: 255 seconds]
<FromGitter> <girng> https://paste.ee/p/7aqQd here is my benchmark code. sometimes when i run it `crystal src/benchmark.cr --release`, it shows that the struct way is slower than the class. but then sometimes, it shows the struct is faster than the class.
alex`` has quit [Quit: WeeChat 2.1]