These are chat archives for highfidelity/hifi

3rd
May 2017
Don Hopkins
@SimHacker
May 03 2017 16:15
I've got a new version of the chat script up now, that I'd like people to test please!
Here is the interface script to test, which you should load as an interface script, and it puts a "CHAT" button on the tablet.:
http://donhopkins.com/home/hifi/Chat/Chat.js
And the web page it uses in the tablet, if you'd like to look at that:
http://donhopkins.com/home/hifi/Chat/ChatPage.html
Now it uses a local text entity to show a "speech bubble" of the text you last typed above your head, so people who have not loaded the chat script will still be able to see it.
Philip Rosedale
@PhilipRosedale
May 03 2017 16:16
@SimHacker Thanks! Will install and start using it!
Don Hopkins
@SimHacker
May 03 2017 16:17
There is a problem that I can't find an API to measure the text in the text entity, like I was doing with Overlays.textSize. So for the time being I am creating a temporary text3d overlay with the same parameters and measuring that.
Unfortunately the measurement isn't exactly right, and the text entity does not seem to support margins like the overlay text3d does.
I added a wee fudge factor to make it a little bigger so it doesn't overflow, since extra space is better than missing text.
Awesome! I am in a cafe with slow internet, so I might be sluggish, but I will beam into the welcome world!
Philip Rosedale
@PhilipRosedale
May 03 2017 16:18
@SimHacker is there any chance you could writeup a worklist job with a precise description of what we need to fix/add on the local text entity and set it to suggested and let me know? I'll immediately fund it so we can get that work done.
Don Hopkins
@SimHacker
May 03 2017 16:19
I looked at the chat board, the way it uses a web browser. It might be neat to make the chat use a web browser too, to display and measure the text precisely. That will give us MUCH more flexability in how to display the chat message! So you could scroll it like CNN news ticker, use nice fonts, draw icons and even show web pages!
OF course there'd be a performance penalty since a web browser is heavier than a text entity.
Philip Rosedale
@PhilipRosedale
May 03 2017 16:20
@SimHacker One thing I noticed in my testing was that it seems to take quite a while for the chat screen to come up on my tablet after I push the 'chat' button. Any thoughts on that?
Don Hopkins
@SimHacker
May 03 2017 16:20
But how about we add an api for measuring text entities, and also controlling the boarders like text overlays? That will help make it look nicer.
YES I sure noticed that! I tried making a super simple web page, and also setting randomizeWebPageURL to false (I was randomizing to get my changes while developing), but neither of those changes seemed to effect the load speed. It's driving me crazy!
Is there another web page based tablet app that pops up instantly that I can use as a baseline?
There is a kind of harsh usability issue: you can't tell if the input focus is set to the tablet or not, so if you start typing a chat message, but it's set to the hifi world, very unexpected things might happen in response to the keystrokes. This isn't an issue with the input focus inside the web browser between html components, but rather with hifi itself. It would be nice if the web browser got notification when it got and lost hifi keyboard focus, so it could at least hide its blinking suggestive beckoning cursor. Otherwise it tempts you into typing a chat message and spazzing out accidentally!
One thing I encountered when switching between local text entities and overlays is that the parameters for each of them are slightly but unnecessarily different. Like the key to make the text face the avatar. And the boarders. I have to check to be sure, but the text entity "faceCamera" flag only yaws it around the y-axis, and doesn't pitch it up (around the x-axis) or roll it (around the z-axis) . Should billboarded text pitch as well as yawing? And should it also roll to match the camera? I think the overlay was pitching but I am not sure.
Don Hopkins
@SimHacker
May 03 2017 16:30
Hang on something's broken -- I'll tell you when to reload!
Weird now it's working!
But I only uncommented some debugging print. Heizenbug? ;)
Also I noticed that the text entity's text color gets darkened randomly, which flickers brighter and darker as you turn the camera around. (I am on desktop and have zoomed out of first person with the mouse wheel, then drag around with the right button to look around).
Don Hopkins
@SimHacker
May 03 2017 16:36
Strange, my speech bubble is working in my sandbox but not in the welcome world. Maybe permission problems? I am passing "true" as the second param to addEntity:
speechBubbleTextID =
Entities.addEntity(speechBubbleParams, true);
Perhaps it's because I am on a very slow internet connection? I'm going to go home where there is fast internet and a graphics accelerator, in a few minutes.
Johnathan Franck
@rabelaiis
May 03 2017 16:41
Are there any js specific coding standards? It looks like the standards on the wiki apply mainly to cpp: https://github.com/highfidelity/hifi/wiki/Coding-Standard
Philip Rosedale
@PhilipRosedale
May 03 2017 17:02
@rabelaiis Good question - basically we've been applying the same C++ standards to JS. But let me ask my team to make that more clear.
Johnathan Franck
@rabelaiis
May 03 2017 17:29
Thanks @PhilipRosedale and @themelissabrown the C++ standards and eslint cover a lot but sometimes teams like to standardize things like how 'this' is used in js so I thought I would make sure I wasn't missing something. \
Philip Rosedale
@PhilipRosedale
May 03 2017 17:42
@SimHacker Would it make sense to set the chat name on startup to the display name?
Don Hopkins
@SimHacker
May 03 2017 17:45
It is trying to set the chat name to MyAvatar.displayName, but if that is empty, it makes a random anonymous id. It was empty for my avatar!
    chatName = Settings.getValue('Chat_chatName', MyAvatar.displayName);
    print("loadSettings: chatName", chatName);
    if (!chatName) {
        chatName = randomAvatarName();
    }
