solanapolis 1.0.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/README.md +518 -0
- package/bin/solanapolis.js +197 -0
- package/convex/_generated/api.d.ts +175 -0
- package/convex/_generated/api.js +23 -0
- package/convex/_generated/dataModel.d.ts +60 -0
- package/convex/_generated/server.d.ts +143 -0
- package/convex/_generated/server.js +93 -0
- package/convex/agent/conversation.ts +352 -0
- package/convex/agent/embeddingsCache.ts +110 -0
- package/convex/agent/memory.ts +450 -0
- package/convex/agent/schema.ts +53 -0
- package/convex/aiChat.ts +54 -0
- package/convex/aiTown/agent.ts +382 -0
- package/convex/aiTown/agentDescription.ts +27 -0
- package/convex/aiTown/agentInputs.ts +155 -0
- package/convex/aiTown/agentOperations.ts +178 -0
- package/convex/aiTown/conversation.ts +395 -0
- package/convex/aiTown/conversationMembership.ts +38 -0
- package/convex/aiTown/game.ts +371 -0
- package/convex/aiTown/ids.ts +32 -0
- package/convex/aiTown/inputHandler.ts +9 -0
- package/convex/aiTown/inputs.ts +25 -0
- package/convex/aiTown/insertInput.ts +20 -0
- package/convex/aiTown/location.ts +32 -0
- package/convex/aiTown/main.ts +154 -0
- package/convex/aiTown/movement.ts +189 -0
- package/convex/aiTown/player.ts +310 -0
- package/convex/aiTown/playerDescription.ts +35 -0
- package/convex/aiTown/schema.ts +79 -0
- package/convex/aiTown/world.ts +65 -0
- package/convex/aiTown/worldMap.ts +74 -0
- package/convex/chat.ts +79 -0
- package/convex/constants.ts +78 -0
- package/convex/convex.config.ts +6 -0
- package/convex/crons.ts +89 -0
- package/convex/engine/abstractGame.ts +199 -0
- package/convex/engine/historicalObject.ts +355 -0
- package/convex/engine/schema.ts +56 -0
- package/convex/http.ts +36 -0
- package/convex/init.ts +110 -0
- package/convex/messages.ts +53 -0
- package/convex/npcCarAgents.ts +415 -0
- package/convex/schema.ts +61 -0
- package/convex/streaming.ts +23 -0
- package/convex/testing.ts +202 -0
- package/convex/tsconfig.json +18 -0
- package/convex/util/FastIntegerCompression.ts +221 -0
- package/convex/util/assertNever.ts +4 -0
- package/convex/util/asyncMap.ts +20 -0
- package/convex/util/compression.ts +71 -0
- package/convex/util/geometry.ts +132 -0
- package/convex/util/isSimpleObject.ts +11 -0
- package/convex/util/llm.ts +724 -0
- package/convex/util/minheap.ts +38 -0
- package/convex/util/object.ts +22 -0
- package/convex/util/sleep.ts +3 -0
- package/convex/util/types.ts +33 -0
- package/convex/util/xxhash.ts +228 -0
- package/convex/world.ts +257 -0
- package/data/animations/campfire.json +45 -0
- package/data/animations/gentlesparkle.json +37 -0
- package/data/animations/gentlesplash.json +61 -0
- package/data/animations/gentlewaterfall.json +61 -0
- package/data/animations/windmill.json +78 -0
- package/data/characters.ts +121 -0
- package/data/convertMap.js +74 -0
- package/data/gentle.js +330 -0
- package/data/spritesheets/f1.ts +75 -0
- package/data/spritesheets/f2.ts +75 -0
- package/data/spritesheets/f3.ts +75 -0
- package/data/spritesheets/f4.ts +75 -0
- package/data/spritesheets/f5.ts +75 -0
- package/data/spritesheets/f6.ts +75 -0
- package/data/spritesheets/f7.ts +75 -0
- package/data/spritesheets/f8.ts +75 -0
- package/data/spritesheets/p1.ts +59 -0
- package/data/spritesheets/p2.ts +59 -0
- package/data/spritesheets/p3.ts +59 -0
- package/data/spritesheets/player.ts +59 -0
- package/data/spritesheets/types.ts +26 -0
- package/eslint.config.mjs +37 -0
- package/next.config.ts +7 -0
- package/package.json +85 -0
- package/postcss.config.mjs +7 -0
- package/public/file.svg +1 -0
- package/public/globe.svg +1 -0
- package/public/helius-icon.svg +84 -0
- package/public/helius-logo.svg +85 -0
- package/public/next.svg +1 -0
- package/public/plane.glb +0 -0
- package/public/vercel.svg +1 -0
- package/public/window.svg +1 -0
- package/scripts/clear-city.ts +74 -0
- package/scripts/seed-wallets.ts +185 -0
- package/scripts/setup-webhook.ts +73 -0
- package/src/app/api/auth/callback/route.ts +6 -0
- package/src/app/api/auth/link-wallet/route.ts +6 -0
- package/src/app/api/auth/phantom/route.ts +6 -0
- package/src/app/api/broadcast-position/route.ts +59 -0
- package/src/app/api/leaderboard/route.ts +85 -0
- package/src/app/api/network-stats/route.ts +86 -0
- package/src/app/api/parcel-reward/route.ts +181 -0
- package/src/app/api/queue-status/route.ts +30 -0
- package/src/app/api/snapshots/route.ts +37 -0
- package/src/app/api/transactions/enhanced/route.ts +57 -0
- package/src/app/api/treasury/route.ts +83 -0
- package/src/app/api/wallet/[address]/balances/route.ts +124 -0
- package/src/app/api/wallet/[address]/identity/route.ts +32 -0
- package/src/app/api/wallet/[address]/route.ts +216 -0
- package/src/app/api/wallet/[address]/traded-tokens/route.ts +41 -0
- package/src/app/api/wallets/route.ts +68 -0
- package/src/app/api/webhooks/helius/route.ts +76 -0
- package/src/app/auth/callback/page.tsx +29 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +39 -0
- package/src/app/layout.tsx +43 -0
- package/src/app/page.tsx +16 -0
- package/src/components/AITownNPCs.tsx +206 -0
- package/src/components/ActivityFeed.tsx +189 -0
- package/src/components/AuthPanel.tsx +163 -0
- package/src/components/BeachScene.tsx +280 -0
- package/src/components/Building.tsx +138 -0
- package/src/components/CesiumFlight.tsx +1768 -0
- package/src/components/CesiumGlobe.tsx +616 -0
- package/src/components/CitizenCard.tsx +442 -0
- package/src/components/CitizenCardModal.tsx +153 -0
- package/src/components/CityGrid.tsx +313 -0
- package/src/components/CityLandmarks.tsx +427 -0
- package/src/components/CityScene.tsx +1289 -0
- package/src/components/CitySlotsBadge.tsx +68 -0
- package/src/components/CockpitHUD.tsx +460 -0
- package/src/components/ConvexWrapper.tsx +19 -0
- package/src/components/DubaiDistrict.tsx +630 -0
- package/src/components/FlightMiniMap.tsx +133 -0
- package/src/components/GameChat.tsx +383 -0
- package/src/components/GameHUD.tsx +393 -0
- package/src/components/Ground.tsx +14 -0
- package/src/components/HowItWorksModal.tsx +251 -0
- package/src/components/IngestionBanner.tsx +123 -0
- package/src/components/InstancedBuildings.tsx +316 -0
- package/src/components/InstancedCars.tsx +504 -0
- package/src/components/InstancedCityPlanes.tsx +259 -0
- package/src/components/InstancedHouses.tsx +246 -0
- package/src/components/InstancedLampPosts.tsx +201 -0
- package/src/components/InstancedResidentCars.tsx +357 -0
- package/src/components/InstancedRoadDashes.tsx +42 -0
- package/src/components/InstancedSkyscrapers.tsx +434 -0
- package/src/components/InstancedTrees.tsx +67 -0
- package/src/components/LeaderboardPanel.tsx +136 -0
- package/src/components/MultiplayerPlanes.tsx +128 -0
- package/src/components/NetworkStats.tsx +83 -0
- package/src/components/NewBuildingSpotlight.tsx +93 -0
- package/src/components/ParcelChallengeBanner.tsx +242 -0
- package/src/components/ParcelReward.tsx +191 -0
- package/src/components/Park.tsx +42 -0
- package/src/components/PhantomWrapper.tsx +22 -0
- package/src/components/PixelStreamViewer.tsx +335 -0
- package/src/components/PlaneMode.tsx +190 -0
- package/src/components/PlayerCar.tsx +211 -0
- package/src/components/PlayerPlane.tsx +255 -0
- package/src/components/ProjectileRenderer.tsx +249 -0
- package/src/components/QueueStatusBanner.tsx +86 -0
- package/src/components/RealPlayerTags.tsx +82 -0
- package/src/components/SceneLighting.tsx +382 -0
- package/src/components/SelectionBeam.tsx +59 -0
- package/src/components/SwapPanel.tsx +104 -0
- package/src/components/SwapParticles.tsx +237 -0
- package/src/components/TreasureGate.tsx +505 -0
- package/src/components/WalletPanel.tsx +421 -0
- package/src/components/WalletSearch.tsx +244 -0
- package/src/components/WelcomeOverlay.tsx +135 -0
- package/src/components/WindowTooltip.tsx +498 -0
- package/src/context/AuthContext.tsx +230 -0
- package/src/lib/bot-detection.ts +125 -0
- package/src/lib/building-math.ts +136 -0
- package/src/lib/building-shader.ts +253 -0
- package/src/lib/car-paths.ts +244 -0
- package/src/lib/car-system.ts +182 -0
- package/src/lib/city-constants.ts +29 -0
- package/src/lib/city-slots.ts +35 -0
- package/src/lib/city-zoning.ts +64 -0
- package/src/lib/collision-map.ts +147 -0
- package/src/lib/day-night.ts +252 -0
- package/src/lib/export-card.ts +28 -0
- package/src/lib/helius-webhook.ts +90 -0
- package/src/lib/helius.ts +74 -0
- package/src/lib/house-shader.ts +119 -0
- package/src/lib/mock-data.ts +56 -0
- package/src/lib/multiplayer-manager.ts +329 -0
- package/src/lib/plane-physics.ts +66 -0
- package/src/lib/player-car.ts +147 -0
- package/src/lib/player-plane.ts +200 -0
- package/src/lib/projectile-system.ts +272 -0
- package/src/lib/skyscraper-types.ts +52 -0
- package/src/lib/sound-engine.ts +464 -0
- package/src/lib/supabase-admin.ts +9 -0
- package/src/lib/supabase.ts +8 -0
- package/src/lib/swap-events.ts +70 -0
- package/src/middleware.ts +37 -0
- package/src/types/phantom.d.ts +16 -0
- package/src/types/wallet.ts +20 -0
- package/tsconfig.json +34 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { useFrame } from "@react-three/fiber";
|
|
5
|
+
import * as THREE from "three";
|
|
6
|
+
|
|
7
|
+
const MAX_BURSTS = 30;
|
|
8
|
+
const PARTICLES_PER_BURST = 12;
|
|
9
|
+
const TOTAL_PARTICLES = MAX_BURSTS * PARTICLES_PER_BURST;
|
|
10
|
+
const BURST_LIFETIME = 1.8; // seconds
|
|
11
|
+
|
|
12
|
+
interface Burst {
|
|
13
|
+
origin: THREE.Vector3;
|
|
14
|
+
born: number;
|
|
15
|
+
color: THREE.Color;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const vertexShader = /* glsl */ `
|
|
19
|
+
attribute float aSize;
|
|
20
|
+
attribute float aLife;
|
|
21
|
+
attribute vec3 aColor;
|
|
22
|
+
varying float vLife;
|
|
23
|
+
varying vec3 vColor;
|
|
24
|
+
|
|
25
|
+
void main() {
|
|
26
|
+
vLife = aLife;
|
|
27
|
+
vColor = aColor;
|
|
28
|
+
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
|
|
29
|
+
gl_PointSize = aSize * (200.0 / -mvPosition.z);
|
|
30
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
const fragmentShader = /* glsl */ `
|
|
35
|
+
varying float vLife;
|
|
36
|
+
varying vec3 vColor;
|
|
37
|
+
|
|
38
|
+
void main() {
|
|
39
|
+
// Soft circle
|
|
40
|
+
vec2 center = gl_PointCoord - 0.5;
|
|
41
|
+
float dist = length(center) * 2.0;
|
|
42
|
+
if (dist > 1.0) discard;
|
|
43
|
+
|
|
44
|
+
float alpha = (1.0 - dist) * vLife;
|
|
45
|
+
alpha *= alpha; // quadratic falloff
|
|
46
|
+
|
|
47
|
+
// Glow effect
|
|
48
|
+
vec3 glow = vColor * (1.0 + vLife * 2.0);
|
|
49
|
+
|
|
50
|
+
gl_FragColor = vec4(glow, alpha * 0.8);
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
interface SwapParticlesProps {
|
|
55
|
+
swapBurstRef: React.MutableRefObject<Array<{ x: number; y: number; z: number; color: string }>>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* GPU particle system for swap activity bursts.
|
|
60
|
+
* When a swap event fires, particles burst upward from the building.
|
|
61
|
+
*/
|
|
62
|
+
export default function SwapParticles({ swapBurstRef }: SwapParticlesProps) {
|
|
63
|
+
const pointsRef = useRef<THREE.Points>(null);
|
|
64
|
+
const burstsRef = useRef<Burst[]>([]);
|
|
65
|
+
const particleDataRef = useRef<{
|
|
66
|
+
positions: Float32Array;
|
|
67
|
+
sizes: Float32Array;
|
|
68
|
+
baseSizes: Float32Array;
|
|
69
|
+
lives: Float32Array;
|
|
70
|
+
colors: Float32Array;
|
|
71
|
+
velocities: Float32Array;
|
|
72
|
+
material: THREE.ShaderMaterial;
|
|
73
|
+
} | null>(null);
|
|
74
|
+
|
|
75
|
+
if (!particleDataRef.current) {
|
|
76
|
+
const positions = new Float32Array(TOTAL_PARTICLES * 3);
|
|
77
|
+
const sizes = new Float32Array(TOTAL_PARTICLES);
|
|
78
|
+
const baseSizes = new Float32Array(TOTAL_PARTICLES);
|
|
79
|
+
const lives = new Float32Array(TOTAL_PARTICLES);
|
|
80
|
+
const colors = new Float32Array(TOTAL_PARTICLES * 3);
|
|
81
|
+
const velocities = new Float32Array(TOTAL_PARTICLES * 3);
|
|
82
|
+
|
|
83
|
+
// Initialize off-screen
|
|
84
|
+
for (let i = 0; i < TOTAL_PARTICLES; i++) {
|
|
85
|
+
positions[i * 3 + 1] = -1000; // below ground
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const material = new THREE.ShaderMaterial({
|
|
89
|
+
vertexShader,
|
|
90
|
+
fragmentShader,
|
|
91
|
+
transparent: true,
|
|
92
|
+
depthWrite: false,
|
|
93
|
+
blending: THREE.AdditiveBlending,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
particleDataRef.current = {
|
|
97
|
+
positions,
|
|
98
|
+
sizes,
|
|
99
|
+
baseSizes,
|
|
100
|
+
lives,
|
|
101
|
+
colors,
|
|
102
|
+
velocities,
|
|
103
|
+
material,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const { positions, sizes, baseSizes, lives, colors, velocities, material } = particleDataRef.current;
|
|
108
|
+
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
return () => {
|
|
111
|
+
material.dispose();
|
|
112
|
+
};
|
|
113
|
+
}, [material]);
|
|
114
|
+
|
|
115
|
+
useFrame((state, delta) => {
|
|
116
|
+
const points = pointsRef.current;
|
|
117
|
+
if (!points) return;
|
|
118
|
+
|
|
119
|
+
const elapsed = state.clock.elapsedTime;
|
|
120
|
+
const dt = Math.min(delta, 0.05); // clamp to prevent explosion on tab-switch
|
|
121
|
+
|
|
122
|
+
// Consume pending bursts
|
|
123
|
+
const pending = swapBurstRef.current.splice(0);
|
|
124
|
+
for (const p of pending) {
|
|
125
|
+
if (burstsRef.current.length >= MAX_BURSTS) {
|
|
126
|
+
burstsRef.current.shift();
|
|
127
|
+
}
|
|
128
|
+
burstsRef.current.push({
|
|
129
|
+
origin: new THREE.Vector3(p.x, p.y, p.z),
|
|
130
|
+
born: elapsed,
|
|
131
|
+
color: new THREE.Color(p.color),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Update all particles
|
|
136
|
+
const bursts = burstsRef.current;
|
|
137
|
+
let particleIdx = 0;
|
|
138
|
+
|
|
139
|
+
for (let b = 0; b < bursts.length; b++) {
|
|
140
|
+
const burst = bursts[b];
|
|
141
|
+
const age = elapsed - burst.born;
|
|
142
|
+
|
|
143
|
+
if (age > BURST_LIFETIME) {
|
|
144
|
+
bursts.splice(b, 1);
|
|
145
|
+
b--;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const life = 1.0 - age / BURST_LIFETIME;
|
|
150
|
+
|
|
151
|
+
for (let p = 0; p < PARTICLES_PER_BURST; p++) {
|
|
152
|
+
if (particleIdx >= TOTAL_PARTICLES) break;
|
|
153
|
+
|
|
154
|
+
const idx = particleIdx * 3;
|
|
155
|
+
|
|
156
|
+
if (age < 0.01) {
|
|
157
|
+
// Initialize particle velocity on first frame
|
|
158
|
+
const angle = (p / PARTICLES_PER_BURST) * Math.PI * 2 + Math.random() * 0.5;
|
|
159
|
+
const speed = 3 + Math.random() * 5;
|
|
160
|
+
const upSpeed = 4 + Math.random() * 6;
|
|
161
|
+
|
|
162
|
+
velocities[idx] = Math.cos(angle) * speed;
|
|
163
|
+
velocities[idx + 1] = upSpeed;
|
|
164
|
+
velocities[idx + 2] = Math.sin(angle) * speed;
|
|
165
|
+
|
|
166
|
+
positions[idx] = burst.origin.x;
|
|
167
|
+
positions[idx + 1] = burst.origin.y;
|
|
168
|
+
positions[idx + 2] = burst.origin.z;
|
|
169
|
+
|
|
170
|
+
// Store initial size seed in sizes array for consistent per-particle sizing
|
|
171
|
+
baseSizes[particleIdx] = 1.5 + Math.random() * 1.5;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Physics update — use actual frame delta
|
|
175
|
+
positions[idx] += velocities[idx] * dt;
|
|
176
|
+
positions[idx + 1] += velocities[idx + 1] * dt;
|
|
177
|
+
positions[idx + 2] += velocities[idx + 2] * dt;
|
|
178
|
+
|
|
179
|
+
// Gravity
|
|
180
|
+
velocities[idx + 1] -= 9.8 * dt;
|
|
181
|
+
|
|
182
|
+
// Particle properties — use stored base size, scale by life
|
|
183
|
+
const baseSize = baseSizes[particleIdx] > 0.01 ? baseSizes[particleIdx] : 2.0;
|
|
184
|
+
sizes[particleIdx] = baseSize * life;
|
|
185
|
+
lives[particleIdx] = life;
|
|
186
|
+
colors[idx] = burst.color.r;
|
|
187
|
+
colors[idx + 1] = burst.color.g;
|
|
188
|
+
colors[idx + 2] = burst.color.b;
|
|
189
|
+
|
|
190
|
+
particleIdx++;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Hide remaining particles
|
|
195
|
+
for (let i = particleIdx; i < TOTAL_PARTICLES; i++) {
|
|
196
|
+
positions[i * 3 + 1] = -1000;
|
|
197
|
+
sizes[i] = 0;
|
|
198
|
+
baseSizes[i] = 0;
|
|
199
|
+
lives[i] = 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Update GPU buffers
|
|
203
|
+
const geom = points.geometry;
|
|
204
|
+
const posAttr = geom.getAttribute("position") as THREE.BufferAttribute;
|
|
205
|
+
const sizeAttr = geom.getAttribute("aSize") as THREE.BufferAttribute;
|
|
206
|
+
const lifeAttr = geom.getAttribute("aLife") as THREE.BufferAttribute;
|
|
207
|
+
const colorAttr = geom.getAttribute("aColor") as THREE.BufferAttribute;
|
|
208
|
+
|
|
209
|
+
posAttr.needsUpdate = true;
|
|
210
|
+
sizeAttr.needsUpdate = true;
|
|
211
|
+
lifeAttr.needsUpdate = true;
|
|
212
|
+
colorAttr.needsUpdate = true;
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<points ref={pointsRef} frustumCulled={false} material={material}>
|
|
217
|
+
<bufferGeometry>
|
|
218
|
+
<bufferAttribute
|
|
219
|
+
attach="attributes-position"
|
|
220
|
+
args={[positions, 3]}
|
|
221
|
+
/>
|
|
222
|
+
<bufferAttribute
|
|
223
|
+
attach="attributes-aSize"
|
|
224
|
+
args={[sizes, 1]}
|
|
225
|
+
/>
|
|
226
|
+
<bufferAttribute
|
|
227
|
+
attach="attributes-aLife"
|
|
228
|
+
args={[lives, 1]}
|
|
229
|
+
/>
|
|
230
|
+
<bufferAttribute
|
|
231
|
+
attach="attributes-aColor"
|
|
232
|
+
args={[colors, 3]}
|
|
233
|
+
/>
|
|
234
|
+
</bufferGeometry>
|
|
235
|
+
</points>
|
|
236
|
+
);
|
|
237
|
+
}
|