game_machine 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +72 -0
  4. data/Rakefile +38 -0
  5. data/bin/game_machine +79 -0
  6. data/config/cluster.conf +65 -0
  7. data/config/config.example.yml +93 -0
  8. data/config/game_messages.proto +45 -0
  9. data/config/messages.proto +339 -0
  10. data/config/regions.example.yml +9 -0
  11. data/config/standalone.conf +36 -0
  12. data/db/do_not_delete +0 -0
  13. data/game_machine.gemspec +38 -0
  14. data/games/example/boot.rb +6 -0
  15. data/games/example/data/game_data.yml +13 -0
  16. data/games/example/lib/aggressive_npc.rb +176 -0
  17. data/games/example/lib/authentication_handler.rb +69 -0
  18. data/games/example/lib/chatbot.rb +61 -0
  19. data/games/example/lib/combat_controller.rb +145 -0
  20. data/games/example/lib/example_controller.rb +21 -0
  21. data/games/example/lib/game.rb +85 -0
  22. data/games/example/lib/models/attack.rb +9 -0
  23. data/games/example/lib/models/combat_update.rb +11 -0
  24. data/games/example/lib/models/player_command.rb +7 -0
  25. data/games/example/lib/models/user.rb +11 -0
  26. data/games/example/lib/models/vitals.rb +17 -0
  27. data/games/example/lib/npc.rb +111 -0
  28. data/games/example/lib/npc_group.rb +42 -0
  29. data/games/example/lib/npc_movement.rb +116 -0
  30. data/games/example/lib/player_manager.rb +58 -0
  31. data/games/example/lib/player_register.rb +80 -0
  32. data/games/example/lib/tracking_handler.rb +17 -0
  33. data/games/example/lib/zone_manager.rb +57 -0
  34. data/games/preload.rb +8 -0
  35. data/integration_tests/basic_spec.rb +68 -0
  36. data/integration_tests/bot_spec.rb +18 -0
  37. data/integration_tests/chat_spec.rb +45 -0
  38. data/integration_tests/distributed_spec.rb +34 -0
  39. data/integration_tests/entity_tracking_spec.rb +48 -0
  40. data/integration_tests/mono_spec.rb +16 -0
  41. data/integration_tests/objectdb_spec.rb +55 -0
  42. data/integration_tests/tcp_client_spec.rb +71 -0
  43. data/integration_tests/udp_client_spec.rb +61 -0
  44. data/integration_tests/udp_spec.rb +20 -0
  45. data/integration_tests/udt_client_spec.rb +23 -0
  46. data/integration_tests/udt_spec.rb +31 -0
  47. data/java/.gitignore +1 -0
  48. data/java/build.gradle +93 -0
  49. data/java/component.erb +396 -0
  50. data/java/gradle.properties +6 -0
  51. data/java/gradle/wrapper/gradle-wrapper.jar +0 -0
  52. data/java/gradle/wrapper/gradle-wrapper.properties +6 -0
  53. data/java/gradlew +164 -0
  54. data/java/gradlew.bat +90 -0
  55. data/java/local_lib/protostuff-compiler-1.0.7-jarjar.jar +0 -0
  56. data/java/settings.gradle +2 -0
  57. data/java/src/main/java/com/game_machine/core/ActorFactory.java +25 -0
  58. data/java/src/main/java/com/game_machine/core/ActorUtil.java +39 -0
  59. data/java/src/main/java/com/game_machine/core/CommandProxy.java +9 -0
  60. data/java/src/main/java/com/game_machine/core/EntitySerializer.java +66 -0
  61. data/java/src/main/java/com/game_machine/core/EventStreamHandler.java +43 -0
  62. data/java/src/main/java/com/game_machine/core/GameMachineLoader.java +25 -0
  63. data/java/src/main/java/com/game_machine/core/Grid.java +195 -0
  64. data/java/src/main/java/com/game_machine/core/GridValue.java +30 -0
  65. data/java/src/main/java/com/game_machine/core/IActorFactory.java +7 -0
  66. data/java/src/main/java/com/game_machine/core/NetMessage.java +28 -0
  67. data/java/src/main/java/com/game_machine/core/UdpServer.java +97 -0
  68. data/java/src/main/java/com/game_machine/core/UdpServerHandler.java +90 -0
  69. data/java/src/main/resources/game_machine.java.stg +738 -0
  70. data/java/src/main/resources/logback.xml +14 -0
  71. data/java/src/main/resources/logging.properties +3 -0
  72. data/java/src/main/resources/protostuff.properties +7 -0
  73. data/lib/game_machine.rb +85 -0
  74. data/lib/game_machine/actor.rb +7 -0
  75. data/lib/game_machine/actor/base.rb +184 -0
  76. data/lib/game_machine/actor/builder.rb +108 -0
  77. data/lib/game_machine/actor/development.rb +31 -0
  78. data/lib/game_machine/actor/factory.rb +35 -0
  79. data/lib/game_machine/actor/mono_actor.rb +89 -0
  80. data/lib/game_machine/actor/ref.rb +81 -0
  81. data/lib/game_machine/actor/reloadable.rb +98 -0
  82. data/lib/game_machine/actor/system.rb +32 -0
  83. data/lib/game_machine/akka.rb +98 -0
  84. data/lib/game_machine/app_config.rb +49 -0
  85. data/lib/game_machine/application.rb +181 -0
  86. data/lib/game_machine/auth_handlers/base.rb +21 -0
  87. data/lib/game_machine/auth_handlers/public.rb +34 -0
  88. data/lib/game_machine/bot/chat.rb +66 -0
  89. data/lib/game_machine/bot/client.rb +54 -0
  90. data/lib/game_machine/client_manager.rb +204 -0
  91. data/lib/game_machine/clients.rb +4 -0
  92. data/lib/game_machine/clients/client.rb +45 -0
  93. data/lib/game_machine/clients/tcp_client.rb +25 -0
  94. data/lib/game_machine/clients/test_client.rb +151 -0
  95. data/lib/game_machine/clients/udp_client.rb +25 -0
  96. data/lib/game_machine/clients/udt_client.rb +34 -0
  97. data/lib/game_machine/cluster_monitor.rb +115 -0
  98. data/lib/game_machine/commands.rb +23 -0
  99. data/lib/game_machine/commands/base.rb +21 -0
  100. data/lib/game_machine/commands/chat_commands.rb +88 -0
  101. data/lib/game_machine/commands/datastore_commands.rb +60 -0
  102. data/lib/game_machine/commands/grid_commands.rb +35 -0
  103. data/lib/game_machine/commands/message_helper.rb +25 -0
  104. data/lib/game_machine/commands/misc_commands.rb +29 -0
  105. data/lib/game_machine/commands/navigation_commands.rb +24 -0
  106. data/lib/game_machine/commands/player_commands.rb +28 -0
  107. data/lib/game_machine/commands/proxy.rb +16 -0
  108. data/lib/game_machine/console.rb +3 -0
  109. data/lib/game_machine/console/build.rb +74 -0
  110. data/lib/game_machine/console/install.rb +92 -0
  111. data/lib/game_machine/console/server.rb +120 -0
  112. data/lib/game_machine/data_store.rb +52 -0
  113. data/lib/game_machine/data_stores/couchbase.rb +18 -0
  114. data/lib/game_machine/data_stores/mapdb.rb +49 -0
  115. data/lib/game_machine/data_stores/memory.rb +35 -0
  116. data/lib/game_machine/data_stores/redis.rb +46 -0
  117. data/lib/game_machine/endpoints.rb +6 -0
  118. data/lib/game_machine/endpoints/mono_gateway.rb +87 -0
  119. data/lib/game_machine/endpoints/tcp.rb +51 -0
  120. data/lib/game_machine/endpoints/tcp_handler.rb +75 -0
  121. data/lib/game_machine/endpoints/udp.rb +88 -0
  122. data/lib/game_machine/endpoints/udp_incoming.rb +113 -0
  123. data/lib/game_machine/endpoints/udp_outgoing.rb +46 -0
  124. data/lib/game_machine/game_loader.rb +46 -0
  125. data/lib/game_machine/game_systems.rb +14 -0
  126. data/lib/game_machine/game_systems/agents/controller.rb +118 -0
  127. data/lib/game_machine/game_systems/chat.rb +256 -0
  128. data/lib/game_machine/game_systems/chat_manager.rb +108 -0
  129. data/lib/game_machine/game_systems/chat_topic.rb +36 -0
  130. data/lib/game_machine/game_systems/devnull.rb +13 -0
  131. data/lib/game_machine/game_systems/entity_loader.rb +12 -0
  132. data/lib/game_machine/game_systems/entity_tracking.rb +133 -0
  133. data/lib/game_machine/game_systems/local_echo.rb +16 -0
  134. data/lib/game_machine/game_systems/objectdb_proxy.rb +61 -0
  135. data/lib/game_machine/game_systems/private_chat.rb +20 -0
  136. data/lib/game_machine/game_systems/region_manager.rb +91 -0
  137. data/lib/game_machine/game_systems/region_service.rb +94 -0
  138. data/lib/game_machine/game_systems/region_settings.rb +13 -0
  139. data/lib/game_machine/game_systems/remote_echo.rb +14 -0
  140. data/lib/game_machine/game_systems/stress_test.rb +21 -0
  141. data/lib/game_machine/grid.rb +60 -0
  142. data/lib/game_machine/grid_replicator.rb +31 -0
  143. data/lib/game_machine/handlers/authentication.rb +55 -0
  144. data/lib/game_machine/handlers/game.rb +63 -0
  145. data/lib/game_machine/handlers/request.rb +80 -0
  146. data/lib/game_machine/hashring.rb +48 -0
  147. data/lib/game_machine/helpers/game_message.rb +159 -0
  148. data/lib/game_machine/helpers/state_machine.rb +29 -0
  149. data/lib/game_machine/java_lib.rb +51 -0
  150. data/lib/game_machine/logger.rb +39 -0
  151. data/lib/game_machine/message_buffer.rb +58 -0
  152. data/lib/game_machine/message_queue.rb +63 -0
  153. data/lib/game_machine/model.rb +125 -0
  154. data/lib/game_machine/models.rb +3 -0
  155. data/lib/game_machine/models/player_status_update.rb +8 -0
  156. data/lib/game_machine/models/region.rb +9 -0
  157. data/lib/game_machine/mono_server.rb +20 -0
  158. data/lib/game_machine/navigation.rb +4 -0
  159. data/lib/game_machine/navigation/detour.rb +20 -0
  160. data/lib/game_machine/navigation/detour_navmesh.rb +53 -0
  161. data/lib/game_machine/navigation/detour_path.rb +53 -0
  162. data/lib/game_machine/navigation/path.rb +31 -0
  163. data/lib/game_machine/object_db.rb +67 -0
  164. data/lib/game_machine/protobuf.rb +6 -0
  165. data/lib/game_machine/protobuf/game_messages.rb +24 -0
  166. data/lib/game_machine/protobuf/generate.rb +113 -0
  167. data/lib/game_machine/protobuf_extensions/entity_helper.rb +11 -0
  168. data/lib/game_machine/reloadable_monitor.rb +26 -0
  169. data/lib/game_machine/restart_watcher.rb +17 -0
  170. data/lib/game_machine/ruby_extensions/nilclass.rb +10 -0
  171. data/lib/game_machine/ruby_extensions/string.rb +17 -0
  172. data/lib/game_machine/scheduler.rb +23 -0
  173. data/lib/game_machine/securerandom.rb +6 -0
  174. data/lib/game_machine/settings.rb +11 -0
  175. data/lib/game_machine/system_monitor.rb +19 -0
  176. data/lib/game_machine/system_stats.rb +24 -0
  177. data/lib/game_machine/uniqueid.rb +23 -0
  178. data/lib/game_machine/vector.rb +95 -0
  179. data/lib/game_machine/version.rb +3 -0
  180. data/lib/game_machine/write_behind_cache.rb +164 -0
  181. data/mono/bin/csharp/common.xslt +109 -0
  182. data/mono/bin/csharp/csharp.xslt +628 -0
  183. data/mono/bin/csharp/descriptor.proto +533 -0
  184. data/mono/bin/csharp/protobuf-net.dll +0 -0
  185. data/mono/bin/csharp/protobuf-net.pdb +0 -0
  186. data/mono/bin/csharp/protobuf-net.xml +2879 -0
  187. data/mono/bin/csharp/protogen.exe.config +3 -0
  188. data/mono/bin/csharp/protogen.pdb +0 -0
  189. data/mono/bin/csharp/protogen_csharp.exe +0 -0
  190. data/mono/bin/csharp/vb.xslt +745 -0
  191. data/mono/bin/csharp/xml.xslt +26 -0
  192. data/mono/server/Makefile +6 -0
  193. data/mono/server/NLog.config +12 -0
  194. data/mono/server/NLog.dll +0 -0
  195. data/mono/server/actor.cs +37 -0
  196. data/mono/server/build.bat +3 -0
  197. data/mono/server/cscompmgd.dll +0 -0
  198. data/mono/server/iactor.cs +11 -0
  199. data/mono/server/message_router.cs +67 -0
  200. data/mono/server/message_util.cs +29 -0
  201. data/mono/server/messages.cs +1888 -0
  202. data/mono/server/protobuf-net.dll +0 -0
  203. data/mono/server/proxy_client.cs +73 -0
  204. data/mono/server/proxy_server.cs +30 -0
  205. data/mono/server/test_actor.cs +33 -0
  206. data/pathfinding/bin/premake4 +0 -0
  207. data/pathfinding/include/mesh_loader.h +28 -0
  208. data/pathfinding/include/pathfind.h +167 -0
  209. data/pathfinding/main.cpp +39 -0
  210. data/pathfinding/mesh_loader.cpp +108 -0
  211. data/pathfinding/pathfind.cpp +174 -0
  212. data/pathfinding/pathfinder.cs +66 -0
  213. data/pathfinding/premake4.lua +109 -0
  214. data/script/server.sh +109 -0
  215. data/script/watch.sh +11 -0
  216. data/spec/actor/actor_spec.rb +73 -0
  217. data/spec/actor/builder_spec.rb +56 -0
  218. data/spec/actor/ref_spec.rb +83 -0
  219. data/spec/application_spec.rb +7 -0
  220. data/spec/client_manager_spec.rb +171 -0
  221. data/spec/commands/chat_commands_spec.rb +38 -0
  222. data/spec/commands/datastore_commands_spec.rb +91 -0
  223. data/spec/commands/grid_commands_spec.rb +37 -0
  224. data/spec/commands/navigation_commands_spec.rb +51 -0
  225. data/spec/commands/player_commands_spec.rb +48 -0
  226. data/spec/commands_spec.rb +38 -0
  227. data/spec/data_stores/mapdb_spec.rb +46 -0
  228. data/spec/data_stores/redis_spec.rb +44 -0
  229. data/spec/game_systems/agents/controller_spec.rb +84 -0
  230. data/spec/game_systems/agents/test_agent.rb +10 -0
  231. data/spec/game_systems/agents/test_agent_config.rb +29 -0
  232. data/spec/game_systems/chat_manager_spec.rb +66 -0
  233. data/spec/game_systems/chat_spec.rb +187 -0
  234. data/spec/game_systems/entity_tracking_spec.rb +64 -0
  235. data/spec/game_systems/region_manager_spec.rb +138 -0
  236. data/spec/grid_spec.rb +37 -0
  237. data/spec/handlers/authentication_spec.rb +36 -0
  238. data/spec/handlers/game_spec.rb +49 -0
  239. data/spec/handlers/request_spec.rb +65 -0
  240. data/spec/hashring_spec.rb +59 -0
  241. data/spec/integration_helper.rb +120 -0
  242. data/spec/java_grid_spec.rb +89 -0
  243. data/spec/message_buffer_spec.rb +67 -0
  244. data/spec/message_expectations.rb +47 -0
  245. data/spec/message_queue_spec.rb +23 -0
  246. data/spec/misc_spec.rb +71 -0
  247. data/spec/model_spec.rb +103 -0
  248. data/spec/mono_spec.rb +36 -0
  249. data/spec/mono_test.rb +18 -0
  250. data/spec/navigation/detour_navmesh_spec.rb +34 -0
  251. data/spec/navigation/detour_path_spec.rb +25 -0
  252. data/spec/spec_helper.rb +40 -0
  253. data/spec/udp_server_spec.rb +10 -0
  254. data/spec/write_behind_cache_spec.rb +109 -0
  255. data/web/app.rb +131 -0
  256. data/web/config/trinidad.yml +4 -0
  257. data/web/controllers/auth_controller.rb +19 -0
  258. data/web/controllers/base_controller.rb +16 -0
  259. data/web/controllers/index_controller.rb +7 -0
  260. data/web/controllers/log_controller.rb +47 -0
  261. data/web/controllers/messages_controller.rb +59 -0
  262. data/web/controllers/player_register_controller.rb +15 -0
  263. data/web/log/development.log +1339 -0
  264. data/web/tmp/restart.txt +0 -0
  265. data/web/views/game_messages.haml +45 -0
  266. data/web/views/index.haml +6 -0
  267. data/web/views/layout.haml +41 -0
  268. data/web/views/logs.haml +32 -0
  269. data/web/views/player_register.haml +22 -0
  270. data/web/views/player_registered.haml +2 -0
  271. data/web/views/register_layout.haml +22 -0
  272. data/web/views/restart.haml +35 -0
  273. metadata +576 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0bdc1f292f01c6341bf168511d642306d1bd4842
