Game Server Development in node.js

Slides:



Advertisements
Similar presentations
IoT with SignalR & .NET Gadgeteer
Advertisements

Microsoft Confidential. An incubation effort to: Support client -> server communication in native code with a modern C++ API design Support writing Azure-based.
Chapter 1: Introduction to Scaling Networks
Executional Architecture
Boosting Web Communication with WebSockets Interoperability for Mobile and Stationary Internet Devices WebTech March 2011 Hotel Equatorial Penang.
Node.JS - Blurring the Line Between Client and Server var title = “ Node.JS - Blurring the Line Between Client and Server ”; $(this).attr(“title”, title);
Database Architectures and the Web
Supercharging PlanetLab : a high performance, Multi-Application, Overlay Network Platform Written by Jon Turner and 11 fellows. Presented by Benjamin Chervet.
Apache Struts Technology
COS 461 Fall 1997 Workstation Clusters u replace big mainframe machines with a group of small cheap machines u get performance of big machines on the cost-curve.
Building fast, scalable game server in node.js 网易杭州研究院
Netscape Application Server Application Server for Business-Critical Applications Presented By : Khalid Ahmed DS Fall 98.
Adding scalability to legacy PHP web applications Overview Mario A. Valdez-Ramirez.
The Team Team consisted of 5 members. Max Annear – Henderson Conrad Orange Mike Debney Anton Slooten Luke Stanford.
–Streamline / organize Improve readability of code Decrease code volume/line count Simplify mechanisms Improve maintainability & clarity Decrease development.
Capacity Planning in SharePoint Capacity Planning Process of evaluating a technology … Deciding … Hardware … Variety of Ways Different Services.
31 January 2007Craig E. Ward1 Large-Scale Simulation Experimentation and Analysis Database Programming Using Java.
REAL WORLD SPA A KNOCKOUT CASE STUDY Cory House | bitnative.com | speakerrate.com/talks/27181.
The powerful capabilities of JBoss Middleware as cloud based services on OpenShift. Build applications. Integrate with other systems Orchestrate using.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Java Omar Rana University of South Asia. Course Overview JAVA  C/C++ and JAVA Comparison  OOP in JAVA  Exception Handling  Streams  Graphics User.
Institute of Computer and Communication Network Engineering OFC/NFOEC, 6-10 March 2011, Los Angeles, CA Lessons Learned From Implementing a Path Computation.
M i SMob i S Mob i Store - Mobile i nternet File Storage Platform Chetna Kaur.
Node.js - What is Node.js? -
Copyright, 1996 © Dale Carnegie & Associates, Inc. Presented by Hsiuling Hsieh Christine Liu.
Google Web Toolkit An Overview By Shauvik Roy Choudhary.
Scalable Web Server on Heterogeneous Cluster CHEN Ge.
Orbited Scaling Bi-directional web applications A presentation by Michael Carter
© 2006 IBM Corporation Agile Planning Web UI. © 2006 IBM Corporation Agenda  Overview of APT Web UI  Current Issues  Required Infrastructure  API.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Case Study ProsperaSoft’s global sourcing model gives the maximum benefit to customers in terms of cost savings, improved quality, access to highly talented.
Server to Server Communication Redis as an enabler Orion Free
1 MMORPG Servers. 2 MMORPGs Features Avatar Avatar Levels Levels RPG Elements RPG Elements Mission Mission Chatting Chatting Society & Community Society.
Moving Web Apps From Synchronous to Asynchronous Processing Jason Carreira Architect, ePlus Systems OpenSymphony member.
Database Server Concepts and Possibilities Lee Lueking D0 Data Browser Workshop April 8, 2002.
Chat Room App Logan Linn Network Application Design Fall 2010.
Martin Kruliš by Martin Kruliš (v1.1)1.
KAASHIV INFOTECH Presents INTEL XDK For Inplant Training / Internship, please download the "Inplant training registration form" from our website
ASP.NET SignalR SoftUni Team Technical Trainers Software University
Node.Js 1. 2 Contents About Node.Js Web requirement latest trends Introduction Simple web server creation in Node.Js Dynamic Web pages Dynamic web page.
© 2008 by Wind River; made available under the EPL v1.0 | 19-Nov-2008 TCF The Target Communication Framework Michael Scharf, Wind River wiki.eclipse.org/DSDP/TM/TCF_FAQ.
Keith Telle Lead Software Engineer Bit Wizards Behind the Magic: SignalR Demystified.
Learn Nodejs by Building 10 projects. What is Nodejs  An Open source, Cross platform, Event Based and Non-blocking framework used to develop server side.
Introduction to Node.js® Jitendra Kumar Patel Saturday, January 31, 2015.
Ext JS - Direct Bridging The Gap A DMSBT Presentation By Timothy Chandler.
CS3220 Web and Internet Programming RESTful Web Service
Optimizing Distributed Actor Systems for Dynamic Interactive Services
NodeJS and MEAN cs6320.
Node.Js Server Side Javascript
Physics validation database
Netscape Application Server
ASP.NET SignalR SoftUni Team C# MVC Frameworks Technical Trainers
Google Web Toolkit Tutorial
CSE 775 – Distributed Objects Submitted by: Arpit Kothari
Open Source distributed document DB for an enterprise
NodeJS and MEAN Prof. L. Grewe.
The merging of Web and Mobile APP
3 Things Everyone Knows About Node JS That You Don't
Storage Virtualization
Node.js talking to PROGRESS
Node.Js Server Side Javascript
Introduction to Apache
Nathan Totten Technical Evangelist Windows Azure
INTRODUCTION TO By Stepan Vardanyan.
Introduction.
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes)
Running C# in the browser
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Game Server Development in node.js Charlie Circle @圈圈套圈圈 @xiecc

