@rtsdk/topia 0.17.1 → 0.17.3
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/README.md +55 -13
- package/dist/index.cjs +564 -364
- package/dist/index.d.ts +507 -333
- package/dist/index.js +564 -364
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -81,13 +81,52 @@ Make an asset “interactive” by adding your PUBLIC key to the integrations pa
|
|
|
81
81
|
- Once you have the above values you can pass them as credentials into the factory classes when creating class instances.
|
|
82
82
|
|
|
83
83
|
```ts
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
// Set up the SDK a separate util file
|
|
85
|
+
import dotenv from "dotenv";
|
|
86
|
+
dotenv.config({ path: "../.env" });
|
|
87
|
+
|
|
88
|
+
import { Topia, AssetFactory, DroppedAssetFactory, UserFactory, VisitorFactory, WorldFactory } from "@rtsdk/topia";
|
|
89
|
+
|
|
90
|
+
const config = {
|
|
91
|
+
apiDomain: process.env.INSTANCE_DOMAIN || "api.topia.io",
|
|
92
|
+
apiProtocol: process.env.INSTANCE_PROTOCOL || "https",
|
|
93
|
+
interactiveKey: process.env.INTERACTIVE_KEY,
|
|
94
|
+
interactiveSecret: process.env.INTERACTIVE_SECRET,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const myTopiaInstance = new Topia(config);
|
|
98
|
+
|
|
99
|
+
const Asset = new AssetFactory(myTopiaInstance);
|
|
100
|
+
const DroppedAsset = new DroppedAssetFactory(myTopiaInstance);
|
|
101
|
+
const User = new UserFactory(myTopiaInstance);
|
|
102
|
+
const Visitor = new VisitorFactory(myTopiaInstance);
|
|
103
|
+
const World = new WorldFactory(myTopiaInstance);
|
|
104
|
+
|
|
105
|
+
export { Asset, DroppedAsset, User, Visitor, World };
|
|
106
|
+
|
|
107
|
+
// Use the SDK in your controllers
|
|
108
|
+
import { Request, Response } from "express";
|
|
109
|
+
import { World } from "../utils/index.js";
|
|
110
|
+
|
|
111
|
+
export const handleFireToast = async (req: Request, res: Response) => {
|
|
112
|
+
try {
|
|
113
|
+
const { assetId, interactiveNonce, interactivePublicKey, urlSlug, visitorId } = req.query;
|
|
114
|
+
const { title, text } = req.body;
|
|
115
|
+
|
|
116
|
+
const world = World.create(urlSlug, {
|
|
117
|
+
credentials: { assetId, interactiveNonce, interactivePublicKey, urlSlug, visitorId },
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
await world.fireToast({
|
|
121
|
+
title,
|
|
122
|
+
text,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return res.json({ world, success: true });
|
|
126
|
+
} catch (error) {
|
|
127
|
+
return res.status(error.status || 500).send({ error, message, success: false });
|
|
128
|
+
}
|
|
129
|
+
};
|
|
91
130
|
```
|
|
92
131
|
|
|
93
132
|

|
|
@@ -109,18 +148,21 @@ A Topia provided API Key can be included with every object initialization as a p
|
|
|
109
148
|
Topia has developed a powerful new Experience Engine that enables extremely low-latency, interactive in-canvas multiplayer experiences. This engine is purpose-built for real-time interaction and supports a wide range of dynamic behaviors, making it ideal for collaborative activities, games, and social experiences within Topia worlds.
|
|
110
149
|
|
|
111
150
|
## Key Features
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
151
|
+
|
|
152
|
+
- Ultra Low Latency: Real-time feedback for seamless multi-user interaction and state synchronization.
|
|
153
|
+
- Physics & Collision: Includes a robust physics and collision system to support realistic and responsive behaviors.
|
|
154
|
+
- Real-Time Interactivity: Supports dynamic responses to user input and environmental changes inside the canvas.
|
|
155
|
+
- Optimized for the Web: Engineered to perform smoothly across browser-based environments with minimal resource impact.
|
|
116
156
|
|
|
117
157
|
## SDK Integration: Leverage the SDK inside the Experience Engine to:
|
|
118
|
-
|
|
119
|
-
-
|
|
158
|
+
|
|
159
|
+
- Trigger visual/audio effects based on real-time interactions
|
|
160
|
+
- Save and persist spatial data, such as object positions or interaction states
|
|
120
161
|
|
|
121
162
|
This engine unlocks a whole new layer of interactivity, paving the way for creative, immersive experiences including educational tools, multiplayer games, or collaborative activities.
|
|
122
163
|
|
|
123
164
|
## Get In Touch
|
|
165
|
+
|
|
124
166
|
To sign up for the experience engine private beta, visit https://topia.io/p/game-engine.
|
|
125
167
|
|
|
126
168
|
# Developers
|