SlideShare una empresa de Scribd logo
1 de 19
Lua in Games



               Mr. Nguyễn Ngọc Vân
      Ass Software Manager – VNG Corporation
Agenda

1.   Lua & Benefits
2.   Core engine & Lua model
3.   Lua integrations model
4.   Secure Lua code
5.   Disadvantages
1. Lua & Benefits
What’s Lua?
•   Scripting language
•   Works through LVM (Lua Virtual Machine)
•   Stack model design
•   “Ultimate game scripting language” (GDC 2010)
•   Popular uses in games
•   Runs on most machines and devices
•   Written in ANSI C and distributed by small library
Lua Benefits
•   Free and open source 
•   Support OOP
•   Runs on almost platforms
•   Easy to interface with C/C++
•   Very clean C API
•   Auto memory management (GC)
•   Powerful, fast and lightweight
•   Flexible data structure (TABLE)
Lua Benefits

•   Contents can be changed in real-time
•   Auto generate contents
•   Users can customize/change contents
•   Fast and easy distributed contents
•   Secure code
•   Easy to use, embed and learn
•   Good references
2. Core Engine & Lua Model
Configs        Control Flow
  Settings
(XML, INI, T   Game Logic Process
   XT, …)       (Behaviors, AI, …)

                  Core Engine
Configs
  Settings
 (…, LUA)
              Control Flow
              Lua Engine
 LUA Logic
  Process
(Behaviors,    Core Engine
  AI, …)
3. Lua Integrations Model
Lua APIs
 Lua     Core Logic                     Lua Engine
codes   (Logic Flow)                      (LVM)
                        Lua interface


                       Core Engine
• Lua APIs
  – Call to LVM through events/triggers base
  – C APIs to work with LVM
  – Auxiliary library provides basic functions to
    check, register, debug, … LVM
  – Use C APIs to build core functions
• Lua Interface
  – Call to core logic through exports APIs
  – Provides APIs (game APIs) to work with core logic
  – Use C APIs to build, register, and exports APIs
