Game Factory – Visual Domain Specific Language
-
Upload
isabelle-ortiz -
Category
Documents
-
view
47 -
download
3
description
Transcript of Game Factory – Visual Domain Specific Language
Game Factory - Visual Domain Specfic Language
1
Game Factory – Visual Domain Specific Language
Pham Hai NamSCE GameLab
Game Factory - Visual Domain Specfic Language
2
Outline
• Game Factory design• C2 application requirements• Visual Domain-Specific Language• C2 template• Open-source software overview
Game Factory - Visual Domain Specfic Language
3
Game Factory
• Game Factory is a game engine with a different approach
• For game designer without knowledge about the implementation details
• Declare the game using a visual DSL• Optimization by writing extra code• Support a template for each genre of game
Game Factory - Visual Domain Specfic Language
4
Outline
• Game Factory design• C2 application requirements• Visual Domain Specific Language• C2 template• Open-source software overview
Game Factory - Visual Domain Specfic Language
5
C2 application requirements
• Divide to independent aspects– Visual display property– Game entities and relationships– Game level design– Input methods of playable characters– AI for NPCs
Game Factory - Visual Domain Specfic Language
6
C2 visual display (1)
Main section:-First person view-Third person view-Bird’s eye view
Map / Radar- Teammates position- Obstacles
GUI- Display info: textual & visual- Get info: button, slider
Game Factory - Visual Domain Specfic Language
7
C2 visual display (2)Night vision view mode-> to see in dark area-> work better with HDR color
Thermal vision view mode-> to indentify camouflaged threats-> must explicitly declare thermal material
Game Factory - Visual Domain Specfic Language
8
C2 Entities & Relationships
Entities• Human• Vehicle
– Tank– Helicopter
• Weapon– Rifle– Rocket launcher
• Bullet– Straight flying (rifle bullet)– Lock-on (missile)– Gravitational trajectory (grenade)
• Building– High Wall, Low Wall– Vertical Stair, Door
Relationships• 1 Human vs 1 Weapon
– Pick up / Drop / Select– Reload
• 1 Human vs 1 Wall– Jump over / Jump and grab– Take cover
• N Human vs 1 Human– Protect– Approach
• Weapon vs Rocket vs Vehicle– Destroy on hit– Lock the rocket on the vehicle
Game Factory - Visual Domain Specfic Language
9
Outline
• Game Factory design• C2 application requirements• Visual Domain Specific Language• C2 template• Open-source software overview
Game Factory - Visual Domain Specfic Language
10
The Visual DSL (1)
• Looks like an Entity Relationship Diagram• Game designer will not directly draw the
diagram• The diagram is generated from a step by step
declaration process– At each step, there are predefined options to
choose from• The textual DSL will be generated and
compiled to make the final Lua game script
Game Factory - Visual Domain Specfic Language
12
Lua script
• Proven, Fast– Unified syntax, only one kind of data structure– Compiled language– The most popular script language in real-time game
• Extensible semantics– Can support object-oriented programming– Can support functional programming– Can support aspect-oriented programming
• Easily integrated with C++
Game Factory - Visual Domain Specfic Language
13
The Textual DSL (1)
• Is Lua script• Is supported by the a game genre template• Is generated from the Visual DSL, or written
directly by programmer• Will be run once to generate another set of
Lua scripts which describes the game logic• The generated Lua scripts is one layer on top
of C++ functions of the genre template
Game Factory - Visual Domain Specfic Language
14
The Textual DSL (2)
• Customize and extend an existing classCustomize{
Name = 'Soldier',IsSelectable = trueCommands = {Move,Attack}Model = ‘mysoldier.dae’
}
Define{Name = 'Commander',Extend = 'Soldier',Constructor = [[
Commands.Add 'IssuedProtectCommand']]
}
Game Factory - Visual Domain Specfic Language
15
The Textual DSL (3)
Relationship{Name = 'TakeCover',Actor = {'Soldier', 'Wall'},Check = [[
Require(IsNear(soldier, wall))]],Input = KeyDown('ctrl'),Perform = [[
soldier:Lean(wall)]]
}
Relationship declaration• Check will return a boolean
value• The variable is generated
automatically• Require will make Check
return another value for complexity
• Check, Input and Peform will be weaved to the correct position in an one-time compilation
Game Factory - Visual Domain Specfic Language
16
The Textual DSL (4)
• 3-tier relationship and Relationship{
Name = 'Protect',Actor = {'Soldier','Soldier','Human'},Association = {1,Many,1},Role = {'commander','soldiers','hostage'},Input = commander::IssuedProctectCommand,Check = [[
Require(Soldier.IsSelected(soldiers))Require(MouseLeftClick(hostage))
]]Perform = [[
AI.Protect(soldiers,hostage,Soldier.Subset('enemy'))]]Broken = [[ Require(hostage:IsDead) ]]Terminate = [[ soldiers:Ready() ]]
}
• Specify association• Assign role if there is
ambiguity• Method is generated for
collection• Broken condition and
terminate action
Game Factory - Visual Domain Specfic Language
17
Outline
• Game Factory design• C2 application requirements• Visual Domain Specific Language• C2 template• Open-source software overview
Game Factory - Visual Domain Specfic Language
18
C2 template
• Includes a Reflective API specifically for C2 game
• Includes a media library for C2 game
Game Factory - Visual Domain Specfic Language
19
Data flow in one frame
• Get input information• Check all relationship conditions• Check all performing relationships breaking
condition• Execute performing relationship (in coroutines)• Perform queued AI requests & physics
simulation• Render the scene
Game Factory - Visual Domain Specfic Language
20
The Reflective API
• Aspect-oriented programming style– Declaration code can be organized in any way– Generated code will be put in optimized position
• Optimization:– Remove unnecessary branching statements– Follow naming convention for generated classes and
variables– Only used entities and relationships will generate code
• Support macros for readability & concise syntax
Game Factory - Visual Domain Specfic Language
21
Outline
• Game Factory design• C2 application requirements• Visual Domain Specific Language• C2 template• Open-source software overview
Game Factory - Visual Domain Specfic Language
22
Nvidia PhysX for physic simulation
• Free for commercial use, closed source• Is the proven & the fastest engine• Has hardware accelerated on dedicated card. Hardware
acceleration will soon be available on Nvidia graphics card• Support Continuous Collision Detection for fast moving
object• Support Vehicle simulation• Support Broadphase Collision Detection for a large number
of moving object• Support Constraints for rag-doll simulation• Support Force Field to simulate Explosion
Game Factory - Visual Domain Specfic Language
23
Irrlicht engine for rendering
• Free for commercial use, open source• Modular, extensible
– Possible to implement advanced rendering techniques for C2 game: HDR, Instancing
– Possible to implement scene rendering technique• Cross-platform• Can be easily integrated with PhysX• Huge library of shaders and scene rendering techniques
(including indoor and outdoor rendering)• Support large amount of 3d geometry formats, including
COLLADA• Support Particle system & GUI
Game Factory - Visual Domain Specfic Language
24
RakNet for networking
• Cheap for commercial use, open source• Game specific engine• Support Lobby system with player matching• Support Peer to Peer network• Support voice communication
Game Factory - Visual Domain Specfic Language
25
Problems
• Describing the radar• Close quarter combat moves• Soldier movement on uneven surface