minko - scripting 3d apps with lua and c++
TRANSCRIPT
![Page 1: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/1.jpg)
Flash Online Conference #7
Scripting 3D apps with Lua and C++
@Minko3D http://minko.io
![Page 2: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/2.jpg)
LATEST MINKO 2 ADDITIONS Available today on minko.io
![Page 3: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/3.jpg)
New Minko 2 Features
Editor – Auto-save – Multiple optimizations
Framework
– Mutiple fixes on the lighting system
Available today! http://minko.io/download
![Page 4: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/4.jpg)
MINKO 3 Codename « Normandie »
![Page 5: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/5.jpg)
Motivations
Target new platforms – Keep the « design once, deploy everywhere » workflow – Larger community
Increase performances, epecially CPU-wise
– Multi-threading?
Leverage existing codebase
![Page 6: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/6.jpg)
Technological choices
C++11 core framework and plugins
Develop once, deploy everywhere – Windows, Mac, Linux – Android, iOS – HTML5, Flash
Work with all the tools you like
![Page 8: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/8.jpg)
Babolat Play - First commercial project!
http://www.youtube.com/watch?v=ewUUerxdZ7U
![Page 9: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/9.jpg)
Babolat Play - Fallback
Is WebGL
available?
Run web app. Generate JPEG on the server
no yes
Thanks to Minko 3, the same code runs on the server side and in the browser.
![Page 10: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/10.jpg)
New Platforms
Platform Status Target Languages
iOS OK Native C/C++
Android OK Native C/C++
Flash (Stage3D) WIP X-Compilation C/C++, AS3
Windows (DirectX) OK Native C/C++
Mac OK Native C/C++
Windows (OpenGL) OK Native C/C++
Linux OK Native C/C++
HTML5 (WebGL) OK X-Compilation C/C++, Javascript
Windows Phone WIP Native C/C++
BlackBerry 10 NA Native C/C++
Firefox OS NA Native C/C++
![Page 11: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/11.jpg)
How can I help?
Show your love for Crossbridge and Minko on the dedicated feature request on Github! – https://github.com/adobe-flash/crossbridge/issues/28
Please leave a comment, even just a +1
![Page 12: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/12.jpg)
2D/3D file formats
50+ 3D file formats – 3DS, BLEND (Blender 3D), DAE/Collada, FBX, IFC-STEP , ASE, DXF,
HMP, MD2, MD3 , MD5, MDC, MDL, NFF, PLY, STL, X, OBJ, SMD, LWO, LXO, LWS, TER, AC3D , MS3D , COB, Q3BSP, XGL, CSM, BVH, B3D, NDO, Ogre XML, Q3D
20+ 2D file formats
– JPEG, PNG, TIF, TGA, RAW, PSD…
![Page 13: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/13.jpg)
Effect files
Store a fully setup multi-pass rendering effect
Include 3rd party shaders and plug them in the engine using bindings
Support über-shaders using automated macro definition based on bindings
Handle multiple rendering techniques to choose from at runtime
Can fallback to another specific technique when the selected one fails (WIP)
![Page 14: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/14.jpg)
Portable Effects & Shaders
Group passes in a named « technique »
Select that technique at runtime based on some flags – Platform – Available features/plugins – Custom flags
"techniques" : [ { "configuration" : [ "windows" ], "passes" : [ { "vertexShader" : … "fragmentShader" : … } }, { "configuration" : [ "flash" ], "passes" : [ { "vertexShader" : … "fragmentShader" : … }, { "vertexShader" : … "fragmentShader" : … } } ]
« w
indo
ws »
tech
niqu
e «
flash
» te
chni
que
![Page 15: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/15.jpg)
Leap Motion support
http://www.youtube.com/watch?v=p14kJNJ9Eoc
![Page 16: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/16.jpg)
Oculus Rift support
![Page 17: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/17.jpg)
SCRIPTING IN MINKO 3
![Page 18: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/18.jpg)
C++11 is great, but…
Is a new language for most developers
It’s too complex for prototyping game design
Requires some setup to get started
Slow iteration times
![Page 19: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/19.jpg)
Core Framework Language Fast
Rich & expressive
Optimized for each target
Scripting Language Simple
Interpreted
Dynamic
VS C, C++, Java, C#... Javascript, Python, AS3…
![Page 20: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/20.jpg)
Complaints about ActionScript
Garbage collector is messy
No operators overloading
Bad performances
No (easy) concurrency
![Page 21: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/21.jpg)
We chose… Lua!
Fits all the requirements of a scripting language
Vastly used by the video game industry (World of Warcraft, Fable II & III, Neverwinter Nights, …) – Complete list of games scripted with Lua
Very (very) fast
– LuaJIT is comparable to Javascript V8, if not faster
Designed to be embedded
Designed to script games – Simple but very efficient syntax – Minimalistic set of features but very extensible – Coroutines!
![Page 22: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/22.jpg)
C++ Lua? LuaGlue!
C++/Lua bindings
Open source project – https://github.com/Tomasu/LuaGlue – We contribute as much as possible
Leverage C++11
– Optimize as compile time as much as possible – Simple binding interface
Used to bind 90% of Minko’s C++ API
– Write 100% of your app in Lua
![Page 23: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/23.jpg)
ActionScript VS Lua
ActionScript Messy garbage
collector
No operators overloading
Bad performances
No easy concurrency
Lua Customizable garbage
collector
Operators overloading
Very fast + custom C/C++ bindings
Coroutines
![Page 24: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/24.jpg)
Minko 3 VS Flash
Flash Runtime
Core Library
ActionScript VM
Application
OS
Minko 3
Core Framework & Plugins
Lua VM
Application
OS
ANE
![Page 25: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/25.jpg)
Flexible
Flash Runtime
Core Library
ActionScript VM
Application
OS
ANE
Minko 3
Core Framework & Plugins
Lua VM
Application
OS
![Page 26: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/26.jpg)
Open Source
Flash Runtime
Core Library
ActionScript VM
Application
OS
Minko 3
Core Framework & Plugins
Lua VM
Application
OS
ANE
![Page 27: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/27.jpg)
Customizable
Flash Runtime
Core Library
ActionScript VM
Application
OS
Minko 3
Core Framework & Plugins
Lua VM
Application
OS
ANE
![Page 28: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/28.jpg)
Coroutines
A function can suspend its execution… – coroutine.yield()
… and then resume « sometime later »
– coroutine.resume()
Gives the illusion of parallelism – Yet no complicated threading stuff – Fully cross-platform
Allow the creation of non-blocking (heavy) functions
Can (always?) be used in place of events/callbacks
![Page 29: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/29.jpg)
Coroutines
function myScript doSomething() while isIdle say(‘hello how are you?’) wait(seconds(3)) while no isIdle wait(keyboard:keyDown()) handleKeyboard() …
![Page 30: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/30.jpg)
![Page 31: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/31.jpg)
Event driven Coroutine driven
Action => reaction
Breaks the code in multiple handlers
Messy execution flow
Messy scopes
Wait for « something » to happen
Non-blocking
Simple execution flow
Meaningful and readable
![Page 32: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/32.jpg)
You chose!
C++ – Performances – Rich and powerful language
Lua
– Simple and efficient – Fast iteration times
Mix both in any project on any target
![Page 33: Minko - Scripting 3D apps with Lua and C++](https://reader031.vdocuments.site/reader031/viewer/2022013121/556a2533d8b42a2f3f8b4d1f/html5/thumbnails/33.jpg)
2014
New Minko editor – Script editor – Live coding – ShaderLab – Animations editor – Plugins system
Open beta of Minko 3 (January)
An amazing new Minko product for businesses and teams
http://www.youtube.com/watch?v=yuR1e1PjU8Y