Category Overview Framework Practice Performance

Overview---node.js and game server 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. Game Server Fast Scalable Network Real-time

Overview --- advantages Scalability --- event driven I/O Game, high density network communication Language, javascript HTML5 – same language in client and server Really quick iteration Multi-Process, Single thread Google grits, mozilla browser quest, single process multi process VS multi thread

Overview -- disadvantage Some CPU sensitive actions Path finding AI Solution Optimization Divide process All can be solved in practice

Overview -- our demo

Overview---architecture of demo

Overview --- game VS web Long connection VS Short connection Partition: area based VS Load balanced cluster State VS Stateless Broadcast VS Request/response Request&tick driven VS Request driven

Overview --- how to solve complexity Too … complicated? solution: framework

Framework --- web VS game Tomcat/Jetty Struts/Spring ruby on rails django express Game Reddwarf SmartfoxServer Bigworld

Category Overview Framework Practice Performance

Framework --- framework Realtime, multi-server app framework ai aoi schedule robot . . . pathfind seq-queue data-sync Admin console Library tools framework Realtime, multi-server app framework

Framework --- design goal Abstract of servers(processes) Auto extend server types Auto extend servers Abstract of request , response and broadcast Zero config request Simple broadcast api Other mechanisms: filter, session Servers communication---rpc framework

Framework --- server abstraction frontend backend forward message push message by channel rpc master

Framework --- server abstraction Frontend(connector) Client connection Maintain session information Dispatch request to backend Push message to client Backend Handle request from frontend Push messages to frontend, through channel or response Rpc service

Framework--- server abstraction Duck type frontend connector backend area chat status

Framework---server abstraction Convention Over Configuration Classify servers by folders handler: for client request remote: for rpc All server code in one project Developer job: fill the handler and remote server type

Framework---server abstraction

Framework --- request abstraction Zero config Client, like ajax Server, like web mvc framework

Framework --- rpc framework Zero config Auto route app.rpc.chat.chatRemote.kick

Framework --- channel&broadcast Push messages to a group of users channelService.pushMessageByUids(msg, uids, callback); var channel = channel.getLocalChannelSync(‘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

Category Overview Framework Practice Performance

Practice --- game demo Develop time(first version): 2012-5-14~2012-6-30 Client Html 5, based on colorbox framework Almost 6,000 lines code Server Node.js, based on pomelo framework Almost 6,000 lines code

Practice --- simplest player move client Area1 connector client1 client2 clientn … 1、Move request 2、Forward 3、Move Handler 4、Backward 5、Broadcast 6、Play move animation

Practice --- Client Move Request … find path, move animation pomelo.request({route:’area.playeHandler.move’, path: path}, function (result){ … });

Practice --- area server handler handler.move = function( req, session, next) { … verify path … handle move channelService.pushMessagesByUids( route:’onMove’, ….); session.response({code:OK}); next(); }

Practice --- client play move pomelo.on(‘onMove’, function(data) { play move animation … });

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)

Category Overview Framework Practice Performance

Performance --- overview The indicator The max online users Response time/throughput Single area or game? The variation Game logic: round or realtime, room or infinite Map size, character density Balance of areas Test parameters: Think time, test action

Performance --- target Area online users next-gen: Socket.io: 25,000 concurrent users But in the real world The real online data: maximum 1,000 concurrent users per area, 8,000 concurrent users per group game servers

Performance --- tools Stress testing for websocket--pomelo-robot master agent robot

Performance --- tools Stress test console

Performance --- tools, profiler Server profiler

Performance --- stress testing Stress on single area, increasing step by step Real game logic simulation Roam, fight, pick Think time: 2s~4s

Performance --- hardware CPU , 24 cores Mem, 48G

Performance --- stress testing

Performance --- stress testing

Performance --- progress 5 rounds Online users: 200 to 1600… Response time: 300ms Problems solved: Html 5, client side memory leak Path finding and aoi optimization Data too… fat, reduce weight Unclean connection data, make socket.io crazy Some api implementation: dataApi Divide process: path finding And… broadcast

Performance --- broadcast 200 online users, connector 100% cpu

Performance --- channel, where is wrong? broadcast serialize channel client1 regroup connector1 serialize uids deserialize uids1 serialize serialize client2 … connector2 uids2 deserialize tick: 100ms tick:50ms clientn … … client connectors Area

Performance --- connector Connector--- the middle man What do I need data for? Decode: only route Message in Parse the route encode connector1 area {route:’area.playerHandler.hello’, data:{…}} forward Client Stringify connector2 parse area forward broadcast Serialize deserialize …

Performance --- the package Pomelo-protocal Only parse head for route information: \0\0\0\3\34connector.loginHandler.login{“username”:”xcc”,……..}

Performance --- the result 1600 onlines

Performance --- the result 1600 onlines , server load Isn’t that amazing? no

Performance --- the result 800 onlines, fight each other

Performance --- the result Server load, fight each other

TODO Performance improvement Interface, tools improvement The broadcast data size GC, object pool, or… really crazy rpc underlying protocal : socket.io, need change Interface, tools improvement Document, website Open source: 2012-11

Q&A