@evitcastudio/kit 3.0.1 → 3.1.0
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.
- package/LICENSE +21 -21
- package/README.md +123 -123
- package/lib/bundle/cli/cli.js +5572 -3
- package/lib/bundle/cli/kit-game-templates/multi/_gitignore +180 -180
- package/lib/bundle/cli/kit-game-templates/multi/src/client/packets/s-packets.ts +4 -4
- package/lib/bundle/cli/kit-game-templates/multi/src/server/packets/c-packets.ts +4 -4
- package/lib/bundle/cli/kit-game-templates/single/_gitignore +180 -180
- package/lib/bundle/cli/kit-game-templates/single/bun-serve.ts +27 -27
- package/lib/cli/resource-builder.d.ts.map +1 -1
- package/lib/cli/resource-builder.js +65 -0
- package/lib/types/vylo.d.ts +3848 -3848
- package/lib/vendor/vyi/index.d.ts +367 -0
- package/lib/vendor/vyi/index.d.ts.map +1 -0
- package/lib/vendor/vyi/index.js +5647 -0
- package/lib/vendor/vyi/vendor/icon-point/index.d.ts +139 -0
- package/lib/vendor/vyi/vendor/icon-point/index.d.ts.map +1 -0
- package/lib/vendor/vyi/vendor/icon-point/index.js +286 -0
- package/lib/vendor/vyi/vyi-worker-inline.d.ts +2 -0
- package/lib/vendor/vyi/vyi-worker-inline.d.ts.map +1 -0
- package/lib/vendor/vyi/vyi-worker-inline.js +3 -0
- package/package.json +1 -1
- package/lib/bundle/cli/kit-game-templates/multi/resource.json +0 -1
- package/lib/bundle/cli/kit-game-templates/single/resource.json +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Jared Bates, Evitca Studio, "doubleactii"
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Jared Bates, Evitca Studio, "doubleactii"
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
# Kit
|
|
2
|
-
|
|
3
|
-
**Kit** is a lightweight, extensible 2D framework for game development in the [Vylocity Game Engine](https://www.vylocity.com/). Designed to be simple and modular, Kit empowers developers to build complex projects quickly through a robust plugin-driven architecture.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
bun install -g @evitcastudio/kit
|
|
9
|
-
```
|
|
10
|
-
> **Note:** The `-g` flag ensures the `kit` CLI tool is globally available in your PATH.
|
|
11
|
-
|
|
12
|
-
## Scaffolding a New Project
|
|
13
|
-
|
|
14
|
-
The `kit init` command provides an interactive walkthrough to quickly scaffold a new project for the Vylocity Game Engine.
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# Start the interactive walkthrough
|
|
18
|
-
kit init
|
|
19
|
-
|
|
20
|
-
# Or scaffold a project with flags
|
|
21
|
-
kit init <project-name> --single # For single-player
|
|
22
|
-
kit init <project-name> --multi # For multiplayer
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
The command will create a structured directory for your project, including pre-configured `package.json`, essential Vylocity files, and a local development environment.
|
|
26
|
-
|
|
27
|
-
After scaffolding, follow these steps to get started:
|
|
28
|
-
1. `cd <project-name>`
|
|
29
|
-
2. `bun install`
|
|
30
|
-
3. `bun run build`
|
|
31
|
-
|
|
32
|
-
## Building the Project
|
|
33
|
-
|
|
34
|
-
> **Note:** This process is preconfigured for you if you used `kit init`
|
|
35
|
-
|
|
36
|
-
The `kit build` command locates all Vylocity engine-related resources in your source directory, anonymizes them, and moves them to a deploy-ready output directory.
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
kit build -i ./<in-dir> -o ./<out-dir>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
# To learn more about this command
|
|
44
|
-
kit build --help
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Executing this command automatically generates a `resource.json` map in your project's directory.
|
|
48
|
-
**Best Practice:** Exclude `resource.json` from version control (`.gitignore`), as it is a build artifact.
|
|
49
|
-
|
|
50
|
-
## Runtime Resource Loading
|
|
51
|
-
|
|
52
|
-
> **Note:** This process is preconfigured for you if you used `kit init`
|
|
53
|
-
|
|
54
|
-
> `Kit.setResources()` should be called **before** `VYLO.load()`.
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
import resourceJSON from 'resource.json';
|
|
58
|
-
|
|
59
|
-
// Initialize the engine with mapped resources
|
|
60
|
-
await Kit.setResources(resourceJSON);
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Local Development & Testing
|
|
64
|
-
|
|
65
|
-
Once your project is scaffolded and dependencies are installed and the project has been built, you can run your game locally.
|
|
66
|
-
|
|
67
|
-
### Running the Game
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
# For Single-Player or Multiplayer games
|
|
71
|
-
bun run host
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Accessing the Game
|
|
75
|
-
|
|
76
|
-
The server will be available at the following locations after being hosted:
|
|
77
|
-
|
|
78
|
-
> **Singleplayer**
|
|
79
|
-
[http://localhost:8090](http://localhost:8090) defined in `./bun-serve.ts`
|
|
80
|
-
|
|
81
|
-
> **Multiplayer or Singleplayer & Multiplayer**
|
|
82
|
-
[http://localhost:30000](http://localhost:30000) defined in `./src/server/settings.json`
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
## Plugin Architecture
|
|
86
|
-
|
|
87
|
-
```ts
|
|
88
|
-
import { Plugin } from 'custom-plugin';
|
|
89
|
-
|
|
90
|
-
// Register a single plugin
|
|
91
|
-
const plugin = Kit.registerPlugin(Plugin);
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
// Register multiple plugins
|
|
96
|
-
import { Plugin1 } from 'custom-plugin1';
|
|
97
|
-
import { Plugin2 } from 'custom-plugin2';
|
|
98
|
-
|
|
99
|
-
const plugins = Kit.registerPlugins([Plugin1, Plugin2]);
|
|
100
|
-
|
|
101
|
-
// After being registered, kit can find the plugin by name.
|
|
102
|
-
const plugin1 = Kit.getPlugin('plugin1-name');
|
|
103
|
-
const plugin2 = Kit.getPlugin('plugin2-name');
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Listening for plugin events
|
|
107
|
-
|
|
108
|
-
Plugins emit events, this is how they pass relevant data to other plugins or the main thread.
|
|
109
|
-
By listening to these events you can act on this data.
|
|
110
|
-
|
|
111
|
-
```js
|
|
112
|
-
const listener = (pEvent: EmitterEvent) => {
|
|
113
|
-
const { data, timestamp } = pEvent;
|
|
114
|
-
// Here you can use the data that the event sent down.
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Choose to listen to specific event from a plugin
|
|
118
|
-
Kit.on('plugin-name', 'event-name', listener);
|
|
119
|
-
|
|
120
|
-
// You can also stop listening for an event
|
|
121
|
-
Kit.off('plugin-name', 'event-name', listener);
|
|
122
|
-
```
|
|
123
|
-
|
|
1
|
+
# Kit
|
|
2
|
+
|
|
3
|
+
**Kit** is a lightweight, extensible 2D framework for game development in the [Vylocity Game Engine](https://www.vylocity.com/). Designed to be simple and modular, Kit empowers developers to build complex projects quickly through a robust plugin-driven architecture.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun install -g @evitcastudio/kit
|
|
9
|
+
```
|
|
10
|
+
> **Note:** The `-g` flag ensures the `kit` CLI tool is globally available in your PATH.
|
|
11
|
+
|
|
12
|
+
## Scaffolding a New Project
|
|
13
|
+
|
|
14
|
+
The `kit init` command provides an interactive walkthrough to quickly scaffold a new project for the Vylocity Game Engine.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Start the interactive walkthrough
|
|
18
|
+
kit init
|
|
19
|
+
|
|
20
|
+
# Or scaffold a project with flags
|
|
21
|
+
kit init <project-name> --single # For single-player
|
|
22
|
+
kit init <project-name> --multi # For multiplayer
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The command will create a structured directory for your project, including pre-configured `package.json`, essential Vylocity files, and a local development environment.
|
|
26
|
+
|
|
27
|
+
After scaffolding, follow these steps to get started:
|
|
28
|
+
1. `cd <project-name>`
|
|
29
|
+
2. `bun install`
|
|
30
|
+
3. `bun run build`
|
|
31
|
+
|
|
32
|
+
## Building the Project
|
|
33
|
+
|
|
34
|
+
> **Note:** This process is preconfigured for you if you used `kit init`
|
|
35
|
+
|
|
36
|
+
The `kit build` command locates all Vylocity engine-related resources in your source directory, anonymizes them, and moves them to a deploy-ready output directory.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
kit build -i ./<in-dir> -o ./<out-dir>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# To learn more about this command
|
|
44
|
+
kit build --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Executing this command automatically generates a `resource.json` map in your project's directory.
|
|
48
|
+
**Best Practice:** Exclude `resource.json` from version control (`.gitignore`), as it is a build artifact.
|
|
49
|
+
|
|
50
|
+
## Runtime Resource Loading
|
|
51
|
+
|
|
52
|
+
> **Note:** This process is preconfigured for you if you used `kit init`
|
|
53
|
+
|
|
54
|
+
> `Kit.setResources()` should be called **before** `VYLO.load()`.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import resourceJSON from 'resource.json';
|
|
58
|
+
|
|
59
|
+
// Initialize the engine with mapped resources
|
|
60
|
+
await Kit.setResources(resourceJSON);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Local Development & Testing
|
|
64
|
+
|
|
65
|
+
Once your project is scaffolded and dependencies are installed and the project has been built, you can run your game locally.
|
|
66
|
+
|
|
67
|
+
### Running the Game
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# For Single-Player or Multiplayer games
|
|
71
|
+
bun run host
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Accessing the Game
|
|
75
|
+
|
|
76
|
+
The server will be available at the following locations after being hosted:
|
|
77
|
+
|
|
78
|
+
> **Singleplayer**
|
|
79
|
+
[http://localhost:8090](http://localhost:8090) defined in `./bun-serve.ts`
|
|
80
|
+
|
|
81
|
+
> **Multiplayer or Singleplayer & Multiplayer**
|
|
82
|
+
[http://localhost:30000](http://localhost:30000) defined in `./src/server/settings.json`
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Plugin Architecture
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { Plugin } from 'custom-plugin';
|
|
89
|
+
|
|
90
|
+
// Register a single plugin
|
|
91
|
+
const plugin = Kit.registerPlugin(Plugin);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// Register multiple plugins
|
|
96
|
+
import { Plugin1 } from 'custom-plugin1';
|
|
97
|
+
import { Plugin2 } from 'custom-plugin2';
|
|
98
|
+
|
|
99
|
+
const plugins = Kit.registerPlugins([Plugin1, Plugin2]);
|
|
100
|
+
|
|
101
|
+
// After being registered, kit can find the plugin by name.
|
|
102
|
+
const plugin1 = Kit.getPlugin('plugin1-name');
|
|
103
|
+
const plugin2 = Kit.getPlugin('plugin2-name');
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Listening for plugin events
|
|
107
|
+
|
|
108
|
+
Plugins emit events, this is how they pass relevant data to other plugins or the main thread.
|
|
109
|
+
By listening to these events you can act on this data.
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
const listener = (pEvent: EmitterEvent) => {
|
|
113
|
+
const { data, timestamp } = pEvent;
|
|
114
|
+
// Here you can use the data that the event sent down.
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Choose to listen to specific event from a plugin
|
|
118
|
+
Kit.on('plugin-name', 'event-name', listener);
|
|
119
|
+
|
|
120
|
+
// You can also stop listening for an event
|
|
121
|
+
Kit.off('plugin-name', 'event-name', listener);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
124
|
For more information check out the [wiki](https://github.com/EvitcaStudio/Kit/wiki)
|