Famo.us - Customizing .render() & .commit() - Will it affect 60fps and cpu performance? - famo.us

I am using Famo.us and getting to a stage where I am customising the Rendering & Commit function for some of the objects I am creating.
Since Famo.us is basically a Gaming Engine and runs at 60 frames per second, how much code is able to be placed and 'parsed' in the Render and Commit functions before it affects the 60 frames per second?
Thanks.
Mark

In Famo.us prior to Mixed mode this has been an issue.
Mixed Mode version
The new version will be addressing this issue and others that affect performance. There will be a full rewrite of the Engine in this new version.
Note: As of the date of this question, mixed mode has not been released to the public. Mixed mode will be allow rendering to WebGL and DOM. The current version is DOM only.
via #michaelobriena at Famo.us commented on Dec 11, 2014
We are working on this in mixed mode. This is essentially gutting our
entire core composition & layout layers.
Things that get killed:
Entity Spec Parser
Things that will either change a lot or have its functionality and
purpose moved to other modules:
Context RenderNode Surface render/commit & more
Because this is such a huge overhaul, we need to take the time to
investigate how we can use our changes to improve the API. We are
really trying to codify our patterns and remove the bad habits we
started of subclassing our base classes, overuse of eventing, and
solving every problem through extra state.

Related

Can I make a multiplayer Phaser game using Lance?

How do I take an existing Phaser game and make it multiplayer?
Can I use the Lance library for this purpose? Both libraries control their own game objects so I don't know how to use the two frameworks together in the same game.
Disclaimer: I am one of the co-creators of Lance
Unfortunately, Phaser's 2.* architecture makes it hard to pair with Lance to make Realtime Javascript Multiplayer games.
The issue is that Phaser makes a lot of assumptions that don't hold for a multiplayer setting. For example, the rendering and game loop are tied together. The server, obviously doesn't need to render anything.
Phaser also assumes the existence of the DOM and the window object which also don't exist on the server. In addition, all of the data structures that hold the world game state objects, sprites, etc' are saved on an extended instances PIXI objects which don't make sense in a Server context. These limitations and tight-coupling aren't compatible with Lance's modular approach.
It is entirely possible to run Phaser on the server using libraries that emulate DOM and Canvas like JSDOM and Node Canvas however it does mean that there's a significant performance degradation by running PIXI on the server, and you also still have the problem of syncing PIXI data structures to contend with.
The good news is that Phaser 3.0 is an ongoing, complete rewrite of Phaser 2.0 in a much more modular approach will hopefully make it much easier to integrate with Lance. We have plans to make this integration easier ourselves in the near future.

detect whether the browser supports famo.us

I want to detect whether a visitors browser is capable of running famo.us - if not redirect them.
My first thought was Modernizr and detect whether the browser is capable of CSS 3D transformations, though i'm worried that this may be too severe as famo.us is adding some backward compatibility perhaps through shims.
I'm currently using WURFL for device detection, though this doesn't give enough browser information as far as i can tell.
Any thoughts on this?
The standout feature that famo.us depends on is CSS preserve-3d which is key to doing CSS 3D transforms and what famo.us depends on to render correctly.
You can use the cutting edge 3.0 beta of Modernizr to test for this support specifically. I'd recommend using it over reading the User Agent, as you'll always get weird false positives somehow. Using the current 2.x release will not work, as testAllProps won't support the two parameter syntax.
if(Modernizr.testAllProps('transformStyle', 'preserve-3d')){
//true
// run famo.us code!
}
else
{
//false
// famo.us 3d transforms won't work right, so lets compromise
}
There's been quite an effort to track this one on the Modernizr teams part, so if you find any issues, let them know here.
You will need to do it via user agents to detect browsers and versions. See:
https://stackoverflow.com/questions/23219710/famo-us-browsers-supports
https://github.com/Famous/famous

How to face many customer specific GUI variants, searching for alternative to Qt

we're maintaining some Qt applications which are running on Linux and Windows desktops. Now, we want to make the applications more attractive by adding customized forms and reports for each customer or at least groups of customers. There may be 10 or more different versions needed.
As we come from Qt, we are wondering how to manage so many configurations and if there already is a framework/development system that would help us here. We were looking at QML/Qt Quick, WT Toolkit or even NC Reports for the reporting part.
Managing configurations and deriving different versions from a base is not a feature which is discussed or promoted.
There should be a clean distinction between Display and Application Logic (Model/View)
Nice would be a textual GUI description, which enables us to release changes in forms or reports without the need to reinstall the whole applications (like QML seems to have that)
Also nice would be a kind of report generator, that helps to create forms and reports for new customers without the need to code them (and so releases our core developers from boring work)
Has somebody experience with such kind of customer based configurations? It would be nice to have a hint what's the best way to do this in the Qt surrounding.
I know comparisons like http://qt-project.org/doc/qt-5.1/qtdoc/topics-ui.html#comparison, but the specific questions that I have are not mentioned.
best regards
I guess you need to differentiate applications in three aspects:
1. appearance - if the application only differs in button color, icon image and background themes, qt's style sheet is light and convenient, you can choose to deploy different qss file and load different ones without recoding. if the variance among customers concerns layouts or available widgets (some has buttons, some use combo boxes, .etc), style sheet cannot meet the requirement, QML seems promising in such case.
business logic - i'm not sure how "generating reports" differs for different customers, if the reports need to be printed, or saved as document, i don't think qt provides good toolkit (QXXXDocument is not suitable to generate / display large amount of document), html? maybe. And i agree with #hyde that loading different plugins or dynamic libraries can solve this.
What I learnt from 8 month qt:
Model/View Architecture is there, for example a tree view that we fill with voyage data. the data is gatheres from several db tables, so we have a good logical distinction.
We hadn't the time to work us into qml, so we stuck with qt designer. It's quite easy, so we're fine with that. Delivering changes in customer forms without recompile will be a feature for a bigger future rework.
Same with report generators...

