<< 08-02-2016 >>

00:00:22derkaHi guys
00:00:33filwithello
00:00:36derkaidlework what kind of game are you working on?
00:01:13ldleworkI just described it :P
00:01:44filwitderka: top-down, open-world, turn-based, explore + build + hunt, etc
00:01:52ldleworkyup
00:01:59derkacool
00:02:07derkaopen source
00:02:08derka?
00:02:29derkaisometric 3d ?
00:02:50*Matthias247 quit (Read error: Connection reset by peer)
00:03:00ldleworknot isometric for now
00:03:08ldleworkcan always add isometric rendering later
00:03:16derkaok cool
00:03:26derkaso like a gauntlet
00:03:38derkaearly days gauntlet
00:04:15ldleworkderka: I posted some screenshots above
00:04:25ldleworkof the look I'm going for
00:04:38derkacool
00:05:23derkanice
00:05:28derkahow long have you been working on it
00:07:20*vendethiel joined #nim
00:12:38ldleworkderka: two months or so in my freetime
00:13:48derkanice
00:19:40*Demon_Fox quit (Ping timeout: 245 seconds)
00:23:01gokrAraq: Perhaps you told me... but dynlib directive - what about a static library?
00:23:28filwitgokr: use --passL:<lib>
00:23:56filwit+ {.importC.}
00:24:10gokrSure, for the linking phase... but... don't I need something more than ... ok, so how do I get that one?
00:24:17gokrI use c2nim.
00:24:20*Demon_Fox joined #nim
00:24:22gokrIt only puts in cdecl.
00:24:43filwitoh, sorry. I've never used c2nim and know nothing about it :\
00:25:07gokrIt has the dynlib directive, but... that's for .so/dll etc. Not .a
00:25:35Araqmight indeed need a c2nim patch I'm afraid
00:27:30gokrHard?
00:27:35Araqnah
00:28:06gokrMy eyes are blurry anyway, so... something you might help within a day or two?
00:28:07Araqjust create a #staticlib that produces .importc and not the .dynlib
00:28:14gokrOk, I can try.
00:28:16*vendethiel quit (Ping timeout: 245 seconds)
00:36:07ldleworkIf you have a concept which takes a generic param.
00:36:10*jaco60 quit (Ping timeout: 260 seconds)
00:36:16ldleworkHow do you actually use that concept as a generic param
00:36:22ldleworknested generic params don't seem to work
00:36:29ldlework Tilemap*[Tile, GeneratorType[Tile]] = ref object
00:36:53ldleworkGeneratorType is a concept
00:36:58ldlework GeneratorType[Tile] = concept cg
00:39:22ldleworkLets say you have `proc foo[A, B]`, if B has a generic parameter, how do you specify it?
00:39:37ldleworkWhat if you want B's generic parameter to be the same type as A?
00:41:31Araqsimple: If they have to be the same only use [A]
00:41:49ldleworkB is not the same type as A
00:41:56ldleworkB is a generic concept
00:42:10ldleworkI want to do `proc foo[A, B[A]]` but can't
00:42:27ldleworkSo if you pass an int as the first parameter, you have to pass in a B[int]
00:42:35ldleworkas the second parameter
00:43:11gokrAraq: Testing it out.
00:44:52*schmebulock joined #nim
00:44:58*filwit quit (Quit: Leaving)
00:45:04*schmebulock left #nim (#nim)
00:45:09Araqldlework: since we don't have "higher kinded types" (template template params or whatever) the solution is to underspecify the generics
00:45:22ldleworkI was just realizing that...
00:45:38ldleworkOnly specify A, and then in the field definition just use blah: B[A] outright
00:45:40ldleworkinteresting.
00:46:00ldleworkis that what you meant?
00:46:01gokrAraq: Think it worked.
00:46:17*desophos joined #nim
00:46:28Araqgokr: create a PR and I will review it
00:46:32gokrsure
00:47:30ldleworkheh
00:47:32ldleworksigmatch.nim(691) typeRel
00:47:34ldleworksigmatch.nim(691) typeRel
00:47:37ldleworksigmatch.nim(626) typeRel
00:47:39ldleworkast.nim skipTypes
00:47:41ldleworkStack overflow
00:48:24Araqldlework: ouch
00:49:33ldleworkhttps://gist.github.com/dustinlacewell/92136d2ce1461d9641ac
00:53:15ldleworkbleh back to invalid type: 'GeneratorType' in this context: 'proc (app: App): GameScene'
00:55:59*darkf quit (Quit: Leaving)
01:04:41ldleworkI think I'm just gonna use methods for this.
01:07:38ldleworkIf anyone can get this to work, that'd be pretty cool: https://gist.github.com/dustinlacewell/4b0a85e3b477a2687d9c
01:07:52ldleworkbut I guess I don't understand concepts well enough to wield them yet
01:08:55ldleworkThe idea is that you have your own Tile type and your own Generator type. You create a Tilemap with them and the Tilemap will return Chunks of your Tile object as returned from the Generator object you pass to it.
01:09:04*francisl joined #nim
01:09:15ldleworkThe idea is that the Tilemap doesn't know ahead of time what Tile and Generator objects will be used so it can be used as library code
01:24:04*sheerun quit ()
01:30:50ldleworkAraq: with your "structural delegate" method replacement idea, if moduleA exports typeA and procA which takes typeA, and I consume typeA to create typeB as a delegate can I pass my typeB into the procA that takes typeA ?
01:31:15ldleworkAlso, how can I override specific procs and fields that should not be delegated?
01:31:28ldleworkHow to deal with collisions between delegate targets?
01:32:33Araqldlework: yes
01:32:44Araqand I dunno I think you can't
01:32:52ldleworkThat doesn't seem super useful then?
01:33:11Araqcollisions are handled by using the declaration order of the fields
01:33:13ldleworkAnywhere I could pass Parent I could just pass Parent.Child
01:33:28ldleworkIf Parent can't alter the behavior the Child I don't see the utility
01:34:00ldleworkAraq: something like, delegates defined earlier, or last, are chosen, etc?
01:35:22ldleworkLike if I call a proc `foo` why not just do overload resolution by trying to find a `foo(typeB)` before calling a `foo(typeA)` ?
01:35:32ldleworkIf B is delegating to A
01:36:03ldleworkIf there is no implementation for the aggregating type, then you start checking delegates in order, or reverse order or whatever.
01:36:12Araqyeah.
01:36:25AraqI guess I don't understand your questions
01:36:41Araqit just works (tm) like you think it would work
01:36:45ldleworklol
01:37:24Araqwe get multiple inheritance and dynamic binding with a single simple to implement mechanism that is also useful for wrappers
01:37:35ldleworkI was asking, if typeB is delegating to typeA and there is a proc foo implemented for typeA, and I call foo on typeB, it'll work. But what if I want to provide a typeB specific impmlementation.
01:37:51Araqit uses a V-table
01:37:55Araqlike C++.
01:38:10Araqit works like C++ in this respect I guess
01:38:28ldleworkAraq: I thought this is what I was getting in Go
01:38:36ldleworkBut they go half-way
01:39:24ldleworkOr was it Rust, I forget.
01:40:14ldleworkusing 'of RootObj' and the 'method' keyword is really easy. I hope this could be made as nice to use.
01:45:15*ThePythonicCow quit (Quit: ChatZilla 0.9.92 [Firefox 44.0/20160123151951])
01:48:39*yglukhov joined #nim
01:53:30*yglukhov quit (Ping timeout: 256 seconds)
02:00:05*derka quit (Ping timeout: 276 seconds)
02:00:36*derka joined #nim
02:05:40*derka quit (Quit: derka)
02:05:57*Varriount joined #nim
02:07:52*Varriount_ quit (Ping timeout: 250 seconds)
02:13:53*brson quit (Quit: leaving)
02:17:16ldleworkgar I just ran into the thing where
02:18:30*vendethiel joined #nim
02:18:44ldleworkif you have library module which exports a base type L and you create a subtype L' and implement a method for it, when the library module calls the method on the L' instance you pass to it, it will not call your overloaded method.
02:18:51ldleworkSince the library module never imports your module.
02:18:54ldleworkDamn that's frustrating.
02:20:03ldleworkAnyone have any advice related to that?
02:21:52ldleworkI don't wanna pass around procvars
02:23:14ldleworkI suppose that's the only way
02:23:26ldleworkto get a library module to execute methods on a subtype
02:23:38ldleworkbecause otherwise how would the library module ever know about thoe methods
02:23:43ldleworkoh god method keyword
02:23:58ldleworkeh I'm using method keyword
02:26:14ldleworkyay
02:40:40*vendethiel quit (Ping timeout: 252 seconds)
02:53:40*ryu0 joined #nim
02:59:31*quark1 quit (Ping timeout: 245 seconds)
03:03:39*ryu0 left #nim ("WeeChat 1.0.1")
03:27:26*gokr quit (Quit: Leaving.)
03:30:23*dashed quit (Quit: Connection closed for inactivity)
03:34:32*pregressive joined #nim
03:43:36*ephja quit (Ping timeout: 250 seconds)
03:50:13*yglukhov joined #nim
03:54:09*yglukhov quit (Ping timeout: 240 seconds)
03:56:40*endragor joined #nim
04:02:26icsSo constructors and UFCS -> undeclared routine
04:08:43Varriountics: ?
04:19:29*ThePythonicCow joined #nim
04:23:12icsVarriount: I was following along with the "object variants" part of the manual, with an enum type and another to wrap it with extra fields
04:23:52*ThePythonicCow_ joined #nim
04:23:57icsIt uses a case statement to look at kind (first parameter) and do something based on that
04:25:53icsI just wanted to see if I could call kindThing.Constructor(field2, field3) instead of Constructor(kind: kindThing, x: field1, y: field2)
04:26:36icsBut it turns out they all need to be named anyway, so Constructor(kindThing, field1, field2) doesn't work either
04:28:55*Demon_Fox quit (Read error: Connection reset by peer)
04:29:16*Demon_Fox joined #nim
04:36:58*vendethiel joined #nim
04:45:23*ThePythonicCow_ left #nim (#nim)
04:50:58*yglukhov joined #nim
04:51:47*ThePythonicCow_ joined #nim
04:52:19*ThePythonicCow_ left #nim (#nim)
04:54:21*francisl quit (Quit: francisl)
04:54:46*ThePythonicCow_ joined #nim
04:55:03*ThePythonicCow_ left #nim (#nim)
04:55:21*yglukhov quit (Ping timeout: 240 seconds)
05:00:06Varriountics: Ah.
05:00:20*vendethiel quit (Ping timeout: 248 seconds)
05:12:52*endragor quit (Remote host closed the connection)
05:14:38*endragor joined #nim
05:14:49*gour joined #nim
05:28:06*pregressive quit (Remote host closed the connection)
05:34:04*s4 joined #nim
05:52:06*lompik quit (Ping timeout: 240 seconds)
05:57:26ldleworkdef-: is there anyway to deserialize reference types with the json module?
05:57:45ldleworkor rather with the marshal lib
06:26:10*s4 quit (Quit: Konversation terminated!)
06:39:02*vendethiel joined #nim
06:52:28*yglukhov joined #nim
06:53:41*derka joined #nim
06:56:45*yglukhov quit (Ping timeout: 245 seconds)
07:01:32*derka quit (Quit: derka)
07:04:46*ThePythonicCow left #nim (#nim)
07:20:16*vendethiel quit (Ping timeout: 250 seconds)
07:32:56*ThePythonicCow joined #nim
07:34:47*filcuc joined #nim
07:42:41*vendethiel joined #nim
07:44:06*toaoMgeorge quit (Ping timeout: 250 seconds)
07:57:08*endragor quit (Remote host closed the connection)
08:04:21*Trustable joined #nim
08:15:45*endragor joined #nim
08:31:41*yglukhov joined #nim
08:45:25*gokr joined #nim
08:52:59*sjums left #nim ("Leaving")
08:58:21*Demon_Fox quit (Quit: Leaving)
09:12:36*apotheon quit (Ping timeout: 248 seconds)
09:23:38*coffeepot joined #nim
09:23:41*Arrrr joined #nim
09:25:22*toaoMgeorge joined #nim
09:26:13*coffeepot quit (Client Quit)
09:27:22*coffeepot joined #nim
09:27:22*coffeepot quit (Client Quit)
09:27:38*coffeepot joined #nim
09:44:27*sheerun joined #nim
09:44:41*jaco60 joined #nim
09:48:14*derka joined #nim
10:12:43*apotheon joined #nim
10:19:25*desophos quit (Read error: Connection reset by peer)
10:42:42*endragor quit (Remote host closed the connection)
10:43:43*filcuc quit (Read error: Connection reset by peer)
10:44:01*filcuc joined #nim
10:51:13*darkf joined #nim
10:57:10filcucare there updated on the channel module..i heard some time ago that it wasn't in a good shape
10:57:54filcucand that it was slow..is it still true? is planned something, maybe a new module to replace it?
10:58:38AraqI have a patch to improve its performance and interface quite a bit
10:59:21filcucAraq: nice to know that ;)
10:59:34Araqand it was on par with spawn anyway, so it's not that slow
10:59:57Araq"slow" mostly means that it doesn't use lockfree stuff
11:02:41filcucAraq: ok
11:11:23coffeepotSo... is Nim getting a PHP backend target?
11:13:40*endragor joined #nim
11:14:22*derka quit (Quit: derka)
11:23:15ArrrrYes, and yet you have to forward declare types.
11:24:13AraqArrrr: maybe I get paid for the PHP backend and not for the removal of forward decls?
11:24:39Araqdid it ever occur to you what it implies to have to live from the software you write?
11:25:48ArrrrOK, i didnt know you were paid for that, sorry.
11:26:00gourAraq: that's so obvious for PHP backend and i'm glad you can pay (some) bills with Nim ;)
11:29:25*iamd3vil joined #nim
11:29:55coffeepotWell this is great news. Never coded a line of PHP in my life but it makes me more certain that Nim is shaping up to be a fantastic 'master' language with all these backends. It's also great news that people are willing to pay to get Nim to expand into other areas.
11:30:54coffeepotc, c++, javascript, llvm(?), PHP, quite a nice selection
11:33:43filcucAraq: has it been announced somewhere? glad to hear that
11:38:39filcuceven if i hardly understand the need for a "server side" language given that you can do the same directly with nim
11:41:21Araq1. the PHP backend is a "mod" of the JS backend. It was cheap to develop and it means bugfixes already affect both the PHP and the JS target
11:41:38AraqIMO a brilliant hack.
11:41:38wuehlmaus... the more i think about it the more i like that the re module is still with nim btw.
11:42:06wuehlmausfor me it feels easier than the nre module even if it is not that capable
11:42:09Araq2. the PHP is not officially supported, I don't plan to document it, nor do I accept bug reports for it
11:42:41Araqexcept of course if they come from my coworkers ;-)
11:43:42Araqso ... I didn't see to announce if officially. and fyi I get paid for lots of other things as well many of which are really useful for the Nim community. The rewrite of the LL comes to mind.
11:44:08Araqrelax, be happy, Nim is only getting better.
11:48:20*derka joined #nim
11:55:24*regtools quit (Quit: leaving)
11:57:53*filcuc_ joined #nim
11:59:10*filcuc|2 joined #nim
12:00:33*filcuc quit (Ping timeout: 240 seconds)
12:02:37*filcuc_ quit (Ping timeout: 276 seconds)
12:04:15*jaco60 quit (Ping timeout: 240 seconds)
12:04:25*iamd3vil left #nim ("Leaving")
12:49:53*BitPuffin joined #nim
13:01:55*yglukhov quit (Ping timeout: 240 seconds)
13:13:45*filwit joined #nim
13:17:21*Ven joined #nim
13:28:02*derka_ joined #nim
13:30:05*derka quit (Ping timeout: 245 seconds)
13:30:06*derka_ is now known as derka
13:32:12*vangroan joined #nim
13:32:56*Arrrrr joined #nim
13:35:10*Arrrr quit (Ping timeout: 252 seconds)
13:35:49filwitAraq: quick questions. When overloading `=` we cannot make the RHS mutable. Is that for some security reason?
13:36:02filwiter.. 'safety' reason
13:36:41Araqit's an oversight
13:36:42Araqbbl
13:37:01*vendethiel quit (Ping timeout: 245 seconds)
13:38:34*junw joined #nim
13:39:48*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:40:06*Ven joined #nim
13:41:21*Ven quit (Client Quit)
13:49:46*Sembei joined #nim
13:52:19*Ven joined #nim
13:54:05*Ven quit (Client Quit)
13:56:52*ephja joined #nim
13:57:40*Ardethian joined #nim
13:57:44*Ardethian left #nim (#nim)
14:01:20*yglukhov joined #nim
14:03:29*lg_ joined #nim
14:04:49*TheManiac quit (Remote host closed the connection)
14:09:25filwitcrap.. it's really hard to avoid undesired recursive maco calls when overloading `.` .. is there some way to enforce that the macro wont be called again on the AST it outputs?
14:10:08*M-max joined #nim
14:11:32*NoOova joined #nim
14:12:20filwiteg, i'm playing with overloading `.` via macro which will delegate field/call access to an object's select members.. but the problem is it often needs to output a newDotExpr() itself.. which in turn calls the macro again, forever, until the compiler complains
14:12:21NoOovaEugene Zaitsev?
14:20:10filwithmm... nevermind I was doing something wrong..
14:22:19filwithmm... nevermind I was doing something wrong..
14:22:25filwitdamn alt-tab...
14:24:35*zaquest quit (Quit: Leaving)
14:26:46*zaquest joined #nim
14:39:32*lompik joined #nim
14:41:25wuehlmaushas somebody considered the possibility of a "nim playgruond" as a webpage or is it available already? a friend of mine just said that he does not understand that even when nim has everything that it needs for this case there is no single playground available
14:46:22lg_NoOova: I'm Evgeny Zaitsev, but how do you get to know?
14:47:30*M-Quora joined #nim
14:50:28*gokr quit (Quit: Leaving.)
14:53:20coffeepotwuehlmaus there was a nim playground type website around before, but I think there was a problem with it.
14:59:35*lompik quit (Ping timeout: 240 seconds)
15:02:04*endragor quit (Remote host closed the connection)
15:12:33*vangroan quit (Ping timeout: 240 seconds)
15:15:42*vendethiel joined #nim
15:15:58*silven quit (Remote host closed the connection)
15:16:26*Dildosan joined #nim
15:17:12*silven joined #nim
15:20:02*zaquest quit (Read error: Connection reset by peer)
15:20:33*zaquest joined #nim
15:22:53*jaco60 joined #nim
15:23:49*Ven joined #nim
15:23:54*Ven quit (Client Quit)
15:25:49filwitcool, just made an auto-dispatch macro for object composition as an alternative to multi-inheritance
15:25:51filwithttps://gist.github.com/PhilipWitte/ff8cc26d76e962591a48
15:26:29*Dildosan quit (Quit: Leaving)
15:27:05filwitmacros.getType() is awesome, love that ability of Nim's macros.. makes doing odd magic stuff like this really easy
15:28:18*Ven joined #nim
15:28:23*silven quit (Remote host closed the connection)
15:29:40*silven joined #nim
15:31:03*saml joined #nim
15:36:33*vendethiel quit (Ping timeout: 240 seconds)
15:41:35*vendethiel joined #nim
15:41:37coffeepotfilwit: that's pretty interesting
15:42:16coffeepotand neat example
15:43:41*endragor joined #nim
15:44:19filwitcoffeepot: yeah it's an examples I've seen before on why multi-inheritance is good (you can't make a KillerRobotDog easily without it), so that's why I tried this... although I did this because of the VTable example Araq posted last night, and this technique could easily be applied there too as an alternative to Nim methods
15:51:32Araqcoffeepot: I asked you to review the odbc PRs, right?
15:55:08*pregressive joined #nim
15:56:29coffeepotyeah you did, on the assumption that I wrote odbc_db, which I didn't. As I said before I can have a look but I'm unfamiliar with the module
15:57:34coffeepotAraq: Can you send me a link to the PR?
16:00:38coffeepotfilwit: I used to be a huge OO fan and shrugged off architecture complexities that came with it. I pined for something like multiple inheritance, but after coming to Nim realised how much easier composition is in a language that allows metaprogramming. Gamedev in particular I've found is not OO friendly, where items often need to share information
16:00:38coffeepotnot from a common route.
16:03:20*vendethiel quit (Ping timeout: 250 seconds)
16:03:24*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:04:34filwitmeh, I still think multi-inheritance is often a better design that composition, but not always.. i mean, it IS composition, just done for you. And object inheritance/composition still work well with game dev stuff.. it's just you can't paint your entire picture with one brush and expect the best results.. but that doesn't mean you don't want multiple brushes at your disposal.
16:07:31coffeepotthat's true, I guess it's just that in the past I've designed an object hierarchy then at some point realised that it just didn't work and had to start again. As you say you can use multiple roots but usually I don't actually care about what came from what, I just want to know if it supports an operation or a bit of data. I agree though, multiple i
16:07:31coffeepotnheritance is an easy way of doing composition, assuming nothing clashes ofc!
16:07:52filwitcomponents "should" not rely on inheritance in game-dev mostly for efficiency reasons. Eg, divide your entity data up for more efficient processing.. so yeah I completely agree you OOP (eg, ref-objects with overloadable dynamic dispatch) is not the best design for a lot of game code... but there are a lot of systems in the engine that don't need to follow that design, and can still use OOP patterns just fine
16:08:25coffeepoti think from what I've seen, we'll end up with some macro 'standard' to do composition as you've demoed above
16:08:59coffeepotit was a while before Nim had a way to access the super class in OOP
16:09:46filwityeah, maybe. though personally I would argue to just put these types of libs in Nimble instead.. cause often you'll have multiple ones with slightly different design goals, and that's a good thing
16:10:19filwitbut i agree, a robust lib like that would be handy for everyone to have easy access too
16:10:48coffeepotdividing your entity up is great, but aside from cache hits with pointers that ref stuff far away in memory, I don't think it's a HUGE hit. I mean, I'm writing an ECS atm where all the components are loaded from hashtables! How slow is that by comparison! Still works well enough at the moment though
16:11:15coffeepotdefinitely agree to put them into nimble
16:11:48coffeepotI've been turned by the slim std-lib philosophy, since nimble is so accessible
16:12:20*pregressive quit (Remote host closed the connection)
16:12:49*pregressive joined #nim
16:13:42coffeepotthere's often people asking about OOP and functional approaches, be great if they could just be pointed to an OOP module to use
16:14:50filwitabout OOP limitations (because I used to be all OOP gung-ho too), I think often people use languages like Java/C# (with single inheritance) that heavily promote using inheritance (ie, virtual functions = overloading) to accomplish everything.. that's where people's confusion and problems stem from with OOP
16:15:25coffeepotby the way, how is your ECS coming along? Do you have a benchmark of number of entities to be processed that you're aiming for?
16:15:51coffeepotfilwit: definitely, and I think I was one of those too
16:16:06coffeepotI think that's partly because there's no other way to do it in those langauges
16:16:40coffeepotit helps if your language has a good ability for compiletime evaluation too
16:16:58filwitit's coming along, and I've only done preliminary benchmarks (since my entire concept about ECS changed not long ago). I'm have a few goals that are somewhat difficult to explain in full over chat..
16:17:55coffeepotI'm aiming for about a hundred thousand entities at a time. I don't think I'll get there with my current approach. At around 10,000 comfortably IIRC
16:19:22coffeepotI really need to sit down and work out how to leverage shaders to do some work for me though, I think you could probably get millions of entities running, depending on what they're doing of course
16:19:25filwityeah I don't fully understand how your system is working... but doing a hash-table looking per-component doesn't sound fast :\
16:19:35coffeepotit's not it's well slow! :D
16:19:43coffeepotit was more of an experiement really
16:19:50ArrrrrWhat are those 10k entities?
16:20:02filwitwait, how would you use shaders to do work for a ECS?
16:20:13Araqwell it simulates how Python does it
16:20:17coffeepotalso I was reading about how the ashley ECS works and thought I'd try it out. I should go back and read it again though
16:20:51filwityou can do skeletal animation via texture+shaders, but only because all data for that can exist on the GPU.. but and ECS needs to exist in system memory
16:22:08coffeepotArrrrr: most of the 10k are particles, so no collision and only simple physics
16:22:21filwitAraq: who where you responding too?
16:22:36Araqcoffeepot's hash tables
16:22:43filwitkk
16:23:08coffeepotfilwit: well from what I've read you can do broadphase on the gpu, and simple physics stuff
16:23:30ArrrrrDo you need those particles to be entities?
16:23:44coffeepotnope :)
16:23:53coffeepotbut hey it's a good performance test!
16:24:16Arrrrrmm
16:24:19*filcuc|2 quit (Read error: Connection reset by peer)
16:24:36*filcuc|2 joined #nim
16:25:20filwitcoffeepot: either way, I don't think that's a good trade. [1] you'll use up very critical CPU->GPU bandwidth that [2] is going to be maxed out with new DX12/Vulkan APIs which will easily allow apps to be GPU bound, so keeping all ECS processing on the CPU is probably much easier and a net-gain in performance when all is said in done (depending on the application of course)
16:25:31coffeepotideally I think particles should be on the gpu as they're not really interactive and simple physics in my case. However I've never written a shader so big learning curve
16:26:01filwitoh i see, you're talking about particles..
16:26:40coffeepotfilwit: I do agree with that, but hey why not both? :D
16:27:03coffeepotif the system can offload to a shader for particles yet you can code it as if it were an entity
16:27:24filwityes, with particles and animation, since all data for those can exist in GPU mem with only higher level booking required for those systems (eg, this is is "playing this animation" or this particle spawner is "emiting since..", etc) then you can get a lot of gains doing it all on the GPU (so I've read)
16:28:16filwitI just saw an 8-mil OpenGL particle system posted the other day.. or was taht 8-bil...
16:28:25filwit(using GPU only processing)
16:28:46coffeepotnice :)
16:28:55*Arrrrr quit (Ping timeout: 240 seconds)
16:29:01coffeepotstuff like this: http://nullprogram.com/blog/2014/06/29/
16:29:06coffeepotphysics on the gpu
16:29:26coffeepotimo, having millions of particles in itself can lend itself to some awesome game ideas
16:29:39filwitnah, had to be million.. billion is insane..
16:30:01coffeepotyeah don't think we'd reach a billion if only for memory!
16:31:11filwitcoffeepot: you just reminded me of this: https://www.youtube.com/watch?v=ffgRC3kvA_k
16:31:25filwitpretty sure that's all GPU processing too
16:31:37coffeepotI'm thinking if I use actual composition instead of loading data components from a hash lookup (for EVERY entity operation) I could probably reach 100k no probs
16:32:09coffeepotoh wow, that's some tasty physics on that vid :)
16:32:36coffeepotnice.
16:32:42filwitcoffeepot: yeah I was going to say before that I think just putting your components into objects would be faster than splitting them up and using a hash-table to access each one
16:33:08coffeepotholy crap yes
16:33:13coffeepotloads faster
16:33:44coffeepotthere are some advantages with using an id system to look stuff up, but not really in nim where we have access to low level optimisations anyway
16:35:04coffeepothaving said that, intsets are very fast
16:35:53filwityeah the only reason to split things up is if you want the performance gains of placing things in continuous memory blocks.. and if you don't do that right it's probably slower and harder to work with overall... but again, I really don't know how your system works, so I'm not sure that's good advice :P
16:36:26*Arrrrr joined #nim
16:36:44coffeepotI use intsets for task/job lists for entities and hashtables for data, where the Data type in inherited.
16:37:14coffeepotyeah it started as an experiment and I just kinda had to finish it off as a matter of principle :)
16:38:14coffeepotin terms of optimisation it's the worst. Every entity operation needs to perform multiple hash lookups and then fetch data from all over the place. Often this happens repeatedly in the same entity operation (eg getting multiple components)
16:38:20coffeepotthere is one advantage though...
16:38:28coffeepotI can add/remove data and tasks at runtime :)
16:40:04coffeepotit's still somehow fast enough to handle thousands of entities though!
16:40:34filwityeah, power to native code on moder hardware :)
16:40:42filwitpower *of*
16:40:49coffeepotyeah, quite!
16:41:01coffeepotand of choosing the right implementation, mind
16:41:21filwitbtw, yu can add/remove components with continuous arrays too.. it's just how you do that is more complicated..
16:41:33coffeepotwhen i was using hashtables to store the list of entities that needed updating for a task, it was REALLY slow. Intsets basically made it workable
16:42:13coffeepotcontinuous array? Of component objects?
16:42:32filwitI still don't know what you mean by using intsets for tasks/jobs, but I'm going to start working on other things now
16:42:40filwityes, of component objects
16:43:22filwiti'd love to talk about this kind of thing all day, but I should do something more practical now
16:46:15coffeepotlol okay yeah I need to go soon anyway. What I meant was for each 'task' (collision detection, rendering, physics, etc), I make a list of all the entities that are registered. This was stored in a Table[EntityID, seq[Entity]]. Later I used a Table instead of the seq as I needed to quickly delete entities from the task list when they were killed. Th
16:46:15coffeepotis was really slow and adding/deleting entities became a huge bottleneck. So, I replaced the seq[Entity] with an IntSet, as the entity ID *is* the entity, and gained an order of magnitude speed up.
16:46:39coffeepotYeah love talking about this too, catch you another, less practical, time :)
16:47:38coffeepotmight try a seq[Data] though, could probably get another huge speedup from that rather than retrieving it from tables
16:48:22filwitsorry, brb
16:48:34*Arrrrrr joined #nim
16:49:42*Arrrrr quit (Ping timeout: 250 seconds)
16:51:04filwitcoffeepot: i see. okay, ttyl
16:53:25coffeepotl8rs :)
16:55:00*avsej quit (Quit: Quit)
16:57:26*avsej joined #nim
16:57:26*avsej quit (Changing host)
16:57:26*avsej joined #nim
17:04:46*M-max quit (Quit: node-irc says goodbye)
17:04:51*xiaojun joined #nim
17:06:19xiaojunsuggest:keyword let change to val, like scala
17:07:33ephjawhy?
17:11:24*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
17:12:29*xiaojun quit (Quit: Page closed)
17:14:02*gokr joined #nim
17:20:55ArrrrrrAnd how would be call val then?
17:20:56*filcuc|2 quit (Read error: Connection reset by peer)
17:22:09Xewhat are the `->` and `=>` macros?
17:22:52Arrrrrrlook into the future module, sugar for anon procs
17:25:06Xemm
17:25:09Xecool
17:39:04icsIs it possible to "rename" the fields in a tuple? sequtils.zip produces a tuple[a, b] I just can't find the right place to do a type conversion. let vs = (seq[tuple[x, y: float]])(zip(fooList, barList)) is invalid
17:41:31Arrrrrrmm, try 'let seq[tuple[x, y: float]] = zip(fooList, barList)'
17:42:24ldleworkwhat
17:43:35icsAraq: type mismatch
17:44:39icsError: type mismatch: got (seq[tuple[a: float, b: float]]) but expected 'seq[tuple[x: float, y: float]]'
17:45:33Arrrrrrit works with casting ... http://ideone.com/Twjew8
17:45:40ArrrrrrI wouldn't recommend that anyway
17:45:41ldleworkOf course it does
17:45:58ldleworktuple[x,y: int] and tuple[a,b: int] are two different types
17:49:39Araquse tuples without field names to gain compatibility
17:52:59*yglukhov quit (Ping timeout: 264 seconds)
17:57:17*ics mixed up names above
17:57:52*derka quit (Quit: derka)
17:58:04icsHmm
18:01:57icsAraq: where do you mean?
18:02:38icsI'm not accessing the values directly
18:03:06icsRather, I have a type alias like `type Coord = tuple[x, y: float]`
18:05:46*sjums joined #nim
18:06:14icsand the output type of my function is seq[Coord] which doesn't work because it returns the output of a zip
18:06:29*ics is thinking out loud
18:06:37ldleworkAraq: maybe tuples would be a good place to start with regards to structural equivalancy or whatever you were talking about a couple days ago.
18:08:09icsI would expect the order of tuple values to matter (obviously) but the field names... well something nicer than cast
18:10:08ics(Until I read the part of the manual which says "The names of the fields also have to be identical.") :)
18:10:53ldleworkhehe
18:11:14*hh_ joined #nim
18:11:52*hh_ quit (Client Quit)
18:11:52*sjums left #nim ("Leaving")
18:12:57*derka joined #nim
18:15:42*brson joined #nim
18:15:44icsproc zipFooey*[F,T](seq1: seq[T], seq2: seq[T]): F
18:16:10icsworks with zipFooey[seq[Coord], float](listA, listB)
18:17:08icsI haven't really gone through the syntax for generics so maybe there's a better way to do or wrap that
18:18:31icsBut hey, it compiles...
18:18:31*endragor quit (Remote host closed the connection)
18:21:10*endragor joined #nim
18:32:06*yglukhov joined #nim
18:32:54*yglukhov quit (Remote host closed the connection)
18:34:59*vendethiel joined #nim
18:37:53*endragor quit (Remote host closed the connection)
18:41:01*Matthias247 joined #nim
18:41:21Araqtype Coord = (float, float)
18:41:42Araqif you don't give a fuck about tuple field names, don't use tuple field names
18:42:16Araqldlework: that's already done.
18:42:50Araqand we used to ignore field names completely. the results were horrible
18:43:19Araqso now tuples without field names are compatible to tuples with names
18:43:36Araqbut if both tuples have names, these need to be identical.
18:46:11Araqoh and sequtils.zip shouldn't return fields ... we need to change that
18:46:39icsThat's what made me curious
18:47:03icszip returning fields
18:47:33*endragor joined #nim
18:53:16avsejI'm doing 'nim c -r src/nimble install' and getting error "nimblepkg/nimscriptsupport.nim(8, 11) Error: cannot open 'compiler/ast'". What I did wrong?
18:53:37icsOh, what went wrong with ignoring tuple field names? Seems bad for the general case but somewhat useful as a separate type... but I don't really know what I'm doing so...
18:54:03ldleworkics: `cast[]()` is how you explicitly ignore field names :)
19:01:00icsIdlework: Something between flipping off the compiler completely and ignoring field names could be nice though, esp. in the case of library functions like zip returning "plain" types
19:01:20icsmaybe `sprinkleGlitter[tuple[x, y: float]]()`
19:03:45*yglukhov joined #nim
19:06:14Araqzip should just be fixed.
19:06:27Araqavsej: I wish I knew
19:07:28avsejAraq, nevermind, seems like my rpm does not install compiler/*.nim stuff. I have to upgrade specfile
19:17:59*Arrrrrr quit (Quit: WeeChat 1.2)
19:18:26*BitPuffin quit (Ping timeout: 240 seconds)
19:18:27icsAraq: Nice, so guessing `var namedTup: tuple[x, y: float] = zipReturn()` would work after?
19:18:47Araqyeah
19:23:11*ics Day 5 or so trying Nim; {.deprecated.} all my dumb wrapper functions today.
19:27:52*Varriount_ joined #nim
19:27:52*Varriount quit (Disconnected by services)
19:28:19*avsej quit (Quit: Quit)
19:28:32*yglukhov quit (Ping timeout: 276 seconds)
19:31:50*avsej joined #nim
19:32:12*avsej is now known as Guest48990
19:37:51*endragor quit (Remote host closed the connection)
19:38:28*yglukhov joined #nim
19:50:32Araqlol, why?
19:54:49*g_ joined #nim
19:55:12*g_ is now known as Guest16325
19:57:06*derka quit (Ping timeout: 240 seconds)
19:58:50*derka joined #nim
20:02:50*yglukhov quit (Read error: Connection reset by peer)
20:05:47*yglukhov joined #nim
20:12:24icsAraq: me? Most of them were for library stuff I didn't understand yet (like named tuples).
20:13:23*silven quit (Ping timeout: 264 seconds)
20:13:58*silven joined #nim
20:16:03*sheerun quit ()
20:16:45icsReally liking Nim though... am not a developer, but the libraries are pretty easy to read, syntax is good, and the speed is great even with a very naive idea of what I want to accomplish.
20:25:04*sheerun joined #nim
20:39:51*Guest16325 quit (Quit: Page closed)
20:41:50*lqdc joined #nim
20:53:04*yglukhov quit (Remote host closed the connection)
20:59:05Xeis there a way to turn off the GC for a specific variable?
21:00:23ephjahow is that different from manual memory management?
21:03:14Xebasically i have a pointer to memory from another garbage collected environment (Go) and I am getting a bus error sometimes when the Nim GC decides to free the Go allocated memory
21:07:24ephjaby pointer you mean reference?
21:08:04ephjaprobably somewhere in the chain
21:08:14ephjayou probably want to modify the reference count then instead
21:08:35ephjawith GC_ref and GC_unref http://nim-lang.org/docs/system.html#GC_ref,ref.T
21:18:04Xeephja: https://git.xeserv.us/xena/twtxtlist/src/master/src/time/gotime.nim#L3
21:19:55Xewhich is this function in Go
21:19:58Xehttps://git.xeserv.us/xena/twtxtlist/src/master/src/time/time.go
21:27:12*gour quit (Quit: WeeChat 1.4)
21:30:36*Dildosan joined #nim
21:39:03*Dildosan quit (Remote host closed the connection)
21:41:38*Dildosan joined #nim
21:44:20*filcuc joined #nim
21:44:56filcucis there a way for making an object from the GC not movable?
21:46:12*sheerun quit (Ping timeout: 272 seconds)
21:47:08filcucif not, how can i safely pass a pointer to a nim object to C and be sure that the object is not moved from nim GC?
22:07:34Varriount_filcuc: Uh, the GC doesn't move objects.
22:08:05Varriount_filcuc: Or at least, the default GC doesn't.
22:09:41ephjaXe: you call GC_ref before passing in the pointer, so that the reference count doesn't reach 0, and then optionally call GC_unref when the pointer isn't used anymore
22:10:12ephjafilcuc: I think that might be relevant to you. it was the last thing we discussed before you joined :p
22:11:51*desophos joined #nim
22:12:22ephjaXe: wait a second
22:12:54ephjaI'm pretty sure that strings are copied before converted to cstring
22:17:11Araq1. conversion to cstring doesn't copy.
22:17:22Araq2. omg, use 'ptr' to interface with Go's memory.
22:17:24Varriount_Strings and sequences are copied on assignment. cstring conversion isn't.
22:17:45XeAraq: how would I use `ptr` here?
22:17:46ephjaI just noticed that
22:17:49*Varriount_ is now known as Varriount
22:18:07ephjawhy not? wouldn't it be better to have to use cast?
22:18:09filcucephja: if still relevant it's a little different story
22:18:28Varriountephja: What would your cast be?
22:18:32filcucin my case i must ensure that object is not relocated by the GC
22:18:46Varriountfilcuc: The GC doesn't relocate anything.
22:18:49filcucthis depends on the GC internals
22:18:55ephjacast[cstring](str[0].addr)?
22:19:41Varriountfilcuc: The GC is a reference counting, *non-compacting* GC.
22:19:50filcucVarriount: nice to know that, but it was not predictable
22:19:51Araqephja: maybe, but the conversion is even implicit for convenience.
22:20:15Varriountfilcuc: What do you mean by 'not predictable'?
22:21:48ephjaand in case of compacting GC's? would you control that with a flag?
22:22:14filcucVarriount: i mean that it's a detail on the GC. For example the D GC has a flag for marking a node not movable
22:22:21filcucthe same applies for C#
22:22:39Varriountephja: As far as I know, there aren't any compacting GC's for Nim, mainly because the entire standard library relies on objects not being moved.
22:22:48filcucbasically i didn't how the nim GC works :P
22:22:49ephjafilcuc: I assume it wouldn't become the default without warning
22:22:57filcucknow
22:22:58ephjaand the GC can be chosen
22:23:40ephjaVarriount: I was just thinking about potential implementations
22:23:44AraqXe: *int64 becomes ptr int64
22:24:54ephjaI suppose it would add some overhead, but the solution in cases like this might be to simply wrap the pointer in a reference counted type
22:25:05Varriountephja: Well, there aren't any current mechanisms for making an object pinned. Any GC that wants to be able to move objects around is going to have to do static analysis to determine which types are safe to move.
22:25:22filcucin reality the D GC doesn't implement compacting yet :) but their API has already a function for the future :)
22:25:43VarriountAraq: What are your thoughts on this?
22:26:11Araqpinning a ref is the same as GC_ref/GC_unref
22:26:31ephjaVarriount: yeah, that would be more convenient. unmovable whenever a pointer is passed to a foreign function then
22:27:24filcucephja: pinning can degrade GC performance (obviously depends on the implementation of the GC)
22:28:05Araq"As far as I know, there aren't any compacting GC's for Nim, mainly because the entire standard library relies on objects not being moved."
22:28:45Araqer no... there aren't any compacting GC's for Nim because these are hard to do when you want to generate C code
22:28:55Araqthat also interfaces easily with C code.
22:29:25ephjareminds me of this argument "why not just use C then if it compiles to C" ;)
22:29:45Araqbecause C cannot even distinguish a pointer from an array?
22:30:00Varriountephja: That's like saying "why not use assembly if that's what C compiles down to?"
22:30:10ephjaVarriount: yeah
22:30:43VarriountReasonable abstractions that simplify the mental model of programming is the main reason.
22:32:08Araqwhy not write LLVM bitcode if Nim compiles to LLVM.
22:33:02ephjaI know, right?
22:33:32Araqwhy not write x86 instructions instead of Haskell.
22:35:23filcucAraq: however adding a "manual" reference to an object it's different of saying "don't move it"
22:35:37filcuc[23:24] <Araq> pinning a ref is the same as GC_ref/GC_unref
22:35:58AraqI fail to see the difference.
22:36:01ephjagotta have monads
22:41:35*filcuc quit (Ping timeout: 264 seconds)
22:49:46*brson quit (Ping timeout: 250 seconds)
22:54:06*vendethiel quit (Ping timeout: 245 seconds)
22:55:16*brson joined #nim
22:56:30*junw quit (Ping timeout: 272 seconds)
23:03:40*derka quit (Ping timeout: 260 seconds)
23:03:57*derka joined #nim
23:05:26*filcuc joined #nim
23:06:48gokrAraq: Hum, so c2nim turns "#define VM_THREAD_HANDLE VMUINT32" to "const VM_THREAD_HANDLE * VMUINT32" for some reason. And that fails later when used as a proc param type.
23:07:10Araqnot for some reason.
23:07:16Araqit was designed to do that.
23:07:45Araqwhat do you think it should do? guess VUINT32 is a type?
23:08:08Araqreplace the #define with typedesc to tell c2nim what it is
23:08:16Araqer *typedef
23:09:04gokrI presume it can't do anything else.
23:10:33*filcuc quit (Ping timeout: 240 seconds)
23:14:18*pregressive quit ()
23:14:20*lankanmon_ joined #nim
23:18:32*junw joined #nim
23:18:35*lankanmon_ quit (Read error: Connection reset by peer)
23:19:15Araqgokr: didn't get any PR from you :-)
23:19:29gokrI know, I will. :)
23:19:58gokrI did do the same as dynlib - passing a name of the lib, although we are not using that.
23:20:54*junw_ joined #nim
23:24:31*junw quit (Ping timeout: 245 seconds)
23:29:17gokrAraq: done
23:29:54*Dildosan left #nim ("Leaving")
23:36:38*Trustable quit (Quit: Leaving)
23:56:40*francisl joined #nim
23:59:31*apotheon quit (Ping timeout: 245 seconds)