21
做遊戲學python python打造的遊戲雲

Building game cloud with python

Embed Size (px)

Citation preview

Page 1: Building game cloud with python

做遊戲學python用python打造的遊戲雲

Page 2: Building game cloud with python

About me

● yyhuang● a.k.a 黃小鴨

● Game programmer of IGS (鈊象電子)

Page 3: Building game cloud with python

Scalable Game Cloud for Mobile & Social Games

Page 4: Building game cloud with python

Game Cloud For...

● Save all game records○ game progress○ level, exp, energy, ...○ virtual money

Hay Day - Supercell

Page 5: Building game cloud with python

Game Cloud For...

● Play from any device○ PC○ iPhone○ iPad○ Android○ Windows Phone○ ...

Puzzle & Dragons - GungHo

Page 6: Building game cloud with python

Game Cloud For...

● Social feature○ invite friends○ messages○ gifts

● Competition○ leaderboards○ tournaments

Candy Crush Sage - King.com

Page 7: Building game cloud with python

Game Cloud Features

Page 8: Building game cloud with python

Login and Authentication

● Facebook account● Auto generate ID from mobile hardware● Allow concurrent access or not

Page 9: Building game cloud with python

Communication Manager

● HTTP-based communication○ apache + php○ wsgi○ gevent + bottle

● Serialize/Deserialize messages○ amf○ json○ ...

Page 10: Building game cloud with python

Communication Manager

● Message sequence check○ Queue requests

● Dispatch message to game servers○ RabbitMQ○ Python Queue module

● Callback interface for client○ Asynchronized○ Synchoronzied

Page 11: Building game cloud with python

Game Database

● Usually interested in data of one player● NoSQL database

○ Non-relational○ Key-value documents○ Easier to shard

● MongoDB○ pymongo

Page 12: Building game cloud with python

E-commerce Server

● Real money to virtual money● Multiple currencies in game● Admin interface for setting up item price● Separate logs

Page 13: Building game cloud with python

Deployment

● git● python package● boto for AWS control● salt

○ deploy commands○ control commands

Page 14: Building game cloud with python

Architecture

Page 15: Building game cloud with python

Game Server Development

Page 16: Building game cloud with python

Games on our platform

● Facebook games○ Airline Fantasy○ Billiard Ace

● Mobile games○ 極速摩托

○ 美髮玩家 1&2○ Slots Paradise

Page 17: Building game cloud with python

Libraries

● Config loader○ Consistent config rules○ Environment check

● Log libraries○ python logging○ syslog-ng

● Database API wrapper

Page 18: Building game cloud with python

Environment

● VirtualBox○ Local development environment

● Amazon EC2○ Development

■ Feature test and verify○ Testing

■ Version ready for release○ Release

Page 19: Building game cloud with python

Development Process

● Scrum○ agile○ iterative○ incremental

● Split user story to the fundamental● Focus on the unknown problem

○ The best part of python

Page 20: Building game cloud with python

Finally... Life Saver

● unittest● pdb● cProfile● ... and git

Page 21: Building game cloud with python

Thank you

● Q & A

● Contact○ elmnhuang at gmail dot com