draco 0.6.0 → 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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +1 -1
- data/{.github/contributing.md → CONTRIBUTING.md} +1 -1
- data/README.md +24 -2
- data/Smaug.toml +25 -0
- data/lib/draco.rb +6 -1
- data/lib/draco/benchmark.rb +8 -7
- data/template/components/index.rb +0 -0
- data/template/entities/index.rb +0 -0
- data/template/systems/index.rb +0 -0
- data/template/worlds/index.rb +0 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9955958e60677a5a301412d5256c3ab226a84f6b265891b543a454d8c5c899eb
|
4
|
+
data.tar.gz: 07a7c1741b363f2ea0ac2ae8eb84429364b3817b2b81db22111cd28c3197699b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c344a3ceac8143b6540b95a3f19cb7d5789ec40a2f6b75d44ec5fa82cfe9e76276bcc106e3fc56fb5d3aa34727b53afabd4f57a876af62a8a25ad4faf16d7ece
|
7
|
+
data.tar.gz: d0cc5124953b2a83d771c35332908a72912b660a180e087425d5606233d89b42d7a7c75bc65ea2f9acba5e5dc9fea49a0d8aa3bbeb0127a5410042e6fe35e417
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
## Legal
|
4
4
|
|
5
|
-
By submitting a Pull Request, you disavow any rights or claims to any changes submitted to the
|
5
|
+
By submitting a Pull Request, you disavow any rights or claims to any changes submitted to the Draco project and assign the copyright of those changes to Big Refactor LLC.
|
6
6
|
|
7
7
|
If you cannot or do not want to reassign those rights (your employment contract for your employer may not allow this), you should not submit a PR. Open an issue and someone else can do the work.
|
data/README.md
CHANGED
@@ -6,6 +6,21 @@ An Entity Component System is an architectural framework that decouples game obj
|
|
6
6
|
build game objects through composition. This allows you to easily share small logic components between different game
|
7
7
|
objects.
|
8
8
|
|
9
|
+
## Table of Contents
|
10
|
+
|
11
|
+
1. [Sample Application](https://github.com/guitsaru/draco#sample-application)
|
12
|
+
2. [Installation](https://github.com/guitsaru/draco#installation)
|
13
|
+
3. [Support](https://github.com/guitsaru/draco#support)
|
14
|
+
4. [Versioning](https://github.com/guitsaru/draco#versioning)
|
15
|
+
5. [Usage](https://github.com/guitsaru/draco#usage)
|
16
|
+
1. [Components](https://github.com/guitsaru/draco#components)
|
17
|
+
2. [Entities](https://github.com/guitsaru/draco#entities)
|
18
|
+
3. [Systems](https://github.com/guitsaru/draco#systems)
|
19
|
+
4. [Worlds](https://github.com/guitsaru/draco#worlds)
|
20
|
+
6. [Plugins](https://github.com/guitsaru/draco#plugins)
|
21
|
+
7. [Resources](https://github.com/guitsaru/draco#learn-more)
|
22
|
+
8. [Commercial License](https://github.com/guitsaru/draco#commercial-license)
|
23
|
+
|
9
24
|
## Sample Application
|
10
25
|
|
11
26
|
This repository includes sample applications in the `samples/` directory.
|
@@ -178,7 +193,7 @@ end
|
|
178
193
|
world = Overworld.new
|
179
194
|
```
|
180
195
|
|
181
|
-
|
196
|
+
#### Named Entities
|
182
197
|
|
183
198
|
If there are entities that are frequently accessed in our systems, we can give these a name. In the above example, our
|
184
199
|
player entity has been given the name `player`. We can now access this directly from our world:
|
@@ -187,7 +202,7 @@ player entity has been given the name `player`. We can now access this directly
|
|
187
202
|
world.player
|
188
203
|
```
|
189
204
|
|
190
|
-
|
205
|
+
#### Fetching entities by id
|
191
206
|
|
192
207
|
In some cases you'll want to keep track of entities by their id, such as when you want to keep track of another entity in a component.
|
193
208
|
|
@@ -200,6 +215,13 @@ world.entities[12] == entity
|
|
200
215
|
# => true
|
201
216
|
```
|
202
217
|
|
218
|
+
## Plugins
|
219
|
+
|
220
|
+
* [Draco::Events](https://github.com/guitsaru/draco-events) - On demand system dispatch and component observers.
|
221
|
+
* [Draco::Scenes](https://github.com/guitsaru/draco-scenes) - Quickly switch out entities and systems in a world.
|
222
|
+
* [Draco::State](https://github.com/guitsaru/draco-state) - Define a set of components on an entity that are mutually exclusive.
|
223
|
+
* [Draco::Periodic](https://github.com/guitsaru/draco-periodic) - Make a system run every n ticks instead of every tick.
|
224
|
+
|
203
225
|
## Learn More
|
204
226
|
|
205
227
|
Here are some good resources to learn about Entity Component Systems
|
data/Smaug.toml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
[package]
|
2
|
+
name = "draco"
|
3
|
+
version = "0.6.1"
|
4
|
+
homepage = "https://github.com/guitsaru/draco"
|
5
|
+
documentation = "https://github.com/guitsaru/draco"
|
6
|
+
authors = ["Matt Pruitt <matt@guitsaru.com>"]
|
7
|
+
keywords = ["ECS"]
|
8
|
+
|
9
|
+
requires = [
|
10
|
+
"lib/draco.rb",
|
11
|
+
"app/components/index.rb",
|
12
|
+
"app/entities/index.rb",
|
13
|
+
"app/systems/index.rb",
|
14
|
+
"app/worlds/index.rb"
|
15
|
+
]
|
16
|
+
|
17
|
+
[dragonruby]
|
18
|
+
version = "2.3"
|
19
|
+
edition = "standard"
|
20
|
+
|
21
|
+
[package.installs]
|
22
|
+
"template/components/index.rb" = "app/components/index.rb"
|
23
|
+
"template/entities/index.rb" = "app/entities/index.rb"
|
24
|
+
"template/systems/index.rb" = "app/systems/index.rb"
|
25
|
+
"template/worlds/index.rb" = "app/worlds/index.rb"
|
data/lib/draco.rb
CHANGED
@@ -7,7 +7,7 @@ module Draco
|
|
7
7
|
class NotAComponentError < StandardError; end
|
8
8
|
|
9
9
|
# Public: The version of the library. Draco uses semver to version releases.
|
10
|
-
VERSION = "0.6.
|
10
|
+
VERSION = "0.6.1"
|
11
11
|
|
12
12
|
# Public: A general purpose game object that consists of a unique id and a collection of Components.
|
13
13
|
class Entity
|
@@ -847,6 +847,11 @@ module Draco
|
|
847
847
|
self
|
848
848
|
end
|
849
849
|
|
850
|
+
# Internal: alias of merge
|
851
|
+
def +(other)
|
852
|
+
merge(other)
|
853
|
+
end
|
854
|
+
|
850
855
|
# Internal: Returns an Enumerator for all of the entries in the Set.
|
851
856
|
def each(&block)
|
852
857
|
@hash.keys.each(&block)
|
data/lib/draco/benchmark.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Public: The Draco ECS library.
|
3
4
|
module Draco
|
4
5
|
# Public: Calculates the average time of
|
5
6
|
module Benchmark
|
6
7
|
def self.included(mod)
|
7
|
-
mod.prepend(
|
8
|
+
mod.prepend(WorldPlugin)
|
8
9
|
end
|
9
10
|
|
10
|
-
# Internal:
|
11
|
-
module
|
11
|
+
# Internal: The module containing the benchmark plugin for Draco::World.
|
12
|
+
module WorldPlugin
|
12
13
|
def before_tick(context)
|
13
|
-
super
|
14
14
|
@system_timer_data = Hash.new { |h, k| h[k] = [] }
|
15
|
-
|
15
|
+
super.each { |system| system.class.prepend(SystemPlugin) }
|
16
16
|
end
|
17
17
|
|
18
18
|
def after_tick(context, results)
|
@@ -21,6 +21,7 @@ module Draco
|
|
21
21
|
name = Draco.underscore(system.class.name.to_s).to_sym
|
22
22
|
@system_timer_data[name] = (system.timer * 1000.0).round(5)
|
23
23
|
end
|
24
|
+
puts @system_timer_data.inspect if (context.tick_count % 10).zero?
|
24
25
|
end
|
25
26
|
|
26
27
|
def system_timers
|
@@ -28,8 +29,8 @@ module Draco
|
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
31
|
-
# Internal:
|
32
|
-
module
|
32
|
+
# Internal: The module containing the benchmark plugin for Draco::System.
|
33
|
+
module SystemPlugin
|
33
34
|
def after_initialize
|
34
35
|
super
|
35
36
|
@timer = 0
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Pruitt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A library for Entities, Components, and Systems in games.
|
14
14
|
email:
|
@@ -17,7 +17,6 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- ".github/contributing.md"
|
21
20
|
- ".github/workflows/ruby.yml"
|
22
21
|
- ".gitignore"
|
23
22
|
- ".rspec"
|
@@ -25,17 +24,23 @@ files:
|
|
25
24
|
- CHANGELOG.md
|
26
25
|
- CODE_OF_CONDUCT.md
|
27
26
|
- COMM-LICENSE
|
27
|
+
- CONTRIBUTING.md
|
28
28
|
- Gemfile
|
29
29
|
- Gemfile.lock
|
30
30
|
- LICENSE
|
31
31
|
- README.md
|
32
32
|
- Rakefile
|
33
|
+
- Smaug.toml
|
33
34
|
- benchmark.rb
|
34
35
|
- bin/console
|
35
36
|
- bin/setup
|
36
37
|
- draco.gemspec
|
37
38
|
- lib/draco.rb
|
38
39
|
- lib/draco/benchmark.rb
|
40
|
+
- template/components/index.rb
|
41
|
+
- template/entities/index.rb
|
42
|
+
- template/systems/index.rb
|
43
|
+
- template/worlds/index.rb
|
39
44
|
homepage: https://github.com/guitsaru/draco
|
40
45
|
licenses: []
|
41
46
|
metadata:
|