« first day (1941 days earlier)      last day (2993 days later) » 

2:18 AM
client.keys("*game*", (err, reply) => {
    reply.map((game, index) => {
        client.smembers(game, (err, reply) => {
            response[game] = reply.length;
        });
        console.log(response);
    });
});
res.send(response);
So I just realized that these redis functions are async -- thus I'm returning an empty object. Should I promisify these methods or just wrap it in a promise?
Not quite sure the best way.
 
Using promisify is better
 
So, I'm importing my redis client -- should I import and Promise.promisify(redis.keys); etc?
Wait.. do I promisify the methods or the import?
 
I don't know
 
2:50 AM
 
3:01 AM
let keysAsync = Promise.promisify(client.keys, {context: client});
let smembersAsync = Promise.promisify(client.smembers, {context: client});
keysAsync("*game*").then(reply => {
  reply.map(game => {
    return smembersAsync(game).then(players => {
      response[game] = players.length;
      console.log(response);
    });
  });
}).then(() => res.send(response));
I don't think I'm doing this right
Context: I'm creating a queue, and to join, you need to select a non-full list. So this iterates all the games in redis, counts the players in each game, and returns an object that I'll turn into a list client side
 
3:56 AM
@BenjaminGruenbaum sorry just saw this -- those are static for testing. Once I get this async thing figured out, when players create a lobby I'll assign it a UUID instead of those
 
 
2 hours later…
5:50 AM
/cc @rlemon @SomeGuy ^
 
6:48 AM
 
user3119231
6:59 AM
good morning, my more intelligent friends (as in rl)
 
7:29 AM
Thought for the day : Your mama so fat, we are all worried about her well being.
 
user3119231
8:23 AM
This is a true story, my indian friend
 
crl
9:01 AM
damn muricans and indians, they have a low gravity imgur.com/gallery/3hmXi19, stralia is high
 
user5503464
9:24 AM
-2
Q: How to make dropdown based on checkbox value using angular?

komalI have some nokia mobile models with some offers. There are two objects, one for nokia models with price, another one for offers. For example I have offers for these two models: "brandname": "Nokia" "model":"Lumia" "submodel": "Lumia 735 TS" "brandname": "Nokia" "model":"Lumia" "submodel": "Lu...

 
@komal That sounds familiar. Did you already ask questions about the same subject?
 
user3119231
9:37 AM
smells like a question ban...
 
> Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live - John Woods
3
 
@towc i'll comment, "// p.s. please dont kill me "
 
user3119231
9:55 AM
Man, check this. It's like he told someone to make him a website. Now he can't do a fucking float: stackoverflow.com/questions/35266544/…
 
10:15 AM
@SomeGuy do you follow Ivo ?
 
10:36 AM
@towc that's a nice quote for me, as a senior QA
gotcha use it someday
 
user3119231
Will definitely use it.
 
man, my arms are shaking from my weight lifting exercises this morning
 
I need 3d maths help...
so, in my way of making 3d graphics using the 2d canvas API I would usually find every point in a polygon, convert it to 2d screen positions, then fill the path
but this doesn't work if, say, I wanted to draw an image, because I can't define the path of the image, even if it's just a rectangle
so I'm forced to use ctx.setTransform, which makes me provide a 3x3 transformation matrix that interacts with (x,y,1)
I'm still stuck not knowing what to do...
[ a, b, c ]
[ d, e, f ]
[ 0, 0, 1 ]
c and f must be the screen positions x and y of the image, ok
then I can rotate the image in 2d using a=cos, d=-sin, b=sin,e=cos, right?
but that's just a z-rotation... how do I combine it with x/y-rotations?
 
user3119231
I would help you, really. But I'm shit af in math.
 
user3119231
But I will reference you with something: stackoverflow.com/questions/17555209/…
 
10:51 AM
TIL Half Life is Open source !
 
@Maurice that does it directly with css, which has it's own built-in functions for 3d maths :/
 
@towc whoah. Maybe you can look into graphical projections or ask kendall.
 
@towc 3x3 matrices are for 2d space
4x4 matrices are for 3d space
 
@phenomnomnominal ik
I'm trying to interpolate a matrix for the third dimension into it's graphical matrix counterpart for 2 dimensions
 
11:05 AM
if you want to interpolate 3d rotations you're not gonna have a good time without quaternions
 
