TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
Slides mihail-ivanchev-1
1. droidcon 2013, Berlin
GamePlay3D: the versatile cross-
platform 3D game framework
Mihail Ivanchev
2. Overview
• GamePlay3D is an open-source 3D game
framework supporting numerous platforms.
3. Overview
• GamePlay3D is an open-source 3D game
framework supporting numerous platforms.
• Quick facts:
– Apache 2.0 license; free for all usage types
– The development is supported by BlackBerry
– The development language is C++
– Declarative nature for rapid development
– Targets independent developers
4. Motivation
• There are open-source frameworks for the
development of cross-platform 2D games.
• For 3D games however the choice is mostly
among proprietary technologies such as
Unity3D and Adobe AIR.
• Flexible, simple, solid design. Intuitive API
with focus on productivity.
5. History
• Initially a private research project known as
Octane3D, a cross-platform engine featuring
intuitive tools and a clean API.
• Envisioned and developed by the duo Sean Paul
Taylor and Steve Grenier in their spare time while
working for BlackBerry.
• In 2012 BlackBerry offers to support the
development of the framework to enhance the
feature set.
6. Features
• Flexible 3D scene graph.
• Material system.
• Particle system.
• Terrain rendering.
• Themable GUI system.
• 3D physics and collision detection.
• AI state machine.
• Lua scripting.
7. Declarative nature
• Many code structures in GamePlay3D can be
build up declaratively using text files.
Structure type File extension
Configuration files .config
Scene definitions .scene
Collision definitions .physics
Animation definitions .animation
Audio asset definitions .audio
Particle systems .particle
GUI forms .form
GUI themes .theme
8. Declarative nature
• Many code structures in GamePlay3D can be
build up declaratively using text files.
Animation: Configuration:
animation animations window
{ {
frameCount = 1100 title = Character
clip idle width = 1280
{ height = 720
begin = 27 fullscreen = false
end = 167 samples = 2
repeatCount = INDEFINITE }
loopBlendTime = 250
} aliases
clip walking {
{ backboard = res/dxt/backboard.dds
begin = 274 basketball = res/dxt/basketball.dds
end = 298 book = res/dxt/book.dds
repeatCount = INDEFINITE ...
} toybox = res/dxt/toybox.dds
clip running walleast = res/dxt/walleast.dds
{ wallnorth = res/dxt/wallnorth.dds
begin = 331 walloverhang = res/dxt/walloverhang.dds
end = 346 wallsouth = res/dxt/wallsouth.dds
repeatCount = INDEFINITE wallwest = res/dxt/wallwest.dds
} windowledge = res/dxt/windowledge.dds
clip runningLeft wood = res/dxt/wood.dds
{ woodn = res/dxt/woodn.dds
begin = 899 }
end = 915
repeatCount = INDEFINITE gamepads
} {
... form = res/common/gamepad.form
} }
9. Technical
• GamePlay3D is fully C++, not a single Java file
is required on Android.
Since Android 2.3!
10. Technical
• GamePlay3D is fully C++, not a single Java file
is required on Android.
• OpenGL 3 used on desktop and OpenGL ES 2
used on mobile targets.
• API support for native features: multi-touch,
accelerometer, file system access etc.
• Different methods for interacting with
platform-specific code: e.g. JNI on Android.
11. Material system
• The material defines how a piece of geometry
is rendered on screen.
Material
PASS 1 PASS 2 PASS N
Render state Render state Render state
Vert. shader Vert. shader Vert. shader
Frag. shader Frag. shader Frag. shader
Technique
12. Material system
• The material defines how a piece of geometry
is rendered on screen.
material duck
{
technique
{
pass 0
{
vertexShader = res/shaders/textured.vert
fragmentShader = res/shaders/textured.frag
defines = SPECULAR
sampler u_diffuseTexture
{
path = res/duck-diffuse.png
mipmap = true
wrapS = CLAMP
wrapT = CLAMP
minFilter = NEAREST_MIPMAP_LINEAR
magFilter = LINEAR
}
renderState
{
cullFace = true
depthTest = true
}
u_cameraPosition = CAMERA_WORLD_POSITION
u_ambientColor = 0.2, 0.2, 0.2
u_lightColor = 0.75, 0.75, 0.75
u_specularExponent = 50
u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
}
}
}
13. Material system
• The material defines how a piece of geometry
is rendered on screen.
• Flexible interaction with the shader uniforms
through material parameters.
15. GUI system
• Supports several control types.
form particleEditor
{
theme = res/editor.theme
autoWidth = true
autoHeight = true
container presets
{
style = basic
layout = LAYOUT_VERTICAL
position = 0, 0
size = 160, 220
label title
{
style = title
size = 140, 30
text = Presets
}
radioButton spiralFlame
{
style = iconNoBorder
text = Fire
group = presets
size = 140, 40
imageSize = 35, 35
selected = true
}
...
}
...
}
16. GUI system
• Supports several control types.
• Flexible theming mechanism.
theme particleEditor style basic
{ {
texture = res/editor.png stateNormal
{
imageList normalImages skin = mainNormal
{ imageList = normalImages
color = #4A8799ff
... font = res/arial18.gpb
} textColor = #ffffffff
imageList activeImages : normalImages fontSize = 18
{ textAlignment = ALIGN_VCENTER_HCENTER
color = #C3D9BFff }
...
} stateActive
skin mainNormal {
{ imageList = activeImages
border }
{ }
left = 10
right = 10 ...
top = 10 }
bottom = 10
}
region = 1, 1, 74, 74
color = #4A8799ff
}
skin mainActive : mainNormal
{
color = #C3D9BFff
}
17. Physics & Collision Detection
• Wraps the Bullet physics library.
• Provides standard rigid body simulation.
• Provides game character and vehicle models.
• Provides ray and hit testing.
18. Particle System
• Supports many particle attributes.
• Supports animated particles.
• Lacks support for particle collisions.
• A simple editor is provided as a sample.
19. Asset Management
• gameplay-encoder – a command-line tool for
packing game assets to a binary file package.
– (.TTF) True-type fonts
– (.FBX) Autodesk’s 3D scene format
gameplay-encoder -s 14 Futura-Medium.ttf futura-med.gpb
gameplay-encoder -oa –tb sphere Level1-Tutorial.fbx lev1-tut.gpb
20. Asset Management
• gameplay-encoder – a command-line tool for
packing game assets to a binary file package.
– (.TTF) True-type fonts
– (.FBX) Autodesk’s 3D scene format
• Other formats are supported directly.
– Standard image formats
– Standard audio formats
21. Lua Scripting & Language Bindings
• Lua scripting is done by specifying Lua
handlers for predefined or custom events.
scripts
{
initialize = res/script.lua#initialize
Game config: update = res/script.lua#update
render = res/script.lua#render
finalize = res/script.lua#finalize
}
Lua script:
22. Lua Scripting & Language Bindings
• Lua scripting is done by specifying Lua
handlers for predefined or custom events.
• Additional interaction possible through the
game’s script controller.
• Additional language bindings available for the
cross-compiled language Haxe.
https://github.com/MIvanchev/hx-gameplay
23. Documentation and development environments
• GamePlay3D is well documented.
• All C++ environments usable.
• All Lua environments usable.
• Command line tools for packaging and
deployment.