design.adoc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. = design
  2. :author:
  3. :revnumber:
  4. :revdate: 2016/03/17 20:48
  5. :relfileprefix: ../../../
  6. :imagesdir: ../../..
  7. ifdef::env-github,env-browser[:outfilesuffix: .adoc]
  8. == Atom Framework Design
  9. This is the repository resulted of the design phase of Atom framework over years.
  10. === Motivation
  11. It born to helps JME3 focus in *game/simulation development*, push futher in lastest/future Java technologies toward to enterpise/AAA game dev as its final goal, but compromise/ compatible with existing insfracture of JME3 and OpenGL.
  12. Its concept, design and archictecture inspired by AAA game engine and Enterprise Java solution.
  13. === Overview
  14. In this page:
  15. . Goal of Atom framework - which tend to expand JME3 and Java language to suite more for game dev.
  16. . Problems of realtime applications (especially games).
  17. . Solutions and those base platforms, frameworks that we going to use to approach those goals.
  18. . Remain works and future vision
  19. == Design goals
  20. ==== Overal goals
  21. * Flexible: Game | simulations centric but not forced!
  22. * Modular: Dependency injection along with Component injection
  23. * Parallel: Embrace parallel computing
  24. * Next gen: Come with Bleeding edge technologies and powers of Java languages
  25. * Cloud ready: Scale to web and distributed computing
  26. * With ease: +++<abbr title="Graphical User Interface">GUI</abbr>+++ Tools everywhere, almost zero config need
  27. * Cross devices: Can run wide range of devices PC-mobile-TV.. any one that has java!
  28. ==== Additional sub goals
  29. * Minimum dependencies and their overlap
  30. * Small footprint &amp; Efficient
  31. === Slides
  32. You can view slides and download papers about the design of Atom framework here.
  33. == Real time applications
  34. Atom is designed to *MAKE* concurrent, real-time, embedded systems and *GAMES*
  35. === Atom VS ptolemy
  36. As mentioned in the Atom framwork's introduction, Atom is actually inspired by Plotemy project link:http://ptolemy.eecs.berkeley.edu/index.htm[http://ptolemy.eecs.berkeley.edu/index.htm]
  37. but it actually tend to has various different goals, techniques, mindset and approaches. The comparasion in constrast with Ptolemy will reveal a lot of Atom characteristics.
  38. ....
  39. The Ptolemy project studies modeling, simulation, and design of concurrent, real-time, embedded systems. The focus is on assembly of concurrent components. The key underlying principle in the project is the use of well-defined models of computation that govern the interaction between components.A major problem area being addressed is the use of heterogeneous mixtures of models of computation.
  40. ....
  41. *VS*
  42. ....
  43. Atom is designed to **MAKE** concurrent, real-time, embedded systems and **GAMES**. So it focus more in code generation, profile, monitoring; focus more in graphics, physics, **player experience**... etc. Underlying, it borrow quite a bunch of concepts that built in Ptolemy (not codes!).
  44. ....
  45. ==== Goals
  46. So the two projects' *goals* are quite overlapped but have different focus points and mindset!
  47. * Atom has no or less concern/ interests about mathematic/ physics correctioness ( so simmulations) but the graphics side and overal behaviors.
  48. * Atom has open-source spirit… but not academic!! You can see Plotemy is quite “complicated and not very popular as it provided for academic first; in constrast, Atom is broadcasted for every one to use and to make games as kids in sandboxes.
  49. ==== Techniques differencies:
  50. * Atom not “just depend on well-defined models!
  51. * Atom use simplier models, …but sometime simplier is better!
  52. ** Simplier Entity model (not abstract out of Java object)
  53. ** Actor model is not as abstrat also actually from threaded enviroment
  54. ** No contract in Systems, the study of Systems conections and interactivities are though data-driven analysising only, that's it, a dataflow monitoring system over working system.
  55. ** Timming: Because of the lack of interests in math/ phycics, time model and precision model is undefined but also from Java platform.
  56. * Those above and its core techniques that you can find below, lead Atom to be less independent from Java but also has well embeding characteristics of Java languages and run-time enviroments. So can say Atom is built directly on top of Java with no hesitate!
  57. === Atom VS JScience
  58. Atom also depends in Javolution and has some parts from JScience code base but once again the purpose, Atom focus in Games and simulations… Also a lot of techniques Atom is different from one used in JScience.
  59. One can also see that Atom fullfill the lack of JScience's experimental Game package. :)
  60. === Target Devices & Platforms
  61. ==== PC
  62. ==== Mobile
  63. ===== Android
  64. ==== Web
  65. ===== HTML5 and WebGL
  66. == Problems
  67. == Solutions & Frameworks & Platforms
  68. In Java, a lot good opensource projects are already provide solutions for various challanges in software developments. The problem is how to glue those gems together in appropriate way and result in efficient, good quality product - Saving time and efforts.
  69. [WARNING]
  70. ====
  71. Hundred of opensource projects…
  72. ====
  73. For example, AtomCore module depends in these high quality libraries:
  74. * JME3
  75. * Common Java JSR annotations:
  76. * Apache commons
  77. ** Lang
  78. ** Configurations
  79. ** BeanUtils
  80. ** Collections
  81. * Google's
  82. ** Guava:
  83. ** Guice: Dependency injection
  84. ** Snappy:
  85. ** LevelDB
  86. ** Auto
  87. *
  88. Other require pieces are write from sk
  89. == Atom framework Design course
  90. This section is dedicated to explain some idioms, patterns, and long term solutions for problems and each design goals, structures.
  91. === Game and real-time application
  92. ==== Cross game-genre elements
  93. From an abstraction level, a Game- a special kind of software (almost always):
  94. * composed by Entities, and their Stage;
  95. * where Actions happen in a Cycle, procedure Events;
  96. A little bit more detailed, Gameplay is the way player play the Game, has:
  97. * Logic:
  98. ** Trigger: in which Conditions, active some appropriate Action, as primitive brick.
  99. ** Rule: the laws, restrictions form the game rule which player, entities obey.
  100. * Routines: Situations/ Events/ Actions that happen in the game Cycle.
  101. ** Story/Cinematic mode: When player just watch the game like a movie.
  102. ** Interactive mode: When player interact with the game world
  103. * Control: The way player handle their entities
  104. * League:
  105. ** Single: Infos, score, rewards stick to an individual
  106. ** Multi: The way players join, left, make friend and interactive and play together…
  107. * Status: Way to pause/continue , save/load current game
  108. The game “software should be published in specific enviroment, it then has:
  109. * Configurations : appropriate settings for specific enviroment, device.
  110. * Data : appropriate size and format
  111. ==== CPU-GPU interactions
  112. ==== Java-Native interactions
  113. ==== Timing
  114. ==== Cycle
  115. === AtomCore Architecture
  116. The Core is the part that focus in *Game and real-time application*. It declare
  117. You can read more about the Core architecture here.
  118. <<jme3/advanced/atom_framework/atomcore#,atomcore>>
  119. === Design patterns & Programming paradigms
  120. Consider research through this trusted resources before we go deeper into Atom architecture and where/why/how it apply each Design patterns:
  121. <<jme3/advanced/atom_framework/design/patterns#,patterns>>
  122. === Programming aspects
  123. ==== Java, but not just Java
  124. The most “Java things in AtomCore is Bean and Properties. Two pure Java data type which are very useful in Game world. Bean is for game object modeling and Properties for configuration.
  125. Of course, other Java technologies are also used but not mentioned because it's not nessesary. But Bean and Properties are the two techs that heavily used!
  126. “Good Java extensions used in AtomCore 0.2+ is:
  127. Guava:
  128. * Bring Eventbus, network in a snap
  129. * Collection, Fluent, functional syntax and flavour to Java.
  130. * Guava also support Cache, reflection and more low level operations
  131. Guice: bring Dependency injection, better unit test, refactoring in a lightweight manner.
  132. Groovy is a JVM language and intergrated deeply with AtomCore, most appreal as Scripting language but remember it also can replace Java, or seen as Java. Groovy also offer much more of superb things.
  133. ==== Code vs Data
  134. For big game, the amount of Data required can be so much. Mean while the complexity of code also rise fast, as the result of data increasing!
  135. At some point, we have to find a solution to reduce “manual Data + code making and maintaining. That where “generative code also can be seen as a kind of Data was born. This called Data-driven architecture (solution). In AtomCore 0.2, it have features to support this trend.
  136. ==== Around Bean
  137. [NOTE]
  138. ====
  139. This is so important to mention that every techs Atom framework are around Bean/ POJO technologies.
  140. ====
  141. For example:
  142. * AtomEX : the bridge to AKKA Actor model also use POJO as its candidate
  143. * EJB leverage…
  144. * Fx: use POJO as its effect elements
  145. Here is a brief explaination why Bean/ POJO is choosed to be the Core of Atom framework?
  146. ....
  147. As built in Java technologies, Bean/ POJO is the only "consider good" solution as:
  148. **"the bridge"** **from Java OOP to COP**, **from Java OOP to AOP**
  149. ....
  150. ....
  151. also can be seen as
  152. **from Object oriented programming to Data oriented programming**
  153. **from Object oriented programming to Aspect oriented programming**
  154. ....
  155. ....
  156. or **Code but also Data**...
  157. ....
  158. === Polygot programming
  159. ....
  160. I want Best of both worlds!!
  161. (.. if it's possible?)
  162. ....
  163. Atom in its core try to be polymorphism (polygot programming), to suite with OOP, COP, AOP or functional … Yeah, it's java after all but good kind of Java.
  164. Because AtomScripting and others use Groovy, so it inherit (a lot of) polygot capacity from Groovy.
  165. Read: link:http://groovy.codehaus.org/Polyglot+Programming+with+Groovy[http://groovy.codehaus.org/Polyglot+Programming+with+Groovy]
  166. ==== Functional reactive programming
  167. ==== Flow based programming
  168. ==== Component based programming
  169. ==== Composite based programming
  170. ==== Data-driven & Model-driven & Domain-driven
  171. === Modular architecture
  172. ....
  173. I want to reuse (or DRY)!!
  174. ....
  175. Take a look at a JME3 game, Manager for example, what if you want the two manager's work together but loosely depend on each other, or what if you want the State to direct the Manager to do something but have minimal informations about them…
  176. More abstract, whenever you have some kind of Service, which is loosely depend on each other, you should try Dependency Injection link:http://martinfowler.com/articles/injection.html[http://martinfowler.com/articles/injection.html] .
  177. That's where Guice help in the big picture.
  178. ==== Dependency injection
  179. link:https://code.google.com/p/google-guice/[https://code.google.com/p/google-guice/]
  180. ==== Component Injection
  181. link:http://wiki.apidesign.org/wiki/Component_Injection[http://wiki.apidesign.org/wiki/Component_Injection]
  182. ==== Dependency injection VS Component Injection
  183. link:http://code.imagej.net/gbh/lookup/DependencyInjectionandLookup.html[http://code.imagej.net/gbh/lookup/DependencyInjectionandLookup.html]
  184. ==== Dependency management coolness
  185. So what's cool about dependency in real-time application and game that Atom included…
  186. A lot of things, but let me point out fews:
  187. *Real-time dependency* is a new feature for game developing…
  188. Imagine that even the game just can load part of assets, with the other are delayed or missing, the dependency graph can help the game cycle continue to run, part of it in the mean time.
  189. In fact the dependency graph can be considered the topo structure of JME assets dependency graph before it built, means hard links via references. Now even when the assets graph are just partly loaded, the game can run because it know a resolution to safety resolve the assets graph and scene graph afterward.
  190. *Enterprise features*
  191. You can imagine how Atom framework tend to bridge JME game and the Web universal. It's not so hard in fact. Cause Java enterprise technologies are already there to use. Lot of them are built on the top of Dependency injection and Inversion of control (or else)… I really like dependency injection but I can not agree that i should always couple with IoC per se. This will be discuss later in this documentation
  192. == Enterprise facilities
  193. ==== Services, Dependency and Decoupling
  194. The world of enteprise evolve Modular paradigm a lot to link services (database, configurations, network protocols, web…) and help they work together in one application.
  195. === Available Services
  196. Try AtomEx
  197. ==== To Database
  198. ==== To other repository
  199. ==== To configurations
  200. ==== To web
  201. == Monitoring and development workflow
  202. == Future vision
  203. == References and Inspiration
  204. Atom framework's design is inspried by:
  205. * Game Engine Architcture book
  206. * Game Programming gems serires
  207. * AI Game Engine book
  208. * AI Game Wisdom book
  209. other GameEngine that I did use:
  210. * UDK
  211. * Unity
  212. * CryEngineSDK
  213. * JavaScript game engines : CraftyJs, GameQuery ..
  214. * Flash game engines : Starling ,
  215. * … dozen of close-source engine.
  216. other Java techs:
  217. * EJB
  218. * Spring
  219. * Groovy
  220. * Netbean
  221. * … hunread of open-source projects
  222. Full researched papers list are comming.