gen-adventure 0.1.7__tar.gz
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.
- gen_adventure-0.1.7/LICENSE +21 -0
- gen_adventure-0.1.7/PKG-INFO +255 -0
- gen_adventure-0.1.7/README.md +237 -0
- gen_adventure-0.1.7/gen_adventure/__init__.py +14 -0
- gen_adventure-0.1.7/gen_adventure/adventure.py +345 -0
- gen_adventure-0.1.7/gen_adventure/pages.py +157 -0
- gen_adventure-0.1.7/gen_adventure/story_imaginator.py +259 -0
- gen_adventure-0.1.7/gen_adventure.egg-info/PKG-INFO +255 -0
- gen_adventure-0.1.7/gen_adventure.egg-info/SOURCES.txt +12 -0
- gen_adventure-0.1.7/gen_adventure.egg-info/dependency_links.txt +1 -0
- gen_adventure-0.1.7/gen_adventure.egg-info/requires.txt +3 -0
- gen_adventure-0.1.7/gen_adventure.egg-info/top_level.txt +1 -0
- gen_adventure-0.1.7/pyproject.toml +45 -0
- gen_adventure-0.1.7/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Johnny Matos
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gen-adventure
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: Generate and play AI-powered interactive adventures.
|
|
5
|
+
Author: Johnny Matos
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DS-Johnny/gen-adventure
|
|
8
|
+
Keywords: ai,game,adventure,pygame,gemini,interactive,story,fantasy
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests
|
|
15
|
+
Requires-Dist: google-genai
|
|
16
|
+
Requires-Dist: pygame
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# Gen-Adventure
|
|
20
|
+
|
|
21
|
+
Generate and play AI-powered interactive adventures with Python, Pygame, and Google Gemini.
|
|
22
|
+
|
|
23
|
+
Gen-Adventure allows you to:
|
|
24
|
+
|
|
25
|
+
* Create interactive branching stories using Google's Gemini models.
|
|
26
|
+
* Play generated stories through a graphical interface built with Pygame.
|
|
27
|
+
* Load stories from local JSON files or remote URLs.
|
|
28
|
+
* Explore built-in example adventures.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
* AI-powered story generation using Gemini.
|
|
35
|
+
* Interactive branching adventures.
|
|
36
|
+
* Pygame graphical interface.
|
|
37
|
+
* Local and remote story support.
|
|
38
|
+
* JSON-based story format.
|
|
39
|
+
* Built-in example stories.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install gen-adventure
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Requirements
|
|
52
|
+
|
|
53
|
+
* Python 3.11+
|
|
54
|
+
* Google Gemini API Key
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Playing an Adventure
|
|
59
|
+
|
|
60
|
+
Load a local JSON story:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from gen_adventure import Adventure
|
|
64
|
+
|
|
65
|
+
game = Adventure("my_story.json")
|
|
66
|
+
game.start()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Load a story hosted online:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from gen_adventure import Adventure
|
|
73
|
+
|
|
74
|
+
game = Adventure(
|
|
75
|
+
"https://example.com/my_story.json"
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
game.start()
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Built-in Example Stories
|
|
84
|
+
|
|
85
|
+
Gen-Adventure includes several example stories hosted in the project's repository.
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from gen_adventure import Adventure, StoryExamples
|
|
89
|
+
|
|
90
|
+
examples = StoryExamples()
|
|
91
|
+
|
|
92
|
+
game = Adventure(examples.fantasy)
|
|
93
|
+
game.start()
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Available examples:
|
|
97
|
+
|
|
98
|
+
* fantasy
|
|
99
|
+
* hacker
|
|
100
|
+
* formatura
|
|
101
|
+
* love_story
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Generating Stories with Gemini
|
|
106
|
+
|
|
107
|
+
Create a story and save it as a JSON file:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from gen_adventure import StoryImaginator
|
|
111
|
+
|
|
112
|
+
imaginator = StoryImaginator()
|
|
113
|
+
|
|
114
|
+
imaginator.gemini_api_key = "YOUR_GEMINI_API_KEY"
|
|
115
|
+
|
|
116
|
+
imaginator.imagine(
|
|
117
|
+
"A cyberpunk hacker fighting an evil corporation",
|
|
118
|
+
"cyberpunk_story.json"
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The generated file can then be loaded into the game:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from gen_adventure import Adventure
|
|
126
|
+
|
|
127
|
+
game = Adventure("cyberpunk_story.json")
|
|
128
|
+
game.start()
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Story Format
|
|
134
|
+
|
|
135
|
+
Stories are stored as JSON files.
|
|
136
|
+
|
|
137
|
+
Example:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"pages": [
|
|
142
|
+
{
|
|
143
|
+
"id": 1,
|
|
144
|
+
"text": "You wake up in a mysterious forest.",
|
|
145
|
+
"options": [
|
|
146
|
+
{
|
|
147
|
+
"text": "Follow the path",
|
|
148
|
+
"target": 2
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"text": "Enter the cave",
|
|
152
|
+
"target": 3
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Each page contains:
|
|
161
|
+
|
|
162
|
+
| Field | Description |
|
|
163
|
+
| ------- | ----------------- |
|
|
164
|
+
| id | Page identifier |
|
|
165
|
+
| text | Story content |
|
|
166
|
+
| options | Available choices |
|
|
167
|
+
|
|
168
|
+
Each option contains:
|
|
169
|
+
|
|
170
|
+
| Field | Description |
|
|
171
|
+
| ------ | ---------------------------- |
|
|
172
|
+
| text | Text displayed to the player |
|
|
173
|
+
| target | Destination page |
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Customizing Colors
|
|
178
|
+
|
|
179
|
+
You can customize the interface colors:
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
from gen_adventure import Adventure
|
|
183
|
+
|
|
184
|
+
game = Adventure("story.json")
|
|
185
|
+
|
|
186
|
+
game.text_color = (255, 255, 255)
|
|
187
|
+
game.background_color = (25, 25, 25)
|
|
188
|
+
game.button_background_color = (50, 50, 50)
|
|
189
|
+
|
|
190
|
+
game.start()
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Example Workflow
|
|
196
|
+
|
|
197
|
+
Generate a story:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
from gen_adventure import StoryImaginator
|
|
201
|
+
|
|
202
|
+
imaginator = StoryImaginator()
|
|
203
|
+
|
|
204
|
+
imaginator.gemini_api_key = "YOUR_GEMINI_API_KEY"
|
|
205
|
+
|
|
206
|
+
imaginator.imagine(
|
|
207
|
+
"A medieval knight searching for a lost kingdom",
|
|
208
|
+
"kingdom.json"
|
|
209
|
+
)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Play the generated adventure:
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
from gen_adventure import Adventure
|
|
216
|
+
|
|
217
|
+
game = Adventure("kingdom.json")
|
|
218
|
+
game.start()
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Project Structure
|
|
224
|
+
|
|
225
|
+
```text
|
|
226
|
+
gen_adventure/
|
|
227
|
+
├── adventure.py
|
|
228
|
+
├── pages.py
|
|
229
|
+
├── story_imaginator.py
|
|
230
|
+
└── __init__.py
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Dependencies
|
|
236
|
+
|
|
237
|
+
* pygame
|
|
238
|
+
* google-genai
|
|
239
|
+
* requests
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## License
|
|
244
|
+
|
|
245
|
+
This project is licensed under the MIT License.
|
|
246
|
+
|
|
247
|
+
See the LICENSE file for details.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Author
|
|
252
|
+
|
|
253
|
+
Johnny Matos
|
|
254
|
+
|
|
255
|
+
GitHub: https://github.com/DS-Johnny
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Gen-Adventure
|
|
2
|
+
|
|
3
|
+
Generate and play AI-powered interactive adventures with Python, Pygame, and Google Gemini.
|
|
4
|
+
|
|
5
|
+
Gen-Adventure allows you to:
|
|
6
|
+
|
|
7
|
+
* Create interactive branching stories using Google's Gemini models.
|
|
8
|
+
* Play generated stories through a graphical interface built with Pygame.
|
|
9
|
+
* Load stories from local JSON files or remote URLs.
|
|
10
|
+
* Explore built-in example adventures.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
* AI-powered story generation using Gemini.
|
|
17
|
+
* Interactive branching adventures.
|
|
18
|
+
* Pygame graphical interface.
|
|
19
|
+
* Local and remote story support.
|
|
20
|
+
* JSON-based story format.
|
|
21
|
+
* Built-in example stories.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install gen-adventure
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
* Python 3.11+
|
|
36
|
+
* Google Gemini API Key
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Playing an Adventure
|
|
41
|
+
|
|
42
|
+
Load a local JSON story:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from gen_adventure import Adventure
|
|
46
|
+
|
|
47
|
+
game = Adventure("my_story.json")
|
|
48
|
+
game.start()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Load a story hosted online:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from gen_adventure import Adventure
|
|
55
|
+
|
|
56
|
+
game = Adventure(
|
|
57
|
+
"https://example.com/my_story.json"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
game.start()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Built-in Example Stories
|
|
66
|
+
|
|
67
|
+
Gen-Adventure includes several example stories hosted in the project's repository.
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from gen_adventure import Adventure, StoryExamples
|
|
71
|
+
|
|
72
|
+
examples = StoryExamples()
|
|
73
|
+
|
|
74
|
+
game = Adventure(examples.fantasy)
|
|
75
|
+
game.start()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Available examples:
|
|
79
|
+
|
|
80
|
+
* fantasy
|
|
81
|
+
* hacker
|
|
82
|
+
* formatura
|
|
83
|
+
* love_story
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Generating Stories with Gemini
|
|
88
|
+
|
|
89
|
+
Create a story and save it as a JSON file:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from gen_adventure import StoryImaginator
|
|
93
|
+
|
|
94
|
+
imaginator = StoryImaginator()
|
|
95
|
+
|
|
96
|
+
imaginator.gemini_api_key = "YOUR_GEMINI_API_KEY"
|
|
97
|
+
|
|
98
|
+
imaginator.imagine(
|
|
99
|
+
"A cyberpunk hacker fighting an evil corporation",
|
|
100
|
+
"cyberpunk_story.json"
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The generated file can then be loaded into the game:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from gen_adventure import Adventure
|
|
108
|
+
|
|
109
|
+
game = Adventure("cyberpunk_story.json")
|
|
110
|
+
game.start()
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Story Format
|
|
116
|
+
|
|
117
|
+
Stories are stored as JSON files.
|
|
118
|
+
|
|
119
|
+
Example:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"pages": [
|
|
124
|
+
{
|
|
125
|
+
"id": 1,
|
|
126
|
+
"text": "You wake up in a mysterious forest.",
|
|
127
|
+
"options": [
|
|
128
|
+
{
|
|
129
|
+
"text": "Follow the path",
|
|
130
|
+
"target": 2
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"text": "Enter the cave",
|
|
134
|
+
"target": 3
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Each page contains:
|
|
143
|
+
|
|
144
|
+
| Field | Description |
|
|
145
|
+
| ------- | ----------------- |
|
|
146
|
+
| id | Page identifier |
|
|
147
|
+
| text | Story content |
|
|
148
|
+
| options | Available choices |
|
|
149
|
+
|
|
150
|
+
Each option contains:
|
|
151
|
+
|
|
152
|
+
| Field | Description |
|
|
153
|
+
| ------ | ---------------------------- |
|
|
154
|
+
| text | Text displayed to the player |
|
|
155
|
+
| target | Destination page |
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Customizing Colors
|
|
160
|
+
|
|
161
|
+
You can customize the interface colors:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from gen_adventure import Adventure
|
|
165
|
+
|
|
166
|
+
game = Adventure("story.json")
|
|
167
|
+
|
|
168
|
+
game.text_color = (255, 255, 255)
|
|
169
|
+
game.background_color = (25, 25, 25)
|
|
170
|
+
game.button_background_color = (50, 50, 50)
|
|
171
|
+
|
|
172
|
+
game.start()
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Example Workflow
|
|
178
|
+
|
|
179
|
+
Generate a story:
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
from gen_adventure import StoryImaginator
|
|
183
|
+
|
|
184
|
+
imaginator = StoryImaginator()
|
|
185
|
+
|
|
186
|
+
imaginator.gemini_api_key = "YOUR_GEMINI_API_KEY"
|
|
187
|
+
|
|
188
|
+
imaginator.imagine(
|
|
189
|
+
"A medieval knight searching for a lost kingdom",
|
|
190
|
+
"kingdom.json"
|
|
191
|
+
)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Play the generated adventure:
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
from gen_adventure import Adventure
|
|
198
|
+
|
|
199
|
+
game = Adventure("kingdom.json")
|
|
200
|
+
game.start()
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Project Structure
|
|
206
|
+
|
|
207
|
+
```text
|
|
208
|
+
gen_adventure/
|
|
209
|
+
├── adventure.py
|
|
210
|
+
├── pages.py
|
|
211
|
+
├── story_imaginator.py
|
|
212
|
+
└── __init__.py
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Dependencies
|
|
218
|
+
|
|
219
|
+
* pygame
|
|
220
|
+
* google-genai
|
|
221
|
+
* requests
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
This project is licensed under the MIT License.
|
|
228
|
+
|
|
229
|
+
See the LICENSE file for details.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Author
|
|
234
|
+
|
|
235
|
+
Johnny Matos
|
|
236
|
+
|
|
237
|
+
GitHub: https://github.com/DS-Johnny
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Gen-Adventure
|
|
3
|
+
|
|
4
|
+
Generate and play AI-powered interactive adventures.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .adventure import Adventure, StoryExamples
|
|
8
|
+
from .story_imaginator import StoryImaginator
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"Adventure",
|
|
12
|
+
"StoryExamples",
|
|
13
|
+
"StoryImaginator"
|
|
14
|
+
]
|