= mmorpg
:author:
:revnumber:
:revdate: 2016/03/17 20:48
:relfileprefix: ../../
:imagesdir: ../..
ifdef::env-github,env-browser[:outfilesuffix: .adoc]



== MMORPG Adventure


== CODE NAME : ANCIENT MONKEY WORLD (AMW)

*Hi, monkeys*

After a long project, I have time to sit down a write something about MMORPG and my adventure in making one (if it’s not a forbidden word). :p


[WARNING]
====
A MMORPG Project is *not easy nor appropriate* for beginner. +
Such projects need a lot of skills, knowledge, passions and efforts to accomplish… +
This tutorial just 've written down as the process of one no warranty attempt start by forum members : @atomix and … ()
====


The project will be a community project, that mean Open-source and non-profit, code name :
*Ancient Monkey World.*

image::http://digital-art-gallery.com/oid/66/1356x1600_12073_Monkey_King_2d_fantasy_character_monkey_king_picture_image_digital_art.jpg[1356x1600_12073_Monkey_King_2d_fantasy_character_monkey_king_picture_image_digital_art.jpg,width="300",height="",align="right"]



=== Quick start for Developers

*  Forum: link:http://hub.jmonkeyengine.org/forum/topic/mmorpg-adventure/[http://hub.jmonkeyengine.org/forum/topic/mmorpg-adventure/]
*  Wiki: <<jme3/atomixtuts/mmorpg#,jme3:atomixtuts:mmorpg>> and link:http://code.google.com/p/ancient-monkey-world/w/list
*  Sourcecode: link:http://code.google.com/p/ancient-monkey-world/[http://code.google.com/p/ancient-monkey-world/]
*  Plan: <<jme3/atomixtuts/mmorpg#process,jme3:atomixtuts:mmorpg#process>>
*  Issues: link:https://code.google.com/p/ancient-monkey-world/issues/list[https://code.google.com/p/ancient-monkey-world/issues/list]
*  Setup:
*  Tools: <<jme3/atomixtuts/mmorpg_tools#, Tools used>> <<jme3/atomixtuts/mmorpg/researches/toolset#,Research about toolset>>
*  Game documents:
*  Art &amp; Assets:
*  License: BSD


=== Quick start for Viewers

*  <<jme3/atomixtuts/mmorpg/phase0#detail, Phase 0 - JME 3D in 2D RPG gameplay>>
*  <<jme3/atomixtuts/mmorpg/phase1#detail, Phase 1 - Physics and network: faster than the bullet>>
*  <<jme3/atomixtuts/mmorpg/phase2#detail, Phase 2 - Quests and Tools>>
*  <<jme3/atomixtuts/mmorpg/phase3#detail, Phase 3 - Deploy to the Cloud and PLAY>>


=== Prelude

I cant count how many times people saying that you can not build a MMORPG with just two hands and a computer… That mean no chance a one man army can even write that kind of game, or it going to be a failure. I’m not a fearless programmer nor a naive kid try to impress. I just think I can!

I was from a Database center solution then come to Game industry in a strangest kind of accident :p As I was a pure Java programmer than become a fulltime designer. That’s kind of weird but teach me one thing “You can do extraordinary thing with the right tool”… not mentioned efford, time, knowledge, exprerience and passion…

The right tools *weapon* I choose is JMonkeyEngine and other opensources project to start to learn.

So did I tell you we can make a MMORPG with just an idea and a few thousand hours of working? Indeed. Here is the story:


==== 0) Your idea:

Let’s say you have a good idea of a Game… an imagination world that people interact and fight, meet, share… you have a story to tell, and want to draw some impressive scenery or beatiful characters. Spend like a few years for the ideas, may be research and play a lot of games, use papers, talk with friends, travel around the world… Until you have concentrade enough for only one good idea.


==== 1) Your skills:

Question: I can draw, can compose music, video, can code, can sing, can write script, can do Java stuff… Is that enough?
Answer: Ummh, NO!
MMORPG is a freaking black-hole of knowledges and experiences requirement. No estimatable amount of knowledge consider enough.
But then I tell you is ENOUGH. At least you can do Java stuff and can draw, you can. The other you will learn when you are on the journey.

*  + Programming: For the start, you need to “know” Java, the more the better. If you just write your first “Hello world” program 3 months ago. You are too hurry for a big challenge. Let make it at least 3 year exprience. I have 13 and consider people with much more expriences still facing problems of course. The years does not matter!
*  + Assets: May be you should know how to draw and 3d stuff, the more the better. I recommend if you are at least 1 year with 3D modelling and animating, and should play around with tools. First is Concept. Then other things come quick : Sound, Sprite,…
*  + Researching skill: This is very important if you are a one man army or indie team. You have to do research, brain-storming or ask people every time. So try to be active to get knowledge.


==== 2) Your workflow:

