260 likes | 419 Views
Game Factory – Visual Domain Specific Language. Pham Hai Nam SCE GameLab. Outline. Game Factory design C2 application requirements Visual Domain-Specific Language C2 template Open-source software overview. Game Factory. Game Factory is a game engine with a different approach
E N D
Game Factory – Visual Domain Specific Language Pham Hai Nam SCE GameLab Game Factory - Visual Domain Specfic Language
Outline • Game Factory design • C2 application requirements • Visual Domain-Specific Language • C2 template • Open-source software overview Game Factory - Visual Domain Specfic Language
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
Outline • Game Factory design • C2 application requirements • Visual Domain Specific Language • C2 template • Open-source software overview Game Factory - Visual Domain Specfic Language
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
C2 visual display (1) • GUI • Display info: textual & visual • Get info: button, slider • Main section: • First person view • Third person view • Bird’s eye view • Map / Radar • Teammates position • Obstacles Game Factory - Visual Domain Specfic Language
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
C2 Entities & Relationships Entities 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 • 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 Game Factory - Visual Domain Specfic Language
Outline • Game Factory design • C2 application requirements • Visual Domain Specific Language • C2 template • Open-source software overview Game Factory - Visual Domain Specfic Language
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
The Visual DSL (2) Game Factory - Visual Domain Specfic Language
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
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
The Textual DSL (2) • Customize and extend an existing class Customize{ Name = 'Soldier', IsSelectable = true Commands = {Move,Attack} Model = ‘mysoldier.dae’ } Define{ Name = 'Commander', Extend = 'Soldier', Constructor = [[ Commands.Add 'IssuedProtectCommand' ]] } Game Factory - Visual Domain Specfic Language
The Textual DSL (3) • Relationship declaration Relationship{ Name = 'TakeCover', Actor = {'Soldier', 'Wall'}, Check = [[ Require(IsNear(soldier, wall)) ]], Input = KeyDown('ctrl'), Perform = [[ soldier:Lean(wall) ]] } 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
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
Outline • Game Factory design • C2 application requirements • Visual Domain Specific Language • C2 template • Open-source software overview Game Factory - Visual Domain Specfic Language
C2 template • Includes a Reflective API specifically for C2 game • Includes a media library for C2 game Game Factory - Visual Domain Specfic Language
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
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
Outline • Game Factory design • C2 application requirements • Visual Domain Specific Language • C2 template • Open-source software overview Game Factory - Visual Domain Specfic Language
NvidiaPhysX 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
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
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
Problems • Describing the radar • Close quarter combat moves • Soldier movement on uneven surface Game Factory - Visual Domain Specfic Language
Thank you • Q & A Game Factory - Visual Domain Specfic Language