game_machine 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6449a7bde96b3fed4008f28d7da02e1c502e717
4
- data.tar.gz: 02158de245f44f5738e9d5db1818e195a891e447
3
+ metadata.gz: 99584a580fcb46287f1510e15f5eeb6c31a0a02d
4
+ data.tar.gz: 3969eb2639475bdcd43849b159eb3725a708f862
5
5
  SHA512:
6
- metadata.gz: 4cef021441c53470b50ae5ddfe74ea0898f2aff46f601b9bca284a53665c0702503a86fa37f2a12d5759c8e6357597dee92a1a28f90b68aa74793815582cdf04
7
- data.tar.gz: b8678ed444e55f9634e81ef6de5f4f3db4ba0246abdf00ef6a8dd39ca19062de5a0e1481cdb5711c6f52a175e0b599f590b5d9715a71a2b362b1024017c577cf
6
+ metadata.gz: f37531bd3d9207336ecaa0685523ce0be204f3a573b99edb6d1f7e708c7bd269b505f2759f30d0e8a08334757449c6059e14fae7ada16954ea9cb4990776f3cf
7
+ data.tar.gz: 5339212baf3d33ecad28a39063359748b5ba94121801330846294e065b83841ffa6803f2e9aa6a2d5e5d4b82931c46575407ec4e146fd9bba7cbb6155e13c5e0
@@ -23,7 +23,7 @@ development:
23
23
  # router size for the udp actor that handles all incoming upd messages
24
24
  udp_routers: 10
25
25
  # What data store the object database will use (one of memory, mapdb, or couchbase)
26
- data_store: memory
26
+ data_store: mapdb
27
27
  # Advanced settings for write behind cache. -1 disables. This is fine for
28
28
  # all but large games with high traffic (hundreds of writes per second)
29
29
  cache_write_interval: -1
@@ -66,7 +66,7 @@ development:
66
66
  game_handler_routers: 10
67
67
  request_handler_routers: 10
68
68
  udp_routers: 10
69
- data_store: memory
69
+ data_store: mapdb
70
70
  cache_write_interval: -1
71
71
  cache_writes_per_second: -1
72
72
  grids:
@@ -73,7 +73,7 @@ module Example
73
73
  if @players[player.id]
74
74
  @players[player.id][:vector].x = player.x
75
75
  @players[player.id][:vector].y = player.y
76
- @players[player.id][:vector].z = 0
76
+ @players[player.id][:vector].z = player.z
77
77
  else
78
78
  @players[player.id] = {:id => player.id, :vector => GameMachine::Vector.from(player)}
79
79
  end
@@ -35,7 +35,7 @@ module Example
35
35
 
36
36
  # Only update position if we moved
37
37
  if position_changed
38
- commands.grid.track(id,position.x,position.y,0)
38
+ commands.grid.track(id,position.x,position.y,position.z)
39
39
  @position_changed = false
40
40
  end
41
41
 
@@ -90,25 +90,19 @@ module Example
90
90
  # Save object creation by not using methods that return new vector
91
91
  x = current_target.x - position.x
92
92
  y = current_target.y - position.y
93
- dirx = GameMachine::Vector.norm(x)
94
- diry = GameMachine::Vector.norm(y)
93
+ dirx,diry = GameMachine::Vector.norm(x,y)
95
94
  position.x += dirx * speed_scale * delta_time
96
95
  position.y += diry * speed_scale * delta_time
97
96
 
98
- #direction = (current_target - position).normalize
99
- #position.x += direction.x * speed_scale * delta_time
100
- #position.y += direction.y * speed_scale * delta_time
97
+ #dir = (current_target - position).normalize
98
+ #position.x += dir.x * speed_scale * delta_time
99
+ #position.y += dir.y * speed_scale * delta_time
101
100
 
102
- # Not really what we want
103
- #position.interpolate(current_target, speed_scale * delta_time)
104
101
 
105
102
  if position.distance(current_target) > current_distance_to_target
106
103
  set_reached_target
107
104
  end
108
105
 
109
- #if id.match(/viking_499/) || id.match(/worm/)
110
- # puts "#{id}: old_distance :#{current_distance_to_target} new_distance: #{position.distance(current_target)} time: #{delta_time}"
111
- #end
112
106
  @last_move = Time.now.to_f
113
107
  @position_changed = true
114
108
  end
@@ -77,9 +77,9 @@ module GameMachine
77
77
 
78
78
  entity.set_vector3(
79
79
  MessageLib::Vector3.new.
80
- set_x(grid_value.x).
81
- set_y(grid_value.y).
82
- set_z(grid_value.z)
80
+ set_x(grid_value.x.round(4)).
81
+ set_y(grid_value.y.round(4)).
82
+ set_z(grid_value.z.round(4))
83
83
  )
84
84
 
85
85
  if EXTRA.has_key?(grid_value.id)
@@ -69,13 +69,15 @@ module GameMachine
69
69
  self.class.new( @x - v1.x, @y - v1.y )
70
70
  end
71
71
 
72
- def self.norm(i)
73
- r = 0
74
- length = Math.sqrt(i*i)
72
+ def self.norm(x,y)
73
+ dx = 0.0
74
+ dy = 0.0
75
+ length = Math.sqrt(x*x + y*y)
75
76
  if length != 0
76
- r = i * (1/length)
77
+ dx = x * (1/length)
78
+ dy = y * (1/length)
77
79
  end
78
- r
80
+ [dx,dy]
79
81
  end
80
82
 
81
83
  def normalize
@@ -1,3 +1,3 @@
1
1
  module GameMachine
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: game_machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Ochs