try Extreme programing: link:http://en.wikipedia.org/wiki/Extreme_programming[http://en.wikipedia.org/wiki/Extreme_programming]

If you never in a professinal workflow before, try to do it simplier as your only have limited man power. Most valuable advice if you’re an artist do programming: Do it like Zen :p

*  - Smart and active: Research first, try to call out for help if need! Opensource are the key.
*  - Flexible but manageable: Try to use SVN.
*  - Shoot with both hands: Do both assets and programming can cause a mesh, do one at a time. After finish review, get approved by yourself or the leader. Continue developing.
*  - Pirate spirit: Use place holder as much as your can. Skip concept, may use existed assets. There are plenty of free assets.
*  - Avoid premature optimization: If still concerning about design, make it work first.
*  … [more to come]


==== 3) Your tools:

Of course this is big task, Your tools are various from DDC to Image/sound editor… But let’s name a few with zero cost! (mean open-source or free)

*  - JME SDK and its plugins (Programming, database tools… a God-like tool for smart monkey)
*  - GIMP (2d: concept, texture…)
*  - Blender (3d)… and there are a lot of good 3d tools. Blender are the best integrated tool to JME
*  - [Other assets tool like sound editors, sprite… come later]


==== 4) Your framework:

This is the most important thing that can make your dream possible. So let me speak a bit slowly:
I spend years for researching in this area (MMORPG), I came across WorldForge, Darkstar,… write my own Network engine and related DB stuff using Hypertable, ORM… (bad mislead time)

[TIP]
====
More about MMORPG Architecture and framework Researches: <<jme3/atomixtuts/mmorpg/researches#,researches>>
====

And finally I found a nice, free but powerful framework: The Threerings project link:http://www.threerings.net/code/[http://www.threerings.net/code/] 2 year ago.

It taken time to research and admit that they do it nicely and scalable (i’m not going to blow it up). If you think you are better than me in reviewing go ahead, i also need valuabe comperations of framework at the moment.

So what I tell you that amount of tool are pretty enough for thousand players game. I’m not going to do Three rings advertisment, for short, it’s your chance to build a MMORPG.

What you will see at first that the OOO even support 3D stuff, as some of their developer also contribute in JME version2, then write their own engine. It’s quite bad compare to JME at the moment. So maybe you want to use JME3 to do graphics stuff and other tools for Network. Deploying and DB. AI stuff are often quite difficult to write your own but in the end, I will offer you a choice.


[IMPORTANT]
====
But is it real you can make a MMORPG game with just that?
Of course not. It will take more than thousands of hours to code and to draw, do experiments, fix bugs… This is just advice point out a good way before start your own journey.
====


People may come up with different levels of knowledge and experience. So here and there, they may want to replace an open-source project by their own library. I also write almost every modules of the architure, but for myself I can not provide enough efforts for an opensource project maintaining. I just can keep bad code, release a few good one and write down articles.

For people who are exciting of community project as MMORPG, may be this time you can gather up. I’m not guaranty that I’m enough of abitily to make it to the end, but at least we have a working base to start with.


[IMPORTANT]
====

Anyone interest can PM me as @atomix in the forum?
====



== THE ADVENTURE BEGIN


=== The idea

In Oriental culture, we all love the legend of Monkey king who traveled to the West and become a Buddha.

link:http://en.wikipedia.org/wiki/Sun_Wukong[http://en.wikipedia.org/wiki/Sun_Wukong]

link:https://www.google.com/search?q=Monkey+King[https://www.google.com/search?q=Monkey+King]

( Songoku in Japanese )

I compose the idea with wild jungle scenes in fictional oriental - western mixed scenery and theme, and adventures along the jouney.

image::http://fc09.deviantart.net/fs70/i/2011/004/d/5/monkey_king_by_saryth-d36e92m.jpg[monkey_king_by_saryth-d36e92m.jpg,width="400",height="",align="center"]


[TIP]
====
More about ideas and Game Design [googlecode] and [googledocs] <<jme3/atomixtuts/mmorpg#,mmorpg>>
====



=== Mind map

This is the sketch mindmap of the game.

iframe::http://text2mindmap.com/JdE5xP[width="100%", height="600px", alt="", scroll="true",border="true",align="false"]



=== Game design


=== MMO Game Architecture Researches


==== Overal MMO Game Architecture

In Phase 0 of the development process I intend to use Marauroa and some code from Arriane because the ease of use and clear design!
In *Marauroa* engine they have an excellent short and precise overview MMO game architecture which I will cite below, keep in my the detail implementation like DB or even programming language are optional:

_Marauroa is based on very simple principles:_