ipad 3 with cocos2d 0.99.5

Is there any way to make my app work on ipad 3 without updating to cocos2d 1.0.1 or higher?
I am using cocos2d 0.99.5 and a third party framework (not mine) which uses cocos2d 0.99.5
Updating to cocos2d 1.0.1 or higher would be a colossal work.
My app is working in ipad 1 and ipad 2, but in ipad 3 i just see a black screen (and listen to the music)
Thank you!!
Possibly, if you can retrace what has been done to add iPad 3 support between 0.99.5 and v1.0.1. You can use the github commit history. Though this will not be an easy task, and possibly cost you more time than updating to v1.0.1.
Why would updating be a colossal task? If you tried it and found hundreds if not thousands of errors, this does not mean you'll have to apply the same number of fixes. One renamed cocos2d class can already give you dozens and more errors depending on the class and your project.
To update cocos2d follow the steps described here. Especially important and often forgotten is to actually delete all the old cocos2d files, otherwise you may still be using old version source files in your project causing all kinds of trouble.
From what I recall when I updated the first edition of my book (cocos2d 0.99) to the second edition (cocos2d 1.0.1) there was very little code between those two cocos2d versions that actually forced me to write new code. 99% of the changes are merely renamed classes, methods and properties - renaming them accordingly fixes 80% of the issues, and the rest are new or removed or re-arranged parameters of methods, almost as easily fixed though not as easily because you can't always use refactor respectively search & replace to fix those.
I suggest to fix the easy ones first (renamed classes, methods, properties) and then get to the rest. If you need help, you already know how to use SO. ;)

What is the best approach to use openGL in the web?

I wrote a program in C++/OpenGL (using Dev-C++ compiler) for my calculus 2 class. The teacher liked the program and he requested me to somehow put it online so that instead of downloading the .exe I can just run it on the web browser. Kinda like java applets run on the browser.
The question is:
How if possible, can I display a C++/OpenGL program in a web browser?
I am thinking of moving to JOGL which is a java interpretation of OpenGL but I rather stay in C++ since I am more familiar with it.
Also is there any other better and easier 3D web base API that I can consider?
There is a lot activity recently with WebGL. It is a binding for Javascript to native OpenGL ES 2.0 implementations, designed as an extension of the canvas HTML5 element.
It is supported by the nightly builds of Firefox, Safari, Chrome and Opera.
Have a look at these tutorials, based on the well known NeHe OpenGL tutorials.
Several projects based on WebGL are emerging, most notably Scenegraphs APIs.
From Indie teams: SceneJS, GLGE, SpiderGL.
From Google: the team behind O3D plugin is trying to implement a pure WebGL backend (source) for the project, so that no plugin will be necessary.
From W3C/Web3D: There is an ongoing discussion to include X3D as part of any HTML5 DOM tree, much like SVG in HTML4. The X3DOM project was born last year to support this idea. Now it is using WebGL as its render backend, and is version 1.0 since March 2010.
I'm almost sure that WebGL is the way to go in the near future. Mozilla/Google/Apple/Opera are promoting it, and if the technology works and there is sufficient customer/developer demand, maybe Microsoft will implement it on IE (let's hope that there will be no "WebDX"!).
AFAIK, there's only 3 options:
Java. it includes the whole OpenGL stack.
Google's Native Client (NaCL), essentially it's a plugin that let's you run executable x86 code. Just compile it and call it from HTML. Highly experimental, and nobody will have it already installed. Not sure if it gives you access to OpenGL libraries.
Canvas:3D. Another very experimental project. This is an accelerated 3D API accessible from JavaScript. AFAICT, it's only on experimental builds of Firefox.
I'd go for Java, if at all.
OTOH, if it's mostly vectorial works (without lots of textures and illumination/shadows), you might make it work on SVG simply by projecting your vectors from 3D to 2D. In that case, you can achieve cross-browser compatibility using SVGWeb, it's a simple JavaScript library that allows you to transparently use either the browser's native SVG support or a Flash-based SVG renderer.
Do you really have the time to rewrite it? I thought students were meant to be too busy for non-essential assignment work.
But if you really want to do it, perhaps a preview of it running as a flash movie is the easiest way. Then it's just a matter of doing that and you could provide a download link to the real application if people are interested.
Outside of Java, in-browser OpenGL is really in its infancy. Google's launched a really cool API and plugin for it though. It's called O3D:
http://code.google.com/apis/o3d/
Article about the overall initiative:
http://www.macworld.com/article/142079/2009/08/webgl.html
It's not OpenGL, but the Web3D Consortium's X3D specification may be of interest.
Another solution is to use Emscripten (a source-to-source compiler).
Emscripten supports C/C++ and OpenGL and will translate the source into html/JavaScript.
To use Emscripten you will need to use SDL as a platform abstraction layer (for getting an OpenGL context as well as loading images).
Emscripten is currently being used in Unreal Engine and will also be used in the Unity 5 engine.
Read more about the project here:
https://github.com/kripken/emscripten
Two approaches:
Switch to Java. However, your application will suffer from a loss of performance as a trade off for portability. But since Java is everywhere, this approach ensures that your code can be executed in most browsers.
Use ActiveX, which allows you to run native binary code for Microsoft Windows. This is not recommended in production because activeX is well known as a potential security hole, but since your lecturer is the one viewing it, security doesn't seem to be a big deal. This is applicable for Microsoft platform (Windows+IE) only.