gamefic-sdk 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +158 -158
- data/lib/gamefic-sdk/tasks/web.rb +1 -1
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scaffolds/project/lib/__name__/chapter.rb.gf.erb +1 -1
- data/scaffolds/project/lib/__name__/common.rb.gf.erb +13 -0
- data/scaffolds/project/lib/__name__/plot.rb.gf.erb +3 -5
- data/scaffolds/project/lib/__name__/subplot.rb.gf.erb +1 -1
- data/scaffolds/project/lib/__name__.rb.gf.erb +2 -1
- data/scaffolds/project/spec/__name__/plot_spec.rb.gf.erb +2 -0
- data/scaffolds/project/spec/__name__/subplot_spec.rb.gf.erb +2 -0
- data/scaffolds/project/spec/gameplay_spec.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fa038497ffa370ceb79dc943824850c60d6cf67b71c39191ab0220a4277b72e
|
4
|
+
data.tar.gz: 83891f88d0ccad744ca541fb235ed531b11bc525f2814a8766f423d12fcea21f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b0851ee5fa6100379e88fbf866060a8360b18bc6f294e8d358f833aae68ba057111a97651bda50aea7c61be40bd22696d8ff5f52bd6c2d379f9c3331abd420a
|
7
|
+
data.tar.gz: 49c7b1e652fe7482b6bce546877a8073189546d7ebf09a29fe091729b28b65008f90a1060bd4a4a44daab3310d8e9b676c2476c629640d8ddc9c2483d0916542
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
## 3.
|
1
|
+
## 3.4.0 - October 19, 2024
|
2
|
+
- Reorder project requires
|
3
|
+
- Add Common module to project scaffold
|
4
|
+
- Lock gamefic-sdk-3 to react-gamefic-1
|
5
|
+
|
6
|
+
## 3.3.0 - September 10, 2024
|
2
7
|
- Add chapter to project scaffold
|
3
8
|
- Remove superfluous no_scripts calls
|
4
9
|
|
data/README.md
CHANGED
@@ -1,158 +1,158 @@
|
|
1
|
-
# Gamefic SDK
|
2
|
-
|
3
|
-
**A Ruby Interactive Fiction Framework**
|
4
|
-
|
5
|
-
The Gamefic SDK provides development tools for writing games and interactive fiction with Gamefic.
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Install the gem:
|
10
|
-
|
11
|
-
$ gem install gamefic-sdk
|
12
|
-
|
13
|
-
## Usage
|
14
|
-
|
15
|
-
This section provides a fast and simple introduction to using the SDK. Go to
|
16
|
-
the [Gamefic website](https://gamefic.com) for in-depth guides and
|
17
|
-
documentation.
|
18
|
-
|
19
|
-
### Creating a New Project
|
20
|
-
|
21
|
-
Create a new project and go to its directory:
|
22
|
-
|
23
|
-
$ gamefic init my_game
|
24
|
-
$ cd my_game
|
25
|
-
|
26
|
-
Test the project by running the game on the command line:
|
27
|
-
|
28
|
-
$ rake ruby:run
|
29
|
-
|
30
|
-
The Ruby game works like a traditional text adventure:
|
31
|
-
|
32
|
-
Hello, world!
|
33
|
-
>
|
34
|
-
|
35
|
-
You can enter commands at the `>` prompt, but you haven't written any content,
|
36
|
-
so there's not much to do yet. Enter `QUIT` to exit the game.
|
37
|
-
|
38
|
-
### The Script Code
|
39
|
-
|
40
|
-
The plot for your narrative is defined in the `plot.rb` file. It should look
|
41
|
-
something like this:
|
42
|
-
|
43
|
-
```ruby
|
44
|
-
module Example
|
45
|
-
class Plot < Gamefic::Plot
|
46
|
-
UUID = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
47
|
-
|
48
|
-
include Gamefic::Standard
|
49
|
-
|
50
|
-
script do
|
51
|
-
introduction do |actor|
|
52
|
-
actor.tell "Hello, world!"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
```
|
58
|
-
|
59
|
-
`UUID` is a globally unique identifier. It can be useful if you want to
|
60
|
-
add your game to online catalogs, such as the [Interactive Fiction Database](https://ifdb.tads.org/),
|
61
|
-
but it's safe to delete if you don't need it.
|
62
|
-
|
63
|
-
['gamefic-standard'](https://github.com/castwide/gamefic-standard) is a collection
|
64
|
-
of baseline features that are frequently useful for interactive fiction. [Inform](http://inform7.com/)
|
65
|
-
developers should find it similar to Inform's Standard Rules. It defines common
|
66
|
-
components like Rooms and Characters, along with in-game commands like `GO`,
|
67
|
-
`GET`, and `DROP` to enable basic interactivity.
|
68
|
-
|
69
|
-
`script` is where you write the story itself. In the starter project,
|
70
|
-
the only thing in the script is an introductory message.
|
71
|
-
|
72
|
-
### Modifying the Script
|
73
|
-
|
74
|
-
Replace the contents of `plot.rb` with the following:
|
75
|
-
|
76
|
-
```ruby
|
77
|
-
module Example
|
78
|
-
class Plot < Gamefic::Plot
|
79
|
-
UUID = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
80
|
-
|
81
|
-
include Gamefic::Standard
|
82
|
-
|
83
|
-
seed do
|
84
|
-
@living_room = make Room, name: 'living room', description: 'This is your living room.'
|
85
|
-
@bedroom = make Room, name: 'bedroom', description: 'This is your bedroom.'
|
86
|
-
connect @living_room, @bedroom, 'north'
|
87
|
-
@backpack = make Room, name: 'backpack', description: 'Your trusty backpack.', parent: @bedroom
|
88
|
-
@book = make Room, name: 'book', description: 'Your favorite novel.', parent: @living_room
|
89
|
-
end
|
90
|
-
|
91
|
-
script do
|
92
|
-
introduction do |actor|
|
93
|
-
actor.parent = @living_room
|
94
|
-
actor.tell "You're in your house."
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
```
|
100
|
-
|
101
|
-
Enter `rake ruby:run` to test the game. Now that it has rooms and objects, you
|
102
|
-
can perform in-game commands like `LOOK AROUND`, `GO NORTH`, and `TAKE THE BACKPACK`.
|
103
|
-
|
104
|
-
### Making Games for the Web
|
105
|
-
|
106
|
-
The default game project includes tasks for building "web" apps using HTML,
|
107
|
-
CSS, and JavaScript. Generate the code for a web build with the following
|
108
|
-
command:
|
109
|
-
|
110
|
-
```
|
111
|
-
$ rake web:generate
|
112
|
-
```
|
113
|
-
|
114
|
-
Test the game in a browser by starting a server:
|
115
|
-
|
116
|
-
```
|
117
|
-
$ rake web:run
|
118
|
-
```
|
119
|
-
|
120
|
-
Open `http://localhost:9000` to run the game in debug mode.
|
121
|
-
|
122
|
-
Build a standalone web game:
|
123
|
-
|
124
|
-
```
|
125
|
-
$ rake web:build
|
126
|
-
```
|
127
|
-
|
128
|
-
The game's HTML file and related assets will be generated in the
|
129
|
-
`web/build` directory. The SDK uses opal](https://github.com/opal/opal)
|
130
|
-
to compile Ruby code to JavaScript, so the web build does not require a
|
131
|
-
Ruby interpreter. Open `index.html` in a browser to play the game.
|
132
|
-
|
133
|
-
Note: building the web app requires [Node.js](https://nodejs.org).
|
134
|
-
|
135
|
-
### Example Projects
|
136
|
-
|
137
|
-
The gamefic-sdk repo includes several example projects that provide more
|
138
|
-
complete demonstrations of Gamefic's features. To run an example, copy
|
139
|
-
its `plot.rb` file to your own project.
|
140
|
-
|
141
|
-
### Learning More
|
142
|
-
|
143
|
-
Go to the [Gamefic website](https://gamefic.com) for more information about
|
144
|
-
developing and building apps with Gamefic.
|
145
|
-
|
146
|
-
## Development
|
147
|
-
|
148
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
149
|
-
|
150
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
151
|
-
|
152
|
-
## Contributing
|
153
|
-
|
154
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/castwide/gamefic-sdk.
|
155
|
-
|
156
|
-
## License
|
157
|
-
|
158
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
1
|
+
# Gamefic SDK
|
2
|
+
|
3
|
+
**A Ruby Interactive Fiction Framework**
|
4
|
+
|
5
|
+
The Gamefic SDK provides development tools for writing games and interactive fiction with Gamefic.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem:
|
10
|
+
|
11
|
+
$ gem install gamefic-sdk
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
This section provides a fast and simple introduction to using the SDK. Go to
|
16
|
+
the [Gamefic website](https://gamefic.com) for in-depth guides and
|
17
|
+
documentation.
|
18
|
+
|
19
|
+
### Creating a New Project
|
20
|
+
|
21
|
+
Create a new project and go to its directory:
|
22
|
+
|
23
|
+
$ gamefic init my_game
|
24
|
+
$ cd my_game
|
25
|
+
|
26
|
+
Test the project by running the game on the command line:
|
27
|
+
|
28
|
+
$ rake ruby:run
|
29
|
+
|
30
|
+
The Ruby game works like a traditional text adventure:
|
31
|
+
|
32
|
+
Hello, world!
|
33
|
+
>
|
34
|
+
|
35
|
+
You can enter commands at the `>` prompt, but you haven't written any content,
|
36
|
+
so there's not much to do yet. Enter `QUIT` to exit the game.
|
37
|
+
|
38
|
+
### The Script Code
|
39
|
+
|
40
|
+
The plot for your narrative is defined in the `plot.rb` file. It should look
|
41
|
+
something like this:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
module Example
|
45
|
+
class Plot < Gamefic::Plot
|
46
|
+
UUID = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
47
|
+
|
48
|
+
include Gamefic::Standard
|
49
|
+
|
50
|
+
script do
|
51
|
+
introduction do |actor|
|
52
|
+
actor.tell "Hello, world!"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
`UUID` is a globally unique identifier. It can be useful if you want to
|
60
|
+
add your game to online catalogs, such as the [Interactive Fiction Database](https://ifdb.tads.org/),
|
61
|
+
but it's safe to delete if you don't need it.
|
62
|
+
|
63
|
+
['gamefic-standard'](https://github.com/castwide/gamefic-standard) is a collection
|
64
|
+
of baseline features that are frequently useful for interactive fiction. [Inform](http://inform7.com/)
|
65
|
+
developers should find it similar to Inform's Standard Rules. It defines common
|
66
|
+
components like Rooms and Characters, along with in-game commands like `GO`,
|
67
|
+
`GET`, and `DROP` to enable basic interactivity.
|
68
|
+
|
69
|
+
`script` is where you write the story itself. In the starter project,
|
70
|
+
the only thing in the script is an introductory message.
|
71
|
+
|
72
|
+
### Modifying the Script
|
73
|
+
|
74
|
+
Replace the contents of `plot.rb` with the following:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
module Example
|
78
|
+
class Plot < Gamefic::Plot
|
79
|
+
UUID = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
80
|
+
|
81
|
+
include Gamefic::Standard
|
82
|
+
|
83
|
+
seed do
|
84
|
+
@living_room = make Room, name: 'living room', description: 'This is your living room.'
|
85
|
+
@bedroom = make Room, name: 'bedroom', description: 'This is your bedroom.'
|
86
|
+
connect @living_room, @bedroom, 'north'
|
87
|
+
@backpack = make Room, name: 'backpack', description: 'Your trusty backpack.', parent: @bedroom
|
88
|
+
@book = make Room, name: 'book', description: 'Your favorite novel.', parent: @living_room
|
89
|
+
end
|
90
|
+
|
91
|
+
script do
|
92
|
+
introduction do |actor|
|
93
|
+
actor.parent = @living_room
|
94
|
+
actor.tell "You're in your house."
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
```
|
100
|
+
|
101
|
+
Enter `rake ruby:run` to test the game. Now that it has rooms and objects, you
|
102
|
+
can perform in-game commands like `LOOK AROUND`, `GO NORTH`, and `TAKE THE BACKPACK`.
|
103
|
+
|
104
|
+
### Making Games for the Web
|
105
|
+
|
106
|
+
The default game project includes tasks for building "web" apps using HTML,
|
107
|
+
CSS, and JavaScript. Generate the code for a web build with the following
|
108
|
+
command:
|
109
|
+
|
110
|
+
```
|
111
|
+
$ rake web:generate
|
112
|
+
```
|
113
|
+
|
114
|
+
Test the game in a browser by starting a server:
|
115
|
+
|
116
|
+
```
|
117
|
+
$ rake web:run
|
118
|
+
```
|
119
|
+
|
120
|
+
Open `http://localhost:9000` to run the game in debug mode.
|
121
|
+
|
122
|
+
Build a standalone web game:
|
123
|
+
|
124
|
+
```
|
125
|
+
$ rake web:build
|
126
|
+
```
|
127
|
+
|
128
|
+
The game's HTML file and related assets will be generated in the
|
129
|
+
`web/build` directory. The SDK uses opal](https://github.com/opal/opal)
|
130
|
+
to compile Ruby code to JavaScript, so the web build does not require a
|
131
|
+
Ruby interpreter. Open `index.html` in a browser to play the game.
|
132
|
+
|
133
|
+
Note: building the web app requires [Node.js](https://nodejs.org).
|
134
|
+
|
135
|
+
### Example Projects
|
136
|
+
|
137
|
+
The gamefic-sdk repo includes several example projects that provide more
|
138
|
+
complete demonstrations of Gamefic's features. To run an example, copy
|
139
|
+
its `plot.rb` file to your own project.
|
140
|
+
|
141
|
+
### Learning More
|
142
|
+
|
143
|
+
Go to the [Gamefic website](https://gamefic.com) for more information about
|
144
|
+
developing and building apps with Gamefic.
|
145
|
+
|
146
|
+
## Development
|
147
|
+
|
148
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
149
|
+
|
150
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
151
|
+
|
152
|
+
## Contributing
|
153
|
+
|
154
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/castwide/gamefic-sdk.
|
155
|
+
|
156
|
+
## License
|
157
|
+
|
158
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -12,7 +12,7 @@ module Gamefic
|
|
12
12
|
|
13
13
|
# Generate a web app using NPM.
|
14
14
|
#
|
15
|
-
def generate version = '@
|
15
|
+
def generate version = '@1.6.1'
|
16
16
|
puts "Node version #{check_for_npm} detected. Preparing the web app..."
|
17
17
|
web_path = File.join(absolute_path, 'web')
|
18
18
|
FileUtils.mkdir_p web_path
|
data/lib/gamefic-sdk/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module <%= camelcase(name) %>
|
4
|
+
# A single container for modules that are shared among plots, chapters, and
|
5
|
+
# subplots.
|
6
|
+
#
|
7
|
+
module Common
|
8
|
+
extend Gamefic::Scriptable
|
9
|
+
|
10
|
+
include Gamefic::Standard
|
11
|
+
# Add more shared modules here
|
12
|
+
end
|
13
|
+
end
|
@@ -6,12 +6,10 @@ module <%= camelcase(name) %>
|
|
6
6
|
class Plot < Gamefic::Plot
|
7
7
|
UUID = 'fe5d62a7-7036-45c0-b5cb-39c336bf1b5a'
|
8
8
|
|
9
|
-
include
|
9
|
+
include Common
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
actor.tell "Hello, world!"
|
14
|
-
end
|
11
|
+
introduction do |actor|
|
12
|
+
actor.tell "Hello, world!"
|
15
13
|
end
|
16
14
|
end
|
17
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gamefic
|
@@ -248,6 +248,7 @@ files:
|
|
248
248
|
- scaffolds/project/Rakefile.gf.erb
|
249
249
|
- scaffolds/project/lib/__name__.rb.gf.erb
|
250
250
|
- scaffolds/project/lib/__name__/chapter.rb.gf.erb
|
251
|
+
- scaffolds/project/lib/__name__/common.rb.gf.erb
|
251
252
|
- scaffolds/project/lib/__name__/plot.rb.gf.erb
|
252
253
|
- scaffolds/project/lib/__name__/subplot.rb.gf.erb
|
253
254
|
- scaffolds/project/main.rb.gf.erb
|