A Practical Architecture Design for MMO Casual Game


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Review lại flow
  • A Practical Architecture Design for MMO Casual Game

    1. 1. • Happy Me• Architecture Overview• Architecture Detail Object Management System Server-Client Data Synchronization Network Message Dispatching System
    2. 2. • MMO casual game• Room-based active server• Web-based Unity3D client• Run on social platform
    3. 3. • 3 system and framework developers• 4 game developers• 12 months of development
    4. 4. InternetDatabase Client Game Servers
    5. 5. Player Data Player DataGame Logic Player Data Server Side Client Side
    6. 6. Object Network MessageManagement Dispatching System System Auto MAKESynchronization OUR LIFE EASIER Framework
    7. 7. • Object management system  MVC design pattern  Dynamic data• Auto synchronization framework  Truly automatic («Set» and forget style)  Synchronize the delta difference only• Network message dispatching system  Custom structure message  Easy to register messages and invoke handlers
    8. 8. Database Database Model ModelController Network Controller(gameplay logic) Messages (graphic logic) 3D View View Models Server Side Client Side Unity3D
    9. 9. Game Model Objects Object View Rooms Views GameController Modules Logic
    10. 10. DatabaseNo-SQL SQL(Storage) (Ranking, Log) Game GameObjects ObjectsGame Network Graphic Modules ModulesLogic Messages LogicObject Object Rooms RoomsViews Views Server Side Client Side
    11. 11. Object Views GameObjects Object Modules Rooms
    12. 12. • A container of properties• Serialize to and deserialize from JSON• Hierarchy relationship (parent-child)
    13. 13. Property Meta Data • Tags • Persistent • Client transfer Guid • TypeObject Property 1 • Long Property 2 • Name • “property 2” • Version • 568
    14. 14. Object Manager DecoView PetView PlayerView Player Unit Pet ObjectViewMainGame GameObject DecoItem Authen Item UseItem Module ObjectHomeDeco ClothItem QuestSyncData Room DataObject Job Lobby Public Personal
    15. 15. Pros• MVC design pattern practice• Fully customizable property system• Manage game world into one single systemCons• Challenge to manage huge number of objects
    16. 16. ServerPlayer.Position = (10, 20) RoomPlayer.OnUpdatePosition(10, 20){ Client model.MoveTo(10, 20);}
    17. 17. • Process messages• Update status from clients• Other duties… • Send or broadcast Message messages to clients Processor Other Schedulers Synchronization Scheduler • Synchronize data changes between server and clients ROOM
    18. 18. Coffee Downtown Personal ROOMS Room Room Room Sync Other Sync TASK Other Sync Sync QUEUES Sync Other OtherWORKERS Thread Pool
    19. 19. 1 second OtherOTHERS SCHEDULER TaskSYNCHRONIZATION Sync SCHEDULER Task 1/10 second Other Task Sync Task TASK QUEUE Other Task Sync Task WORKER Thread
    20. 20. PositionSetProperty(Position, (1, 2)) Object Energy Gold Change SetSYNCHRONIZATION Sync SCHEDULER Task
    21. 21. Pros• Automatic synchronization property changes• Optimal data transfer• Best use for active server gameCons• Overhead to determine what has changed since last sync.
    22. 22. Login Synchronize Buy Item Chat RequestFriend - Username - Type - ItemType - Message - FriendGuid - Password - Properties - QuantityEncryption Network package Serializer (Thrift, Protobuf, Json, XML)
    23. 23. Login Server- Username- Password OnLogin Message Send Handlers Serialize Login OnAuthen Authen Move Run OnMove Deserialize OnRun Login Client - Username - Password Receive
    24. 24. Pros• Meaningful message by define custom structure• Familiar usage as common GUI system (MFC, WinForm)• Share message definition between server and client• Easy to apply encryptionCons• Unknown
    25. 25. • Seamless MVC framework across server and client• Address the most common difficulty in design active server : the synchronization• Base framework environment for adapting any gameplay