SlideShare a Scribd company logo
1 of 59
Game server development in
node.js
Charlie Crane
@xiecc
Who am I
 NASDAQ: NTES
 Senior engineer, architect(8 years) in NetEase
Inc. , developed many web, game products
 Recently created the open source game server
framework in node.js: pomelo
Agenda
 The state of pomelo
 Motivation
 Framework
 Practice
 Performance
The state of pomelo
Fast, scalable, distributed game
server framework for node.js
Open sourced in 2012.11.20
Newest version: V0.6
https://github.com/NetEase/pomelo
Pomelo position
 Game server framework
 Mobile game
 Web game
 Social game
 MMO RPG(middle scale)
 Realtime application server framework
Realtime Multiple User Interaction
State of pomelo
 Pomelo is not a
single project
 Almost 40 repos in total
Framework ---
State of pomelo -- clients
Success stories
 Chinese mythology
Community
Agenda
 The state of pomelo
 Motivation
 Framework
 Practice
 Performance
Motivation--node.js and game
server
 Game Server
Fast Scalable
Network Real-time
Node.js is a platform built on Chrome's JavaScript
runtime for easily building fast, scalable network
applications. Node.js uses an event-driven, non-
blocking I/O model that makes it lightweight and
efficient, perfect for data-intensive real-time
applications that run across distributed devices.
Motivation--node.js advantages
 Scalability -- event driven I/O
 Game, network-insentive, massive network flow
 Language, javascript
 Browser, HTML5, unity3d, cocos2d-x, other
platform – same language in client and server
 Multi-Process, Single thread
 No lock
 Simple logic
 Lightweight, development efficiency, really quick
Motivation–node.js disadvantage
 Some CPU sensitive actions
 Path finding
 AI
 Solution
 Optimization
 Divide process
 All can be solved in practice
Node.js game—Mozilla
BrowserQuest
Node.js game—google gritsgame
Motivation -- our demo
http://pomelo.netease.com/lordofpomelo
Motivation--architecture of demo
Motivation -- game VS web
 Long connection VS Short connection
 Partition: area based VS Load balanced
cluster
 Stateful VS Stateless
 Request/broadcast VS
Request/response
Motivation--complicate servers
 Game VS web
Motivation--how to solve
complexity
Too … complicated?
solution: framework
Agenda
 The state of pomelo
 Motivation
 Framework
 Practice
 Performance
Pomelo Framework
The essence of pomelo:
A distributed, scalable, realtime
application framework.
Framework --- design goal
 Abstract of servers(processes)
 Auto extend server types
 Auto extend servers
 Abstract of request/response and broadcast/push
 Zero config request
 Simple broadcast api
 Servers communication---rpc framework
Framework --- server abstraction
frontend
frontend
backend
backend
backend
backend
master
Framework--- server abstraction
Duck type
frontend
con
nect
or
backend
area
chat
status
Server abstraction
servers
The
Duck
Framework---server abstraction
Framework --- request
abstraction
 Client call remote method on server
 Client, like ajax
 Server, like web mvc framework
Framework --- request
abstraction
Connector
SIOConnector HybridConnector
Pomelo
component
Loader
MQTTConnecto
r
Socket.io client Socket, websocket
client
Mobile client
Framework -- request abstraction
Socket.io
Socket/We
bSocket
Support socket.io and socket in one project
Framework --- push&broadcast
Push messages to a group of users
channelService.pushMessageByUids(msg,
uids, callback);
var channel =
channelService.getChannel(‘area1’);
channel.pushMessage(msg);
Framework ---
channel&broadcast
area
connectors
client
channel
uids
connector1
connector2
client1
client2
clientn
…
regroup
uids1
uids2
… …
broadcast
 Easy API
 Most frequent action
 Potentially performance
problem
Framework -- rpc framework
Framework – rpc framework
 Why rpc is so easy in pomelo?
 Thrift
 Writing a .thrift file
 Generate Thrift file to source code
thrift --gen <language> <Thrift filename>
 Copy the source to application
 Pomelo—start up, all done
 Client and server in one project
 Servers folder convention
 Auto generate proxy and remote on start up
Agenda
 The state of pomelo
 Overview
 Framework
 Practice
 Performance
