<< 21-12-2015 >>

00:02:54*kulelu88 left #nim ("Leaving")
00:11:59*irrequietus quit ()
00:14:41*vendethiel quit (Ping timeout: 265 seconds)
00:18:11*gokr quit (Ping timeout: 264 seconds)
00:19:20*gokr joined #nim
00:23:15*jaco60 quit (Ping timeout: 240 seconds)
00:23:26*gokr quit (Ping timeout: 240 seconds)
00:24:39*gokr joined #nim
00:37:26*ephja quit (Ping timeout: 240 seconds)
00:55:19Araqcryzed: in a nutshell: yes.
00:56:15strcmp1what about a crab shell
00:56:18strcmp1any different in that case
00:57:14Araqall shells are crappy
00:59:54strcmp1yeah try telling a turtle that
01:02:45AraqI only need to put it on its back
01:03:27strcmp1lol
01:05:56*gokr quit (Quit: Leaving.)
01:18:12cryzedAraq, oh -- so I'll have to rely on generics?
01:18:31Araqmethods + generics don't work.
01:18:34cryzedbasically if I want to use the component stuff as some library, I'll probably have to instantiate it as newGameObject[MyComponentType](...)
01:18:45cryzedwell...
01:18:58cryzedthen I have no idea what I'm doing
01:19:18Araqin retrospect it was a big mistake that the compiler even tries to "support" this construct
01:19:43Araqbut then IMHO the whole language would be better without the 'method' keyword
01:19:57cryzedwithout dynamic dispatching?
01:20:01Araqyeah
01:20:22Araqwhen I need dyndisp, I use a closure. works much better anyway.
01:20:53cryzedWell then I'll have to reconsider how implementing such a component architecture would work better in Nim
01:21:29Araqa component architecture ... well nobody knows how to design these afaict
01:21:48AraqI did some research and took some notes
01:22:22cryzedhttp://gameprogrammingpatterns.com/component.html I wanted to design code close to this
01:23:01*Trustable quit (Quit: Leaving)
01:23:28cryzedbasically pass in multiple component classes managed by a container object (gameobject). When you call update on the container, it calls update on all components which are able to modify its state or broadcast messages through the container to other components
01:23:50cryzedWhich, in theory, should allow you good seperation of concerns and reusability
01:26:48*pregressive joined #nim
01:31:52cryzedAraq, so do you have any pointers for me where I could start? I suppose by removing all method calls, and using procs with generics?
01:32:21Araqwell I would say this is always a good idea :P
01:34:37Araqwell I don't know your background etc. but I suggest you write the game and then later see how it can be refactored into components
01:34:51cryzedI am trying to write the game, using components
01:35:04cryzedso I don't have to put code from every part of the system into the entity's update method
01:35:17*liori joined #nim
01:36:12AraqI wouldn't care until the game's code becomes big enough to be barely managable
01:36:31cryzedhm
01:36:53Araqusually it's much easier to see better designs at this stage rather than anticipating of what could go wrong
01:37:09cryzedAlright, I might do that then.
01:37:42cryzedfor now it's just snake anyways
01:37:51cryzedand then I wanted to progress to something like a dungeon crawler/roguelike
01:38:19Araqalso you should always clearly distinguish between *ugly* code and *error prone* code.
01:38:42Araqprogrammers usually act like these are the same. They are not.
01:39:26Araqin other words study where the bugs come from.
01:40:02cryzedYou are trying to say that having the update method of entities access most parts of the system isn't really error-prone, just maybe not that nice?
01:40:34*sqwishy quit (Read error: Connection reset by peer)
01:41:08Araqno, I don't have enough experience with games to say that.
01:41:15*sqwishy joined #nim
01:41:33cryzedAh ok, you are indicating that might be the case and to not overengineer from the beginning
01:41:41Araqexactly.
01:41:43cryzedI wanted to start out with good practices, that's all
01:41:49cryzedbut maybe getting my hands dirty will help me more
01:41:56cryzedand well.. let me make any kind of progress
01:44:08cryzedI have never used closures in nim, I didn't even know that was possible
01:53:58*[CBR]Unspoken quit (Ping timeout: 272 seconds)
01:55:02lioriare strings mutable?
01:55:12cryzedyes
01:55:37*[CBR]Unspoken joined #nim
02:23:26*jakesyl quit (Ping timeout: 250 seconds)
02:35:52*Demon_Fox joined #nim
02:36:20*jakesyl joined #nim
03:06:11*vendethiel joined #nim
03:27:37*Demon_Fox quit (Remote host closed the connection)
03:30:10*vendethiel quit (Ping timeout: 250 seconds)
03:39:04*Demon_Fox joined #nim
03:49:59*kniteli joined #nim
04:00:42*pregressive quit (Remote host closed the connection)
04:00:55*pregressive joined #nim
04:01:03*pregressive quit (Remote host closed the connection)
04:01:19*pregressive joined #nim
04:34:28*Demos quit (Read error: Connection reset by peer)
04:48:46*sqwishy quit (Read error: Connection reset by peer)
04:49:25*sqwishy joined #nim
04:57:00*kniteli quit (Ping timeout: 272 seconds)
05:08:47*pregressive quit (Remote host closed the connection)
05:09:23*pregressive joined #nim
05:10:33*pregressive quit (Read error: Connection reset by peer)
05:10:47*pregressive joined #nim
05:22:35*darkf joined #nim
05:54:17*xet7 joined #nim
05:57:11*Demon_Fox quit (Quit: Leaving)
06:03:26*pregressive quit (Remote host closed the connection)
06:06:13*lokulin quit (Quit: bye!)
06:39:42strcmp1did twitter only exist since 2013 or did another republican presidential candidate talk a bunch of shit yet again
06:40:00strcmp1sry
06:40:03strcmp1wrng buffer
07:42:02*Sembei joined #nim
08:23:30*gokr joined #nim
08:26:28*gokr quit (Client Quit)
08:26:31*gokr1 joined #nim
08:31:20*BitPuffin|osx quit (Ping timeout: 255 seconds)
08:36:57*lyro quit (Quit: WeeChat 1.1.1)
09:13:38*lyro joined #nim
09:42:56*jaco60 joined #nim
09:44:10*jck_ joined #nim
09:46:44*sepisoad joined #nim
09:47:46*_stowa_ joined #nim
09:48:14*Araq_ joined #nim
09:48:28*cryzed_ joined #nim
09:48:41*Yaiyan_ joined #nim
09:48:47*someplac- joined #nim
09:49:01*r-ku- joined #nim
09:49:14*Amrykid2 joined #nim
09:49:44*dom96_ joined #nim
09:49:51*gsingh93- joined #nim
09:49:55*gsingh93 quit (*.net *.split)
09:49:56*someplace quit (*.net *.split)
09:49:56*r-ku quit (*.net *.split)
09:49:57*jck quit (*.net *.split)
09:49:58*cryzed quit (*.net *.split)
09:49:58*bbl_ quit (*.net *.split)
09:49:59*_stowa quit (*.net *.split)
09:49:59*Araq quit (*.net *.split)
09:50:00*dom96 quit (*.net *.split)
09:50:00*Amrykid quit (*.net *.split)
09:50:00*nim-buildbot quit (*.net *.split)
09:50:00*Xe quit (*.net *.split)
09:50:00*Yaiyan quit (*.net *.split)
09:50:02*wh1t3r0s3 quit (*.net *.split)
09:50:06*dom96_ is now known as dom96
09:50:46*gsingh93- is now known as gsingh93
09:50:56*Xe joined #nim
09:51:09*sepisoad quit (Read error: Connection reset by peer)
09:56:23*bbl_ joined #nim
09:59:38*buMPnet joined #nim
10:00:54*OmlkRoNiXz joined #nim
10:03:38*xet7_ joined #nim
10:07:24*_stowa_ is now known as _stowa
10:12:08*xet7 quit (*.net *.split)
10:12:09*Jesin quit (*.net *.split)
10:12:12*M-max quit (*.net *.split)
10:12:13*Amun_Ra quit (*.net *.split)
10:12:15*buMPnet_ quit (*.net *.split)
10:12:16*OmIkRoNiXz quit (*.net *.split)
10:13:26*M-max joined #nim
10:17:52*Jesin joined #nim
10:22:51*Amun_Ra joined #nim
10:41:38*lokulin joined #nim
11:11:22*thotypous quit (Quit: WeeChat 1.3)
11:11:42*thotypous joined #nim
11:13:16*ephja joined #nim
11:28:42*Trustable joined #nim
11:42:17*filcuc joined #nim
11:54:34*jakesyl quit (Ping timeout: 250 seconds)
12:48:26*wh1t3r0s3 joined #nim
12:56:54*gokr1 quit (Read error: Connection reset by peer)
12:59:08*gokr joined #nim
13:15:52*wh1t3r0s3 quit (Read error: Connection reset by peer)
13:17:23*pregressive joined #nim
13:23:58*Demon_Fox joined #nim
13:36:51*wh1t3r0s3 joined #nim
13:40:59Araq_cryzed_: https://en.wikipedia.org/wiki/Entity_component_system is a pretty good description of an entity component system that seems easy enough to implement in Nim
13:46:57*n1ftyn8_ quit (Quit: Connection closed for inactivity)
13:56:43*gokr quit (Ping timeout: 260 seconds)
14:02:48*razaaa joined #nim
14:02:49*razaaa quit (Read error: Connection reset by peer)
14:03:09*razaaa joined #nim
14:03:10*razaaa quit (Read error: Connection reset by peer)
14:06:16*Demon_Fox quit (Quit: Leaving)
14:07:48*pregressive quit (Remote host closed the connection)
14:22:24*Demon_Fox joined #nim
14:40:02cryzed_Araq_, that's what I attempted to do but quickly ran into issues with
14:40:20cryzed_well since theres no real usable dynamic dispatching, at least from what I can see
14:40:36cryzed_I'm not even sure how to store a bunch of entities in an array and later differentiate them without having to rely on variant objects
14:41:02*cryzed_ is now known as cryzed
14:43:19cryzedI planned for my components to "contain" or expose the functions that would in the end modify the entity
14:44:14cryzedBut since I can't store component subclasses in a seq within the entity, without them being handled like superclass components (i.e. I lose? dynamic dispatching for my subclassed types?)
14:44:17cryzedI'm not sure what to do
14:45:26Araq_cryzed: well you don't need anything like that if an entity is simply an ID anyway
14:46:04Araq_the physics component can operate on a seq of physics data
14:46:49Araq_every component needs a register(id)/unregister(id)
14:47:22Araq_iterating over every component is trivial to refactor into a template/macro
14:48:58Araq_with IDs you also don't need to store which components are active for the entity since physicsManager.unregister(id) can simply be a nop for non-existing IDs
14:50:08Araq_or you can store the active components as another component
14:51:33cryzedAraq_, thanks I'll see if I can implement this in a nice way
15:06:34*pregressive joined #nim
15:09:03*Sornaensis quit (Excess Flood)
15:09:31*Sornaensis joined #nim
15:30:19*pregressive quit (Remote host closed the connection)
15:32:58cryzedAraq_, so basically if I had a physicscontroller which would allow an entity to have a position/velocity for example, it would go like this: If I have list of controllers, implementing functionality in their "update" procs for example. Internally I manage an array of unique IDs associated with the given behaviour. So when I call game.update() in the mainloop, I iterate over every controller, which in turn iterates over every entity ID managed
15:32:58cryzedby them and updates them. If there's interdependency between controllers, I could simply givem the references to each other and do something like physicsController.get(id) in the graphicsController to draw the graphics for the entity at the correct position
15:34:06Araq_that is correct
15:35:12cryzedAlright, I'll try this. I just wanted to do it the other way around initially, i.e. call update on every entity so that the components associated with it can modify the entity -- but I suppose the other way around works just as well
15:37:02*pregressive joined #nim
15:37:04Araq_usually you also have descriptors
15:37:27Araq_that are like type information
15:37:59Araq_and describe if the object is a unit, a weapon, a doodad
15:38:24cryzedso I can implement customized behavior in the controllers?
15:38:41cryzedno, hm, I think that would defeat the purpose
15:39:20cryzedI agree, I just dont know where I would use that information currently
15:39:52Araq_another interesting question is how many components exist
15:41:37Araq_if I understand it correctly, components are hard coded and there are only few
15:42:31Araq_which means seq[Component] is misguided and instead you can have 'fieldA: ComponentA; fieldB: ComponentB; ...' directly in the entity
15:43:25Araq_but then you don't get the memory layout optimizations that Entity-component-frameworks also strive for
15:43:33Araq_bbl
16:05:06*pregressive quit (Remote host closed the connection)
16:05:36*pregressive joined #nim
16:13:00*zaquest quit (Remote host closed the connection)
16:13:11*kulelu88 joined #nim
16:13:11*kulelu88 quit (Changing host)
16:13:11*kulelu88 joined #nim
17:08:52*Demon_Fox quit (Quit: Leaving)
17:09:02*gokr joined #nim
17:12:25*gokr quit (Client Quit)
17:28:50*filcuc quit (Ping timeout: 260 seconds)
17:29:11*cyraxjoe joined #nim
17:33:53*xet7_ is now known as xet7
17:38:01*BitPuffin|osx joined #nim
17:39:30*zaquest joined #nim
18:06:53*Jesin quit (Ping timeout: 255 seconds)
18:09:59*gokr joined #nim
18:16:44*darkf quit (Quit: Leaving)
18:20:36*vendethiel joined #nim
18:32:07*Jesin joined #nim
18:56:31*sepisoad joined #nim
18:59:33*sepisoad quit (Read error: Connection reset by peer)
19:15:33flyxis it possible to get the nth element of an OrderedTable?
19:16:33Araq_good question.
19:17:38flyxyeah, I worked hard on it.
19:19:16Araq_I don't think that's exposed, but
19:19:28flyxI guess I can use pairs n times
19:19:32Araq_the implementation uses a linked list under the hood
19:19:47Araq_so access would be O(n) anyway
19:19:54flyxthought so
19:19:59Araq_and you might indeed just use the iterator then
19:21:51flyxyeah, I guess I'll do that
19:22:01flyxI don't expect the table to grow large anyway
19:27:20*Matthias247 joined #nim
19:28:27flyxhmm, what's the difference between []= and add() for tables? documentation says add() inserts the pair *even if t[key] already exists*. so it replaces the old value?
19:32:25Araq_yes
19:32:52flyxbut []= also replaces it…?
19:47:51*Demos joined #nim
19:54:39juanfraCan anyone help me with this? http://forum.nim-lang.org/t/1877 . I would like generate the tarball to test devel on openbsd.
20:06:25Araq_no, []= replaces, add adds
20:06:51Araq_juanfra: 'koch csources && koch xz'
20:08:43Araq_or something like that
20:09:11Araq_there is a wiki page about it
20:17:39*boopisaway is now known as boop
20:19:00flyxso, I can have multiple entries with the same key in a Table?
20:20:17cryzed[]= maybe only works of the key already exists?
20:20:22cryzed*if
20:36:48*pregressive quit (Remote host closed the connection)
20:41:54*nande joined #nim
20:43:26*kulelu88 quit (Ping timeout: 240 seconds)
21:02:12*kulelu88 joined #nim
21:04:56cryzedAraq_, after some thinking: I'll think I'll do it something like this: Have an entity type, which is just a synonym for an int. Have a component type, that holds raw data: For example a sprite or coordinates. Have systems that connect entities to component instances (XSystem creates XComponent for the entity) with as Table internally. Then all the code lives in the System instance which has a proc update defined. This update proc is called in
21:04:57cryzedthe mainloop, for example for the transform/physics system it would simply be update(timeDelta: int), whereas the graphics system update-proc might also get a SDL surface. Because you can have multiple system instances, it's possible to easily suspend a whole subsystem by simply not calling update for a whole -- making it possible to have separate windows/interfaces etc. at runtime easily (i.e. create a graphicssystem instance for some
21:04:57cryzedwindow, which the mainloop updates but stops updating the normal game graphics-system or some such). Communication between systems is handled by accepting dependencies to other system instances during initialization -- that way it's possible to have pools of entities/systems that only talk to each other, because they either only need to know about each other or they represent a subset of all entities within the game. I haven't really
21:05:02cryzedconsidered this much yet, but if I add an EventSystem and simply associate each Entity with an EventComponent that can hold a sequence of events, I could also emit events that would be consumed by other systems. This should in theory allow threading: i.e. instead of modifying Component instances returned by the System when talking to each other, events are simply emitted which should be threadsafe insofar that I use a simple locking mechanism
21:05:07cryzedfor the EventSystem. But yeah, this is just an inaccurate approximation and I'll probably run into troubles
21:08:35Araq_flyx: that is correct
21:08:38cryzedwell that seems like rambling
21:11:27ldleworkare you talking about an entity component system?
21:11:41cryzedldlework, yes
21:11:47ldleworkfowl built one already
21:11:50cryzedtrying to implement one in Nim
21:12:06ldleworkWhy would you need communication between systems?
21:12:13cryzedNot sure, I've never used one
21:12:26ldleworkI use ECS in javascript. Never needed communication between systems.
21:12:27cryzedwhere is their system?
21:13:07ldleworkThe whole point of ECS is to create a system wherein application logic is physically divided based on data dependencies
21:13:15ldleworkSo a system should be completely self-contained
21:13:50ldleworkcryzed: on their github somewhere I imagine
21:13:59ldleworkbe warned, fowl is too smart for his own good
21:14:06ldleworkhis code is strange and alien
21:14:33cryzedldlework, what if I have some system that suddenly tells some entity "yeah this guy needs to fly really high into the air now" imagine he took some item or something
21:14:39cryzedhow would I tell that to the physics-system
21:14:59ldleworkThat's not how it works
21:15:10cryzedhow would I implement that behavior elsewise
21:15:19ldleworkYou have a system, whatever system you're taking about, and it consumes entities that have a physics component.
21:15:49ldleworkThe system we're talking about doesn't talk to some other system in order to get the data in the physics component to reflect a change in velocity, this system is the one that does it.
21:15:59cryzedyes, and through that physics component I want to implement a jump into the air when the entity takes a potion or some such
21:16:03ldleworkno
21:16:13ldleworkcomponents are _just data_
21:16:14ldleworknothing else
21:16:17ldleworkno code whatsoever
21:16:24cryzedYep. The code lives in the system, I know
21:16:38cryzedhow do I signal a sudden change in velocity of an entity from another system
21:16:43ldlework"and through that physics component I want to implement a jump into the air when the entity
21:16:50ldleworkby changing the data in the physics component
21:17:09cryzedSo the physics component has ties to the item system?
21:17:17cryzedeh
21:17:18cryzedsystem
21:17:19ldleworkThere are no ties - anywhere
21:17:34ldleworkThink of it like this
21:17:38ldleworkThere *ARE NO SYSTEMS*
21:17:51ldleworkA system, is just a function you call, passing in a set of entities.
21:17:57ldleworkThe function, is an entry point to a code path
21:18:07ldleworkBased on the details of the data inside the entities
21:18:12ldleworkwhen you call the function
21:18:12cryzedyes.
21:18:14ldleworkand pass the data
21:18:19ldleworka certain code path will be followed
21:18:27ldleworkthat code path, will call other library functions
21:18:37ldleworklike, say, to update stuff inside of physics components
21:18:50ldleworkif this top-level function, ever, anywhere, calls code that works on physics components
21:19:02ldleworkthne this top-level function must be passed entities that have physics components
21:19:08ldleworkthere is no "physics system"
21:19:11ldleworkor "item system"
21:19:17ldleworkthere are only components that contain data
21:19:26ldleworkand API for querying entities that have specific components
21:19:34cryzedSo how would you implement what I asked?
21:19:43ldleworkand top-level routines that take entities, and may or may not call some library code that works on specific components
21:20:19ldleworkIf you understand what I just said, that should be clear.
21:20:23ldleworkYou have a function
21:20:25ldleworkthat does what you want
21:20:30ldleworkbased on what that function does
21:20:43ldleworkthat function has a list of implicit component depndencencies
21:20:56ldleworkmake sure when you call that function, to make it do what it does, that you pass the right entities to it.
21:21:11cryzedThe only logical way I can see is getting the PhysicsComponent associated with that entity, changing the velocity attribute and the next time the Physics "system" is called it will change the coordinates based on that new velocity
21:21:20ldleworkYes.
21:21:55ldleworkprocess_status_effects(entities)
21:22:16ldleworkin some ECS Systems are raised up to first-class objects
21:22:22ldleworkand their dependnecies are made explicit
21:22:25ldleworkby listing them
21:22:41ldleworkand then you can audit the entities passed in for the requried components
21:23:06ldleworkbut in the end, the actual list of dependencies is resolved based on what the function does and what component-using library code is called from that code path
21:23:23ldleworkIf you want to get fancy
21:23:39ldleworkyou can even make it so that systems go ahead and query the entity API themselves for the enetities relevant to them
21:25:21cryzedI don't for now, this is my first game with Nim and a custom ECS -- at least I hope it will be. But thank you, I'll try to implement this for now and see where it leads me
21:26:05ldleworkThe hardest part of ECS is making entity querying efficient
21:51:45*tmm1 joined #nim
22:25:34*mat4 joined #nim
22:29:46*tmm1 quit (Ping timeout: 276 seconds)
22:38:21*Jesin quit (Quit: Leaving)
22:38:57juanfraAraq_: thanks for the help. "nim c koch && ./koch csource && ./koch xz" worked fine.
22:41:06*Jesin joined #nim
22:49:05*vendethiel quit (Ping timeout: 260 seconds)
22:50:21*mat4 quit (Quit: Verlassend)
22:58:30*tmm1 joined #nim
23:02:20*lazypenguin quit (Ping timeout: 250 seconds)
23:07:51*tmm1 quit (Ping timeout: 260 seconds)
23:10:02*Trustable quit (Remote host closed the connection)
23:15:27*lazypenguin joined #nim
23:17:59*kulelu88 quit (Ping timeout: 265 seconds)
23:19:53*brson joined #nim
23:31:02*kulelu88 joined #nim
23:32:04*tmm1 joined #nim
23:36:53*boop is now known as boopisaway
23:48:06*tmm1 quit (Ping timeout: 240 seconds)
23:57:39*tmm1 joined #nim