<FromGitter>
<bew> Directly you can't because there is a space, but you can make a converter that will replace the space by an underscore and run `MaritalStatus.parse` for it
<FromGitter>
<extremety1989> @schoening what kind of game is it ? can we play it?
<FromGitter>
<schoening> I am trying my hands on a multiplayer tank game. I can post it here in a moment, just gotta re-deploy. ⏎ I think I found the bug that crashes the server occasionally when a connection drops and it still looks for the socket + game_object in the hash so I wrapped it in #has_key? for now..
<FromGitter>
<extremety1989> @schoening fater you delploy,link it , i wanna see how much fps it has, never played games build with crystal ...
<FromGitter>
<schoening> Well the client side is non optimized and using canvas so it wont tell much yet :) but the server is at least 10 times faster than the typescript version.
<FromGitter>
<extremety1989> @schoening :)
<FromGitter>
<bararchy> @schoening Waiting too
<FromGitter>
<schoening> Haha.. the pressure is rising. Hopefully itll work
<FromGitter>
<schoening> Alright. Lets see how long before it crashes.
<FromGitter>
<schoening> Well damn. That was a fail. Something messed up :p
<FromGitter>
<schoening> Back to the drawing board, I post a bit later again...
<FromGitter>
<bararchy> lol it's dead
<FromGitter>
<extremety1989> haha
<FromGitter>
<extremety1989> @schoening is your server in digitalocean ?
<FromGitter>
<bararchy> well, not the worst publish event I have seen
<FromGitter>
<schoening> Yeah, I killed it, I messed something up. Thats typical when I try and showcase haha
<FromGitter>
<schoening> HAHA @bararchy
<FromGitter>
<schoening> yes @extremety1989
<FromGitter>
<schoening> Always found them very easy to work with + bitbucket
<FromGitter>
<schoening> Looks like it was a git pull that got messed up, but not enough for crystal to see a problem :p
<FromGitter>
<schoening> Ok, try again
<FromGitter>
<schoening> I havent added client side smoothing yet, so there is that ofc.
<FromGitter>
<bararchy> @schoening How do I shoot?
<FromGitter>
<schoening> You just get into range
<FromGitter>
<bararchy> oh
<FromGitter>
<bararchy> I get killed really fast, I want to buy upgrades
<FromGitter>
<extremety1989> i am 78
<FromGitter>
<bararchy> are there loot crates?
<FromGitter>
<bararchy> XD
<FromGitter>
<extremety1989> now 90
<FromGitter>
<extremety1989> 130
<FromGitter>
<schoening> Yeah, its the uuid of the game_object. Just for debugging
<FromGitter>
<schoening> Haha! Well, I was thinking to add health packs, and coins to upgrade, and seeker missiles you can pick up.
<FromGitter>
<extremety1989> how did you hide your javscript script game logic ?
<FromGitter>
<schoening> What do you mean
<FromGitter>
<extremety1989> you are using javscript in front end right ?
<FromGitter>
<schoening> Yes
<FromGitter>
<bararchy> What about naming your tank
<FromGitter>
<schoening> Yes, absolutely, there will be a login screen. Its all gonna be quite similar to other io games.
<FromGitter>
<schoening> But with a much better backend :p
<FromGitter>
<extremety1989> o i see
<FromGitter>
<extremety1989> compressed.js
<FromGitter>
<schoening> Yeah, but once I focus on the client side its gonna be TypeScript + WebPack
<FromGitter>
<extremety1989> what i do not like in javascript that everybody can not hide logic
<FromGitter>
<extremety1989> i mean everybody can see your game logic
<FromGitter>
<schoening> Yeah thats why I at least compressed it. But the client for this game is gonna be so dumb and everything is gonna be server side anyways.
<FromGitter>
<schoening> I tried using Construct 3 for client side, its a visual game editor. But it coulndt handle so many updates even with custom scripts. So I am gonna use Phaser3 I think.
<FromGitter>
<schoening> Cool. Well if this turns out great then I guess its my turn to write a blog post on the crystal website lol
<FromGitter>
<extremety1989> try to learn webgl2
<FromGitter>
<extremety1989> well damn difficult =(
<FromGitter>
<schoening> sentry is a godsend for developing btw.
<FromGitter>
<schoening> Damn. Still getting that key error.
TCZ has joined #crystal-lang
pabs has quit [Ping timeout: 264 seconds]
pabs has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
pabs has quit [Ping timeout: 256 seconds]
pabs has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
<FromGitter>
<fgimian> Hey guys, little one for ya
<FromGitter>
<fgimian> when the two lines are commented out above, the program simply hangs and waits forever
<FromGitter>
<fgimian> is that expected?
Yxhuvud has joined #crystal-lang
<FromGitter>
<fgimian> test.txt is a larger text file too
<FromGitter>
<fgimian> the file is 717 kb
<FromGitter>
<fgimian> another issue I'm seeing is, if I attempt to read the error output first (which is empty), the script also hangs, even if I have the lines uncommented
<crystal-gh>
[crystal] sdogruyol pushed 1 new commit to master: https://git.io/vh0J2
<crystal-gh>
crystal/master a64e603 Johannes Müller: Use qualified type Crystal::Path in compiler specs (#6071)
<FromGitter>
<anicholson> @fgimian hmm. I think `cat` would be buffering the output into the `output` pipe. It's not going to close the pipe until the process on the other end of it (your program) reads it in. Your program's not doing that, so there's a stalemate.
<FromGitter>
<anicholson> w.r.t. the second one, I'm guessing `gets_to_end` is a blocking IO call. It's hogging the main thread until it gets something. It doesn't, so your program hangs. I think you'd find that if you wrapped those in `spawn` calls (to put them in different Fibers) you wouldn't see this problem.
<RX14>
@fgimian thats expected
<RX14>
pipes have a limited fixed-size buffer
<RX14>
cat writes into the buffer, but if you don't read from the buffer it will fill up the buffer and wait for you to read from the buffer
<FromGitter>
<fgimian> interesting, thanks guys
<RX14>
which you never do, and the pipes dont get closed until cat exists
<RX14>
so you deadlock
<FromGitter>
<fgimian> I suppose the tricky thing is, if you're executing an external program, it's hard to know if it will write to stdout or stderr
<FromGitter>
<fgimian> so which one do you read first?
<RX14>
both
<RX14>
at the same time
<RX14>
using fibers
<FromGitter>
<fgimian> gotcha
<RX14>
alternatively, you can just pass an IO as the output and error arguments
<RX14>
for example... a String::Builder
<FromGitter>
<fgimian> very interesting problem indeed, I haven't come across it before tbh
<RX14>
and then it's nice and neat
<FromGitter>
<fgimian> gotcha, out of interest, why would that work as opposed to the pipe?
<FromGitter>
<fgimian> (forgive me if that's a stupid question)
<FromGitter>
<fgimian> I'm just looking at process.cr and trying to understand it as we speak in fact
<RX14>
because a String::Builder doesn't have a fixed sized buffer
<RX14>
it'll read up to 2 gigabytes
<FromGitter>
<fgimian> aaah wow
<RX14>
then fail in a nasty way
<FromGitter>
<fgimian> I see
<RX14>
because we have no overflow detection lol
<FromGitter>
<fgimian> also @anicholson thanks so much for the reply too
<FromGitter>
<fgimian> lol!
<FromGitter>
<fgimian> oh dear
<FromGitter>
<fgimian> :)
<FromGitter>
<anicholson> yw @fgimian - now you're set with pipes :)
<RX14>
internally Process.new with an IO uses a pipe
<RX14>
then spawns a fiber to read from the pipe and write in the IO
<RX14>
so really it's the same thing going on either way
<RX14>
it's just one is neater to write and already in the stdlib
<FromGitter>
<fgimian> awesome, really appreciate all the help!! 😄
<RX14>
note that also gets_to_end uses a string builder internally so it really is the same code just layed out differently
<FromGitter>
<fgimian> ah yes
<FromGitter>
<fgimian> I'll try out String::Builder now and see how I go
<RX14>
you can read how it works internally if you really want to understand it fully!
<RX14>
one of my favourite parts of crystal
<RX14>
reading the source is so easy
<FromGitter>
<anicholson> now it's my turn with a Q!:
<FromGitter>
<fgimian> thank you so much @faustinoaq 😄
<FromGitter>
<Blacksmoke16> i hope you did the crystal test with `--release` ;)
<FromGitter>
<svs> @fgimian you said precisely what was on my mind. Also I wanted to use a language with type safety but without union types it becomes very unweildy very quickly. I have the exact same problems with Go, Elixir, Rust..... Crystal just hits that sweet spot in terms of language design. Hope it lives long!
<FromGitter>
<fgimian> @Blacksmoke16 yep I did 😄
<FromGitter>
<fgimian> @svs awesome! me too 😄
<FromGitter>
<fgimian> I'll be honest, I hadn't heard of Crystal until very recently. I was basically looking at Nim as my choice.
<FromGitter>
<fgimian> And fortunately a friend of mine at work told me about Crystal
<FromGitter>
<fgimian> so it all worked out in the end
<FromGitter>
<fgimian> my team at work is using Elixir for all their new work, and they're quite happy with it; it fits their use case well
<FromGitter>
<fgimian> I personally work on platform automation, so mostly I'm dealing with Terraform, CloudFormation, Jenkins .etc, and some scripting in Python. My initial goal with Crystal is indeed automation for my own personal projects.
<FromGitter>
<fgimian> 😄
<FromGitter>
<Blacksmoke16> write a program to do your programming for you ;)
TCZ has quit [Quit: Leaving]
<FromGitter>
<fgimian> hahaha, that's what we all need 😄
duane has joined #crystal-lang
<FromGitter>
<S-YOU> Static binaries on OSX is actually possible, if you implement everything like Go 😄
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter>
<S-YOU> Nice to read that, @fgimian 👍
<FromGitter>
<sdogruyol> please submit your questions before the session :) It's gonna be fun
<FromGitter>
<fgimian> thank you so much @S-YOU 😄
TCZ has joined #crystal-lang
dragonkh has joined #crystal-lang
dragonkh has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<FromGitter>
<hugoabonizio> @sdogruyol 🎉
TCZ has quit [Quit: Leaving]
dragonkh has joined #crystal-lang
<ben___>
@fgimian great blog post 😊 🎉
<ben___>
Q&A is out of my time 😣 maybe I can switch for short views 😊
<FromGitter>
<schoening> Its not possible that an array is being modified while I am looping over it inside a fiber right? The program halts while the fiber executes?
akaiiro has quit [Remote host closed the connection]
<FromGitter>
<bcardiff> you need to add some type information in the block in this case
<FromGitter>
<Grabli66> Great thanks.
<FromGitter>
<j8r> I didn't understand the question 😅
dragonkh has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
pabs has quit [Ping timeout: 248 seconds]
pabs has joined #crystal-lang
<ben___>
@schoening Crystal isn't parallel yet, so you can do only one (blocking) thing per time yet - the scheduler times this, you can communicate via channels or switch via Fiber.yield
GoldenBear has joined #crystal-lang
dragonkh has joined #crystal-lang
<FromGitter>
<bew> @schoening if you have an IO operation or a sleep or a channel send/receive, it could change. Otherwise, no it won't change. (because Cr is not parallel)
sz0 has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
pabs has quit [Ping timeout: 240 seconds]
<FromGitter>
<bararchy> When RX14 finishes his new pchan shard it would be possible using that (to parallel)
<RX14>
no it wouldn't
<RX14>
because pchan has no shamed memory
<RX14>
shared*
<RX14>
ok - no shared heap
pabs has joined #crystal-lang
akaiiro has quit [Read error: Connection reset by peer]
<FromGitter>
<fgimian> Thanks so much ben__, sorry I had gone to bed 😄
<FromGitter>
<fgimian> @faustinoaq Thanks for the comment buddy, I got an email notification about it but for some reason it's not appearing on my blog page. Did you delete it by any chance?
<FromGitter>
<fgimian> Or is Disqus just being weird 😄
<faustinoaq>
@fgimian No, I didn't delete it :)
<faustinoaq>
@fgimian Maybe Disqus detected it as spam :-P
<OvermindDL1>
Disqus is very spam-detection happy, it hasn't caught any legit spam on my blog but it catches lots of legitimate postings... >.<
<FromGitter>
<fgimian> That's so weeeeeird, let me see what I can do. I'm so sorry about that, it was an awesome comment and I would really love to see it on my post.
<FromGitter>
<fgimian> @OvermindDL1 lol yeah
<OvermindDL1>
The owner can check the spam list in disqus though, but they get no message about it, have to manually check it, it's irritating
<FromGitter>
<fgimian> I'm just checking no, I haven't done it before so just trying to find it in the Disqus admin page