Practice --- simplest player move
client
Area1
connector
client1
client2
clientn
…
1、Move
request
3、Move
Handler
2、Forward
4、Backward
5、Broadcast
6、Play move
animation Route rule
1.5
Practice --- Client Move Request
… find path, move animation
pomelo.request(’area.playeHandler.move’
,
{path: path}, function (result){
…
});
Practice --- area server handler
handler.move = function( msg, session,
next) {
… verify path
… handle move, add move action to
tick
channelService.pushMessagesByUids
(
route:’onMove’,
….);
next(null, {pos: playerPos, code:OK});
Practice --- client play move
pomelo.on(‘onMove’,
function(data) {
play move animation
…
});
Practice – route rule
Define once:
app.route(‘area’, routeUtil.area);
Practice --- character move
Character Move, isn’t that easy?
In reality , it’s hard
Practice --- handle move
 Different situations
 Player move, mob move
 AI driven or player driven
 Smooth effect
 Client prediction
 Latency Compensate
 How to notify
 AOI(area of interest)
Agenda
 The state of pomelo
 Overview
 Framework
 Practice
 Performance
Performance --- overview
 The performance varies largely in different
applications
 The variation
 Application type: Game or realtime application
 Game type: round or realtime fight, room or infinite
 Game design: Map size, character density, balance
of areas
 Test parameters: Think time, test action
Performance --- reference data
 Online users per process
 next-gen: support 20,000 concurrent players in one
area
 World record – not in one area
 world of tanks(bigworld), 74,536 online users
 But in real world(MMO rpg)
 The real online data: maximum 800 concurrent users per
area, 7,000 concurrent users per group game servers
Performance--Server
configuration
Server: Openstack virtual machine
Performance --- stress testing
 Use Case 1: fight
 Stress on single area(area 3), increasing
step by step, login every 2 seconds
 Game logic: attack monstors or other
players every 2~5 seconds
Performance --- stress testing
Performance – too crowded
Performance --- stress testing
Performance--result
 486 onlines
Performance -- top
 Using toobusy to limit cpu: 80%
Performance – stress test
 Use case 2 – move
 Stress on single area(area 3), increasing
step by step, login every 2 seconds
 Game logic: move around in the map every
2~5 seconds
Performance – stress test
 800 onlines in 1 area
Performance --- stress testing
 Use Case 3: fight & move
 Stress on single area(area 3), increasing
step by step, login every 2 seconds
 Game logic: 50% attack monstors or other
players every 2~5 seconds, 50% move
around
 Result: 558 onlines in one area
What’s more
 Plugin, components
 Realtime application framework – a better one,
more scalable, adaptable
 AI – pomleo-bt
 Broadcast strategy – pomelo-aoi , schedule
 Data sync strategy – pomelo-sync
 Admin all the servers -- pomelo-admin pomelo-
cli
 How to build a full game – lordofpomelo play
online
 High availability – master and zookeeper
Looking for contributors
 We need you!!!
Q&
A
https://github.com/NetEase/pomelo

More Related Content

What's hot

Nimbuzz march2012
Nimbuzz march2012Nimbuzz march2012
Nimbuzz march2012nlwebperf
 
Talk about Ansible and Infrastructure as Code
Talk about Ansible and Infrastructure as CodeTalk about Ansible and Infrastructure as Code
Talk about Ansible and Infrastructure as CodeSATOSHI TAGOMORI
 
How to Transfer Magento Project from One Server to another Server
How to Transfer Magento Project from One Server to another ServerHow to Transfer Magento Project from One Server to another Server
How to Transfer Magento Project from One Server to another ServerKaushal Mewar
 
Memcached B box presentation
Memcached B box presentationMemcached B box presentation
Memcached B box presentationNagesh Chinkeri
 
Caching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and ProfilingCaching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and ProfilingScott MacVicar
 
Web Performance Optimization with HTTP/3
Web Performance Optimization with HTTP/3Web Performance Optimization with HTTP/3
Web Performance Optimization with HTTP/3SangJin Kang
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011Mike Willbanks
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with ApacheBradley Holt
 
Caching for Cash: Caching
Caching for Cash: CachingCaching for Cash: Caching
Caching for Cash: CachingScott MacVicar
 
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
 
Itb2018 cf apps to dev to production with command box cf-config docker
Itb2018   cf apps to dev to production with command box cf-config dockerItb2018   cf apps to dev to production with command box cf-config docker
Itb2018 cf apps to dev to production with command box cf-config dockerOrtus Solutions, Corp
 
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocOGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocBuff Nguyen
 
A Better WordPress Workflow with WP-CLI
A Better WordPress Workflow with WP-CLIA Better WordPress Workflow with WP-CLI
A Better WordPress Workflow with WP-CLIRikesh Ramlochund
 
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)Japheth Thomson
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dumpejlp12
 

