SlideShare a Scribd company logo
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 (20)

PDF
게임 디자이너와 게임 서버
ByungChun2
 
PDF
Effective LiveOps Strategies for F2P Games
James Gwertzman
 
PDF
Game Design - Monetization
Erez Yerushalmi
 
PPTX
Deep Dive into Keystone Tokens and Lessons Learned
Priti Desai
 
PDF
[NDC2017 : 박준철] Python 게임 서버 안녕하십니까 - 몬스터 슈퍼리그 게임 서버
준철 박
 
PPTX
VPP for Stateless SRv6/GTP-U Translation
Satoru Matsushima
 
PDF
Iocp 기본 구조 이해
Nam Hyeonuk
 
PDF
실시간 게임 서버 최적화 전략
YEONG-CHEON YOU
 
PDF
Introduction to BRAS
KHNOG
 
PPTX
Les types de jeu videos
Yann Leroux
 
PDF
7 Habits of Breakthrough Entrepreneurs - Casual Connect 2015
Amy Jo Kim
 
PPTX
mongodb와 mysql의 CRUD 연산의 성능 비교
Woo Yeong Choi
 
PDF
Introduction MQTT in English
Eric Xiao
 
PDF
2015 FOSDEM - OVS Stateful Services
Thomas Graf
 
PPTX
Tic tac toe
Syeda Urooba
 
PDF
유니티3D에서 2D 이미지 다루기
Jungsoo Park
 
PDF
Epic Fails in LiveOps
James Gwertzman
 
PPTX
Next-generation MMORPG service architecture
Jongwon Kim
 
PPTX
데이터분석 기반 게임봇과 작업장 탐지 (NDC 2017)
Korea University
 
PDF
[2019] 게임 서버 대규모 부하 테스트와 모니터링 이렇게 해보자
NHN FORWARD
 
게임 디자이너와 게임 서버
ByungChun2
 
Effective LiveOps Strategies for F2P Games
James Gwertzman
 
Game Design - Monetization
Erez Yerushalmi
 
Deep Dive into Keystone Tokens and Lessons Learned
Priti Desai
 
[NDC2017 : 박준철] Python 게임 서버 안녕하십니까 - 몬스터 슈퍼리그 게임 서버
준철 박
 
VPP for Stateless SRv6/GTP-U Translation
Satoru Matsushima
 
Iocp 기본 구조 이해
Nam Hyeonuk
 
실시간 게임 서버 최적화 전략
YEONG-CHEON YOU
 
Introduction to BRAS
KHNOG
 
Les types de jeu videos
Yann Leroux
 
7 Habits of Breakthrough Entrepreneurs - Casual Connect 2015
Amy Jo Kim
 
mongodb와 mysql의 CRUD 연산의 성능 비교
Woo Yeong Choi
 
Introduction MQTT in English
Eric Xiao
 
2015 FOSDEM - OVS Stateful Services
Thomas Graf
 
Tic tac toe
Syeda Urooba
 
유니티3D에서 2D 이미지 다루기
Jungsoo Park
 
Epic Fails in LiveOps
James Gwertzman
 
Next-generation MMORPG service architecture
Jongwon Kim
 
데이터분석 기반 게임봇과 작업장 탐지 (NDC 2017)
Korea University
 
[2019] 게임 서버 대규모 부하 테스트와 모니터링 이렇게 해보자
NHN FORWARD
 

Viewers also liked (10)

PPTX
Game server development in node.js
Xie ChengChao
 
PPTX
Building fast,scalable game server in node.js
Xie ChengChao
 
PPTX
Pomelo Logistics 27 Nov 2011
thaikoraa
 
PPT
Citrius family
bonophool banerjee
 
PPTX
Clementines
Katie Boyd McGlenn
 
PPTX
Citrus fruit variety
Santi Catanesi
 
PPTX
Packaging
vikash
 
PDF
Bao cao do an Phát triển hệ thống game server Online
Hoàng Phạm
 
PDF
Pomelo y limon
cepecole
 
PDF
[KGC 2012] Online Game Server Architecture Case Study Performance and Security
Seungmin Shin
 
Game server development in node.js
Xie ChengChao
 
Building fast,scalable game server in node.js
Xie ChengChao
 
Pomelo Logistics 27 Nov 2011
thaikoraa
 
Citrius family
bonophool banerjee
 