it's probably possible, since I can access all the data I want
@phenomnomnominal which is why I'm asking for help
 
there is a not-so-performant way :P If you are doing this solely for learning why don't you update the pixel data directly ?
 
@Abhishrek I could find the point path for every pixel in the image and do it that way, but that's ridiculously expensive
I'd know how to do that
 
taht's why i suggested to contact kendall
he understands quaternions more than i do
had a conversation with him before about that topic
 
@KendallFrey hihelloineedyourhelpwithmathsplz pbs.twimg.com/media/Car-SDzW0AAPUXh.png
 
11:13 AM
@Abhishrek so..with that licence you can only learn from it? and possibly build something with it but not distribute your work?
 
@GeoPhoenix vOv Afaik, they won't mind if you distribute it on steam
evil grin
 
hey guys, so I'm new to JavaScript, and I'm trying to include the <details> tag in my page, as you know it's not fully supported so I'm using the modernizr library. This tutorial is guiding me through it, now I don't know where exactly to write the $('details').details; in the page
 
@SamIbraheem Welcome to the JavaScript chat! Please review the room rules. Please don'task if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@SamIbraheem did you have included a polyfill ?
 
@KarelG of course, I've included the jquery.details.js file in the <head> tag in the header.php file (I'm using WordPress)
 
11:22 AM
someone good at finding documentation could help ?
can't find any documentation for this library at all...
https://www.nuget.org/packages/XAct.Core.PCL/
 
@SamIbraheem the git documentation is pretty self-explanatory. Just write your javascript codes in a new <script> tag after importing these libraries in the <head>
if you are planning to write a large set of code, please use a file instead. But i've a feeling that you've skipped the javascript basics
 
anyone knows how I can require a local package from a globally installed package (mine)?
 
user5503464
0
Q: How can i solve "Cannot read property 'length' of undefined at checkWithSeletedModel" in angularjs?

komalhow can i solve this error "Cannot read property 'length' of undefined at checkWithSeletedModel". when i add object directly in controller its working but when data coming from api i am getting error TypeError: Cannot read property 'length' of undefined at checkWithSeletedModel (newbooking.htm...

 
user5503464
help me out
 
11:39 AM
@komal you asked it just 3 minutes ago :|
 
The error is self-explanatory. Please read it carefully
you're calling length a variable which isn't initialized ( = undefined). Ensure that the variable holds a reference to an object
just go to the line of that error and check why that variable isn't initialized yet
 
@KarelG I'm truly sorry, will this code generate the <details> tag or am I supposed to write it my self? (completely clueless) :(
 
what $('details').details() does is "search for "detail" tag and enable its events
just checked on git, and there is a HTML document with a lot comments. Maybe you can check it yourself: github.com/mathiasbynens/jquery-details/blob/master/demo.html
2
 
12:07 PM
Hi there, anyone has an answer for this one? stackoverflow.com/questions/35269288/…
gulp just breaks my images...
and the funny thing is that it was not that way some weeks ago :O it was working perfectly
 
Guys... Just read a few lines here...
Should we update the room description to remember everyone that Javascript "is complimentary to and integrated with Java" ?
 
user3119231
  <script language="javascript" type="text/javascript">
     <!--
        document.write("Hello World!")
     //-->
  </script>
 
user3119231
even this isn't actually the right "way"
 
;_; for my KAA server, i have to install MongoDB
i hate that db system
 
@towc Are you trying to project 3D objects onto a 2D canvas, or just transforming 2D objects?
 
former
 
In that case you need 4x4 matrices :)
 
@Mosho global modules, run from within a directory with local modules installed?
 
12:28 PM
Do you want perspective projection?
 
user3119231
Come and listen to me I bring you something: espruino.com
 
@BenFortune That is fantastic :D
 
12:45 PM
@phenomnomnominal yeah, found this: npmjs.com/package/require-relative
 
@KendallFrey I have projected 3d points onto 2d canvas before (with perspective), from which I can create a path and make solid-coloured shapes or wireframes, but if I were to use that technique for textures I'd have to repeat the process for every pixel in the image and meh
and I think that there's a way to not to that by myself, but letting the canvas do it, using setTransform
 
Yeah I've done the same (even wrote a library for it ;))
 
the problem is that I'm transforming the graphics to other graphics, not 3d space to 2d space
 