What's hot (19)

Nimbuzz march2012
Nimbuzz march2012Nimbuzz march2012
Nimbuzz march2012
 
Talk about Ansible and Infrastructure as Code
Talk about Ansible and Infrastructure as CodeTalk about Ansible and Infrastructure as Code
Talk about Ansible and Infrastructure as Code
 
Medusa Project
Medusa ProjectMedusa Project
Medusa Project
 
How to Transfer Magento Project from One Server to another Server
How to Transfer Magento Project from One Server to another ServerHow to Transfer Magento Project from One Server to another Server
How to Transfer Magento Project from One Server to another Server
 
Memcached B box presentation
Memcached B box presentationMemcached B box presentation
Memcached B box presentation
 
Caching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and ProfilingCaching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and Profiling
 
Web Performance Optimization with HTTP/3
Web Performance Optimization with HTTP/3Web Performance Optimization with HTTP/3
Web Performance Optimization with HTTP/3
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with Apache
 
Caching for Cash: Caching
Caching for Cash: CachingCaching for Cash: Caching
Caching for Cash: Caching
 
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
 
Itb2018 cf apps to dev to production with command box cf-config docker
Itb2018   cf apps to dev to production with command box cf-config dockerItb2018   cf apps to dev to production with command box cf-config docker
Itb2018 cf apps to dev to production with command box cf-config docker
 
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocOGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
 
Noit ocon-2010
Noit ocon-2010Noit ocon-2010
Noit ocon-2010
 
A Better WordPress Workflow with WP-CLI
A Better WordPress Workflow with WP-CLIA Better WordPress Workflow with WP-CLI
A Better WordPress Workflow with WP-CLI
 
PostgreSQL: meet your queue
PostgreSQL: meet your queuePostgreSQL: meet your queue
PostgreSQL: meet your queue
 
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
 
Web sockets in Java
Web sockets in JavaWeb sockets in Java
Web sockets in Java
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dump
 

Viewers also liked

Game server development in node.js
Game server development in node.jsGame server development in node.js
Game server development in node.jsXie ChengChao
 
Pomelo Logistics 27 Nov 2011
Pomelo Logistics 27 Nov 2011Pomelo Logistics 27 Nov 2011
Pomelo Logistics 27 Nov 2011thaikoraa
 
Packaging
PackagingPackaging
Packagingvikash
 
Bao cao do an Phát triển hệ thống game server Online
Bao cao do an Phát triển hệ thống game server OnlineBao cao do an Phát triển hệ thống game server Online
Bao cao do an Phát triển hệ thống game server OnlineHoàng Phạm
 
Pomelo y limon
Pomelo y limonPomelo y limon
Pomelo y limoncepecole
 
[KGC 2012] Online Game Server Architecture Case Study Performance and Security
[KGC 2012] Online Game Server Architecture Case Study Performance and Security[KGC 2012] Online Game Server Architecture Case Study Performance and Security
[KGC 2012] Online Game Server Architecture Case Study Performance and SecuritySeungmin Shin
 

Viewers also liked (9)

Game server development in node.js
Game server development in node.jsGame server development in node.js
Game server development in node.js
 
Pomelo Logistics 27 Nov 2011
Pomelo Logistics 27 Nov 2011Pomelo Logistics 27 Nov 2011
Pomelo Logistics 27 Nov 2011
 
Citrius family
Citrius familyCitrius family
Citrius family
 
Clementines
ClementinesClementines
Clementines
 
Citrus fruit variety
Citrus fruit varietyCitrus fruit variety
Citrus fruit variety
 
Packaging
PackagingPackaging
Packaging
 
