12/11/2008

Scalability in Online Game and Virtual World

The latest issue of ACM Queue Magazine has an article titled "Scaling in Games & Virtual Worlds", which talks about SUN's efforts on the scalability problem in Online Game and Virtual World systems(A.K.A. MMORPG).

The author is a Distinguished Engineer in SUN, who had been involved in the scalable online game platform: DarkStar for about 2 years. He summarized many interesting points in this paper.

I - Unique Characteristics of Online Game:
1. Being Fun is the Prime Directive
2. Should be Easy to Learn, but Hard to Master
3. Client is Fat and Powerful
4. Network Latency is a Critical Factor

II - Current State of the Art of Techniques in Game & World:
1. Network protocol is simple and should be hold in one network packet
2. Server is artictured as doing small things fast with large scale concurrent requests
3. Predict & Adjust tricks are used to hide network latency
4. Servers act as player interaction hub and arbiter to avoid client cheating

III - Current Scaling Strategy:
1. Geographic Decomposition - Partitioned by Geography Information. For example, all activities in an island/country are processed by one physical server
2. Sharding - create noninteracting copies of parts of a world, players can only interact with players in the same shard

The problems that SUN found are:
1. Chip Architecture is switching to multi-core style, which is suitable for parallel tasks
2. Server side game tasks are essentially parallelized: one thread for one player, interactions among users are relatively small, compared with all activies
3. Currently, most game implementation can't expoit parallel characteristic of multi-core cpu

SUN's proposal for next generation game development:
1. Hide concurrency and distribution for game logic developer
2. Server is architectured as event-based(may be SEDA like, I guess) and one client request served by one server task
3. Communication is abstracted as Channel, physical address is hiden from developer
4. Data/State is moved from server memory to global data service, which is based on simplified DBMS technologies
5. Since little state in task logic and server mem, task imigration is possible, which enables hot load balance

The last valubale word in this paper: the darkstar is open sourced.

I think the observation and current tech description are the most interesting parts, the solution part is not that exciting, since the idea is somewhat not so innovative.

One personal observation is that, general platform will improve productivity of application developer, but with the price of performance. So, what's future of the darkstar project? It may be useful for small scale game, but when your players grows to M or 10M level, productivity is not the primary problem for dev team, but performance/stability is. So large scale applications always use ad-hoc solutions. But if darkstar is not used in REALLY LARGE scale environment, how can we evaluate the value of this system, how can we say the project succeed or fail?

12/04/2008

Use Reg Expression in VIM

    When I am writing blog, I will use photos from flickr very often. When posting photos to blogspot, I usually upload them to flickr first, then use the "add image" button in blogger edit box. At the mean time, I usually modify the image target link to the url of the original size photo. When the photo count is relatively large, for example, larger than 10, doing these things maually is annoying.

     So I decided to do it in two steps using VIM's replacing command:(Suppose we now have all image's urls in vim)

1. Compose the Blogspot style image anchor tags.
VIM command: %s/^\(\S\+\)$/str1\1str2\1str3

str1 -- <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="
str2 -- "><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 240px; height: 135px;" src="
str3 -- " border="0" alt="" /></a>


2. Modify the image anchor target to be the original size photo:
The medium size photo's url is like: http://farm3.static.flickr.com/2357/2096529455_4bc506c8ff_m.jpg
The original size photo's url is like: http://farm3.static.flickr.com/2357/2096529455_4bc506c8ff_b.jpg

VIM command:%s/^\(\S\+href\S\+\)\(_m\)\(\S\+\)$/\1_s\2


So it becomes much easier to do blogging on blogspot with a lot of image urls.

For VIM reg expression and replacing syntax, see the reference documents(Sorry, all in Chinese).

Reference(In Chinese):
[1] http://ubuntu-fans.blogspot.com/2007/02/vi.html
[2] http://bbs.et8.net/bbs/showthread.php?t=746650
[3] http://vimcdoc.sourceforge.net/doc/pattern.html#pattern.txt

12/03/2008

Visual Studio Product Comparison

  When the first version of VSTS(vsts 2005) came out, I was very confused about the various names, products' functionalities and the relationships among them. So I spent some time and came out the following brief summary. Wish it be helpful if you encounter the same problem.


/-
| Express Edition (VB/VC++/VC#/Web for Free)
|
| Standard Edition (Basic for Individual Developer)
|
| Professional Edition (Std + Adv.Debug/Office/Mobile)
|
Visual Studio + /- VSDB - DataBase
| | VSTA - Architecture
| /- Team Suite +
| | | VSTD - Development
| Team System + \- VSTT - Test
| |
| \- Team Fundation Server
\-

Visual Studio Product Family


VSTS - Visual Studio Team System

TFS(Team Fundation Server) - It combines project management, work item tracking, version control, reporting & business intelligence, build management, and process guidance into a unified team server.

VSTA/VSTD/VSTT/VSDB
- It is for Architect/Developer/Tester/DB Professional individually.

The Official Visual Studio Product Comparison Web version and PDF version