Q3D V-2.4 [3D Physics + Skeletal Animation UPDATE]

Post your completed addons to share with the community

Post » Tue Feb 10, 2015 6:24 pm

Physics plugin is about 90% complete, I've added support for various joint types, collision bitmasks, spheres/boxes/cylinders, helper functions, and only have multi-body shapes left to add.
B
79
S
13
G
8
Posts: 1,977
Reputation: 9,947

Post » Wed Feb 11, 2015 2:00 am

@QuaziGNRLnose, This is great to hear!

I had one more performance hitch while using morph target animation. Just when the morph target animation begins, I notice that the FPS drastically falls to 1FPS or so momentarily and then again picks-up the next moment to 47FPS or so. And this happens for the first time when the model loads...I belive this drastic momentarily decrease in FPS is causing a problem to load on iPad. Whenever this is happening, the iPad safari browser again tries to reload the same page (note that I have got rid of all Q3Dlights in my code for performance reasons).

Here is what I am doing in the code -

I am having only Q3DModel object but am loading a .js model dynamically using "change model" action. Then on model created, I am calling "play morph animation". I have also tried to pre-load the .js model files at the start of the layout but it didn't help in the performance issue. I am assuming that this issue is happening somewhere between loading the model and then playing the animation "on model created" because I also notice that the model doesn't load instantaneously for the first time (it takes 0.5sec to 1 sec gap to load)...However this happens only for the first .js model file...Later models load and play animation almost instantaneously though I am loading the remaining models, dynamically, as well using the same action - events...I very vaguely remember I didn't observe this hitch when I was using v-2.2 plugin...Not sure if something changed in the code for v2.3...Any ideas what could be wrong? I have spent several hours building models in blender to launch this app in iPad and got almost everything working except this...I can share the .capx in a PM if you want to take a look.

One more C2 coding related issue while using Q3DMaster -
While shuttling between layouts that use Q3DMaster objects during game play, I observe that there are few issues. For the first time when I go to a layout using Q3DMaster, then it loads all the objects for the first time...Then lets say I go back and come back again to the same layout...When I come back again to the same layout I believe it assumes that all Q3Dobjects are already loaded etc., so action-events like "on model created" give a javascript error ( I think it assumes the model is already created)...This is adding an additional burden to figure out in C2 code if I am coming to this layout for the first time or later and accordingly add some repeating logic w/o "on model created" action etc., Will it be possible to see if this could be simplified in the plugin ?
For game development / IT services contact - [email protected]

List of published iOS apps -
https://itunes.apple.com/us/artist/ravi ... d693234511
B
84
S
20
G
3
Posts: 337
Reputation: 7,368

Post » Wed Feb 11, 2015 2:28 am

@kmsravindra

please do pm me with the capx.

Note that loading models for the first time requires the browser to download the file, and send the geometry to the gpu, so it causes a drop in the fps that can't be avoided, also, using the same model but never uploading it to the gpu because it hasn't been rendered yet, or requires new model attributes because of textures/animations/etc. also causes small drops. these delays are unavoidable for first time initialization, but usually aren't a big problem on desktops. I assume again that the ipad hardware isn't really the greatest and the webgl implementation is poor.

You can load everything at the beginning using the Q3DMaster action "load model" and then the drop will only occur at the beginning but not when swapping between models with "change model", this will mean the models don't have to be downloaded but there will still be a small pause on first time initialization. to get rid of even that pause, you have to basically get those models to initialize first, which should happen if you change to each of the models you need at least once in this case. Q3D sort of lazy initializes things this way because it would otherwise use way too much memory making assumptions.

I'd advise you that the "keep mat settings" feature in "Change Model" introduced in V.2-3 is "slow" (at least it probably introduces a non-negligible overhead on mobile), and you should disable it unless you need it. "Change model" is also not the fastest function unless its changing to initialized models.

Again, Q3D is very optimized, but the IPad has slow hardware and safari's .js engine and webGl implementation aren't very good. There isn't very much I can do to improve things, but your projects performance can easily be improved by properly initializing objects. I can't make Q3D automatically guess the number of models and of what type it needs to build pools for, or the models it needs to load, so you have to do that manually if you wish for the initialization to occur only during loading and not lazily on a need-to-know basis. Perhaps eventually i'll include the option for a special initialization file that gives Q3D instructions, but for now you can use change model (ensure the files are done downloading first).
B
79
S
13
G
8
Posts: 1,977
Reputation: 9,947

Post » Wed Feb 11, 2015 2:40 am

Thanks @QuaziGNRLnose. I am sending the .capx file right away. Could you please respond to this question as well ( that I edited later in the above post..prob you might have missed it)