Quick Sample
function OnPlayerUseItem(nItem)
        core.InstanceObj(OBJ_KIND_ITEM, nItem)
        if item.GetKind() == ITM_KIND_HP then
                local nItemHP = item.GetAttribute(ITM_ATTR_HP)
                local nPlayerHP = player.GetCurrentHP()
                local nAddHP = 0.2 * nPlayerHP
                if nAddHP > 0 and nAddHP < player.GetMaxHP() then
                        player.SetCurrentHP(nAddHP)
                        player.Message('Player:
'..player.GetName()..' use item '..item.GetName())
                end
        end
end
4. Secure Lua Code
• Compile to byte-code
  – Popular use
  – Use luaC module included in library
  – Modify luaC with keys for more secure
• Encrypted
  – Little use
  – Use keys-pair to encrypted
  – Use signed file, CRC
• Simple code
  function Add(a, b)
     return a + b
  end
  print(Add(100, 200))

• Byte-code
5. Disadvantages
• C APIs are too low-level
• Error messages are very confusing 
• No try-catch, no exceptions
• Hard to debug
• Hard to interfaces with unlike C/C++
• Once LVM is crashed, it’s not likely to recover and the
  service is crashed too 
• Hard to implement reload feature at run-time
• For extreme speed, LuaJIT is a good choice 
Benefits/tutorial of Lua in games

Más contenido relacionado

La actualidad más candente

Setting up a local WordPress development environment
Setting up a local WordPress development environmentSetting up a local WordPress development environment
Setting up a local WordPress development environmentZero Point Development
 
Intro to Massively Multiplayer Online Game (MMOG) Design
Intro to Massively Multiplayer Online Game (MMOG) DesignIntro to Massively Multiplayer Online Game (MMOG) Design
Intro to Massively Multiplayer Online Game (MMOG) DesignChristopher Mohritz
 
Highly available Drupal on a Raspberry Pi cluster
Highly available Drupal on a Raspberry Pi clusterHighly available Drupal on a Raspberry Pi cluster
Highly available Drupal on a Raspberry Pi clusterJeff Geerling
 
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...Simplilearn
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Dylan Butler
 
Open Cloud BBQ - Nano Server
Open Cloud BBQ - Nano ServerOpen Cloud BBQ - Nano Server
Open Cloud BBQ - Nano ServerTomica Kaniski
 
MMO Design Architecture by Andrew
MMO Design Architecture by AndrewMMO Design Architecture by Andrew
MMO Design Architecture by AndrewAgate Studio
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance DrupalJeff Geerling
 
Empowering developers to deploy their own data stores
Empowering developers to deploy their own data storesEmpowering developers to deploy their own data stores
Empowering developers to deploy their own data storesTomas Doran
 
OGDC2012 A Practical Architecture Design For MMO Casual Game_Mr. An, Ngo Thai
OGDC2012 A Practical Architecture Design For MMO Casual Game_Mr. An, Ngo ThaiOGDC2012 A Practical Architecture Design For MMO Casual Game_Mr. An, Ngo Thai
OGDC2012 A Practical Architecture Design For MMO Casual Game_Mr. An, Ngo ThaiBuff Nguyen
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...Sencha
 
Aos canadian tour (YOW) @energizedtech - Manage AzureRM with powershell
Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershellAos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell
Aos canadian tour (YOW) @energizedtech - Manage AzureRM with powershellSean Kearney
 
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...Amazon Web Services
 

La actualidad más candente (18)

Setting up a local WordPress development environment
Setting up a local WordPress development environmentSetting up a local WordPress development environment
Setting up a local WordPress development environment
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 
Intro to Massively Multiplayer Online Game (MMOG) Design
Intro to Massively Multiplayer Online Game (MMOG) DesignIntro to Massively Multiplayer Online Game (MMOG) Design
Intro to Massively Multiplayer Online Game (MMOG) Design
 
CUDA vs OpenCL
CUDA vs OpenCLCUDA vs OpenCL
CUDA vs OpenCL
 
Highly available Drupal on a Raspberry Pi cluster
Highly available Drupal on a Raspberry Pi clusterHighly available Drupal on a Raspberry Pi cluster
Highly available Drupal on a Raspberry Pi cluster
 
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
Ansible Tutorial For Beginners | What Is Ansible And How It Works? | Ansible ...
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
 
Open Cloud BBQ - Nano Server
Open Cloud BBQ - Nano ServerOpen Cloud BBQ - Nano Server
Open Cloud BBQ - Nano Server
 
MMO Design Architecture by Andrew
MMO Design Architecture by AndrewMMO Design Architecture by Andrew
MMO Design Architecture by Andrew
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance Drupal
 
Empowering developers to deploy their own data stores
Empowering developers to deploy their own data storesEmpowering developers to deploy their own data stores
Empowering developers to deploy their own data stores
 
OGDC2012 A Practical Architecture Design For MMO Casual Game_Mr. An, Ngo Thai
OGDC2012 A Practical Architecture Design For MMO Casual Game_Mr. An, Ngo ThaiOGDC2012 A Practical Architecture Design For MMO Casual Game_Mr. An, Ngo Thai
OGDC2012 A Practical Architecture Design For MMO Casual Game_Mr. An, Ngo Thai
 
Nano Server (ATD 11)
Nano Server (ATD 11)Nano Server (ATD 11)
Nano Server (ATD 11)
 
Extending ansible
Extending ansibleExtending ansible
Extending ansible
 
Introduction to AJAX
Introduction to AJAXIntroduction to AJAX
Introduction to AJAX
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
 
Aos canadian tour (YOW) @energizedtech - Manage AzureRM with powershell
Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershellAos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell
Aos canadian tour (YOW) @energizedtech - Manage AzureRM with powershell
 
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
 

Similar a Benefits/tutorial of Lua in games

Lua in games
Lua in gamesLua in games
Lua in gamesSon Aris
 
Lua in Games
Lua in GamesLua in Games
Lua in Gameswe20
 
Apache Traffic Server & Lua
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & LuaKit Chan
 
High-Performance Computing with C++
High-Performance Computing with C++High-Performance Computing with C++
High-Performance Computing with C++JetBrains
 
Hkube
HkubeHkube
Hkubehkube
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileAmazon Web Services Japan
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeFrancis Alexander
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeDmitri Nesteruk
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?GetInData
 
.Net overviewrajnish
.Net overviewrajnish.Net overviewrajnish
.Net overviewrajnishRajnish Kalla
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayLuka Zakrajšek
 
ApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
ApacheCon NA 2010 - High Performance Cloud-enabled SCA RuntimesApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
ApacheCon NA 2010 - High Performance Cloud-enabled SCA RuntimesJean-Sebastien Delfino
 
Using LuaJIT in mid-load web-projects
Using LuaJIT in mid-load web-projectsUsing LuaJIT in mid-load web-projects
Using LuaJIT in mid-load web-projectsAlexander Gladysh
 
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...gree_tech
 
Near real-time anomaly detection at Lyft
Near real-time anomaly detection at LyftNear real-time anomaly detection at Lyft
Near real-time anomaly detection at Lyftmarkgrover
 
Treasure Data Summer Internship 2016
Treasure Data Summer Internship 2016Treasure Data Summer Internship 2016
Treasure Data Summer Internship 2016Yuta Iwama
 
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangPractical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangLyon Yang
 
[Intuit] Control Everything
[Intuit] Control Everything[Intuit] Control Everything
[Intuit] Control EverythingPerforce
 

Similar a Benefits/tutorial of Lua in games (20)

Lua in games
Lua in gamesLua in games
Lua in games
 
Lua in Games
Lua in GamesLua in Games
Lua in Games
 
Apache Traffic Server & Lua
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & Lua
 
High-Performance Computing with C++
High-Performance Computing with C++High-Performance Computing with C++
High-Performance Computing with C++
 
Hkube
HkubeHkube
Hkube
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never Before
 
01 java intro
01 java intro01 java intro
01 java intro
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/Invoke
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?
 
.Net overviewrajnish
.Net overviewrajnish.Net overviewrajnish
.Net overviewrajnish
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
 
ApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
ApacheCon NA 2010 - High Performance Cloud-enabled SCA RuntimesApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
ApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
 
Using LuaJIT in mid-load web-projects
Using LuaJIT in mid-load web-projectsUsing LuaJIT in mid-load web-projects
Using LuaJIT in mid-load web-projects
 
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
Common Pitfalls of Functional Programming and How to Avoid Them: A Mobile Gam...
 
Near real-time anomaly detection at Lyft
Near real-time anomaly detection at LyftNear real-time anomaly detection at Lyft
Near real-time anomaly detection at Lyft
 
Treasure Data Summer Internship 2016
Treasure Data Summer Internship 2016Treasure Data Summer Internship 2016
Treasure Data Summer Internship 2016
 
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangPractical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
 
PyData Boston 2013
PyData Boston 2013PyData Boston 2013
PyData Boston 2013
 
[Intuit] Control Everything
[Intuit] Control Everything[Intuit] Control Everything
[Intuit] Control Everything
 

Más de action.vn

Bao cao tai nguyen Internet VN 2013
Bao cao tai nguyen Internet VN 2013Bao cao tai nguyen Internet VN 2013
Bao cao tai nguyen Internet VN 2013action.vn
 
ComScore - Southeast Asia Digital Future in Focus 2013
ComScore - Southeast Asia Digital Future in Focus 2013ComScore - Southeast Asia Digital Future in Focus 2013
ComScore - Southeast Asia Digital Future in Focus 2013action.vn
 
comScore's Presentation Google's Think Digital Vietnam 11-Dec-2012
comScore's Presentation Google's Think Digital Vietnam 11-Dec-2012comScore's Presentation Google's Think Digital Vietnam 11-Dec-2012
comScore's Presentation Google's Think Digital Vietnam 11-Dec-2012action.vn
 
Toan canh thuong mai dien tu 2012
Toan canh thuong mai dien tu 2012Toan canh thuong mai dien tu 2012
Toan canh thuong mai dien tu 2012action.vn
 
White book 2012 - Các vấn đề thương mại/đầu tư và kiến nghị
White book 2012 - Các vấn đề thương mại/đầu tư và kiến nghịWhite book 2012 - Các vấn đề thương mại/đầu tư và kiến nghị
White book 2012 - Các vấn đề thương mại/đầu tư và kiến nghịaction.vn
 
Amazon Annual Report
Amazon Annual ReportAmazon Annual Report
Amazon Annual Reportaction.vn
 
HIGH IMPACT ENTREPRENEURS
HIGH IMPACT ENTREPRENEURSHIGH IMPACT ENTREPRENEURS
HIGH IMPACT ENTREPRENEURSaction.vn
 
Bao cao EBI TMDT 2012
Bao cao EBI TMDT 2012Bao cao EBI TMDT 2012
Bao cao EBI TMDT 2012action.vn
 
VC-Corp Intro
VC-Corp IntroVC-Corp Intro
VC-Corp Introaction.vn
 
Mobile Trends: Cơ hội còn bỏ ngỏ
Mobile Trends: Cơ hội còn bỏ ngỏMobile Trends: Cơ hội còn bỏ ngỏ
Mobile Trends: Cơ hội còn bỏ ngỏaction.vn
 
Mobile VAS market in Vietnam
Mobile VAS market in VietnamMobile VAS market in Vietnam
Mobile VAS market in Vietnamaction.vn
 
Vietnam’s Web in 2012
Vietnam’s Web in 2012Vietnam’s Web in 2012
Vietnam’s Web in 2012action.vn
 
Mạng quảng cáo gia tăng hiệu quả cho quảng cáo hiển thị
Mạng quảng cáo gia tăng hiệu quả cho quảng cáo hiển thịMạng quảng cáo gia tăng hiệu quả cho quảng cáo hiển thị
Mạng quảng cáo gia tăng hiệu quả cho quảng cáo hiển thịaction.vn
 
IDC Q3 2012 Mobile Developer Report
IDC Q3 2012 Mobile Developer ReportIDC Q3 2012 Mobile Developer Report
IDC Q3 2012 Mobile Developer Reportaction.vn
 
Why not to do a startup?
Why not to do a startup?Why not to do a startup?
Why not to do a startup?action.vn
 
Mobiles share of the mix marketing evolution
Mobiles share of the mix marketing evolutionMobiles share of the mix marketing evolution
Mobiles share of the mix marketing evolutionaction.vn
 
Khảo sát lứa tuổi Teen Việt Nam 2012
Khảo sát lứa tuổi Teen Việt Nam 2012Khảo sát lứa tuổi Teen Việt Nam 2012
Khảo sát lứa tuổi Teen Việt Nam 2012action.vn
 
Creative design for mobile social game
Creative design for mobile social gameCreative design for mobile social game
Creative design for mobile social gameaction.vn
 
Balance in SNS by Energy
Balance in SNS by EnergyBalance in SNS by Energy
Balance in SNS by Energyaction.vn
 
Training and developing human resources in a game studio
Training and developing human resources in a game studioTraining and developing human resources in a game studio
Training and developing human resources in a game studioaction.vn
 

Más de action.vn (20)

Bao cao tai nguyen Internet VN 2013
Bao cao tai nguyen Internet VN 2013Bao cao tai nguyen Internet VN 2013
Bao cao tai nguyen Internet VN 2013
 
ComScore - Southeast Asia Digital Future in Focus 2013
ComScore - Southeast Asia Digital Future in Focus 2013ComScore - Southeast Asia Digital Future in Focus 2013
ComScore - Southeast Asia Digital Future in Focus 2013
 
comScore's Presentation Google's Think Digital Vietnam 11-Dec-2012
comScore's Presentation Google's Think Digital Vietnam 11-Dec-2012comScore's Presentation Google's Think Digital Vietnam 11-Dec-2012
comScore's Presentation Google's Think Digital Vietnam 11-Dec-2012
 
Toan canh thuong mai dien tu 2012
Toan canh thuong mai dien tu 2012Toan canh thuong mai dien tu 2012
Toan canh thuong mai dien tu 2012
 
White book 2012 - Các vấn đề thương mại/đầu tư và kiến nghị
White book 2012 - Các vấn đề thương mại/đầu tư và kiến nghịWhite book 2012 - Các vấn đề thương mại/đầu tư và kiến nghị
White book 2012 - Các vấn đề thương mại/đầu tư và kiến nghị
 
Amazon Annual Report
Amazon Annual ReportAmazon Annual Report
Amazon Annual Report
 
HIGH IMPACT ENTREPRENEURS
HIGH IMPACT ENTREPRENEURSHIGH IMPACT ENTREPRENEURS
HIGH IMPACT ENTREPRENEURS
 
Bao cao EBI TMDT 2012
Bao cao EBI TMDT 2012Bao cao EBI TMDT 2012
Bao cao EBI TMDT 2012
 
VC-Corp Intro
VC-Corp IntroVC-Corp Intro
VC-Corp Intro
 
Mobile Trends: Cơ hội còn bỏ ngỏ
Mobile Trends: Cơ hội còn bỏ ngỏMobile Trends: Cơ hội còn bỏ ngỏ
Mobile Trends: Cơ hội còn bỏ ngỏ
 
Mobile VAS market in Vietnam
Mobile VAS market in VietnamMobile VAS market in Vietnam
Mobile VAS market in Vietnam
 
Vietnam’s Web in 2012
Vietnam’s Web in 2012Vietnam’s Web in 2012
Vietnam’s Web in 2012
 
Mạng quảng cáo gia tăng hiệu quả cho quảng cáo hiển thị
Mạng quảng cáo gia tăng hiệu quả cho quảng cáo hiển thịMạng quảng cáo gia tăng hiệu quả cho quảng cáo hiển thị
Mạng quảng cáo gia tăng hiệu quả cho quảng cáo hiển thị
 
IDC Q3 2012 Mobile Developer Report
IDC Q3 2012 Mobile Developer ReportIDC Q3 2012 Mobile Developer Report
IDC Q3 2012 Mobile Developer Report
 
Why not to do a startup?
Why not to do a startup?Why not to do a startup?
Why not to do a startup?
 
Mobiles share of the mix marketing evolution
Mobiles share of the mix marketing evolutionMobiles share of the mix marketing evolution
Mobiles share of the mix marketing evolution
 
Khảo sát lứa tuổi Teen Việt Nam 2012
Khảo sát lứa tuổi Teen Việt Nam 2012Khảo sát lứa tuổi Teen Việt Nam 2012
Khảo sát lứa tuổi Teen Việt Nam 2012
 
Creative design for mobile social game
Creative design for mobile social gameCreative design for mobile social game
Creative design for mobile social game
 
Balance in SNS by Energy
Balance in SNS by EnergyBalance in SNS by Energy
Balance in SNS by Energy
 
Training and developing human resources in a game studio
Training and developing human resources in a game studioTraining and developing human resources in a game studio
Training and developing human resources in a game studio
 

Último

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 

Último (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

Benefits/tutorial of Lua in games

  • 1. Lua in Games Mr. Nguyễn Ngọc Vân Ass Software Manager – VNG Corporation
  • 2. Agenda 1. Lua & Benefits 2. Core engine & Lua model 3. Lua integrations model 4. Secure Lua code 5. Disadvantages
  • 3. 1. Lua & Benefits
  • 4. What’s Lua? • Scripting language • Works through LVM (Lua Virtual Machine) • Stack model design • “Ultimate game scripting language” (GDC 2010) • Popular uses in games • Runs on most machines and devices • Written in ANSI C and distributed by small library
  • 5. Lua Benefits • Free and open source  • Support OOP • Runs on almost platforms • Easy to interface with C/C++ • Very clean C API • Auto memory management (GC) • Powerful, fast and lightweight • Flexible data structure (TABLE)
  • 6. Lua Benefits • Contents can be changed in real-time • Auto generate contents • Users can customize/change contents • Fast and easy distributed contents • Secure code • Easy to use, embed and learn • Good references
  • 7. 2. Core Engine & Lua Model
  • 8. Configs Control Flow Settings (XML, INI, T Game Logic Process XT, …) (Behaviors, AI, …) Core Engine
  • 9. Configs Settings (…, LUA) Control Flow Lua Engine LUA Logic Process (Behaviors, Core Engine AI, …)
  • 11. Lua APIs Lua Core Logic Lua Engine codes (Logic Flow) (LVM) Lua interface Core Engine
  • 12. • Lua APIs – Call to LVM through events/triggers base – C APIs to work with LVM – Auxiliary library provides basic functions to check, register, debug, … LVM – Use C APIs to build core functions • Lua Interface – Call to core logic through exports APIs – Provides APIs (game APIs) to work with core logic – Use C APIs to build, register, and exports APIs
  • 13. Quick Sample function OnPlayerUseItem(nItem) core.InstanceObj(OBJ_KIND_ITEM, nItem) if item.GetKind() == ITM_KIND_HP then local nItemHP = item.GetAttribute(ITM_ATTR_HP) local nPlayerHP = player.GetCurrentHP() local nAddHP = 0.2 * nPlayerHP if nAddHP > 0 and nAddHP < player.GetMaxHP() then player.SetCurrentHP(nAddHP) player.Message('Player: '..player.GetName()..' use item '..item.GetName()) end end end
  • 15. • Compile to byte-code – Popular use – Use luaC module included in library – Modify luaC with keys for more secure • Encrypted – Little use – Use keys-pair to encrypted – Use signed file, CRC
  • 16. • Simple code function Add(a, b) return a + b end print(Add(100, 200)) • Byte-code
  • 18. • C APIs are too low-level • Error messages are very confusing  • No try-catch, no exceptions • Hard to debug • Hard to interfaces with unlike C/C++ • Once LVM is crashed, it’s not likely to recover and the service is crashed too  • Hard to implement reload feature at run-time • For extreme speed, LuaJIT is a good choice 