SlideShare a Scribd company logo
閒聊Python應用在Game
Server的開發
Eric Chen
Agenda
● Python應用在之前的專案中
● Django與REST應用在遊戲開發上
● 面臨的問題與挑戰
Before...
● Pure Python (Socket + Epoll)
● Django + PyAMF
● Django + REST
Socket vs Web Service
● Socket Server
○ Real Time
■ Player location info.
■ Chat
● Web Service
○ polling
REST API
HTTP Method Data operate Description
POST Create Create a resource without
id.
GET Read Get a resource.
PUT Update Update a resource or create
a resource with id if not
existed.
DELETE Delete Delete a resource
Framework
● Django
● Django REST framework
Why Django REST framework?
Source of photo credit :http://django-rest-framework.org/
Example by Puzzle & Dragon
Source of photo credit :http://www.gungho.co.jp/
Game flow
選擇關卡 進入戰鬥 卡片編輯
Source of photo credit :http://www.padpadblog.com/2012/11/blog-post_6024.html & http://zh.pad.wikia.com/wiki/Puzzle_%26_Dragons_%E7%BB%B4%
E5%9F%BA
隊伍編輯
API
● /api/login/
● /api/players/me/
● /api/stages/
● /api/cards/
● /api/cards/groups/
● etc...
Login
models.py
class Player(models.Model):
access_token = models.CharField(max_length=255)
level = models.
exp = models.
money = models
...
serializer.py
class LoginSerializer(serializers.Serializer):
access_token = serializers.CharField()
api.py
class LoginView(APIView):
def post(self, request):
serializer = SnippetSerializer(data=request.DATA)
if not serializer.is_valid():
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
player, created = Player.objects.get_or_create(access_token=access_token)
result = {}
request.session['player_id'] = player.id
return Response(result)
Problem
● 資料庫存取次數
● 資料庫延遲
● Application Server 效能問題
● 減少Server端計算
● 修改企劃
● 資料庫分割
● 快取
● NOSQL
● Queue
Q&A

More Related Content

PPTX
Sphinx autodoc - automated api documentation - PyCon.KR 2015
PDF
Py conkr 20150829_docker-python
PDF
pa-pe-pi-po-pure Python Text Processing
PDF
Reversing the dropbox client on windows
PDF
Cluj.py Meetup: Extending Python in C
PDF
Threads and Callbacks for Embedded Python
PDF
Python高级编程(二)
PDF
History & Practices for UniRx(EN)
Sphinx autodoc - automated api documentation - PyCon.KR 2015
Py conkr 20150829_docker-python
pa-pe-pi-po-pure Python Text Processing
Reversing the dropbox client on windows
Cluj.py Meetup: Extending Python in C
Threads and Callbacks for Embedded Python
Python高级编程(二)
History & Practices for UniRx(EN)

What's hot (20)

PPT
Euro python2011 High Performance Python
PDF
Facebook Glow Compiler のソースコードをグダグダ語る会
PDF
node ffi
PDF
Cluj Big Data Meetup - Big Data in Practice
PDF
Про асинхронность / Максим Щепелин / Web Developer Wargaming
PDF
Windbg랑 친해지기
PDF
Elegant concurrency
PDF
PyData Berlin Meetup
PDF
TensorFlow XLA RPC
PDF
Learning Python from Data
PDF
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
PDF
Google Edge TPUで TensorFlow Liteを使った時に 何をやっているのかを妄想してみる 2 「エッジAIモダン計測制御の世界」オ...
PDF
Introduction httpClient on Java11 / Java11時代のHTTPアクセス再入門
PDF
Profiling and optimizing go programs
PPTX
node.js and native code extensions by example
PDF
Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;
PDF
How to Write Node.js Module
PDF
Python于Web 2.0网站的应用 - QCon Beijing 2010
PDF
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Euro python2011 High Performance Python
Facebook Glow Compiler のソースコードをグダグダ語る会
node ffi
Cluj Big Data Meetup - Big Data in Practice
Про асинхронность / Максим Щепелин / Web Developer Wargaming
Windbg랑 친해지기
Elegant concurrency
PyData Berlin Meetup
TensorFlow XLA RPC
Learning Python from Data
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
Google Edge TPUで TensorFlow Liteを使った時に 何をやっているのかを妄想してみる 2 「エッジAIモダン計測制御の世界」オ...
Introduction httpClient on Java11 / Java11時代のHTTPアクセス再入門
Profiling and optimizing go programs
node.js and native code extensions by example
Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;
How to Write Node.js Module
Python于Web 2.0网站的应用 - QCon Beijing 2010
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Ad

Viewers also liked (13)

PDF
Python 于 webgame 的应用
PPT
Astral game server
DOC
China game-server-vpn-to-reduce-delay-abroad
PPT
构建ActionScript游戏服务器,支持超过15000并发连接
PPT
Social Game
PPTX
30 分鐘學會實作 Python Feature Selection
PDF
How_to_build_GameServer_2
PDF
Multi thread game server
PDF
SDC 3rd 안중원님 - InGame CashShop 개발 하기
PDF
C/C++调试、跟踪及性能分析工具综述
PDF
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
PPT
Building an ActionScript Game Server with over 15,000 Concurrent Connections
PDF
Server side game_development
Python 于 webgame 的应用
Astral game server
China game-server-vpn-to-reduce-delay-abroad
构建ActionScript游戏服务器,支持超过15000并发连接
Social Game
30 分鐘學會實作 Python Feature Selection
How_to_build_GameServer_2
Multi thread game server
SDC 3rd 안중원님 - InGame CashShop 개발 하기
C/C++调试、跟踪及性能分析工具综述
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
Building an ActionScript Game Server with over 15,000 Concurrent Connections
Server side game_development
Ad

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Spectroscopy.pptx food analysis technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MIND Revenue Release Quarter 2 2025 Press Release
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
20250228 LYD VKU AI Blended-Learning.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectroscopy.pptx food analysis technology
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

閒聊Python應用在game server的開發