with textures, you'd have to write your own shader probably
sounds like you'd be better off using three.js/webgl
 
@KendallFrey trying to do this using only the 2d canvas context
 
12:52 PM
and js?
because you could write a "shader" in js
 
of course using a proper api would be more semantically correct and efficient, but I want to see if it's still doable easily using the 2d context
@KendallFrey you feed a 4d point, attributes and fragment colors, then let it do the things, it's possible, but the maximum amount of processess modern browsers allow for is 8 (web workers) so it'd still be slow af
 
Hae guys.. I having doubt with Jquery. Shall I discuss here ?
 
crl
only the J
 
user3119231
@RajaSimon feel free to ask.
 
In the ajax success function I'm decoding the base64 content using window.atob(result.content); after that I simply do this $('#content').text(decodedData); but the content is not properly align why ?
 
12:57 PM
@towc anything in JS is gonna be slow compared to a GPU
 
@KendallFrey ok, but it's still not going to be reasonable I think
 
It won't be slow unless you have hundreds? thousands? of polygons
 
@KendallFrey enlighten me
 
Kendall bro o/
 
12:58 PM
how would you do it with images
 
another idea (if you don't need accurate texturing) is point clouds
 
@KendallFrey discard that
again, probably there's an efficient way of doing it using setTransform, point clouds would also be utterly inefficient compared to that
 
setTransform doesn't work with perspective, does it?
 
Does this mean that the server is always 100ms ahead of clients ?
 
pls help me
 
1:03 PM
@RajaSimon If someone knew the answer, they would have answered
 
user3119231
calm your nuts, I'm already looking.
 
okay
 
user3119231
 
@RajaSimon you need to use a <pre> tag
 
@KendallFrey could be. This is why I'm asking for your help :P
 
user3119231
1:05 PM
just noticed that atob means A to B :D
 
@Abhishrek oh.. I'll try that ..
 
@Maurice I remember you wrote games :P
 
user3119231
yup
 
@Abhishrek lag in realtime multiplayer is well known. clients are always using outdated information. I play Planetside 2 sometimes, where other players see you a couple hundred ms behind where you actually are
 
user3119231
But this is a common problem. There are several methods against this.
 
1:07 PM
@KendallFrey How does that handle paradox ?
I know clients can't have 0 latency
but as written there HL engine
 
I occasionally do online racing sometimes, where clients do have to extrapolate to figure out where the other cars are, leading to rubber banding and weird shit
 
basically enforces an extra 100 ms lag
 
user3119231
I think you have to create a "logic".
 
@Abhishrek PS2 uses client-side logic for important things like hit detection
 
crl
1:09 PM
my browser is ahead of server, get content before the http response
 
@KendallFrey My game shares them both
As in hit detection occurs both the places
 
which is authoritative?
 
the server corrects the game state every tick
Server ofc
 
you don't have a server
the host peer?
 
yes for the sake of simplicity lets call it server
 
1:10 PM
what genre of game is yours again?
 
space shoot em up, although I will deploy it to a server if it even gets slightly fun to play
 
if it's a shooting game, with one player serving as the host, that player will have a ridiculous host advantage if the latency is anything but super fast
nobody likes host advantage
 
Yeah, I am getting rid of the host --- I just can't host a server :x
> In essence, you can think of interpolation, in the above example, as buffering an additional 100 milliseconds of data on the client. The other players, therefore, are drawn where they were at a point in the past that is equal to your exact latency plus the amount of time over which you are interpolating. To deal with the occasional dropped packet, we could set the interpolation time as 200 milliseconds instead of 100 milliseconds.
 
ah yeah that makes sense
but that's a lot of latency
 
What I am wondering is say the server sends a packet where you are not dead (at time t = 0.1). Since I am buffering I see you I shoot you, you die
 
1:13 PM
too much for serverside hit detection
 
at t = 0.1 for me
 
@Abhishrek yep, that's the host advantage
 
@KendallFrey Ah so you are saying in real world with real latencies
this won't create a paradox ?
 
now if the host has 100ms enforced latency as well, then nobody will be able to hit anybody
 
@KendallFrey but what do I show to the user ?
 
1:15 PM
@Abhishrek not if you have an authoritative server
 
Valve says that their server goes back in time
and updates
so essentially I will take it as you dying at 0.1 for me will be shown to 0.2 to everyone ?
 
@Abhishrek show them the latest imformation from the server, plus everything that's happened on their client since then
@Abhishrek yeah
 
So basically interpolate b/w MY_STATE -> SERVER_STATE + MY_PREDICTION ?
 
but the most important thing is that you won't be able to hit anyone according to the server
thus no one will die and it won't be fun
 
:P see my point ?
 
1:17 PM
no, what's your point?
 
> but the most important thing is that you won't be able to hit anyone according to the server
 
i said that
 
server already sent not hit at t 0.1 If I kill you at t = 0.1 then the server must send an updated state for t = 0.1 ?
or does the server in that case simply sends t = 0.2 with you dead ?
 
You know that in a shooting game 0 latency is going to be a huge advantage compared to +50ms latency. What do you even mean with t = 0.1
 
If the server is authoritative, you will hit someone someone on your screen, but they won't die because they weren't hit on the server's screen
 
1:20 PM
If you can accept the side-effects, going "unlagged" might be worthwhile.
 
@RoelvanUden Valve says that when the client recieves their state of t = 0.1
he is showing t = 0
After reading that article I am removing the advantage to host with 0 latency.
 
const morning = new Event('morning');
room.addEventListener('join', e => console.log('sup'));
room.dispatchEvent(morning);
see, it's so early I made a bug
 
That's the essential unlagged technique. If the connection is consistent, you can count at the server back to the position at which the shot was fired and generate the event for other clients there, and perform hit collision according to each unlagged position. It can cause slight warping, short distances won't be rendered very well (or at all) and you eventually die when you just ran behind a corner because some high latency guy supposedly shot you. All very infuriating
Hence it works really quite well in high speed instant-shot games, but for slower projectiles and slow moving shooters.. it's really fucked up
 
@RoelvanUden So far in my game anyone > 100ms latency is kicked out
but that was p2p land
 
That's brutal lol :D
 
1:24 PM
Ofcourse it is brutal but I don't want to handle super laggy users
 
user2620028
Wow shrek lol... when i was in thailand i was playing games on 400ms ping
 
user2620028
and was still competitive
 
Did you read ra.is/unlagged @Abhishrek?
 
@HatterisMad my own ping is going to be 240ms, India
 
user2620028
yeah lol i dont doubt it
 
1:28 PM
PS my game uses projectiles even for lazer
 
Which is going to cause all kinds of side effects depending on how you approach time warps, or don't do it at all if it doesn't suit your game.
e.g. in a high pace game where you spray tons of projectiles, nobody is going to notice the occasional error (think Diablo III chaos)
What kind of pacing will it have @Abhishrek?
 
just kidding xD
 
@RoelvanUden >>>>> usual player velocities
 
@Abhishrek What's usual? :/
 
1:32 PM
right now they are 1400x player velocities
The maximum velocity a player can attain so far is c/1400
 
I have no idea what that means.
 
c = speed of light.
 
crl
light celerity
3e8m/s
 
I'm just asking about the pacing to try and understand what kind of networking would cause what kind of errors. I don't need relative velocities and such, it's about pacing. If you move at the speed of light and you're the size of a fucking galaxy the pace is still going to be slow. Compare it with a game I might know :P
Since there is no universal solution.
 
Well the game runs at a pretty realistic scale (As in planets are way bigger than ships, and orbiting one will take time)
you don't have open world
 
1:37 PM
And you don't have a lot of projectiles flying around? So I'm thinking of a semi-realistic slow-paced military shooter? Or in space terms, like dogfights and not like spraying the entire screen with attacks
 
@DomagojSabolic Welcome to the JavaScript chat! Please review the room rules. Please don'task if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
okay thanks
 
user3119231
This caprica... <3
 
@RoelvanUden yep
Space Dogfights where you collaborate with someone else
they fly you shoot.
(Now you see why lag compensation is a pita for me :? )
 
1:42 PM
Ahh. Gotcha.
 
Thank's. Please explain this: (err, data) => {} Is (function(){}).length works in most of the browsers? Is this something new? Do you know about IE6? — Amina 2 mins ago
Dear lord.
 
crl
he meant es6 maybe
 
hello guys
 
crl
because ie6 is 6 feet underground
 
@JonasDulay Welcome to the JavaScript chat! Please review the room rules. Please don'task if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
1:44 PM
anyone can help me on my script
 
@crl I do hope so.
 
@RoelvanUden I will just hope the lag compensation
 
crl
I don't know redux well, but I don't even like the idea to call a reducer something that compute a new state from a state, for me reducing is more a surjective function (return less dimensions)
 
will not make lot of difference b/w shooter and pilot :-(
 
1:46 PM
I'm new to javascript, im using jquery and I want some button to fadeIn() when cursor is over it and to fadeOut() when cursor leaves it. I was trying something but when I place the cursor inside it and hold it there in fades in and then fades out and thats, could some1 please help me? Thanks
 
use css :hover pseudo class instead
 
yeah I tried that too but its the same
 
and use transition + opacity to handle the fadein and fadeout
any simple fiddle?
 
@Abhishrek Lag compensation is almost a necessity for the projectiles and collisions with the enemies. Then just add a point-of-origin and angle to each projectile the clients wants to fire, trace whether it is reasonably allowed to do so (since there will be discrepancy between pilot/shooter) and go from there. Seems okay to me. It's just the addition of origin/angle to shots rather than just a packet "pulled trigger" and interpolating from there.
 
crl
1:48 PM
oldState + action = newState// this is not reducing for me
 
@crl It is.
Imagine that you can do this:
 
@DomagojSabolic a test fiddle on jsfiddle.net
 
listOfStates.reduce(reducerFunction, initialState);
 
from where I can learn redux?
 
@RoelvanUden I think interpolation actually makes sense in here
 
Let's say you initialState is 0, and reducerFunction is (a, b) => a+b
 
because everyone will see the same picture + 0.1 second
I think human brain should just compensate for it.
 
!!> [32,7,3,21,6].reduce((a,b) => a+b, 0)
 
@MadaraUchiha 69
 
crl
@MadaraUchiha there I agree, but when you state is an object, hmmm right it's good too
 
thanks
So is it really the future?
 
@Mr_Green here you go, the javascript code is when its visible to remove visibility when its on it because somethings not right when I used hide() https://jsfiddle.net/pvju0wt1/1/
 
crl
also why would I need some Action classes, Store classes, etc... where all I need are helper functions, and the store is just te root component state
 
!!> var state = {value: 0}; var reducer = (state, action) => ({value: state.value + action.value}); var actionMaker = value => ({type: "ADD", value: value}); [1, 5, 2, 7, 23, 8].map(actionMaker /* create array of action */).reduce(reducer, state);
 
@MadaraUchiha {"value":46}
 
1:52 PM
@crl ^
 
@Mr_Green if you need this https://jsfiddle.net/pvju0wt1/1/#&togetherjs=H6QhMwg3na
 
A reducer isn't limited to numbers. The entire idea is that you have a function that accepts a current state and a "commit" (or as redux calls it, an "action")
 
crl
ok, but I could do it with a helper function, instead of that 'action' thing
 
Your current state can be defined to be the accumulation of the initial state and all of the actions following
 
things are changing faster :(
 
user3119231
1:54 PM
Can someone tell me sense for const? It is just for protect variables?
 
crl
@MadaraUchiha it's good for keeping an history at least
 
@Maurice No. It's for your own sanity.
@crl Not only that.
At any point I can test if oldState === newState and if it's true, then I know, by definition, that the state hasn't changed.
Because the reducer never changes the action or the state, it always returns a new reference.
So if I have referential equality, I am also sure of deep equality.
 
crl
yea it's clean, I'm already creating clones/ object copies, a bit
 
@DomagojSabolic sorry, no idea
 
@Mr_Green
 
1:56 PM
@crl You usually don't have to deepcopy anything.
 
@Mr_Green okay thanks!
 
crl
just the wrapper like you told me recently, ok
 
can any1 else help me?
 
@crl You normally do something like this in your reducers:
 
How much longer did it take to think about, then locate and press the 1 vs writing anyone
 
user3119231
1:58 PM
Who the hell is wild wolf?
 
return Object.assign({}, oldState, {keyThatChanged: valueThatChanged});
 
crl
I do that, yes
 
@crl I have no idea what action/store classes are.
I just use literal function and objects everywhere
I have pure functions that generate actions, and pure functions that process actions.
Sometimes, the functions that generate actions are impure though
To keep the purity of the reducers.
 

« first day (1941 days earlier)      last day (2993 days later) »