Clementines
Katie Boyd McGlenn
 
Citrus fruit variety
Santi Catanesi
 
Packaging
vikash
 
Bao cao do an Phát triển hệ thống game server Online
Hoàng Phạm
 
Pomelo y limon
cepecole
 
[KGC 2012] Online Game Server Architecture Case Study Performance and Security
Seungmin Shin
 
Ad

Similar to Game server development in node.js in jsconf eu (20)

PPT
Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...
Amr Awadallah
 
PPTX
StrongLoop Overview
Shubhra Kar
 
PDF
Comet from JavaOne 2008
Joe Walker
 
KEY
Catan world and Churchill
Grant Goodale
 
PPTX
Real time Communication with Signalr (Android Client)
Deepak Gupta
 
PPTX
Real-time ASP.NET with SignalR
Alexander Konduforov
 
PPT
Building an ActionScript Game Server with over 15,000 Concurrent Connections
Renaun Erickson
 
PPTX
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Puppet
 
PDF
Privacy-first in-browser Generative AI web apps: offline-ready, future-proof,...
Maxim Salnikov
 
PPTX
Intro to node and mongodb 1
Mohammad Qureshi
 
PPTX
IoT with SignalR & .NET Gadgeteer - NetMF@Work
Mirco Vanini
 
PPT
Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea
webhostingguy
 
PDF
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
María Angélica Bracho
 
PDF
XML-RPC and SOAP (April 2003)
Kiran Jonnalagadda
 
PPTX
Openstack Icehouse IaaS Presentation
emad ahmed
 
PPTX
XLcloud 3-d remote rendering
Marius Preda PhD
 
ZIP
OneTeam Media Server
Mickaël Rémond
 
PPTX
Windows containers troubleshooting
Alexey Bokov
 
PDF
Node.js vs Play Framework
Yevgeniy Brikman
 
PPT
線上遊戲與雲端運算
Sheng-Wei (Kuan-Ta) Chen
 
Applications of Virtual Machine Monitors for Scalable, Reliable, and Interact...
Amr Awadallah
 
StrongLoop Overview
Shubhra Kar
 
Comet from JavaOne 2008
Joe Walker
 
Catan world and Churchill
Grant Goodale
 
Real time Communication with Signalr (Android Client)
Deepak Gupta
 
Real-time ASP.NET with SignalR
Alexander Konduforov
 
Building an ActionScript Game Server with over 15,000 Concurrent Connections
Renaun Erickson
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Puppet
 
Privacy-first in-browser Generative AI web apps: offline-ready, future-proof,...
Maxim Salnikov
 
Intro to node and mongodb 1
Mohammad Qureshi
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
Mirco Vanini
 
Feb. 9, 2010 ICACT 2010@Phoenix Park, Korea
webhostingguy
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
María Angélica Bracho
 
XML-RPC and SOAP (April 2003)
Kiran Jonnalagadda
 
Openstack Icehouse IaaS Presentation
emad ahmed
 
XLcloud 3-d remote rendering
Marius Preda PhD
 
OneTeam Media Server
Mickaël Rémond
 
Windows containers troubleshooting
Alexey Bokov
 
Node.js vs Play Framework
Yevgeniy Brikman
 
線上遊戲與雲端運算
Sheng-Wei (Kuan-Ta) Chen
 
Ad

Recently uploaded (20)

PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 

Game server development in node.js in jsconf eu

Editor's Notes

  • #13: 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!!!
  • #14: 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!
  • #15: 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.
  • #16: 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.
  • #17: 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.
  • #18: 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.
  • #19: 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.
  • #20: 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.
  • #21: 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.
  • #22: 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.
  • #23: So, let’s take a look at the pomelo framework.
  • #24: 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.
  • #33: 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.
  • #35: 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.
  • #36: 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.
  • #37: The fourth part, practice.
  • #38: 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.
  • #39: 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.
  • #40: 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.
  • #41: The last step, every players received the broadcast message should play the move animation, really simple!
  • #43: So easy, right? But, in reality, it is not as simple as you think. There are many issues you should consider.
  • #44: 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.
  • #45: Last part performance
  • #50: This the game picture of our stress test. Too much players in the map!!!
  • #52: This is another picture, we make the map a little bigger, so the players in one screen is dropped, which is good to broadcast.
  • #58: 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.