*  Clients communicate with the server, and vice-versa, using a TCP portable network protocol with reliability in mind to allow a stabler experience when online game lag occurs.
*  To play a game every player needs an account on the server that is identified by an username and a password.
*  Players use their account to login into the server and then choose a 'player' stored under their account to play with. The server then checks the login information using the MySQL backend and loads the player into the game using the persistence engine.
*  Players send actions to the server. The action system is totally open and has nothing hard-coded so you can edit it totally to your game style. The server sends at regular intervals, called turns, a perception to each player to inform them about the state of the game and any relevant state modifications. Marauroa's perception system is based on the Delta^2 ideology: simply send what has changed.
*  The server executes some code each turn in order to move the game status on. Using this hook it is simple to code triggers, timeouts, conditions and whatever kind of behavior you need.
*  The server transparently and automatically stores players and game status modifications on the persistence engine, and also information decided by the game developer using their game definition scripts.
*  Game rules can be coded in Java to allow simple and rapid development and without having to know anything about Marauroa's internals. Python scripts for the game rules could be supported with a little work.
*  The server generates statistics of usage which are stored in a MySQL or H2 database (so you can later generate fancy statistics from them). Or in case you don't require them, they can be disabled to save CPU cycles and disk space. Marauroa features a modular structure that means modules can be changed and disabled without affecting the operation of other modules.
*  Both the server and clients are fully and wisely documented, with documentation about specification and design and not just +++<abbr title="Application Programming Interface">API</abbr>+++ documentation.

Review the full description here

[TIP]
====
link:http://arianne.sourceforge.net/engine/marauroa.html[http://arianne.sourceforge.net/engine/marauroa.html]
====


As said, the architecture and the components of a MMORPG game will be kept but part by part will be swaped or replaced as the process go. Why? Because there are better solutions new technologies nowaday. Now let take a look at the three things call the “Triangle of Bedmudas in game design.


==== Entity system

Yeah, this is not really new. In fact, the Entity system wave was from 2006-2007, as
link:http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/[http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/]
and almost become a standard solution in MMO world.

The idea of Entity System are descripted better with details here:
<<jme3/contributions/entitysystem/introduction#, Entity system Introduction>>

So, as you see, JME community already offer 2-3 Entity System solutions. As the guys discuss in the forum, the code base of the ES should be kept rather small and compact because it's going to be involve in every game cycle. The first thing should be revolved and change from Marauroa code base is the Entity System intergration which also with be the base of other additons in the future.


==== Event system

What's the hurry for a game event system?
Yeah, event system here is not just the event (message) broadcasting. Because game technologies involve more and more parallelism, especially to be corporate with networking, the event system should also be considered again.

Event system should encourage decoupeling and give the developer more strength and controls. Also ease of use, ightweight, non blocking, non replicating…etc

I'm not going to the details here but you can read more about it in the researches.


==== Network system

This problem can be considered a challange in design. No one can say it easy or they not write it and test it yet. C

orporate with entity, event and networking make a “Death point for every design. For big MMO game (and other kind of massive real time system) in 4-5 years ago, they strugge to make those 3 work together, by trying to reduce the network cost, multi thread the server, and do C++ tricks in memory, pointer…etc . Yeah, we will have to do them same to be optimized …


[TIP]
====
For further reading: GOTO <<jme3/atomixtuts/mmorpg/researches#,researches>>
====



==== The chosen one
[quote]
____
But can we come up with better overal design first?+Hopefully, yes, this time!
____

So the asynchronized server, network and event system are widely use nowadays. The are dozen of open source project intended to solve the enterprise problems at once.

....
 Node.js is a good example, the idea is simple but the implementation are truely epic. They've done it beautifully and we (java devs) should have the same thing or get used to it in the mean time.
 The runner up but in the Java world is the Three rings projects, well done and save developer from the hard parts.
....

But till the time of writing, almost no one get it straight into game developing or not into 3D (like Three rings). I considered those general systems can not sastify the needs for *enterprise game developing*! They always try to keep it relatively small because of affair / obsesses it will become un-optimized. But also because of that, they don't solve the 3 main problems at once, which lead to the un sastification i mentioned.

In the researches you will find an article tell extractly how I use, modify, leverage and optimize Three rings and the existed opensource projects to let them work seamlessly together, without worry about the over engineering!


=== AMW Architecture


== PROCESS


=== Phase Zero

*Start:* July 1st - August 1st

*Main task:* Setup and Port  MORPG engine Arriane from 2D to 3D. Try and review.

<<jme3/atomixtuts/mmorpg/phase0#,phase0>>


=== Phase 1

*Start:* August 1st - September 1st

*Main task:* Unknown

<<jme3/atomixtuts/mmorpg/phase1#,phase1>>


=== Phase 2

*Start:* September 1st - Oct 1st

*Main task:* Unknown

<<jme3/atomixtuts/mmorpg/phase2#,phase2>>


=== Phase 3

*Start:* Oct 1st - Nov 1st

*Main task:* Unknown

<<jme3/atomixtuts/mmorpg/phase3#,phase3>>
