zyps 0.5.2 → 0.6.1
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.
- data/README.txt +18 -0
- data/bin/zyps +13 -9
- data/bin/zyps_demo +3 -0
- data/bin/zyps_server +262 -0
- data/doc/classes/Zyps.html +161 -0
- data/doc/classes/Zyps/AccelerateAction.html +200 -0
- data/doc/classes/Zyps/AccelerateAction.src/M000020.html +19 -0
- data/doc/classes/Zyps/AccelerateAction.src/M000021.html +19 -0
- data/doc/classes/Zyps/AccelerateAction.src/M000022.html +18 -0
- data/doc/classes/Zyps/Accelerator.html +181 -0
- data/doc/classes/Zyps/Accelerator.src/M000044.html +19 -0
- data/doc/classes/Zyps/Accelerator.src/M000045.html +18 -0
- data/doc/classes/Zyps/Action.html +217 -0
- data/doc/classes/Zyps/Action.src/M000014.html +18 -0
- data/doc/classes/Zyps/Action.src/M000015.html +18 -0
- data/doc/classes/Zyps/Action.src/M000016.html +17 -0
- data/doc/classes/Zyps/Action.src/M000017.html +18 -0
- data/doc/classes/Zyps/AgeCondition.html +181 -0
- data/doc/classes/Zyps/AgeCondition.src/M000058.html +18 -0
- data/doc/classes/Zyps/AgeCondition.src/M000059.html +18 -0
- data/doc/classes/Zyps/ApproachAction.html +207 -0
- data/doc/classes/Zyps/ApproachAction.src/M000074.html +19 -0
- data/doc/classes/Zyps/ApproachAction.src/M000075.html +19 -0
- data/doc/classes/Zyps/ApproachAction.src/M000076.html +38 -0
- data/doc/classes/Zyps/Behavior.html +206 -0
- data/doc/classes/Zyps/Behavior.src/M000012.html +20 -0
- data/doc/classes/Zyps/Behavior.src/M000013.html +31 -0
- data/doc/classes/Zyps/BlendAction.html +181 -0
- data/doc/classes/Zyps/BlendAction.src/M000066.html +18 -0
- data/doc/classes/Zyps/BlendAction.src/M000067.html +18 -0
- data/doc/classes/Zyps/Clock.html +180 -0
- data/doc/classes/Zyps/Clock.src/M000069.html +18 -0
- data/doc/classes/Zyps/Clock.src/M000070.html +21 -0
- data/doc/classes/Zyps/Clock.src/M000071.html +18 -0
- data/doc/classes/Zyps/CollisionCondition.html +148 -0
- data/doc/classes/Zyps/CollisionCondition.src/M000083.html +18 -0
- data/doc/classes/Zyps/Color.html +299 -0
- data/doc/classes/Zyps/Color.src/M000038.html +18 -0
- data/doc/classes/Zyps/Color.src/M000039.html +16 -0
- data/doc/classes/Zyps/Color.src/M000040.html +16 -0
- data/doc/classes/Zyps/Color.src/M000041.html +16 -0
- data/doc/classes/Zyps/Color.src/M000042.html +18 -0
- data/doc/classes/Zyps/Color.src/M000043.html +22 -0
- data/doc/classes/Zyps/Condition.html +118 -0
- data/doc/classes/Zyps/Creature.html +190 -0
- data/doc/classes/Zyps/Creature.src/M000025.html +19 -0
- data/doc/classes/Zyps/Creature.src/M000026.html +18 -0
- data/doc/classes/Zyps/DestroyAction.html +181 -0
- data/doc/classes/Zyps/DestroyAction.src/M000054.html +18 -0
- data/doc/classes/Zyps/DestroyAction.src/M000055.html +20 -0
- data/doc/classes/Zyps/EatAction.html +149 -0
- data/doc/classes/Zyps/EatAction.src/M000068.html +21 -0
- data/doc/classes/Zyps/Enclosure.html +206 -0
- data/doc/classes/Zyps/Enclosure.src/M000010.html +18 -0
- data/doc/classes/Zyps/Enclosure.src/M000011.html +31 -0
- data/doc/classes/Zyps/Environment.html +203 -0
- data/doc/classes/Zyps/Environment.src/M000081.html +19 -0
- data/doc/classes/Zyps/Environment.src/M000082.html +67 -0
- data/doc/classes/Zyps/EnvironmentalFactor.html +118 -0
- data/doc/classes/Zyps/FaceAction.html +148 -0
- data/doc/classes/Zyps/FaceAction.src/M000080.html +18 -0
- data/doc/classes/Zyps/FleeAction.html +207 -0
- data/doc/classes/Zyps/FleeAction.src/M000084.html +19 -0
- data/doc/classes/Zyps/FleeAction.src/M000085.html +19 -0
- data/doc/classes/Zyps/FleeAction.src/M000086.html +38 -0
- data/doc/classes/Zyps/Friction.html +181 -0
- data/doc/classes/Zyps/Friction.src/M000072.html +19 -0
- data/doc/classes/Zyps/Friction.src/M000073.html +18 -0
- data/doc/classes/Zyps/GameObject.html +282 -0
- data/doc/classes/Zyps/GameObject.src/M000060.html +19 -0
- data/doc/classes/Zyps/GameObject.src/M000061.html +16 -0
- data/doc/classes/Zyps/GameObject.src/M000062.html +19 -0
- data/doc/classes/Zyps/GameObject.src/M000063.html +16 -0
- data/doc/classes/Zyps/GameObject.src/M000064.html +16 -0
- data/doc/classes/Zyps/Gravity.html +145 -0
- data/doc/classes/Zyps/Gravity.src/M000065.html +16 -0
- data/doc/classes/Zyps/Location.html +167 -0
- data/doc/classes/Zyps/Location.src/M000037.html +18 -0
- data/doc/classes/Zyps/NoMatchException.html +111 -0
- data/doc/classes/Zyps/PopulationLimit.html +183 -0
- data/doc/classes/Zyps/PopulationLimit.src/M000027.html +19 -0
- data/doc/classes/Zyps/PopulationLimit.src/M000028.html +20 -0
- data/doc/classes/Zyps/ProximityCondition.html +182 -0
- data/doc/classes/Zyps/ProximityCondition.src/M000056.html +18 -0
- data/doc/classes/Zyps/ProximityCondition.src/M000057.html +18 -0
- data/doc/classes/Zyps/PullAction.html +199 -0
- data/doc/classes/Zyps/PullAction.src/M000046.html +19 -0
- data/doc/classes/Zyps/PullAction.src/M000047.html +19 -0
- data/doc/classes/Zyps/PullAction.src/M000048.html +23 -0
- data/doc/classes/Zyps/PushAction.html +199 -0
- data/doc/classes/Zyps/PushAction.src/M000049.html +19 -0
- data/doc/classes/Zyps/PushAction.src/M000050.html +19 -0
- data/doc/classes/Zyps/PushAction.src/M000051.html +23 -0
- data/doc/classes/Zyps/SpeedLimit.html +181 -0
- data/doc/classes/Zyps/SpeedLimit.src/M000023.html +18 -0
- data/doc/classes/Zyps/SpeedLimit.src/M000024.html +18 -0
- data/doc/classes/Zyps/TagAction.html +181 -0
- data/doc/classes/Zyps/TagAction.src/M000052.html +18 -0
- data/doc/classes/Zyps/TagAction.src/M000053.html +18 -0
- data/doc/classes/Zyps/TagCondition.html +181 -0
- data/doc/classes/Zyps/TagCondition.src/M000018.html +18 -0
- data/doc/classes/Zyps/TagCondition.src/M000019.html +18 -0
- data/doc/classes/Zyps/TrailsView.html +209 -0
- data/doc/classes/Zyps/TrailsView.src/M000008.html +40 -0
- data/doc/classes/Zyps/TrailsView.src/M000009.html +78 -0
- data/doc/classes/Zyps/TurnAction.html +200 -0
- data/doc/classes/Zyps/TurnAction.src/M000077.html +19 -0
- data/doc/classes/Zyps/TurnAction.src/M000078.html +19 -0
- data/doc/classes/Zyps/TurnAction.src/M000079.html +18 -0
- data/doc/classes/Zyps/Utility.html +251 -0
- data/doc/classes/Zyps/Utility.src/M000001.html +26 -0
- data/doc/classes/Zyps/Utility.src/M000002.html +22 -0
- data/doc/classes/Zyps/Utility.src/M000003.html +18 -0
- data/doc/classes/Zyps/Utility.src/M000004.html +21 -0
- data/doc/classes/Zyps/Utility.src/M000005.html +25 -0
- data/doc/classes/Zyps/Utility.src/M000006.html +21 -0
- data/doc/classes/Zyps/Utility.src/M000007.html +21 -0
- data/doc/classes/Zyps/Vector.html +281 -0
- data/doc/classes/Zyps/Vector.src/M000029.html +19 -0
- data/doc/classes/Zyps/Vector.src/M000030.html +16 -0
- data/doc/classes/Zyps/Vector.src/M000031.html +21 -0
- data/doc/classes/Zyps/Vector.src/M000032.html +16 -0
- data/doc/classes/Zyps/Vector.src/M000033.html +18 -0
- data/doc/classes/Zyps/Vector.src/M000034.html +16 -0
- data/doc/classes/Zyps/Vector.src/M000035.html +18 -0
- data/doc/classes/Zyps/Vector.src/M000036.html +25 -0
- data/doc/created.rid +1 -0
- data/doc/files/COPYING_LESSER_txt.html +311 -0
- data/doc/files/COPYING_txt.html +1003 -0
- data/doc/files/README_txt.html +236 -0
- data/doc/files/lib/zyps/actions_rb.html +134 -0
- data/doc/files/lib/zyps/conditions_rb.html +134 -0
- data/doc/files/lib/zyps/environmental_factors_rb.html +134 -0
- data/doc/files/lib/zyps/views/trails_rb.html +134 -0
- data/doc/files/lib/zyps_rb.html +134 -0
- data/doc/fr_class_index.html +62 -0
- data/doc/fr_file_index.html +34 -0
- data/doc/fr_method_index.html +112 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/zyps.rb +40 -9
- data/lib/zyps/actions.rb +8 -1
- data/lib/zyps/conditions.rb +6 -0
- data/lib/zyps/environmental_factors.rb +74 -0
- data/lib/zyps/views/trails.rb +6 -0
- data/test/test_zyps.rb +3 -0
- data/test/zyps/test_actions.rb +3 -0
- data/test/zyps/test_conditions.rb +3 -0
- data/test/zyps/test_environmental_factors.rb +90 -7
- metadata +185 -9
data/README.txt
CHANGED
|
@@ -34,6 +34,24 @@ To see a tutorial on the library, at a command line, type:
|
|
|
34
34
|
|
|
35
35
|
zyps_demo
|
|
36
36
|
|
|
37
|
+
To run a DRb server that clients can connect to:
|
|
38
|
+
|
|
39
|
+
zyps_server [options]
|
|
40
|
+
-h, --help Display program help.
|
|
41
|
+
-m, --max-population [number] The maximum number of allowed game objects.
|
|
42
|
+
25 by default.
|
|
43
|
+
-s, --max-speed [number] The fastest an object can go. 500 by
|
|
44
|
+
default.
|
|
45
|
+
-n, --no-enclosure Disables the barrier that normally keeps
|
|
46
|
+
objects on the screen.
|
|
47
|
+
-u, --url [url] dRuby URL to run the server on. If not
|
|
48
|
+
defined, one will be selected and printed to
|
|
49
|
+
STDOUT.
|
|
50
|
+
-f, --fps [frames] Number of frames to draw per second. 60 by
|
|
51
|
+
default.
|
|
52
|
+
--view-width [pixels] Window width. 800 by default.
|
|
53
|
+
--view-height [pixels] Window height. 600 by default.
|
|
54
|
+
|
|
37
55
|
|
|
38
56
|
== Development
|
|
39
57
|
|
data/bin/zyps
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
gems_loaded = false
|
|
21
22
|
begin
|
|
22
23
|
require 'zyps'
|
|
23
24
|
require 'zyps/actions'
|
|
@@ -25,15 +26,18 @@ begin
|
|
|
25
26
|
require 'zyps/environmental_factors'
|
|
26
27
|
require 'zyps/views/trails'
|
|
27
28
|
rescue LoadError
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
if gems_loaded == false
|
|
30
|
+
require 'rubygems'
|
|
31
|
+
gems_loaded = true
|
|
32
|
+
retry
|
|
33
|
+
else
|
|
34
|
+
raise
|
|
35
|
+
end
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
|
|
39
|
+
include Zyps
|
|
40
|
+
|
|
37
41
|
|
|
38
42
|
class Application
|
|
39
43
|
|
|
@@ -79,6 +83,9 @@ class Application
|
|
|
79
83
|
#Keep all objects under a certain speed.
|
|
80
84
|
@environment.environmental_factors << SpeedLimit.new(100)
|
|
81
85
|
|
|
86
|
+
#Limit population.
|
|
87
|
+
@environment.environmental_factors << PopulationLimit.new(@environment, 25)
|
|
88
|
+
|
|
82
89
|
#Set up a creature generator.
|
|
83
90
|
@generator = CreatureGenerator.new(@environment)
|
|
84
91
|
|
|
@@ -94,9 +101,6 @@ class Application
|
|
|
94
101
|
|
|
95
102
|
@environment.interact
|
|
96
103
|
|
|
97
|
-
#Control population.
|
|
98
|
-
@environment.objects.shift while @environment.objects.length > 25
|
|
99
|
-
|
|
100
104
|
#Determine how much time is left in this frame.
|
|
101
105
|
time_left_in_frame = (time_per_frame) - drawing_clock.elapsed_time
|
|
102
106
|
#Sleep for the remaining time.
|
data/bin/zyps_demo
CHANGED
data/bin/zyps_server
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
#!/usr/local/bin/ruby
|
|
2
|
+
|
|
3
|
+
# Copyright 2007 Jay McGavren, jay@mcgavren.com.
|
|
4
|
+
#
|
|
5
|
+
# This file is part of Zyps.
|
|
6
|
+
#
|
|
7
|
+
# Zyps is free software; you can redistribute it and/or modify
|
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
# the Free Software Foundation; either version 3 of the License, or
|
|
10
|
+
# (at your option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
# GNU General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
gems_loaded = false
|
|
22
|
+
begin
|
|
23
|
+
require 'optparse'
|
|
24
|
+
require 'zyps'
|
|
25
|
+
require 'zyps/actions'
|
|
26
|
+
require 'zyps/conditions'
|
|
27
|
+
require 'zyps/environmental_factors'
|
|
28
|
+
require 'zyps/views/trails'
|
|
29
|
+
require 'drb'
|
|
30
|
+
rescue LoadError
|
|
31
|
+
if gems_loaded == false
|
|
32
|
+
require 'rubygems'
|
|
33
|
+
gems_loaded = true
|
|
34
|
+
retry
|
|
35
|
+
else
|
|
36
|
+
raise
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
include Zyps
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
DEFAULT_VIEW_WIDTH = 800
|
|
45
|
+
DEFAULT_VIEW_HEIGHT = 600
|
|
46
|
+
DEFAULT_MAX_SPEED = 500
|
|
47
|
+
DEFAULT_MAX_POPULATION = 25
|
|
48
|
+
DEFAULT_FPS = 60
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
#Extend Environment for serving over DRb.
|
|
52
|
+
class Environment
|
|
53
|
+
|
|
54
|
+
include DRbUndumped
|
|
55
|
+
|
|
56
|
+
def initialize (objects = [], environmental_factors = [])
|
|
57
|
+
@objects, @environmental_factors = objects, environmental_factors
|
|
58
|
+
@clock = Clock.new
|
|
59
|
+
@objects.extend DRbUndumped
|
|
60
|
+
@environmental_factors.extend DRbUndumped
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
alias old_objects= objects=
|
|
64
|
+
def objects=(value)
|
|
65
|
+
old_objects=(value)
|
|
66
|
+
@objects.extend DRbUndumped
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
alias old_environmental_factors= environmental_factors=
|
|
70
|
+
def environmental_factors=(value)
|
|
71
|
+
old_environmental_factors=(value)
|
|
72
|
+
@environmental_factors.extend DRbUndumped
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
#A server for a Zyps Environment.
|
|
78
|
+
class EnvironmentServer
|
|
79
|
+
|
|
80
|
+
#Port to open service on.
|
|
81
|
+
attr_accessor :url
|
|
82
|
+
#Maximum allowed number of objects.
|
|
83
|
+
attr_accessor :max_population
|
|
84
|
+
#View dimensions.
|
|
85
|
+
attr_accessor :view_width, :view_height
|
|
86
|
+
|
|
87
|
+
#Set up default values.
|
|
88
|
+
def initialize(
|
|
89
|
+
url = nil,
|
|
90
|
+
view_width = DEFAULT_VIEW_WIDTH,
|
|
91
|
+
view_height = DEFAULT_VIEW_HEIGHT,
|
|
92
|
+
fps = DEFAULT_FPS,
|
|
93
|
+
max_population = DEFAULT_MAX_POPULATION,
|
|
94
|
+
max_speed = DEFAULT_MAX_SPEED,
|
|
95
|
+
enclosure = true
|
|
96
|
+
)
|
|
97
|
+
@url, @view_width, @view_height, @fps, @max_population, @max_speed, @enclosure =
|
|
98
|
+
url, view_width, view_height, fps, max_population, max_speed, enclosure
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
#Create app window, game environment, view, and network service.
|
|
102
|
+
def main
|
|
103
|
+
|
|
104
|
+
#A clock to track frames to draw this second.
|
|
105
|
+
clock = Clock.new
|
|
106
|
+
time_per_frame = 1.0 / @fps
|
|
107
|
+
|
|
108
|
+
#Create a window, and set GTK up to quit when it is closed.
|
|
109
|
+
window = Gtk::Window.new
|
|
110
|
+
window.signal_connect("delete_event") {false}
|
|
111
|
+
window.signal_connect("destroy") {Gtk.main_quit}
|
|
112
|
+
|
|
113
|
+
#Add view to window.
|
|
114
|
+
view = TrailsView.new(@view_width, @view_height)
|
|
115
|
+
window.add(view.canvas)
|
|
116
|
+
window.show_all
|
|
117
|
+
|
|
118
|
+
#Create environment.
|
|
119
|
+
environment = Environment.new
|
|
120
|
+
|
|
121
|
+
#Point view at environment.
|
|
122
|
+
environment.add_observer(view)
|
|
123
|
+
|
|
124
|
+
#Limit population.
|
|
125
|
+
environment.environmental_factors << PopulationLimit.new(environment, @max_population) if @max_population
|
|
126
|
+
|
|
127
|
+
#Limit speed of objects.
|
|
128
|
+
environment.environmental_factors << SpeedLimit.new(@max_speed) if @max_speed
|
|
129
|
+
|
|
130
|
+
#Keep objects on screen.
|
|
131
|
+
if @enclosure
|
|
132
|
+
enclosure = Enclosure.new()
|
|
133
|
+
enclosure.left = 0
|
|
134
|
+
enclosure.bottom = 0
|
|
135
|
+
enclosure.top = @view_height
|
|
136
|
+
enclosure.right = @view_width
|
|
137
|
+
environment.environmental_factors << enclosure
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
#Create thread to update environment.
|
|
141
|
+
update_thread = Thread.new do
|
|
142
|
+
|
|
143
|
+
begin
|
|
144
|
+
|
|
145
|
+
loop do
|
|
146
|
+
|
|
147
|
+
begin
|
|
148
|
+
environment.interact
|
|
149
|
+
rescue Exception => exception
|
|
150
|
+
puts exception, exception.backtrace
|
|
151
|
+
puts environment.inspect
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
#Control population.
|
|
155
|
+
environment.objects.shift while environment.objects.length > @max_population
|
|
156
|
+
|
|
157
|
+
#Determine how much time is left in this frame.
|
|
158
|
+
time_left_in_frame = time_per_frame - clock.elapsed_time
|
|
159
|
+
#Sleep for the remaining time.
|
|
160
|
+
if time_left_in_frame > 0
|
|
161
|
+
sleep time_left_in_frame
|
|
162
|
+
#Skip a frame if things are going too slow.
|
|
163
|
+
else
|
|
164
|
+
sleep time_per_frame
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
rescue Exception => exception
|
|
170
|
+
puts exception, exception.backtrace
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
#Start a network service.
|
|
176
|
+
DRb.start_service(
|
|
177
|
+
@url,
|
|
178
|
+
environment
|
|
179
|
+
)
|
|
180
|
+
#Display our URI.
|
|
181
|
+
puts "Zyps server active at #{DRb.uri}"
|
|
182
|
+
|
|
183
|
+
#Disable file system access.
|
|
184
|
+
$SAFE = 2
|
|
185
|
+
|
|
186
|
+
#Activate the GUI.
|
|
187
|
+
Gtk.main
|
|
188
|
+
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
#Set attributes according to command-line arguments.
|
|
193
|
+
def process_options(arguments)
|
|
194
|
+
|
|
195
|
+
#Set up option parser.
|
|
196
|
+
options = OptionParser.new
|
|
197
|
+
|
|
198
|
+
#Define valid options.
|
|
199
|
+
options.on("-h", "--help", TrueClass, "Display program help.") {
|
|
200
|
+
puts options.help
|
|
201
|
+
exit
|
|
202
|
+
}
|
|
203
|
+
options.on(
|
|
204
|
+
"-m",
|
|
205
|
+
"--max-population [number]",
|
|
206
|
+
Integer,
|
|
207
|
+
"The maximum number of allowed game objects. #{DEFAULT_MAX_POPULATION} by default."
|
|
208
|
+
) {|value| @max_population = value}
|
|
209
|
+
options.on(
|
|
210
|
+
"-s",
|
|
211
|
+
"--max-speed [number]",
|
|
212
|
+
Integer,
|
|
213
|
+
"The fastest an object can go. #{DEFAULT_MAX_SPEED ? DEFAULT_MAX_SPEED : 'No limit'} by default."
|
|
214
|
+
) {|value| @max_speed = value}
|
|
215
|
+
options.on(
|
|
216
|
+
"-n",
|
|
217
|
+
"--no-enclosure",
|
|
218
|
+
"Disables the barrier that normally keeps objects on the screen."
|
|
219
|
+
) {|value| @enclosure = false}
|
|
220
|
+
options.on(
|
|
221
|
+
"-u",
|
|
222
|
+
"--url [url]",
|
|
223
|
+
String,
|
|
224
|
+
"dRuby URL to run the server on. If not defined, one will be selected and printed to STDOUT."
|
|
225
|
+
) {|value| @url = value}
|
|
226
|
+
options.on(
|
|
227
|
+
"-f",
|
|
228
|
+
"--fps [frames]",
|
|
229
|
+
Integer,
|
|
230
|
+
"Number of frames to draw per second. #{DEFAULT_FPS} by default."
|
|
231
|
+
) {|value| @fps = value}
|
|
232
|
+
options.on(
|
|
233
|
+
"--view-width [pixels]",
|
|
234
|
+
Integer,
|
|
235
|
+
"Window width. #{DEFAULT_VIEW_WIDTH} by default."
|
|
236
|
+
) {|value| @view_width = value}
|
|
237
|
+
options.on(
|
|
238
|
+
"--view-height [pixels]",
|
|
239
|
+
Integer,
|
|
240
|
+
"Window height. #{DEFAULT_VIEW_HEIGHT} by default."
|
|
241
|
+
) {|value| @view_height = value}
|
|
242
|
+
|
|
243
|
+
#Parse the options, printing usage if parsing fails.
|
|
244
|
+
options.parse(arguments) rescue puts "#{$!}\nType '#{$0} --help' for valid options."
|
|
245
|
+
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
begin
|
|
253
|
+
#Create a server.
|
|
254
|
+
server = EnvironmentServer.new
|
|
255
|
+
#Parse the command line.
|
|
256
|
+
server.process_options(ARGV)
|
|
257
|
+
#Start the server.
|
|
258
|
+
server.main
|
|
259
|
+
rescue => exception
|
|
260
|
+
#Print error to STDERR and exit with an abnormal status.
|
|
261
|
+
abort "Error: " + exception.message + exception.backtrace.join("\n")
|
|
262
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Module: Zyps</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Module</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Zyps</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../files/lib/zyps_rb.html">
|
|
59
|
+
lib/zyps.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
<a href="../files/lib/zyps/actions_rb.html">
|
|
63
|
+
lib/zyps/actions.rb
|
|
64
|
+
</a>
|
|
65
|
+
<br />
|
|
66
|
+
<a href="../files/lib/zyps/environmental_factors_rb.html">
|
|
67
|
+
lib/zyps/environmental_factors.rb
|
|
68
|
+
</a>
|
|
69
|
+
<br />
|
|
70
|
+
<a href="../files/lib/zyps/conditions_rb.html">
|
|
71
|
+
lib/zyps/conditions.rb
|
|
72
|
+
</a>
|
|
73
|
+
<br />
|
|
74
|
+
<a href="../files/lib/zyps/views/trails_rb.html">
|
|
75
|
+
lib/zyps/views/trails.rb
|
|
76
|
+
</a>
|
|
77
|
+
<br />
|
|
78
|
+
</td>
|
|
79
|
+
</tr>
|
|
80
|
+
|
|
81
|
+
</table>
|
|
82
|
+
</div>
|
|
83
|
+
<!-- banner header -->
|
|
84
|
+
|
|
85
|
+
<div id="bodyContent">
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<div id="contextContent">
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<!-- if includes -->
|
|
100
|
+
|
|
101
|
+
<div id="section">
|
|
102
|
+
|
|
103
|
+
<div id="class-list">
|
|
104
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
|
105
|
+
|
|
106
|
+
Module <a href="Zyps/Utility.html" class="link">Zyps::Utility</a><br />
|
|
107
|
+
Class <a href="Zyps/AccelerateAction.html" class="link">Zyps::AccelerateAction</a><br />
|
|
108
|
+
Class <a href="Zyps/Accelerator.html" class="link">Zyps::Accelerator</a><br />
|
|
109
|
+
Class <a href="Zyps/Action.html" class="link">Zyps::Action</a><br />
|
|
110
|
+
Class <a href="Zyps/AgeCondition.html" class="link">Zyps::AgeCondition</a><br />
|
|
111
|
+
Class <a href="Zyps/ApproachAction.html" class="link">Zyps::ApproachAction</a><br />
|
|
112
|
+
Class <a href="Zyps/Behavior.html" class="link">Zyps::Behavior</a><br />
|
|
113
|
+
Class <a href="Zyps/BlendAction.html" class="link">Zyps::BlendAction</a><br />
|
|
114
|
+
Class <a href="Zyps/Clock.html" class="link">Zyps::Clock</a><br />
|
|
115
|
+
Class <a href="Zyps/CollisionCondition.html" class="link">Zyps::CollisionCondition</a><br />
|
|
116
|
+
Class <a href="Zyps/Color.html" class="link">Zyps::Color</a><br />
|
|
117
|
+
Class <a href="Zyps/Condition.html" class="link">Zyps::Condition</a><br />
|
|
118
|
+
Class <a href="Zyps/Creature.html" class="link">Zyps::Creature</a><br />
|
|
119
|
+
Class <a href="Zyps/DestroyAction.html" class="link">Zyps::DestroyAction</a><br />
|
|
120
|
+
Class <a href="Zyps/EatAction.html" class="link">Zyps::EatAction</a><br />
|
|
121
|
+
Class <a href="Zyps/Enclosure.html" class="link">Zyps::Enclosure</a><br />
|
|
122
|
+
Class <a href="Zyps/Environment.html" class="link">Zyps::Environment</a><br />
|
|
123
|
+
Class <a href="Zyps/EnvironmentalFactor.html" class="link">Zyps::EnvironmentalFactor</a><br />
|
|
124
|
+
Class <a href="Zyps/FaceAction.html" class="link">Zyps::FaceAction</a><br />
|
|
125
|
+
Class <a href="Zyps/FleeAction.html" class="link">Zyps::FleeAction</a><br />
|
|
126
|
+
Class <a href="Zyps/Friction.html" class="link">Zyps::Friction</a><br />
|
|
127
|
+
Class <a href="Zyps/GameObject.html" class="link">Zyps::GameObject</a><br />
|
|
128
|
+
Class <a href="Zyps/Gravity.html" class="link">Zyps::Gravity</a><br />
|
|
129
|
+
Class <a href="Zyps/Location.html" class="link">Zyps::Location</a><br />
|
|
130
|
+
Class <a href="Zyps/NoMatchException.html" class="link">Zyps::NoMatchException</a><br />
|
|
131
|
+
Class <a href="Zyps/PopulationLimit.html" class="link">Zyps::PopulationLimit</a><br />
|
|
132
|
+
Class <a href="Zyps/ProximityCondition.html" class="link">Zyps::ProximityCondition</a><br />
|
|
133
|
+
Class <a href="Zyps/PullAction.html" class="link">Zyps::PullAction</a><br />
|
|
134
|
+
Class <a href="Zyps/PushAction.html" class="link">Zyps::PushAction</a><br />
|
|
135
|
+
Class <a href="Zyps/SpeedLimit.html" class="link">Zyps::SpeedLimit</a><br />
|
|
136
|
+
Class <a href="Zyps/TagAction.html" class="link">Zyps::TagAction</a><br />
|
|
137
|
+
Class <a href="Zyps/TagCondition.html" class="link">Zyps::TagCondition</a><br />
|
|
138
|
+
Class <a href="Zyps/TrailsView.html" class="link">Zyps::TrailsView</a><br />
|
|
139
|
+
Class <a href="Zyps/TurnAction.html" class="link">Zyps::TurnAction</a><br />
|
|
140
|
+
Class <a href="Zyps/Vector.html" class="link">Zyps::Vector</a><br />
|
|
141
|
+
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
<!-- if method_list -->
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
<div id="validator-badges">
|
|
157
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
</body>
|
|
161
|
+
</html>
|