Then it saves the chat name in the settings, whatever it is.
Under what conditions will MyAvatar.displayName be empty? Do I need to set it for each logged in instance? (I am running it at the same time on a mac and a pc, for testing multi user stuff)
Philip Rosedale
@PhilipRosedale
May 03 2017 18:26
OK cool - so what you are saying is that if I have set my display name, it will use that?
Faye Li
@fayeli
May 03 2017 18:30
Hey guys! It's Faye. I have a question but I realised I don't have slack access anymore so I'm asking here - how does HiFi's C++ engine read in JSON?
Is it handled by Qt? Or?
Clément Brisset
@Atlante45
May 03 2017 18:31
Hey Faye! Yes, we just QJsonDocument.
Don Hopkins
@SimHacker
May 03 2017 18:32
Well if you run chat first without a display name, then it will assign you a random Anon_2345 name, and save that in settings. Then if you change your avatar name, it will still use the anon name since that is saved in settings now.
Faye Li
@fayeli
May 03 2017 18:33
Cool! Thanks Clement!
Don Hopkins
@SimHacker
May 03 2017 18:33
Should it always use your display name if it's defined, overriding anything saved in settings? or save "" in settings to mean "use display name" (but then what to do if both are "" -- we can generate a random name, but if we save it, we're right back to where we are now if ignoring the display name.
Faye Li
@fayeli
May 03 2017 18:34
I was wondering about that because at my new job, we have this crazy idea that we want try implementing a JSON deep copy function in WebAssembly to speed things up
Don Hopkins
@SimHacker
May 03 2017 18:34
Or we could save a special non-empty string that means "use the display name" like "DISPLAY_NAME".
Faye Li
@fayeli
May 03 2017 18:36
I was thinking I'd definitely need to use some kind of C++ JSON parser to do that. Right?
Also is this even a good idea? I can use some advice!! haha
@AndrewMeadows ? or @sethalves ?
Clément Brisset
@Atlante45
May 03 2017 18:41
Hmm, I really don't know enough about that to make an accurate call. Guess you'll have to time it and see.
I usually just do:
var jsonString = JSON.stringify(json);
var copy = JSON.parse(jsonString);
Makes a deep copy.
Faye Li
@fayeli
May 03 2017 18:45
Yeah! That's what I used to do too but apparently it's also quite common to use a js library. like this one: https://github.com/primus/ejson/blob/master/index.js#L612
var copiedJSON = EJSON.clone(originalJSON)
What we're wondering is whether it's possible to speed it up even moreee haha. Cause it's called so often
Clément Brisset
@Atlante45
May 03 2017 18:49
I'm not very well versed in that subject, this is mostly a JS issue. But I bet people have already worked on that in the past.
Quick Google search give me 2 SO posts. I'm sure you could find some nice research or previous implementations that would point you in the right direction.
Faye Li
@fayeli
May 03 2017 18:52
What did you search for?
Clément Brisset
@Atlante45
May 03 2017 18:52
"Faster JSON copy"
Polyrhythm
@Polyrhythm
May 03 2017 18:54
i think you probably don't want to lean on json for cloning and do this as js objects
newer browser-based APIs let you clone objects pretty well
the stringify/parse method will not work on objects with functions
Faye Li
@fayeli
May 03 2017 18:56
^Yep you're totally right on.
Polyrhythm
@Polyrhythm
May 03 2017 18:56
json parsing is so error-prone that i would tend to stay away from it for anything important, personally :)
Faye Li
@fayeli
May 03 2017 19:00
Haha that's so true
We saw this yesterday with the JS API we use
> var x = { '0': {} }
> var y = [ {} ]
> EJSON.equals(x,y)
true
> EJSON.equals(y,x)
false