Bao cao do an Phát triển hệ thống game server Online
Bao cao do an Phát triển hệ thống game server OnlineBao cao do an Phát triển hệ thống game server Online
Bao cao do an Phát triển hệ thống game server Online
 
Pomelo y limon
Pomelo y limonPomelo y limon
Pomelo y limon
 
[KGC 2012] Online Game Server Architecture Case Study Performance and Security
[KGC 2012] Online Game Server Architecture Case Study Performance and Security[KGC 2012] Online Game Server Architecture Case Study Performance and Security
[KGC 2012] Online Game Server Architecture Case Study Performance and Security
 

Similar to Game server development in node.js framework Pomelo

Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...
Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...
Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...Amr Awadallah
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop OverviewShubhra Kar
 
Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008Joe Walker
 
Catan world and Churchill
Catan world and ChurchillCatan world and Churchill
Catan world and ChurchillGrant Goodale
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 
Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1KlaraOrban
 
Building an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent ConnectionsBuilding an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent Connections Renaun Erickson
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Puppet
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkIoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkMirco Vanini
 
Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea
Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea
Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea webhostingguy
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewMaría Angélica Bracho
 
Openstack Icehouse IaaS Presentation
Openstack Icehouse  IaaS PresentationOpenstack Icehouse  IaaS Presentation
Openstack Icehouse IaaS Presentationemad ahmed
 
XLcloud 3-d remote rendering
XLcloud 3-d remote renderingXLcloud 3-d remote rendering
XLcloud 3-d remote renderingMarius Preda PhD
 
Windows containers troubleshooting
Windows containers troubleshootingWindows containers troubleshooting
Windows containers troubleshootingAlexey Bokov
 

Similar to Game server development in node.js framework Pomelo (20)

Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...
Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...
Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008
 
Catan world and Churchill
Catan world and ChurchillCatan world and Churchill
Catan world and Churchill
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 
Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1
 
Real-time ASP.NET with SignalR
Real-time ASP.NET with SignalRReal-time ASP.NET with SignalR
Real-time ASP.NET with SignalR
 
Building an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent ConnectionsBuilding an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent Connections
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkIoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@Work
 
Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea
Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea
Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
 
XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)
 
Openstack Icehouse IaaS Presentation
Openstack Icehouse  IaaS PresentationOpenstack Icehouse  IaaS Presentation
Openstack Icehouse IaaS Presentation
 
XLcloud 3-d remote rendering
XLcloud 3-d remote renderingXLcloud 3-d remote rendering
XLcloud 3-d remote rendering
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Windows containers troubleshooting
Windows containers troubleshootingWindows containers troubleshooting
Windows containers troubleshooting
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
線上遊戲與雲端運算
線上遊戲與雲端運算線上遊戲與雲端運算
線上遊戲與雲端運算
 