4
+ data.tar.gz: 76cac922f01f09c59150b5f58bf797e06bf66bcc
5
+ SHA512:
6
+ metadata.gz: 4d7aa754c530d15ea986fd178ac128d0f0eb1df77ecaf6d362c39685f1bc7753f4bf8de9f74ba1f907a96fa97c230698e3e8bdd7e652ea5f0de336804b613782
7
+ data.tar.gz: 0a0a74f1fe8cc73266d0db7cd88fb61c740a21788f6c3c2d29c91e3769afbd0f522f265fceca716fb5f4cbccdd30c9eb0ecdca67b86d09aa4edc56a674f4ed15
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ game_machine (0.0.5)
5
+ consistent-hashing
6
+ ffi
7
+ haml
8
+ i18n
9
+ json
10
+ rjack-logback
11
+ settingslogic
12
+ sinatra
13
+ sinatra-contrib
14
+ webrick
15
+
16
+ GEM
17
+ remote: https://rubygems.org/
18
+ specs:
19
+ avl_tree (1.1.3)
20
+ backports (3.6.0)
21
+ consistent-hashing (1.0.0)
22
+ avl_tree (>= 1.1.3)
23
+ descriptive_statistics (1.1.2)
24
+ diff-lcs (1.2.5)
25
+ ffi (1.9.3-java)
26
+ haml (4.0.5)
27
+ tilt
28
+ i18n (0.6.9)
29
+ json (1.8.1-java)
30
+ multi_json (1.10.1)
31
+ rack (1.5.2)
32
+ rack-protection (1.5.3)
33
+ rack
34
+ rack-test (0.6.2)
35
+ rack (>= 1.0)
36
+ rake (10.1.0)
37
+ rjack-logback (1.7.0-java)
38
+ rjack-slf4j (>= 1.6.5, < 1.8)
39
+ rjack-slf4j (1.7.6.0-java)
40
+ rspec (2.14.1)
41
+ rspec-core (~> 2.14.0)
42
+ rspec-expectations (~> 2.14.0)
43
+ rspec-mocks (~> 2.14.0)
44
+ rspec-core (2.14.7)
45
+ rspec-expectations (2.14.4)
46
+ diff-lcs (>= 1.1.3, < 2.0)
47
+ rspec-mocks (2.14.4)
48
+ settingslogic (2.0.9)
49
+ sinatra (1.4.5)
50
+ rack (~> 1.4)
51
+ rack-protection (~> 1.4)
52
+ tilt (~> 1.3, >= 1.3.4)
53
+ sinatra-contrib (1.4.2)
54
+ backports (>= 2.0)
55
+ multi_json
56
+ rack-protection
57
+ rack-test
58
+ sinatra (~> 1.4.0)
59
+ tilt (~> 1.3)
60
+ tilt (1.4.1)
61
+ webrick (1.3.1)
62
+
63
+ PLATFORMS
64
+ java
65
+
66
+ DEPENDENCIES
67
+ descriptive_statistics
68
+ game_machine!
69
+ rake
70
+ rspec
71
+ rspec-expectations
72
+ rspec-mocks
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ specfile = File.join(File.dirname(__FILE__), 'game_machine.gemspec')
4
+ if File.exists?(specfile)
5
+ require "bundler/gem_tasks"
6
+ end
7
+
8
+ RSpec::Core::RakeTask.new
9
+
10
+ task :default => :spec
11
+
12
+ namespace :game do
13
+ task :demo do
14
+ cp 'lib/demo/boot.rb', 'boot.rb'
15
+ end
16
+
17
+ task :none do
18
+ rm 'boot.rb'
19
+ end
20
+ end
21
+
22
+ namespace :java do
23
+ gradlew = File.join(File.dirname(__FILE__), 'java','gradlew')
24
+
25
+ task :clean do
26
+ FileUtils.rm_f 'java/lib/*.jar'
27
+ FileUtils.rm_f 'java/src/main/java/com/game_machine/entity_system/generated/*.java'
28
+ end
29
+
30
+ task :all => [:clean] do
31
+ system "cd java && #{gradlew} clean && #{gradlew} codegen && #{gradlew} build && #{gradlew} install_libs"
32
+ end
33
+
34
+ task :build do
35
+ system "cd java && #{gradlew} build && #{gradlew} install_libs"
36
+ end
37
+ end
38
+
data/bin/game_machine ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ require 'rubygems'
4
+ require 'fileutils'
5
+
6
+ def load_game_machine
7
+ begin
8
+ require 'game_machine'
9
+ rescue LoadError
10
+ require_relative '../lib/game_machine'
11
+ end
12
+ end
13
+
14
+ ARGV << '--help' if ARGV.empty?
15
+
16
+ aliases = {
17
+ "n" => "new",
18
+ "b" => "build",
19
+ "s" => "server",
20
+ "sl" => "server_loop"
21
+ }
22
+
23
+ command = ARGV.shift
24
+ command = aliases[command] || command
25
+
26
+ ENV['APP_ROOT'] ||= File.expand_path(Dir.pwd)
27
+ ENV['JAVA_ROOT'] = File.join(ENV['APP_ROOT'],'java')
28
+ ENV['GAME_ENV'] = 'development'
29
+
30
+ require_relative '../lib/game_machine/console'
31
+
32
+ if command == 'new'
33
+ bin_path = File.dirname(__FILE__)
34
+ install_source_path = File.expand_path(
35
+ File.join(bin_path,'../')
36
+ )
37
+ GameMachine::Console::Install.new(ARGV,install_source_path).run!
38
+
39
+ elsif command == 'build'
40
+ require_relative '../java/local_lib/protostuff-compiler-1.0.7-jarjar.jar'
41
+ require_relative '../lib/game_machine/protobuf/game_messages.rb'
42
+ require_relative '../lib/game_machine/protobuf/generate.rb'
43
+ GameMachine::Console::Build.new(ARGV).run!
44
+
45
+ elsif command == 'server'
46
+ # Need to set environment vars before loading everything.
47
+ server = GameMachine::Console::Server.new(ARGV)
48
+ server.set_environment
49
+ load_game_machine
50
+
51
+ # Run the server
52
+ server.run!
53
+
54
+ elsif command == 'server_loop'
55
+ GameMachine::Console::Server.run_in_loop
56
+ else
57
+
58
+ puts <<EOF
59
+ Usage:
60
+
61
+ game_machine server [options] Start the server
62
+ -r, --restartable If tmp/gm_restart.txt should trigger a restart
63
+ -s, --server=name Server name
64
+ -c, --config=name Configuration file
65
+ -e, --environment=name Specifies the environment to run under (development/production).
66
+ Default: development
67
+
68
+ game_machine server_loop Runs server in loop that restarts when tmp/gm_restart.txt
69
+ is present. On restart it will run build then server -r.
70
+
71
+ game_machine build Generate and compile protobuf messages
72
+
73
+ game_machine new [path] Create a new Game Machine application at the
74
+ specified path
75
+
76
+ EOF
77
+ end
78
+
79
+
@@ -0,0 +1,65 @@
1
+
2
+
3
+ cluster {
4
+
5
+ default-pinned-dispatcher {
6
+ executor = thread-pool-executor
7
+ type = PinnedDispatcher
8
+ thread-pool-executor.keep-alive-time = 315360000s
9
+ # note that disabling core timeout altogether doesn't work
10
+ # until ticket 2856 is fixed
11
+ thread-pool-executor.allow-core-timeout = off
12
+ }
13
+
14
+ akka {
15
+
16
+ cluster {
17
+ seed-nodes = [SEEDS]
18
+ acceptable-heartbeat-pause = 10 s
19
+ auto-down-unreachable-after = 10s
20
+ }
21
+
22
+ actor.debug.unhandled = "on"
23
+ jvm-exit-on-fatal-error=false
24
+ loglevel = "WARNING"
25
+
26
+ actor {
27
+ serializers {
28
+ java = "akka.serialization.JavaSerializer"
29
+ bytes = "akka.serialization.ByteArraySerializer"
30
+ myown = "com.game_machine.core.EntitySerializer"
31
+ }
32
+
33
+ serialization-bindings {
34
+ "[B" = bytes
35
+ "java.io.Serializable" = java
36
+ "com.dyuproject.protostuff.Message" = myown
37
+ "GameMachine.Messages.ClientMessage" = myown
38
+ "GameMachine.Messages.Entity" = myown
39
+ "GameMachine.Messages.ObjectdbGet" = myown
40
+ "GameMachine.Messages.ObjectdbPut" = myown
41
+ "GameMachine.Messages.ObjectdbUpdate" = myown
42
+ }
43
+ provider = "akka.cluster.ClusterActorRefProvider"
44
+ #serialize-messages = on
45
+ #serialize-creators = on
46
+ }
47
+ remote {
48
+ log-remote-lifecycle-events = off
49
+
50
+
51
+ #enabled-transports = ["akka.remote.netty.tcp"]
52
+ netty.tcp {
53
+ hostname = "HOST"
54
+ port = PORT
55
+ }
56
+ }
57
+ }
58
+
59
+ akka.actor.deployment {
60
+ /inbound {
61
+ router = round-robin
62
+ nr-of-instances = 10
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,93 @@
1
+ ---
2
+ development:
3
+ servers:
4
+ default:
5
+ environment: development
6
+ # Authorization handler. Public allows any authtoken to be used and
7
+ # does not check username/password
8
+ auth_handler: Example::AuthenticationHandler
9
+ #auth_handler: GameMachine::AuthHandlers::Public
10
+ # Class that handles user registration via web page
11
+ player_register_handler: Example::PlayerRegister
12
+ # Player manager. Receives player status updates
13
+ player_manager: Example::PlayerManager
14
+ # Top level actor that handles game messages. Don't change this
15
+ game_handler: GameMachine::Handlers::Request
16
+ # Hook for accessing location updates from players (cheat prevention)
17
+ entity_tracking_handler: Example::TrackingHandler
18
+ # Size of the router for incoming message from all clients
19
+ game_handler_routers: 10
20
+ # Also in the pipeline for all incoming requests, should be set the same as
21
+ # game_handler_routers
22
+ request_handler_routers: 10
23
+ # router size for the udp actor that handles all incoming upd messages
24
+ udp_routers: 10
25
+ # What data store the object database will use (one of memory, mapdb, or couchbase)
26
+ data_store: memory
27
+ # Advanced settings for write behind cache. -1 disables. This is fine for
28
+ # all but large games with high traffic (hundreds of writes per second)
29
+ cache_write_interval: -1
30
+ cache_writes_per_second: -1
31
+ # Spatial grids. default, aoe, and local_chat are required.
32
+ # value is grid size, cell size, and update frequency
33
+ grids:
34
+ default: 4000, 50, 1
35
+ aoe: 4000, 5, 1
36
+ local_chat: 4000, 10, 10
37
+ # Couchbase config
38
+ couchbase_servers:
39
+ - http://127.0.0.1:8091/pools
40
+ #auth_handler: Example::AuthenticationHandler
41
+ http_enabled: true
42
+ http_host: 0.0.0.0
43
+ http_port: 3000
44
+ udp_enabled: true
45
+ udp_host: 0.0.0.0
46
+ udp_port: 24130
47
+ tcp_enabled: true
48
+ tcp_host: 0.0.0.0
49
+ tcp_port: 8700
50
+ akka_host: 127.0.0.1
51
+ akka_port: 2551
52
+ # array of seed servers. Required if node is in a cluster
53
+ seeds: [default,seed01]
54
+ # Mono server settings
55
+ mono_enabled: false
56
+ mono_dll: test_actor.dll
57
+ mono_gateway_host: 127.0.0.1
58
+ mono_gateway_port: 8800
59
+ seed01:
60
+ environment: development
61
+ auth_handler: Example::AuthenticationHandler
62
+ player_register_handler: Example::PlayerRegister
63
+ player_manager: Example::PlayerManager
64
+ game_handler: GameMachine::Handlers::Request
65
+ entity_tracking_handler: Example::TrackingHandler
66
+ game_handler_routers: 10
67
+ request_handler_routers: 10
68
+ udp_routers: 10
69
+ data_store: memory
70
+ cache_write_interval: -1
71
+ cache_writes_per_second: -1
72
+ grids:
73
+ default: 4000, 50, 1
74
+ aoe: 4000, 5, 1
75
+ local_chat: 4000, 10, 10
76
+ couchbase_servers:
77
+ - http://127.0.0.1:8091/pools
78
+ http_enabled: false
79
+ http_host: 127.0.0.1
80
+ http_port: 3000
81
+ udp_enabled: true
82
+ udp_host: 0.0.0.0
83
+ udp_port: 24130
84
+ tcp_enabled: false
85
+ tcp_host: 0.0.0.0
86
+ tcp_port: 8700
87
+ akka_host: 127.0.0.1
88
+ akka_port: 2551
89
+ seeds: [default,seed01]
90
+ mono_enabled: false
91
+ mono_dll: test_actor.dll
92
+ mono_gateway_host: 127.0.0.1
93
+ mono_gateway_port: 8800
@@ -0,0 +1,45 @@
1
+
2
+ // Used to by the entity tracking system to attack additional fields to your
3
+ // tracking updates. You can change any of the fields in TrackExtra to suit your
4
+ // needs, but do NOT remove the message definition!
5
+
6
+ message TrackExtra {
7
+ optional float speed = 1;
8
+ optional float velocity = 2;
9
+ optional Vector3 direction = 3;
10
+ }
11
+
12
+ message Health {
13
+ required int32 health = 1;
14
+ }
15
+
16
+ message Effect {
17
+ optional int32 length = 1;
18
+ optional string name = 2;
19
+ optional int32 healthDiff = 3;
20
+ optional int32 damageDiff = 4;
21
+ optional int32 timePeriod = 5;
22
+ optional string type = 6;
23
+ }
24
+
25
+ message EffectList {
26
+ repeated Effect effect = 1;
27
+ }
28
+
29
+ message CombatAbility {
30
+ required string name = 1;
31
+ required int32 damage = 2;
32
+ optional int32 hitChance = 3;
33
+ required int32 range = 4;
34
+ optional string type = 5;
35
+ }
36
+
37
+ message Attack {
38
+ required string attacker = 1;
39
+ required string target = 2;
40
+ optional int32 combatAbilityId = 3;
41
+ }
42
+
43
+ message IsPlayer {
44
+ optional bool enabled = 1;
45
+ }
@@ -0,0 +1,339 @@
1
+ package GameMachine.Messages;
2
+ option optimize_for = SPEED;
3
+
4
+ //GAME_MESSAGES
5
+
6
+ message Rpc {
7
+ required string method = 1;
8
+ repeated string arguments = 2;
9
+ optional bool returnValue = 3;
10
+ }
11
+
12
+ message MessageEnvelope {
13
+ required string name = 1;
14
+ optional string server = 2;
15
+ optional string id = 3;
16
+ required string type = 4;
17
+ }
18
+
19
+ message TrackEntity {
20
+ required bool value = 1;
21
+ optional bool internal = 2;
22
+ optional TrackExtra trackExtra = 3;
23
+ }
24
+
25
+ message PlayerLogout {
26
+ required string playerId = 1;
27
+ optional string authtoken = 2;
28
+ }
29
+
30
+ message PlayerConnect {}
31
+ message PlayerConnected {}
32
+
33
+ message PlayerAuthenticated {
34
+ required string playerId = 1;
35
+ }
36
+
37
+ message ErrorMessage {
38
+ required string code = 1;
39
+ required string message = 2;
40
+ }
41
+
42
+ message ChatInvite {
43
+ required string invitee = 1;
44
+ required string inviter = 2;
45
+ required string channelName = 4;
46
+ required string invite_id = 5;
47
+ }
48
+
49
+ message ChatBanned {
50
+ required string banned_id = 1;
51
+ required string channelNname = 2;
52
+ optional string reason = 3;
53
+ }
54
+
55
+ message ChatBannedList {
56
+ repeated ChatBanned chatBanned = 1;
57
+ }
58
+
59
+ message ChatChannels {
60
+ repeated ChatChannel chatChannel = 1;
61
+ }
62
+
63
+ message ChatChannel {
64
+ required string name = 1;
65
+ optional Subscribers subscribers = 2;
66
+ optional string flags = 3;
67
+ optional string invite_id = 5;
68
+ }
69
+
70
+ message ChatRegister {
71
+ required string chatId = 1;
72
+ required string registerAs = 2;
73
+ }
74
+
75
+ message JoinChat {
76
+ repeated ChatChannel chatChannel = 1;
77
+ }
78
+
79
+ message LeaveChat {
80
+ repeated ChatChannel chatChannel = 1;
81
+ }
82
+
83
+ message ChatMessage {
84
+ required ChatChannel chatChannel = 1;
85
+ required string message = 2;
86
+ required string type = 3;
87
+ optional string senderId = 4;
88
+ optional Entity entity = 5;
89
+ }
90
+
91
+ message ChatStatus {
92
+ }
93
+
94
+ message ClientEvent {
95
+ required string event = 1;
96
+ required string clientId = 2;
97
+ required string senderId = 3;
98
+ optional string playerId = 4;
99
+ }
100
+
101
+ message ClientEvents {
102
+ repeated ClientEvent clientEvent = 1;
103
+ }
104
+
105
+ message ClientManagerUnregister {
106
+ optional string registerType = 1;
107
+ optional string name = 2;
108
+ }
109
+
110
+ message ClientManagerRegister {
111
+ optional string events = 1;
112
+ optional string registerType = 2;
113
+ optional string name = 3;
114
+ }
115
+
116
+ message ClientManagerEvent {
117
+ required string client_id = 1;
118
+ required string player_id = 2;
119
+ required string event = 3;
120
+ }
121
+
122
+ message Subscribers {
123
+ repeated string subscriberId = 1;
124
+ }
125
+
126
+ message Subscribe {
127
+ optional string topic = 1;
128
+ }
129
+
130
+ message Unsubscribe {
131
+ required string topic = 1;
132
+ }
133
+
134
+ message Publish {
135
+ optional string topic = 1;
136
+ required Entity message = 2;
137
+ optional string path = 3;
138
+ }
139
+
140
+ message ObjectdbDel {
141
+ required string entityId = 1;
142
+ }
143
+
144
+ message ObjectdbGet {
145
+ required string entityId = 1;
146
+ optional string playerId = 2;
147
+ }
148
+
149
+ message ObjectdbGetResponse {
150
+ required bool entityFound = 1;
151
+ }
152
+
153
+ message ObjectdbPut {
154
+ required Entity entity = 1;
155
+ }
156
+
157
+ message ObjectdbUpdate {
158
+ required string currentEntityId = 1;
159
+ optional string updateClass = 2;
160
+ required string updateMethod = 3;
161
+ required Entity updateEntity = 4;
162
+ }
163
+
164
+ message ClientConnection {
165
+ required string id = 1;
166
+ optional string gateway = 2;
167
+ optional string server = 3;
168
+ optional string type = 4;
169
+ }
170
+
171
+ message Name {
172
+ required string value = 1;
173
+ }
174
+
175
+ message IsNpc {
176
+ required bool enabled = 1;
177
+ }
178
+
179
+ message Player {
180
+ required string id = 1;
181
+ optional string name = 2;
182
+ optional bool authenticated = 3;
183
+ optional string authtoken = 4;
184
+ optional Transform transform = 5;
185
+ }
186
+
187
+ message Vector3 {
188
+ optional float x = 1;
189
+ optional float y = 2;
190
+ optional float z = 3;
191
+ optional int32 xi = 4;
192
+ optional int32 yi = 5;
193
+ optional int32 zi = 6;
194
+ }
195
+
196
+ message Quaternion {
197
+ optional float w = 1;
198
+ optional float x = 2;
199
+ optional float y = 3;
200
+ optional float z = 4;
201
+ optional int32 wi = 5;
202
+ optional int32 xi = 6;
203
+ optional int32 yi = 7;
204
+ optional int32 zi = 8;
205
+ }
206
+
207
+ message Transform {
208
+ optional Vector3 vector3 = 1;
209
+ optional Quaternion quaternion = 2;
210
+ }
211
+
212
+ message EchoTest {
213
+ required string message = 1;
214
+ }
215
+
216
+ message TestObject {
217
+ optional string optionalString = 1;
218
+ required string requiredString = 2;
219
+ repeated int32 numbers = 3;
220
+ optional bytes bstring = 4;
221
+ optional bool bvalue = 5;
222
+ optional double dvalue = 6;
223
+ optional float fvalue = 7;
224
+ optional int64 numbers64 = 8;
225
+ repeated Player player = 9;
226
+ enum Corpus {
227
+ UNIVERSAL = 0;
228
+ WEB = 1;
229
+ IMAGES = 2;
230
+ LOCAL = 3;
231
+ NEWS = 4;
232
+ PRODUCTS = 5;
233
+ VIDEO = 6;
234
+ }
235
+ optional Corpus corpus = 10;
236
+ repeated Corpus corpus2 = 11;
237
+ }
238
+
239
+
240
+ message Neighbors {
241
+ repeated Entity entity = 1;
242
+ }
243
+
244
+ message GetNeighbors {
245
+ optional uint32 search_radius = 2;
246
+ required Vector3 vector3 = 3;
247
+ optional string neighborType = 4;
248
+ optional string gridName = 5;
249
+ }
250
+
251
+ message MessageRouting {
252
+ optional string destination = 1;
253
+ optional string senderId = 2;
254
+ optional string id = 3;
255
+ }
256
+
257
+ message NativeBytes {
258
+ required bytes bytes = 1;
259
+ }
260
+
261
+ message JsonEntity {
262
+ required string json = 1;
263
+ optional string klass = 2;
264
+ }
265
+
266
+ message JsonStorage {
267
+ required string json = 1;
268
+ }
269
+
270
+ message Regions {
271
+ required string regions = 1;
272
+ }
273
+
274
+ message Entity {
275
+ optional Player player = 1;
276
+ optional Neighbors neighbors = 2;
277
+ optional MessageEnvelope messageEnvelope = 3;
278
+ optional ChatMessage chatMessage = 4;
279
+ optional ClientConnection clientConnection = 5;
280
+ optional EchoTest echoTest = 6;
281
+ required string id = 7;
282
+ optional Subscribe subscribe = 9;
283
+ optional Publish publish = 10;
284
+ optional ChatChannel chatChannel = 11;
285
+ optional JoinChat joinChat = 12;
286
+ optional LeaveChat leaveChat = 13;
287
+ optional Unsubscribe unsubscribe = 14;
288
+ optional ChatRegister chatRegister = 15;
289
+ optional ChatChannels chatChannels = 16;
290
+ optional ErrorMessage errorMessage = 17;
291
+ optional GetNeighbors getNeighbors = 21;
292
+ optional TrackEntity trackEntity = 22;
293
+ optional Transform transform = 23;
294
+ optional IsNpc isNpc = 24;
295
+ optional Vector3 vector3 = 25;
296
+ optional EntityList entityList = 27;
297
+ optional bool published = 29;
298
+ optional string entityType = 30;
299
+ optional PlayerAuthenticated playerAuthenticated = 37;
300
+ optional PlayerLogout playerLogout = 38;
301
+ optional bool sendToPlayer = 39;
302
+ optional Rpc rpc = 40;
303
+ optional Subscribers subscribers = 41;
304
+ optional bool save = 42;
305
+ optional MessageRouting messageRouting = 43;
306
+ optional ObjectdbGetResponse objectdbGetResponse = 44;
307
+ optional NativeBytes nativeBytes = 45;
308
+ optional ObjectdbGet objectdbGet = 46;
309
+ optional JsonEntity jsonEntity = 47;
310
+ optional string destination = 48;
311
+ optional bool json = 49;
312
+ optional string params = 50;
313
+ optional ChatStatus chatStatus = 51;
314
+ optional ChatBannedList chatBannedList = 52;
315
+ optional ChatInvite chatInvite = 53;
316
+ optional ClientManagerRegister clientManagerRegister = 54;
317
+ optional ClientManagerUnregister clientManagerUnregister = 55;
318
+ optional ClientEvent clientEvent = 56;
319
+ optional ClientEvents clientEvents = 57;
320
+ optional JsonStorage jsonStorage = 58;
321
+ optional ClientManagerEvent clientManagerEvent = 59;
322
+ optional Regions regions = 60;
323
+ //GAME_ENTITY_MESSAGES
324
+ }
325
+
326
+ message EntityList {
327
+ repeated Entity entity = 1;
328
+ }
329
+
330
+ message ClientMessage {
331
+ repeated Entity entity = 1;
332
+ optional Player player = 2;
333
+ optional ClientConnection clientConnection = 4;
334
+ optional PlayerLogout playerLogout = 5;
335
+ optional ErrorMessage errorMessage = 6;
336
+ optional PlayerConnect playerConnect = 7;
337
+ optional PlayerConnected playerConnected = 8;
338
+ optional int32 connection_type = 9;
339
+ }