game_machine 0.0.11 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +12 -1
- data/Gemfile.lock +32 -47
- data/Rakefile +0 -27
- data/bin/bundle_run.sh +1 -0
- data/bin/game_machine +29 -27
- data/config/cluster.conf +6 -5
- data/config/default.conf +164 -0
- data/config/game_machine.sql +33 -0
- data/config/game_messages.proto +87 -25
- data/config/gamecloud.conf +140 -0
- data/config/messages.proto +46 -53
- data/config/test.conf +149 -0
- data/game_machine.gemspec +10 -5
- data/games/boot.rb +3 -0
- data/games/example/data/game_data.yml +4 -4
- data/games/example/lib/aggressive_npc.rb +1 -1
- data/games/example/lib/game.rb +1 -2
- data/games/example/lib/player_register.rb +1 -1
- data/games/routes.rb +9 -0
- data/games/tutorial/boot.rb +12 -0
- data/games/tutorial/item_manager.rb +256 -0
- data/games/tutorial/object_store.rb +55 -0
- data/games/tutorial/seed.rb +52 -0
- data/games/tutorial/sql_store.rb +30 -0
- data/java/project/build.gradle +134 -0
- data/java/project/component.erb +719 -0
- data/java/{gradle.properties → project/gradle.properties} +1 -1
- data/java/project/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/java/{gradle → project/gradle}/wrapper/gradle-wrapper.properties +2 -2
- data/java/{gradlew → project/gradlew} +0 -0
- data/java/{gradlew.bat → project/gradlew.bat} +0 -0
- data/java/project/local_lib/AdminUi.jar +0 -0
- data/java/{local_lib/protostuff-compiler-1.0.7-jarjar.jar → project/local_lib/protostuff-compiler-1.0.8-jarjar.jar} +0 -0
- data/java/project/local_lib/sigar/libsigar-amd64-freebsd-6.so +0 -0
- data/java/project/local_lib/sigar/libsigar-amd64-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-amd64-solaris.so +0 -0
- data/java/project/local_lib/sigar/libsigar-ia64-hpux-11.sl +0 -0
- data/java/project/local_lib/sigar/libsigar-ia64-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-pa-hpux-11.sl +0 -0
- data/java/project/local_lib/sigar/libsigar-ppc-aix-5.so +0 -0
- data/java/project/local_lib/sigar/libsigar-ppc-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-ppc64-aix-5.so +0 -0
- data/java/project/local_lib/sigar/libsigar-ppc64-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-s390x-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-sparc-solaris.so +0 -0
- data/java/project/local_lib/sigar/libsigar-sparc64-solaris.so +0 -0
- data/java/project/local_lib/sigar/libsigar-universal-macosx.dylib +0 -0
- data/java/project/local_lib/sigar/libsigar-universal64-macosx.dylib +0 -0
- data/java/project/local_lib/sigar/libsigar-x86-freebsd-5.so +0 -0
- data/java/project/local_lib/sigar/libsigar-x86-freebsd-6.so +0 -0
- data/java/project/local_lib/sigar/libsigar-x86-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-x86-solaris.so +0 -0
- data/java/project/local_lib/sigar/sigar-amd64-winnt.dll +0 -0
- data/java/project/local_lib/sigar/sigar-x86-winnt.dll +0 -0
- data/java/project/local_lib/sigar/sigar-x86-winnt.lib +0 -0
- data/java/project/model.erb +99 -0
- data/java/{settings.gradle → project/settings.gradle} +0 -0
- data/java/project/src/main/java/com/game_machine/authentication/DefaultAuthenticator.java +28 -0
- data/java/project/src/main/java/com/game_machine/authentication/PlayerAuthenticator.java +6 -0
- data/java/project/src/main/java/com/game_machine/authentication/PublicAuthenticator.java +20 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/ActorFactory.java +0 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/ActorUtil.java +13 -0
- data/java/project/src/main/java/com/game_machine/core/AuthorizedPlayers.java +23 -0
- data/java/project/src/main/java/com/game_machine/core/ClientMessageDecoder.java +36 -0
- data/java/project/src/main/java/com/game_machine/core/ClientMessageEncoder.java +19 -0
- data/java/project/src/main/java/com/game_machine/core/CloudClient.java +298 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/CommandProxy.java +0 -0
- data/java/project/src/main/java/com/game_machine/core/Commands.java +20 -0
- data/java/project/src/main/java/com/game_machine/core/DatastoreCommands.java +43 -0
- data/java/project/src/main/java/com/game_machine/core/DbConnectionPool.java +72 -0
- data/java/project/src/main/java/com/game_machine/core/DefaultMovementVerifier.java +56 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/EntitySerializer.java +0 -0
- data/java/project/src/main/java/com/game_machine/core/EntityTracking.java +119 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/EventStreamHandler.java +1 -1
- data/java/project/src/main/java/com/game_machine/core/GameActor.java +73 -0
- data/java/project/src/main/java/com/game_machine/core/GameMachineLoader.java +43 -0
- data/java/project/src/main/java/com/game_machine/core/GameMessageActor.java +44 -0
- data/java/project/src/main/java/com/game_machine/core/Grid.java +255 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/GridValue.java +0 -0
- data/java/project/src/main/java/com/game_machine/core/Hashring.java +66 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/IActorFactory.java +0 -0
- data/java/project/src/main/java/com/game_machine/core/LocalLinkedBuffer.java +20 -0
- data/java/project/src/main/java/com/game_machine/core/MessageGateway.java +120 -0
- data/java/project/src/main/java/com/game_machine/core/MessagePersister.java +26 -0
- data/java/project/src/main/java/com/game_machine/core/MonoProxy.java +39 -0
- data/java/project/src/main/java/com/game_machine/core/MovementVerifier.java +7 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/NetMessage.java +10 -6
- data/java/project/src/main/java/com/game_machine/core/PersistentMessage.java +9 -0
- data/java/project/src/main/java/com/game_machine/core/PlayerCommands.java +31 -0
- data/java/project/src/main/java/com/game_machine/core/TcpServer.java +100 -0
- data/java/project/src/main/java/com/game_machine/core/TcpServerHandler.java +54 -0
- data/java/project/src/main/java/com/game_machine/core/TcpServerInitializer.java +32 -0
- data/java/project/src/main/java/com/game_machine/core/UdpClient.java +86 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/UdpServer.java +18 -27
- data/java/{src → project/src}/main/java/com/game_machine/core/UdpServerHandler.java +23 -26
- data/java/project/src/main/java/com/game_machine/core/Vector3.java +159 -0
- data/java/project/src/main/java/com/game_machine/orm/models/PlayerItem.java +118 -0
- data/java/project/src/main/java/com/game_machine/orm/models/TestObject.java +110 -0
- data/java/project/src/main/java/com/game_machine/tutorial/LootGenerator.java +26 -0
- data/java/{src → project/src}/main/resources/game_machine.java.stg +3 -1
- data/java/project/src/main/resources/logback.properties +13 -0
- data/java/project/src/main/resources/logback.xml +76 -0
- data/java/{src → project/src}/main/resources/protostuff.properties +0 -0
- data/java/src/main/java/game/MyGameActor.java +26 -0
- data/lib/game_machine.rb +17 -16
- data/lib/game_machine/actor.rb +1 -1
- data/lib/game_machine/actor/base.rb +8 -31
- data/lib/game_machine/actor/builder.rb +5 -6
- data/lib/game_machine/actor/game_actor.rb +55 -0
- data/lib/game_machine/actor/reloadable.rb +6 -1
- data/lib/game_machine/akka.rb +26 -32
- data/lib/game_machine/app_config.rb +39 -26
- data/lib/game_machine/application.rb +56 -62
- data/lib/game_machine/client_manager.rb +14 -8
- data/lib/game_machine/cloud_updater.rb +51 -0
- data/lib/game_machine/cluster_monitor.rb +3 -3
- data/lib/game_machine/commands.rb +1 -1
- data/lib/game_machine/commands/misc_commands.rb +4 -8
- data/lib/game_machine/commands/player_commands.rb +8 -0
- data/lib/game_machine/console.rb +1 -0
- data/lib/game_machine/console/build.rb +57 -24
- data/lib/game_machine/console/bundle.rb +95 -0
- data/lib/game_machine/console/deploy.rb +30 -0
- data/lib/game_machine/console/install.rb +70 -36
- data/lib/game_machine/console/server.rb +2 -69
- data/lib/game_machine/data_store.rb +111 -15
- data/lib/game_machine/data_stores/couchbase.rb +8 -3
- data/lib/game_machine/data_stores/gamecloud.rb +93 -0
- data/lib/game_machine/data_stores/jdbc.rb +98 -0
- data/lib/game_machine/default_handlers.rb +2 -0
- data/lib/game_machine/default_handlers/team_handler.rb +51 -0
- data/lib/game_machine/default_handlers/zone_manager.rb +30 -0
- data/lib/game_machine/endpoints.rb +0 -4
- data/lib/game_machine/endpoints/udp_incoming.rb +13 -5
- data/lib/game_machine/endpoints/udp_outgoing.rb +15 -9
- data/lib/game_machine/game_systems.rb +0 -2
- data/lib/game_machine/game_systems/agents/controller.rb +2 -2
- data/lib/game_machine/game_systems/entity_tracking.rb +0 -3
- data/lib/game_machine/game_systems/region_manager.rb +3 -2
- data/lib/game_machine/game_systems/region_service.rb +2 -2
- data/lib/game_machine/game_systems/remote_echo.rb +10 -0
- data/lib/game_machine/game_systems/team_manager.rb +2 -11
- data/lib/game_machine/grid.rb +5 -18
- data/lib/game_machine/handlers/authentication.rb +1 -9
- data/lib/game_machine/handlers/game.rb +27 -2
- data/lib/game_machine/handlers/player_authentication.rb +87 -0
- data/lib/game_machine/handlers/request.rb +9 -11
- data/lib/game_machine/hocon_config.rb +81 -0
- data/lib/game_machine/java_lib.rb +14 -1
- data/lib/game_machine/logger.rb +10 -23
- data/lib/game_machine/models.rb +1 -0
- data/lib/game_machine/mono_server.rb +6 -1
- data/lib/game_machine/object_db.rb +12 -6
- data/lib/game_machine/protobuf.rb +1 -1
- data/lib/game_machine/protobuf/game_messages.rb +13 -3
- data/lib/game_machine/protobuf/generate.rb +107 -5
- data/lib/game_machine/restart_watcher.rb +1 -1
- data/lib/game_machine/routes.rb +23 -0
- data/lib/game_machine/scheduler.rb +1 -1
- data/lib/game_machine/securerandom.rb +2 -0
- data/lib/game_machine/system_stats.rb +28 -7
- data/lib/game_machine/version.rb +1 -1
- data/lib/game_machine/wavefront_ext.rb +47 -0
- data/lib/game_machine/write_behind_cache.rb +24 -9
- data/mono/server/Makefile +1 -1
- data/mono/server/Newtonsoft.Json.dll +0 -0
- data/mono/server/build.bat +1 -1
- data/mono/server/callable.cs +9 -0
- data/mono/server/echo.cs +17 -0
- data/mono/server/message_router.cs +16 -23
- data/mono/server/messages.cs +1792 -417
- data/mono/server/protobuf-net.dll +0 -0
- data/mono/server/server.cs +120 -0
- data/mono/server/server.exe +0 -0
- data/pathfinding/astar.cpp +149 -0
- data/pathfinding/build.sh +6 -0
- data/pathfinding/build.txt +16 -0
- data/pathfinding/crowd.cpp +194 -0
- data/pathfinding/include/astar.h +49 -0
- data/pathfinding/include/common.h +5 -0
- data/pathfinding/include/crowd.h +43 -0
- data/pathfinding/include/micropather.h +511 -0
- data/pathfinding/include/navmesh.h +114 -0
- data/pathfinding/include/pathfinder.h +24 -0
- data/pathfinding/main.cpp +108 -17
- data/pathfinding/micropather.cpp +1062 -0
- data/pathfinding/navmesh.cpp +408 -0
- data/pathfinding/overrides/DetourCrowd.cpp +1446 -0
- data/pathfinding/overrides/DetourNavMeshQuery.cpp +3551 -0
- data/pathfinding/overrides/DetourNavMeshQuery.h +538 -0
- data/pathfinding/pathfinder.cpp +117 -0
- data/pathfinding/{bin → premake}/premake4 +0 -0
- data/pathfinding/premake/premake4.exe +0 -0
- data/pathfinding/premake4.lua +12 -3
- data/spec/actor/actor_spec.rb +0 -7
- data/spec/client_manager_spec.rb +1 -1
- data/spec/couchproxy_spec.rb +38 -0
- data/spec/entity_persistence_spec.rb +129 -0
- data/spec/game_systems/team_manager_spec.rb +2 -2
- data/spec/hashring_spec.rb +17 -39
- data/spec/java_grid_spec.rb +0 -2
- data/spec/misc_spec.rb +111 -0
- data/spec/mono_spec.rb +50 -3
- data/spec/reliable_message_spec.rb +38 -0
- data/spec/spec_helper.rb +4 -4
- data/spec/spec_helper_minimal.rb +10 -0
- data/web/app.rb +108 -86
- data/web/config/trinidad.yml +1 -0
- data/web/views/add_player.erb +25 -0
- data/web/views/index.erb +0 -0
- data/web/views/layout.erb +48 -0
- data/web/views/login.erb +25 -0
- data/web/views/players.erb +24 -0
- metadata +209 -94
- data/config/config.example.yml +0 -100
- data/config/regions.example.yml +0 -9
- data/games/example/lib/authentication_handler.rb +0 -69
- data/games/models.rb +0 -3
- data/games/models/clan_member.rb +0 -8
- data/games/models/clan_profile.rb +0 -9
- data/games/models/player.rb +0 -7
- data/games/plugins.rb +0 -1
- data/games/plugins/team_handler.rb +0 -49
- data/games/preload.rb +0 -13
- data/java/.gitignore +0 -1
- data/java/build.gradle +0 -95
- data/java/component.erb +0 -396
- data/java/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/java/src/main/java/com/game_machine/core/GameMachineLoader.java +0 -25
- data/java/src/main/java/com/game_machine/core/Grid.java +0 -195
- data/java/src/main/resources/logback.xml +0 -14
- data/java/src/main/resources/logging.properties +0 -3
- data/lib/game_machine/actor/mono_actor.rb +0 -89
- data/lib/game_machine/auth_handlers/base.rb +0 -21
- data/lib/game_machine/auth_handlers/public.rb +0 -34
- data/lib/game_machine/endpoints/mono_gateway.rb +0 -87
- data/lib/game_machine/endpoints/tcp.rb +0 -51
- data/lib/game_machine/endpoints/tcp_handler.rb +0 -75
- data/lib/game_machine/endpoints/udp.rb +0 -88
- data/lib/game_machine/game_loader.rb +0 -46
- data/lib/game_machine/game_systems/region_settings.rb +0 -13
- data/lib/game_machine/hashring.rb +0 -48
- data/lib/game_machine/settings.rb +0 -11
- data/mono/server/actor.cs +0 -37
- data/mono/server/iactor.cs +0 -11
- data/mono/server/message_util.cs +0 -29
- data/mono/server/proxy_client.cs +0 -73
- data/mono/server/proxy_server.cs +0 -30
- data/mono/server/test_actor.cs +0 -33
- data/pathfinding/include/pathfind.h +0 -167
- data/pathfinding/pathfind.cpp +0 -174
- data/pathfinding/pathfinder.cs +0 -66
- data/script/server.sh +0 -109
- data/script/watch.sh +0 -11
- data/spec/commands/navigation_commands_spec.rb +0 -51
- data/spec/game_systems/entity_tracking_spec.rb +0 -64
- data/spec/navigation/detour_navmesh_spec.rb +0 -34
- data/spec/navigation/detour_path_spec.rb +0 -25
- data/spec/udp_server_spec.rb +0 -10
- data/web/controllers/auth_controller.rb +0 -19
- data/web/controllers/base_controller.rb +0 -16
- data/web/controllers/index_controller.rb +0 -7
- data/web/controllers/log_controller.rb +0 -47
- data/web/controllers/messages_controller.rb +0 -59
- data/web/controllers/player_register_controller.rb +0 -15
- data/web/views/game_messages.haml +0 -45
- data/web/views/index.haml +0 -6
- data/web/views/layout.haml +0 -41
- data/web/views/logs.haml +0 -32
- data/web/views/player_register.haml +0 -22
- data/web/views/player_registered.haml +0 -2
- data/web/views/register_layout.haml +0 -22
- data/web/views/restart.haml +0 -35
data/script/server.sh
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
#export LD_PRELOAD=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/libjsig.so
|
3
|
-
SCRIPT_PATH=`dirname "$0"`; SCRIPT_PATH=`eval "cd \"$SCRIPT_PATH\" && pwd"`
|
4
|
-
SERVER_HOME=$SCRIPT_PATH/../
|
5
|
-
SERVER_LOG=$SERVER_HOME/log
|
6
|
-
SERVER_TMP=$SERVER_HOME/tmp
|
7
|
-
|
8
|
-
mkdir -p $SERVER_LOG
|
9
|
-
mkdir -p $SERVER_TMP
|
10
|
-
|
11
|
-
cd $SERVER_HOME
|
12
|
-
|
13
|
-
#unset GEM_HOME
|
14
|
-
#unset BUNDLE_GEMFILE
|
15
|
-
#unset GEM_PATH
|
16
|
-
CWD=$(pwd)
|
17
|
-
APP_NAME=game_machine
|
18
|
-
|
19
|
-
ERR_FILE=$SERVER_HOME/log/game_machine.stderr
|
20
|
-
OUT_FILE=$SERVER_HOME/log/game_machine.stdout
|
21
|
-
|
22
|
-
PID_PATH=$SERVER_HOME/tmp
|
23
|
-
PID_FILE=$PID_PATH/game_machine.pid
|
24
|
-
mkdir -p $PID_PATH
|
25
|
-
ARGV="$2"
|
26
|
-
|
27
|
-
start_daemon() {
|
28
|
-
if [ -e "$PID_FILE" ]; then
|
29
|
-
echo "PID file already exists."
|
30
|
-
exit 1
|
31
|
-
else
|
32
|
-
if [ -e "./bin/game_machine" ]; then
|
33
|
-
echo "Starting local $APP_NAME with args $ARGV."
|
34
|
-
nohup ./bin/game_machine s -s "$ARGV" 2>> "$ERR_FILE" >> "$OUT_FILE" &
|
35
|
-
else
|
36
|
-
echo "Starting $APP_NAME with args $ARGV."
|
37
|
-
nohup game_machine server "$ARGV" 2>> "$ERR_FILE" >> "$OUT_FILE" &
|
38
|
-
fi
|
39
|
-
echo $! > "$PID_FILE"
|
40
|
-
exit $?
|
41
|
-
fi
|
42
|
-
}
|
43
|
-
|
44
|
-
stop_daemon() {
|
45
|
-
if [ -e "$PID_FILE" ]; then
|
46
|
-
echo "Stopping $APP_NAME."
|
47
|
-
PID=`cat $PID_FILE`
|
48
|
-
for i in 1 2 3 4 5 6 7 8 9 10
|
49
|
-
do
|
50
|
-
if [ "$i" -gt 2 ] ;then
|
51
|
-
echo "Using kill -9"
|
52
|
-
kill -9 $PID 2> /dev/null
|
53
|
-
else
|
54
|
-
kill -TERM $PID 2> /dev/null
|
55
|
-
fi
|
56
|
-
echo "try $i"
|
57
|
-
if [ `ps $PID 2> /dev/null | grep $PID | wc -l` -eq 1 ]; then
|
58
|
-
echo "$APP_NAME still running"
|
59
|
-
else
|
60
|
-
echo "$APP_NAME killed"
|
61
|
-
break;
|
62
|
-
fi
|
63
|
-
sleep 1
|
64
|
-
done
|
65
|
-
rm $PID_FILE
|
66
|
-
else
|
67
|
-
echo "PID file not found."
|
68
|
-
return 1
|
69
|
-
fi
|
70
|
-
}
|
71
|
-
|
72
|
-
check_status() {
|
73
|
-
if [ -e "$PID_FILE" ]; then
|
74
|
-
PID=`cat $PID_FILE`
|
75
|
-
if [ `ps $PID 2> /dev/null | grep $PID | wc -l` -eq 1 ]; then
|
76
|
-
echo "$APP_NAME is running"
|
77
|
-
return 0
|
78
|
-
else
|
79
|
-
echo "$APP_NAME is not running (stale pidfile)"
|
80
|
-
return 3
|
81
|
-
fi
|
82
|
-
fi
|
83
|
-
|
84
|
-
echo "$APP_NAME is not running"
|
85
|
-
return 3
|
86
|
-
}
|
87
|
-
|
88
|
-
|
89
|
-
case $1 in
|
90
|
-
start)
|
91
|
-
start_daemon
|
92
|
-
;;
|
93
|
-
stop)
|
94
|
-
stop_daemon
|
95
|
-
;;
|
96
|
-
status)
|
97
|
-
check_status
|
98
|
-
;;
|
99
|
-
restart)
|
100
|
-
stop_daemon
|
101
|
-
sleep 1
|
102
|
-
start_daemon
|
103
|
-
;;
|
104
|
-
*)
|
105
|
-
echo "usage: $0 start|stop|restart|status"
|
106
|
-
exit 1
|
107
|
-
;;
|
108
|
-
esac
|
109
|
-
|
data/script/watch.sh
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module GameMachine
|
4
|
-
module Commands
|
5
|
-
describe NavigationCommands do
|
6
|
-
|
7
|
-
let(:navmesh) {double("DetourNavmesh", :load_mesh! => true)}
|
8
|
-
let(:query_ref) {double("DetourPath")}
|
9
|
-
|
10
|
-
let(:meshfile) {File.join(GameMachine.app_root,'../data/meshes/test.bin')}
|
11
|
-
subject{NavigationCommands.new}
|
12
|
-
|
13
|
-
before(:each) do
|
14
|
-
allow(Navigation::DetourPath).to receive(:query_ref).and_return(query_ref)
|
15
|
-
allow(Navigation::DetourNavmesh).to receive(:create).and_return(navmesh)
|
16
|
-
allow(Navigation::DetourNavmesh).to receive(:find).and_return(navmesh)
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#load_navmesh" do
|
20
|
-
it "returns a navmesh instance" do
|
21
|
-
expect(
|
22
|
-
subject.load_navmesh(1,meshfile)
|
23
|
-
).to eql(navmesh)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "calls load_mesh! on navmesh" do
|
27
|
-
expect(navmesh).to receive(:load_mesh!)
|
28
|
-
subject.load_navmesh(1,meshfile)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "raises an exception of navmesh file does not exist" do
|
32
|
-
expect {
|
33
|
-
subject.load_navmesh(1,'/blahblah')
|
34
|
-
}.to raise_error(/does not exist/)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#navmesh" do
|
39
|
-
it "returns the navmesh by id" do
|
40
|
-
expect(subject.navmesh(1)).to eql(navmesh)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "#query_ref" do
|
45
|
-
it "returns a navmesh query reference" do
|
46
|
-
expect(subject.query_ref(1)).to eql(query_ref)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module GameMachine
|
4
|
-
module GameSystems
|
5
|
-
describe EntityTracking do
|
6
|
-
|
7
|
-
|
8
|
-
subject do
|
9
|
-
ref = Actor::Builder.new(EntityTracking).with_name('entity_tracking_test').test_ref
|
10
|
-
ref.underlying_actor.post_init
|
11
|
-
ref.underlying_actor
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:track_entity) do
|
15
|
-
MessageLib::TrackEntity.new.set_value(true)
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:vector3) do
|
19
|
-
MessageLib::Vector3.new.set_x(0).set_y(0).set_z(0)
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:get_neighbors) do
|
23
|
-
MessageLib::GetNeighbors.new.set_neighbor_type('player').set_vector3(vector3)
|
24
|
-
end
|
25
|
-
|
26
|
-
let(:player) do
|
27
|
-
MessageLib::Player.new.set_id('1')
|
28
|
-
end
|
29
|
-
|
30
|
-
let(:entity) do
|
31
|
-
MessageLib::Entity.new.set_id('0').
|
32
|
-
set_player(player).
|
33
|
-
set_track_entity(track_entity).
|
34
|
-
set_entity_type('player').
|
35
|
-
set_vector3(vector3)
|
36
|
-
end
|
37
|
-
|
38
|
-
let(:get_neighbors_entity) do
|
39
|
-
MessageLib::Entity.new.set_id('0').set_get_neighbors(get_neighbors)
|
40
|
-
end
|
41
|
-
|
42
|
-
let(:actor_ref) {double('Actor::Ref', :tell => true)}
|
43
|
-
|
44
|
-
describe 'tracking location' do
|
45
|
-
|
46
|
-
it "should call grid.set with player" do
|
47
|
-
expect(subject.grid).to receive(:set).with('0',0.0,0.0,0.0,'player')
|
48
|
-
subject.on_receive(entity)
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'get neighbors' do
|
54
|
-
it "sends neighbors to player" do
|
55
|
-
expect(subject).to receive(:send_neighbors_to_player)
|
56
|
-
get_neighbors_entity.set_player(player)
|
57
|
-
subject.on_receive(entity)
|
58
|
-
subject.on_receive(get_neighbors_entity)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module GameMachine
|
4
|
-
module Navigation
|
5
|
-
describe DetourNavmesh do
|
6
|
-
|
7
|
-
let(:meshfile) {File.join(GameMachine.app_root,'../data/meshes/test.bin')}
|
8
|
-
let(:bad_meshfile) {File.join(GameMachine.app_root,'../data/meshes/bad.bin')}
|
9
|
-
let(:navmesh_id) {1}
|
10
|
-
|
11
|
-
describe "#create" do
|
12
|
-
it "raises an error if meshfile does not exist" do
|
13
|
-
expect {
|
14
|
-
DetourNavmesh.create(navmesh_id,bad_meshfile)
|
15
|
-
}.to raise_error(/file does not exist/)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#load_mesh!" do
|
20
|
-
it "should return 1 on success" do
|
21
|
-
expect(DetourNavmesh.create(navmesh_id,meshfile).load_mesh!).to eql(1)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should raise error on failure" do
|
25
|
-
#Detour.stub(:loadNavMesh).and_return(0)
|
26
|
-
expect {
|
27
|
-
DetourNavmesh.new(navmesh_id,meshfile).load_mesh!
|
28
|
-
}.to raise_error(/failed to load/)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module GameMachine
|
4
|
-
module Navigation
|
5
|
-
describe DetourPath do
|
6
|
-
|
7
|
-
let(:meshfile) {File.join(GameMachine.app_root,'../data/meshes/test.bin')}
|
8
|
-
|
9
|
-
subject {DetourPath}
|
10
|
-
|
11
|
-
describe "#query_ref" do
|
12
|
-
it "returns a detour path for the given navmesh id" do
|
13
|
-
DetourNavmesh.create(2,meshfile)
|
14
|
-
expect(subject.query_ref(1)).to be_a(subject)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "raises an error if the navmesh is not found" do
|
18
|
-
expect {
|
19
|
-
subject.query_ref(3)
|
20
|
-
}.to raise_error(/Navmesh with id 3 not found/)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/udp_server_spec.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Web
|
2
|
-
module Controllers
|
3
|
-
class AuthController < BaseController
|
4
|
-
|
5
|
-
def get
|
6
|
-
if auth = login(params['username'],params['password'])
|
7
|
-
auth
|
8
|
-
else
|
9
|
-
GameMachine.logger.info "#{self.class.name} Login Error: #{params['username']}"
|
10
|
-
"error"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def login(user,pass)
|
15
|
-
GameMachine::Application.auth_handler.authorize(user,pass)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module Web
|
2
|
-
module Controllers
|
3
|
-
class LogController < BaseController
|
4
|
-
|
5
|
-
attr_reader :logfiles
|
6
|
-
def initialize
|
7
|
-
logpath = File.join(GameMachine.app_root,'log')
|
8
|
-
@logfiles = {
|
9
|
-
:app => @applog = File.join(logpath,"#{GameMachine.env}.log"),
|
10
|
-
:stdout => @stdout = File.join(logpath,'game_machine.stdout'),
|
11
|
-
:stderr => @stderr = File.join(logpath,'game_machine.stderr')
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def readlog(logtype)
|
16
|
-
count = 100
|
17
|
-
path = logfiles[logtype]
|
18
|
-
unless File.exists?(path)
|
19
|
-
GameMachine.logger.info "No such logfile: #{path}"
|
20
|
-
return []
|
21
|
-
end
|
22
|
-
|
23
|
-
tmpname = "/tmp/#{logtype}_tmp"
|
24
|
-
system("tail -#{count} #{path} >#{tmpname}")
|
25
|
-
IO.readlines(tmpname)
|
26
|
-
end
|
27
|
-
|
28
|
-
def logs(logtype)
|
29
|
-
readlog(logtype).map do |line|
|
30
|
-
if logtype == :app
|
31
|
-
begin
|
32
|
-
line.match(/^(.*?)\[(.*?)\]\s(INFO|ERROR|DEBUG|WARN)\s(.*)/)
|
33
|
-
|
34
|
-
# timestamp,severity,service,message
|
35
|
-
[$1,$3.to_sym,$2,$4]
|
36
|
-
rescue Exception => e
|
37
|
-
['unknown','UNKNOWN','unknown',line]
|
38
|
-
end
|
39
|
-
else
|
40
|
-
line
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module Web
|
4
|
-
module Controllers
|
5
|
-
class MessagesController < BaseController
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@combined_messages_file = File.join(
|
9
|
-
GameMachine.app_root,'config','combined_messages.proto')
|
10
|
-
@game_messages_file = File.join(
|
11
|
-
GameMachine.app_root,'config','game_messages.proto')
|
12
|
-
end
|
13
|
-
|
14
|
-
def all
|
15
|
-
read_file(@combined_messages_file)
|
16
|
-
end
|
17
|
-
|
18
|
-
def game
|
19
|
-
read_file(@game_messages_file)
|
20
|
-
end
|
21
|
-
|
22
|
-
def update
|
23
|
-
FileUtils.cp(@game_messages_file,"#{@game_messages_file}.bak")
|
24
|
-
content = params['game_messages']
|
25
|
-
write_file(@game_messages_file,content)
|
26
|
-
GameMachine::Console::Build.new([]).generate_code
|
27
|
-
game_messages = read_file(@game_messages_file)
|
28
|
-
|
29
|
-
if ENV.has_key?('RESTARTABLE')
|
30
|
-
GameMachine::Console::Server.restart!
|
31
|
-
return 'restart'
|
32
|
-
else
|
33
|
-
return game_messages
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def write_file(filename,content)
|
40
|
-
File.open(filename,'wb') {|f| f.write(content)}
|
41
|
-
end
|
42
|
-
|
43
|
-
def read_file(filename)
|
44
|
-
if File.exists?(filename)
|
45
|
-
File.read(filename)
|
46
|
-
else
|
47
|
-
nil
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def generate_combined
|
52
|
-
GameMachine::Protobuf::Generate.new(
|
53
|
-
GameMachine.app_root
|
54
|
-
).generate
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|