greengriminal has quit [Ping timeout: 264 seconds]
greengriminal has joined #crystal-lang
<FromGitter>
<opensas> Yo
greengriminal has quit [Quit: This computer has gone to sleep]
DTZUZO has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
alex`` has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9]
<FromGitter>
<ansarizafar> @uSide Mutable NamedTuple would be easier to understand for devs coming from other languages. A feature request for the core teams.
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
rohitpaulk has joined #crystal-lang
<FromGitter>
<bararchy> Groogy I suddenly had a question , your game engine is pure crystal , how much sprites do you think could live independently until you will start having "lag" because of single threading ?
<txdv>
Groogy: you got a game engine written with crystal?
<txdv>
@bararchy there is a lot to code and to optimize before you hit that limit
<FromGitter>
<bararchy> I'm sure , still interesting , let's say you have a strategy like game , where each unit should have its own "logic" , and might be controlled differently, how does other game engines do it ? A thread each ? Sounds crazy
<FromGitter>
<faustinoaq> > Mutable NamedTuple would be easier to understand for devs coming from other languages. ⏎ ⏎ I disagree, currently we have Tuple && Nametuples as inmutables sequences and Arrays && Hash as mutable ones, I think is ok as is, we just need a better documentation 😉
rohitpaulk has quit [Ping timeout: 240 seconds]
Papierkorb_ has joined #crystal-lang
<vegai>
hmmh :P
<vegai>
morning
<vegai>
so ... is there any standardish way to output compile-time warnings?
<vegai>
from stdlib code
rohitpaulk has joined #crystal-lang
<FromGitter>
<ansarizafar> @faustinoaq Muatable NamedTuple are easy to understand, define (user = {count: Int32, name: String}) and use, specially for Developers coming from Nodjes/Javascript and in my opinion many Nodejs developers would like to switch after V1 release as less memory/CPU usage and performance gains will be huge.
<vegai>
I guess {{ p "WARN" }} would do it at least, but that doesn't seem like the correct solution
<Groogy>
Morning!
<Groogy>
txdv I sure do!
<Groogy>
Well under development, working on text rendering right now, next is UI then I'll start porting my game from c++
<Groogy>
@bararchy it depends on what you mean and define as "how many sprites" ;D
<Groogy>
There's tons of tricks you can do, for instance in a tilemap, you can render like 8x8 over a surface of 1600x1200 which normally would be 30 000 sprites (and kill ANYTHING)
<Groogy>
but you could do that with only one single draw call and just construct the data needed in the shader
<Papierkorb_>
ansarizafar, why do you insist on named tuples? Just use a real class.
<Papierkorb_>
Named tuples are *not* for what you try to use them.
<vegai>
hmm, perhaps I don't even want compile time warnings actually
<Groogy>
Eh what d oyou mean compile time warnings?
<Groogy>
You mean like C++ #message preprocessor command?
<Papierkorb_>
vegai: The stance is "don't warn, error instead"
<Groogy>
also yeah ^
<Papierkorb_>
vegai: If you want to error out, you can use `raise` in a {{ }}
<Groogy>
If you bother enough to warn about this, then something is wrong and it should be fixed, not ignored
<Papierkorb_>
vegai: Even better, you can use `raise` on a macro variable, try this: `macro foo(x); {{ x.raise "Nope nope nope" }}; end; foo("Something")` - That'll show a compile-time error and point at the macro argument
<FromGitter>
<ansarizafar> Mutable NamedTuples For simplicity, ease of use without boilerplate code and for the benefit of huge number of Nodejs devs who can become Crystal devs afetr v1 release. Switching to a new language is not easy specially at the beginning .
<Papierkorb_>
That's correct, because you have to learn the language.
<Papierkorb_>
And what you're trying is not how Crystal works. Use an actual class.
<Papierkorb_>
And simplicity? Huh? How is `foo[:bar]` not much worse than `foo.bar`, while a proper type, with all of its benefits, is just a single `class Foo` away?
<Papierkorb_>
Not to mention that you'll have much fun to store named tuples in an @instance variable, and if you change anything, change all of these occurences. That alone should tell you that you're doing something not in the intended way
claudiuinberlin has joined #crystal-lang
<Papierkorb_>
Don't expect a paradigm from language A to be the exactly same in language B. This even holds true for people coming from Ruby, who have to learn quite a few new things, as many paradigms from our "mother" language don't port over so well - The biggest driving factor behind this being the step from a dynamic to static type system.
<Groogy>
I've only used tuples in Crystal for metaprogramming stuff pretty much
claudiuinberlin has quit [Client Quit]
<Papierkorb_>
Which is mostly how it should be. You can count the valid use-cases of tuples in user-code on a single hand
claudiuinberlin has joined #crystal-lang
<Groogy>
Also Papier what was the next-gen branch? Did it support C?
<Groogy>
didn't see it until I got to work
<Papierkorb_>
Currently working on cleanly porting all-the-features over. C support requires additional logic in the Clang tool too, but it's one of the things I totally want to look into. And with a custom processor (If the configuration stuff isn't enough by then), you can do the mapping magic without messing with anything but that
<Groogy>
ah the #define is not done?
<Papierkorb_>
#define is a story on its own, but atm, the tool doesn't support reporting global methods at all
<FromGitter>
<sdogruyol> Morning everyone
rohitpaulk has quit [Ping timeout: 240 seconds]
<Groogy>
o/ sdogruyol
<Groogy>
Yeh #define is nessecity for all the c based bindings I use :(
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy>
reading through the TEMPLATE.yml now to get a better view of how things work
claudiuinberlin has joined #crystal-lang
<FromGitter>
<bararchy> morning @sdogruyol
<FromGitter>
<bararchy> Groogy, that's cool, it's an interesting subject
<Groogy>
It's a bit eh "the hype right now" without any point really
<Groogy>
learning ai is trying to solve a problem which doesn't merge well with games
<Groogy>
So it is just riding on a "AI Hype wave" caused by AlphaGo but it has no practical application within games
<Papierkorb_>
The only gain will be creating a system which automatically repacks cosmetic DLCs to generate more money
<Papierkorb_>
As if they're not already plain cash grabs for something you got for the price of the game. You know, back when you bought a game, and actually had it?
<Papierkorb_>
It's not hard to build a "toy blockchain" at all
<FromGitter>
<bararchy> Groogy, don't you think that maybe using Neural nets you can create an enemy AI which can rival human players ? something like evolving enemy mode, where each level or "wave" the enemy is smarter (it's cooler then just "have more units" or "you have less resources")
<FromGitter>
<sdogruyol> it's for demonstration purposes @Papierkorb
<Papierkorb_>
What most people think it's just a structure with a parent hash, some data on its own, and a hash on its own lower than some target value
<Groogy>
@bararchy you don't want an AI that rivals human players in games
<Papierkorb_>
Hasn't anyone built one already sdogruyol?
<Groogy>
you want an AI that *entertains* human players
<Papierkorb_>
ansarizafar, I think I know the implications of different data structures. A mutable named tuple doesn't magically produce a fast program. If you're under that impression, you're misled.
<Papierkorb_>
Or you tell me how a tuple and a structure are not the same thing on machine level. Hint: There's none.
<Groogy>
besides the performance gain is only if the struct/tuple is a temp object that is recreated a lot
<Groogy>
and a bit of memory locality
<Groogy>
but then you are microoptimizing
<Papierkorb_>
Insane how I actually pull out this quote unironically: "For 97% of your code, premature performance optimizations is the root of all evil. In the other 3% however, it's a good thing". Now, does your web (!) application consist solely of that 3%? The chance is pretty high that no.
<Groogy>
As an example @bararchy on AI that enterains the player, in Crusader Kings II, the code that just makes choices on who to assasinate, who to marry etc. that build more of a narrative for the player is way more complex than the part of the AI that moves troops
<FromGitter>
<ansarizafar> Ok. I am new to Crystal lang. Just trying to learn from you guys.
<Groogy>
because that part of the AI looks at "Alright I am greedy, so I am gonna make this mistake, or I am honest so I am gonna be naive", which is what the player really wants/expects and not that the AI minmax and tries to beat you
<Groogy>
which to be honest, is way easier to do, even without neural netowrks
<Groogy>
@ansarizafar Javascript and Lua goes by Prototype based object orientation, Crystal/Ruby etc are Class based object orientation
<Groogy>
they are fundamentally different languages by its very core so what might have been good praxis in Node.js, is definetly not going to be so in another language
<Papierkorb_>
Groogy: I think the more interesting aspect of deep learning (sic) AI would be that it has to sabotage itself to not be overpowered
<Groogy>
I believe more in expanding on what Valve did with Left 4 Dead and explore that more
<Groogy>
Automated AI Direction
<Groogy>
An AI whose only job is to make sure the player is having fun
<Papierkorb_>
And then, how it does so. A badly learned AI would make the game a laughing stock real quick. And I'd imagine, intentionally building an idiot isn't that easy at all :)
<Papierkorb_>
Yeah that worked for the most part
<Groogy>
It wasn't perfect, but I feel the idea is the right path and I've been trying to push internally we should look more to that
<Papierkorb_>
Though it stopped too early. Had to force it to trigger panics 100% of the time for us to do something hehe :P
<Groogy>
one of our problems is event spam where while you are in high pressure situation (war) you get bombarded by events or something at a cruical moment
<Groogy>
an AI that guides that stuff would be way better
<Papierkorb_>
But yes, the concept worked fine
<Groogy>
@bararchy not saying self-learning AI doesn't have its purpose etc. But when it comes to games, as in a random player is trying to enjoy himself. That is not it in my opinion
<Papierkorb_>
Groogy: If it does away with difficulty levels, that'd be great. I as player don't know how good I'm before getting into the game. And once i'm in, i'm reluctant to change. But as I'm uncertain, I'd never choose e.g. Hard.
<Groogy>
I always play all the games at hardest available and move it down to find my "sweet spot"
Philpax__ has joined #crystal-lang
Philpax_ has quit [Ping timeout: 246 seconds]
<FromGitter>
<ansarizafar> @Groogy Got it. Thanks for explanation.
<Groogy>
To put in context, Tuples mainly from my experience in Crystal (I am also fairly new compared ot these guys) is more as language constructs
<Groogy>
Like with macros, generics and for variadic argument calls
sz0 has joined #crystal-lang
<Groogy>
I would say in Crystal using a class or struct is always better because it provides you a lot more safety from doing things wrong in the long run
<Groogy>
While tuple is more seen as a very temporary construct, if you need to reference its type directly then you probably need to rethink what you are doing or hell is going to break loose on you
rohitpaulk has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
mark_66 has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
flaviodesousa has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmcginty has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #crystal-lang
bmcginty has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/vdeUu
<crystal-gh>
crystal/master 79fd84e Luis Lavena: Support LLVM 4.0 postfixed versions...
<FromGitter>
<sdogruyol> I really like Crystal being self-hosted
<FromGitter>
<sdogruyol> You can contribute back to Crystal itself from day 1
<Papierkorb_>
mfw more HTML than C++
<FromGitter>
<sdogruyol> lol
greengriminal has joined #crystal-lang
<FromGitter>
<krypton97> just messed up with boost, forgot how cpp feels like
<Papierkorb_>
I never used Boost.
<Papierkorb_>
Qt's stuff was perfectly fine. And much faster to compile (in C++ terms) too.
<FromGitter>
<bararchy> @ekremkaraca your Hebrew is good :) I wish I knew Turkish, only know some basic Arabic
rohitpaulk has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
ShalokShalom_ is now known as ShalokShalom
rohitpaulk has quit [Ping timeout: 240 seconds]
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
lapinferoce has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter>
<ekremkaraca> @bararchy no problem, sometimes I get help from Google translate :)
<FromGitter>
<ekremkaraca> I just know the alphabet and some phrases
snsei has quit [Remote host closed the connection]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
snsei has joined #crystal-lang
Papierkorb_ has quit [Quit: Konversation terminated!]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
greengriminal has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9]
rohitpaulk has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
ylluminate has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
lapinferoce has quit [Quit: Lost terminal]
weston1 has joined #crystal-lang
weston1 has quit [Ping timeout: 240 seconds]
mark_66 has quit [Remote host closed the connection]
<FromGitter>
<crisward> I'm parsing json, but sometimes a value is null, sometimes its a float and sometimes its an int. I'm checking for null, but `as_f` breaks if it's an int. Is there a nice way of handling this without lots of begin rescue blocks?
<FromGitter>
<sdogruyol> doesn't .as(Float32) works all the time?
<FromGitter>
<crisward> Ips is an object with a json mapping
<Papierkorb>
You want to use JSON.mapping always if possible. Makes working with JSON and friends much more fun after the initial "cost" of writing the host class
<Papierkorb>
bew, it doesn't make a lot of sense really. an abstract method is guaranteed to be implemented by an instance. a sub-class isn't an instance of an (abstract) class, it's a provider for an implementation
<FromGitter>
<bew> yeah I agree it doesn't make a lot of sense, but then we don't have a way to force the user to define a class method (when they include my module)
<FromGitter>
<bew> other than writing dumb methods that raises at compile time (and I'm not even sure it's possible)
<Papierkorb>
raising at compile time is forcing the user to do that, isn't it?
Groogy has quit [Disconnected by services]
Groogy2 is now known as Groogy
<Groogy>
Aaw yiz, one of our expansions launched without too much of a problem today! \o/
<FromGitter>
<bew> But it seems you can't even "include" class methods :/
<Groogy>
no you use extend
<Groogy>
don't you?
<FromGitter>
<bew> yeah https://carc.in/#/r/2rrl but it feels counter intuitive to write it like that
<FromGitter>
<bew> (a little)
<oprypin>
bew, class methods don't participare in inheritance. abstract class methods are impossible and that's not a coincidence
<FromGitter>
<bew> yeah I agree it doesn't make sens to call them abstract class method
<FromGitter>
<bew> but in case of a module, it ensures that classes including this module implement this or that method, would be interesting to also have this for class methods
<oprypin>
it's not about the name. you see that abstract class method does not exist then you try to do a workaround with the same functionality but it also doesnt work
<oprypin>
im not against abstract class methods but that's just how it is
claudiuinberlin has joined #crystal-lang
<FromGitter>
<Rinkana> @Googy are you going to the GDC next year?
<FromGitter>
<Rinkana> Groogy*
<Groogy>
Maybe
<Groogy>
I'll ask for it but if there's a junior that has never been I'm gonna let them go first
<Groogy>
I might just go for my own money though instead
<FromGitter>
<Rinkana> Alright. if you are going please hit me up. I'm probably going too
<Groogy>
Oh cool, where do you work?
<FromGitter>
<Rinkana> Creative Group. In The Netherlands. I was this year too @ GDC. I'm building my own engine in Crystal so it's all in my spare time (any money)
<FromGitter>
<Rinkana> And the GDC is not cheap either...
<FromGitter>
<Rinkana> It barely renders a cube atm
<FromGitter>
<Rinkana> But it's getting there :P
<Groogy>
I am currently working on text rendering with free-type :/
<Groogy>
that library seriously suuuuuuuck
rohitpaulk has joined #crystal-lang
<Groogy>
also huh you are using GLEW in your project?
<Groogy>
how are you using it?
<FromGitter>
<bew> TIL that you can use a variable and a method with same name in the same scope, like https://carc.in/#/r/2rrr
<FromGitter>
<bew> feels weird ^^
<Groogy>
yeah I try to avoid it as much as possible
<Groogy>
I would prefer compile error over it :/
<FromGitter>
<bew> me too, I'd see `::bla bla` for top level method, and `self.bla bla` for instance methods
<FromGitter>
<bew> but compile error for `bla bla`
<FromGitter>
<Rinkana> Groogy. I'm building everything by myself. Including the bindings. However I've only made the glew repo. It's not being used atm.
<FromGitter>
<Rinkana> I do see that we have two completely different coding styles
<Groogy>
yeah I noticed since everything is lazily bound you don't need GLEW
<Groogy>
since GLEW is there to help you avoid linkage errors
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy>
When Papierkorb gets closer to finish his bindgen tool I will probably make a opengl binding that does the GLEW linkage error handling for you
<Groogy>
I'm too lazy to deal with bindings
<FromGitter>
<Rinkana> But if you go to the gdc, let me know I loved it this year but next year I want to get more in depth with people that are in the industry
<FromGitter>
<Rinkana> My idea is to later convert it to a vulkan engine. But that's hard when you can't run it on a mac
<Groogy>
yeah also Vulkan is specificly targetted at like Ubisoft, DICE, etc.
<Groogy>
I have built mine with the thought it should *eventually* support Vulkan but really if you just want something on screen it isn't really worth it more than a "it is fun to do"
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter>
<Rinkana> Yeah, true that.
<FromGitter>
<Rinkana> It's somewhat awesome that I've found someone who is somewhat like minded about crystal and it's 3d capeabilities 😄
<Groogy>
Yeah ^^
<Groogy>
I tried doing 3D in Ruby, code looked really nice...
<Groogy>
problem was math...
<Papierkorb>
Groogy: Favorite chars from a game you worked on?
<Groogy>
fuuuck, I think FreeType needs me to also map the internal structures of the structs to work properly...
<Groogy>
Papierkorb our games don't really have chars... but maybe the shy molluscoid?
<Papierkorb>
Embedded structures? Of course, they need to be there .. Well, in more actual terms, their bytes needs to be their. If you don't care about them, and only want to make it work, `internal_foo: UInt8[<Correct run-time byte size here>]` is your friend.
greengriminal has quit [Quit: This computer has gone to sleep]
claudiuinberlin has joined #crystal-lang
<Papierkorb>
That's the "Dear Library, look how much I care: Just do it" hack
<Groogy>
Papierkorb, need to get this to work: error = FT_Render_Glyph( face->glyph, render_mode ) in Crystal
<Groogy>
and face so far has been like a handle :/
<Papierkorb>
Yeah fun times ahead
<Papierkorb>
Though to be precise, you just need the correct pointer to that.
<Papierkorb>
I mean copying the structure is totally how you're supposed to do it!
<Papierkorb>
No one forces you though lul
<Groogy>
:(
<Groogy>
gonna see if I can find something like FT_Get_Glyph_Slot or something
<Papierkorb>
If it's a scary big struct, you can 1) write a C wrapper function 2) just copy enough of the struct to make it work 3) do it the correct way and copy the whole thing 4) manually do pointerof + offset
<Papierkorb>
„God bless this mess“
<Groogy>
:flip:
<Groogy>
(ノ `Д´)ノ ~┻━┻
<Papierkorb>
Oh and for 1), as Crystal uses gcc as "linker", you can go lazy mode: Write the wrapper, and @Link directly your wrapper.c, instead of compiling it manually lul.
<Papierkorb>
I don't recommend it, but for PoC's .. who cares.
<Groogy>
I hate this sooo much ;_;
<Papierkorb>
Am packing stuff can't really look into it, sorry
<Groogy>
no I am just moaning about it to ease the pain