Recently uploaded

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Recently uploaded (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

Game server development in node.js framework Pomelo

Editor's Notes

  1. Node.js is extremely suitable for game server development. Look at the definition of node.js, all these key words: fast, scalable, network, real-time are the character of game server. What a perfect match!!!
  2. There are many advantages of developing games with node.js. First, scalability, of course, node was designed for event driven IO, and game server is such a high network communication application, which makes node a killer application. Second, javascript language, HTML5 can enjoy the share language between client and server, but not only html5, other languages are also suitable for it. Third, lightweight, traditionaly game server development heavy, but node.js makes game server development light and happy, it is crucial for efficiency. Forth, multi-process single thread model, game logic is complicated, multi-thread lock can make a mass, but the single thread model of node.js makes logic clean and simple. Awesome!
  3. There are also some disadvantages in node.js since node is not good at CPU sensitive actions. Some AI and path finding actions is CPU sensitive. But in practice, all these problems can be solved. In our demo, all these CPU problems are solve by dividing process and other optimizations.
  4. We are not the first guy who use node.js as game servers. Mozilla published an open source game demo called BrowserQuest a few months before we open sourced. It is really a good demo for HTML5, but on the server side, it uses a single process node server, which can not hold too much online users.
  5. Google also published a game demo called gritsgame, which have an excellent presentation on google io 2012. But same problem, the demo focus on client side,the server side is a simple single process node.js server, which can not hold too much online users.
  6. This is our demo. Believe me, the art material sucks. So what is the difference between our game and BrowserQuest. The server side!!! We have a strong server side, which can hold thousands of online users.
  7. This the backend of our server architecture, each rectangle represents a process. In the frontend, there are a group of processes called connector, whose job is holding connection of clients. Connector do not do the real logic, all the logics are sent to the backend processes. There are many types of back end processes, including, area, login, chat, status, team etc., in reality, there may have 10 types of processes. The main game logic is handled in area servers.
  8. I believe most of you are from web background. So I will give a comparison between web and game. First, long connection VS short connection, it is obvious, realtime game need instant reaction, we must use long connection to push message.Second, partition, game is partitioned by area or room, it is decided by the nature of game. In the previous demo, all the players in the same map are actually in the same processes. When you walk to another map, you are most likely in another process. Because in game, most of the player interations are in a same map, making them in same process can minimize the inter-process communication. Third, game is stateful, because of the parition strategy, the request of certain player can only be handled by specific server. This is why game can not as scalable as web. Fourth, request/broadcast, most of player action need to be broadcasted to other players immediately, which is a scalability killer, we need many optimizations.
  9. So, because of all the differences, the architecture of web and game is different. Web application can enjoy the benefit of load balancer, since all the processes are equal. Game, on the other hand, is a complicated spider web,different types of servers communicate to each other. It is hard to manage all these servers, and the communication can be complicated, which lead us to distributed programming.
  10. Since the runtime architecture of a game is so complicated, we need a solution to simplify it. And these is a solution: framework, which lead us to next chapter.
  11. So, let’s take a look at the pomelo framework.
  12. You will be surprised to find ot that pomelo framework is nothing to do with game. In essence, it is a distributed scalable realtime application framework.
  13. Last, channel and broadcast. It push messages to a group of users. The API above is just simple. But as you know, broadcast is one of the most frequent actions in game, and it can can cause many performance problems.
  14. Now, rpc, it works like magic. Zero config, you do not need to specify target server IP, port or anything. Just a function call, the client will automaticlly routed to target server, send to specific file and method. You don’t event feel that you are doing remote call. Of course, you need define a route function before hand, it’s quite simple.
  15. We have known a bunch of rpc frameworks, but none is as simple as pomelo. Why? For example, thrift, you need to write a .thrift file, and generate it to source code, copy the source to application. If the interface is changed, damn, do it again. But nothing need to be done in pomelo, you just start up, boo.. Just call rpc like local method, all done. Why? Because we have servers abstraction in our framework. When we start up, we scan the server’s folder, generate the proxy automatically on start up.
  16. The fourth part, practice.
  17. As time is limited, I’m going to talk about the simplest game logic, player move! As you see, there are 6 steps in player move, basicly, the client send a message of move request to server, the connector route the request to specific area server. The area server do move logic, and broadcast to the clients who can see the movement of first client. The clients play the move animation. Done! The blue part is accomplished by framework, You only need to write the code of step 1,3,6.
  18. Step one, client move, the client side need to find path and move animation. We find path on client side can save many cpu resources on the server and make the animation more smooth. Then the client send the move request to the server, it is the basic API of pomelo client, just like AJAX call.
  19. Step 3, the area server receive the request, route to this method ‘handler.move’ based on convention over configuration. The method signature is similar to http, except we need a session message, and a next callback. The method verify path, handle move logic, and then it need a broadcast to tell all the users who can see the first players’ move. After that, it send the response back with a next method.
  20. The last step, every players received the broadcast message should play the move animation, really simple!
  21. So easy, right? But, in reality, it is not as simple as you think. There are many issues you should consider.
  22. First, different situations. I only demonstrate player move before. The mob move is quite different, it is driven by AI. Second, smooth effect. If you play animation after server send message, there will be some delay. To achieve smooth effect, you must use client prediction. But all the complexity will come since there is disaccord between client and server. Third , how to notify, broadcast to all the users is wasteful, you must use some algorithm to minimized the price of broadcast. This is where AOI fit in.
  23. Last part performance
  24. This the game picture of our stress test. Too much players in the map!!!
  25. This is another picture, we make the map a little bigger, so the players in one screen is dropped, which is good to broadcast.
  26. The time is limited , we do not have time to talk all the details. Two weeks later in Lisbon, I will give a talk focus on performance.