One more C2 coding related issue while using Q3DMaster -
While shuttling between layouts that use Q3DMaster objects during game play, I observe that there are few issues. For the first time when I go to a layout using Q3DMaster, then it loads all the objects for the first time...Then lets say I go back and come back again to the same layout...When I come back again to the same layout I believe it assumes that all Q3Dobjects are already loaded etc., so action-events like "on model created" give a javascript error ( I think it assumes the model is already created)...This is adding an additional burden to figure out in C2 code if I am coming to this layout for the first time or later and accordingly add some repeating logic w/o "on model created" action etc., Will it be possible to see if this could be simplified in the plugin ?
For game development / IT services contact - [email protected]

List of published iOS apps -
https://itunes.apple.com/us/artist/ravi ... d693234511
B
84
S
20
G
3
Posts: 337
Reputation: 7,368

Post » Wed Feb 11, 2015 2:54 am

@kmsravindra

Didn't know about that bug! The plugin covers a lot of functionality so it's difficult for me to test every interaction. I have simple unit tests but sometimes I just miss bugs like that. A way to deal with the issue for now that you can do is probably to just make Q3DMaster a global object and make it invisible when it isn't needed. I'll try to figure out whats causing the bug for the next update though. Please report any bugs like this that you run into!

EDIT:

From testing in a simple project, i couldn't recreate that bug. could you please pm me a simple cap that causes the problem you're talking about. i made a project that switches between two layout and uses "on model created" but this is insufficient to cause the bug.
B
79
S
13
G
8
Posts: 1,977
Reputation: 9,947

Post » Wed Feb 11, 2015 4:25 am

@QuaziGNRLnose, Understood...I am not complaining...After all you really dared to make a great plugin that lot of us could not even imagine...
So in the same capx file that I sent you, if you can "toggle disable" the following lines -

- Disable Line 2 till Line 11 ( here is where I am checking if it has already come to this layout before, then using these events)
- Disable only "System first time = 0 " condition in Line 12
- Disable only "System first time2 = 0 " condition in Line 22

If you observe, I am almost doing the same thing between Line 2 to Line 11 as between Line 12 to Line 22 - The difference being checking for "On model created" event in Line 12 to 22 and not checking for the same during LIne2 to LIne 11.

When I run with the above mentioned lines disabled in the below scenario, I get this error -

Here is how to create this scenario -
1. Choose a cylinder shape and click Nets ( Now for the first time it works fine)
2. Go back using 3D shapes button
3. Again click on Nets ( Cylinder shape is chosen by default anyway)
4. I get the JS error as mentioned in the image.
You do not have the required permissions to view the files attached to this post.
For game development / IT services contact - [email protected]

List of published iOS apps -
https://itunes.apple.com/us/artist/ravi ... d693234511
B
84
S
20
G
3
Posts: 337
Reputation: 7,368

Post » Wed Feb 11, 2015 5:09 am

Edit:

Sorry, I mistook the "Q3D" models as Quake 3 MD3 files for some reason.

This looks like a great project. Thanks for sharing it with us :)
Last edited by jojoe on Wed Feb 11, 2015 5:27 am, edited 1 time in total.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Wed Feb 11, 2015 5:37 am

As i explained, you need to create one of each model at least once, either by swapping to it with change model when the model is finally loaded, or by creating and destroying instances with that model (again the model has to be loaded first, or Q3D will "wait" for the load to finish and it wont initialize in the same way). It's kind of difficult to explain but Q3D models use complex internal pooling, so that things work efficiently if you create and destroy a lot of objects. "Change model" isn't really meant to be used the way you're using it without hiccups, so it makes things a bit more complicated to initialize.

Normally Q3D expects one model file for each Q3DModel in the scene, so it just initializes everything at the beginning, and as you dynamically load in things that it's never seen before it has to do the setup work on the spot. Since you're basically always changing to things it's never seen before, it has to take that time the first time it sees it. You have to force it to see it earlier to get around that.
B
79
S
13
G
8
Posts: 1,977
Reputation: 9,947

Post » Wed Feb 11, 2015 5:42 am

Understood. I will give this early loading a try. Also I hope you were able to reproduce the error I mentioned above...Thanks!
For game development / IT services contact - [email protected]

List of published iOS apps -
https://itunes.apple.com/us/artist/ravi ... d693234511
B
84
S
20
G
3
Posts: 337
Reputation: 7,368

Post » Wed Feb 11, 2015 5:43 am

jojoe wrote:Edit:

Sorry, I mistook the "Q3D" models as Quake 3 MD3 files for some reason.

This looks like a great project. Thanks for sharing it with us :)


Ah, i can see the confusion :P

Q3D loads .obj files and three.js json files, which can be converted to from most common formats. Supporting fbx/etc. internally is a bit of a pain since they're proprietary, and it's not a trivial task to write complicated loaders for these file types. The three.js community has written various tools that do the conversion already anyway, and I think modeling software should be used to handle the conversion anyway, rather than an event sheet. Importing 3D models is always a dirty process in every engine, but i'll do my best to integrate more loaders in the future.
B
79
S
13
G
8
Posts: 1,977
Reputation: 9,947

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest