diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..46d2e5938 Binary files /dev/null and b/.DS_Store differ diff --git a/.github/workflows/deploy-mainnet.yaml b/.github/workflows/deploy-mainnet.yaml index 6b07048ab..074a85bcd 100644 --- a/.github/workflows/deploy-mainnet.yaml +++ b/.github/workflows/deploy-mainnet.yaml @@ -10,9 +10,9 @@ name: Deploy to slot on: push: - branches: - - "1on1-mainnet" - - "deployment-mainnet" + branches: + - '1on1-mainnet' + - 'deployment-mainnet' permissions: contents: read @@ -28,7 +28,7 @@ jobs: - id: setup-dojo uses: runelabsxyz/setup-dojo@main with: - version: "v1.0.0" + version: 'v1.0.0-alpha.16' - uses: oven-sh/setup-bun@v2 with: @@ -37,21 +37,22 @@ jobs: - name: Install dependencies working-directory: ./client run: bun install --frozen-lockfile - + - name: Build frontend for slot run: bun run build working-directory: ./client env: ENV: mainnet # Force the auto bundler to prepare for cloudflare (otherwise it does weird things) - CF_PAGES: "1" + CF_PAGES: '1' # For now, isok, but getting an official file at some point would be nice: PUBLIC_TORII_URL: https://api.cartridge.gg/x/octoguns-mn-alpha-1/torii PUBLIC_RPC_URL: https://api.cartridge.gg/x/starknet/mainnet - PUBLIC_WORLD_ADDRESS: "0x7447477a7c852c946f0b8d13ebdfe0db9e78f3de60ab799320691502b4d32a3" + PUBLIC_WORLD_ADDRESS: '0x7447477a7c852c946f0b8d13ebdfe0db9e78f3de60ab799320691502b4d32a3' - name: Deploy to cloudflare pages working-directory: ./client - run: bun wrangler pages deploy + run: bun wrangler pages deploy env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + diff --git a/.github/workflows/deploy-slot.yaml b/.github/workflows/deploy-slot.yaml index abc216b85..371ab4dcd 100644 --- a/.github/workflows/deploy-slot.yaml +++ b/.github/workflows/deploy-slot.yaml @@ -10,9 +10,9 @@ name: Deploy to slot on: push: - branches: - - "main" - - "deployment" + branches: + - 'main' + - 'deployment' permissions: contents: read @@ -28,7 +28,7 @@ jobs: - id: setup-dojo uses: runelabsxyz/setup-dojo@main with: - version: "v1.0.0" + version: 'v1.0.0-alpha.16' - uses: oven-sh/setup-bun@v2 with: @@ -42,25 +42,25 @@ jobs: working-directory: ./contracts run: sozo test -P slot if: false # Set this to true when we finally have working tests - + - name: Deploy contract working-directory: ./contracts run: sozo migrate apply -P slot - env: + env: DOJO_ACCOUNT_ADDRESS: ${{ secrets.DOJO_ACCOUNT_ADDRESS }} DOJO_PRIVATE_KEY: ${{ secrets.DOJO_PRIVATE_KEY }} - name: Install dependencies working-directory: ./client run: bun install --frozen-lockfile - + - name: Build frontend for slot run: bun run build working-directory: ./client env: ENV: slot # Force the auto bundler to prepare for cloudflare (otherwise it does weird things) - CF_PAGES: "1" + CF_PAGES: '1' # For now, isok, but getting an official file at some point would be nice: PUBLIC_TORII_URL: https://api.cartridge.gg/x/octoguns-public-alpha1/torii PUBLIC_RPC_URL: https://api.cartridge.gg/x/octoguns-public-alpha1/katana @@ -70,6 +70,7 @@ jobs: - name: Deploy to cloudflare pages working-directory: ./client - run: bun wrangler pages deploy + run: bun wrangler pages deploy env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + diff --git a/.tool-versions b/.tool-versions index 8490e233c..23d5d7d50 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -dojo 1.0.0 -scarb 2.8.4 \ No newline at end of file +dojo 1.0.0-alpha.16 +scarb 2.7.0 \ No newline at end of file diff --git a/README.md b/README.md index 6cc2743ae..42d0bcaf3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ OctoGuns is a fully on-chain 1v1 strategy FPS where players control 8 characters ### Versions -- Dojo: 1.0.0 +- Dojo: 1.0.0-alpha9 - Node: 20 - Cairo: 2.7.0 @@ -47,7 +47,8 @@ OctoGuns is a fully on-chain 1v1 strategy FPS where players control 8 characters - Customizable, no-code maps - User-generated content support + ## Data - world address: 0x7447477a7c852c946f0b8d13ebdfe0db9e78f3de60ab799320691502b4d32a3 -- contract address: 0x1650b45b82ed70796c56e3bc19bff48ac4ccf7152a2f76bfd36981a99672e9 +- contract address: 0x1650b45b82ed70796c56e3bc19bff48ac4ccf7152a2f76bfd36981a99672e9 \ No newline at end of file diff --git a/client/bun.lockb b/client/bun.lockb index f4dbf0ad1..db4dde00a 100755 Binary files a/client/bun.lockb and b/client/bun.lockb differ diff --git a/client/package.json b/client/package.json index c066a2a46..0501894ad 100644 --- a/client/package.json +++ b/client/package.json @@ -11,39 +11,40 @@ "format": "prettier --write ." }, "devDependencies": { - "@sveltejs/adapter-auto": "^3.3.1", - "@sveltejs/adapter-cloudflare": "^4.7.4", - "@sveltejs/kit": "^2.8.0", - "@sveltejs/vite-plugin-svelte": "^4.0.0", + "@sveltejs/adapter-auto": "^3.2.4", + "@sveltejs/adapter-cloudflare": "^4.7.2", + "@sveltejs/kit": "^2.5.25", + "@sveltejs/vite-plugin-svelte": "^3.1.2", "@types/three": "^0.168.0", "autoprefixer": "^10.4.20", "dotenv": "^16.4.5", - "postcss": "^8.4.47", - "svelte": "^5.1.13", - "svelte-check": "^4.0.6", - "tailwindcss": "^3.4.14", - "typescript": "^5.6.3", - "vite": "^5.4.10", - "wrangler": "^3.86.0" + "postcss": "^8.4.43", + "svelte": "^4.2.19", + "svelte-check": "^3.8.6", + "tailwindcss": "^3.4.10", + "typescript": "^5.5.4", + "vite": "^5.4.2", + "wrangler": "^3.79.0" }, "type": "module", "dependencies": { "@cartridge/controller": "^0.3.46", - "@dojoengine/core": "^1.0.0-alpha.30", - "@dojoengine/create-burner": "^1.0.0-alpha.30", + "@dojoengine/core": "^1.0.0-alpha.29", + "@dojoengine/create-burner": "^1.0.0-alpha.29", "@dojoengine/recs": "^2.0.13", - "@dojoengine/state": "^1.0.0-alpha.30", - "@dojoengine/torii-client": "^1.0.0-alpha.30", - "@dojoengine/torii-wasm": "^1.0.0-alpha.30", - "@dojoengine/utils": "^1.0.0-alpha.30", - "@threlte/core": "^8.0.0-next.30", - "@threlte/extras": "^9.0.0-next.39", + "@dojoengine/state": "^1.0.0-alpha.29", + "@dojoengine/torii-client": "^1.0.0-alpha.29", + "@dojoengine/torii-wasm": "^1.0.0-alpha.29", + "@dojoengine/utils": "^1.0.0-alpha.29", + "@latticexyz/utils": "^2.2.0", + "@threlte/core": "^7.3.1", + "@threlte/extras": "^8.11.5", "clsx": "^2.1.1", "lucide-svelte": "^0.445.0", "prettier": "^3.3.3", - "prettier-plugin-svelte": "^3.2.7", + "prettier-plugin-svelte": "^3.2.6", "starknet": "^6.11.0", - "tailwind-merge": "^2.5.4", + "tailwind-merge": "^2.5.2", "three": "^0.168.0", "three-inspect": "^0.7.2", "vite-plugin-mkcert": "^1.17.6", diff --git a/client/src/dojo/manifest_octoguns_sepolia.json b/client/src/dojo/manifest_octoguns_sepolia.json deleted file mode 100644 index 1858d410a..000000000 --- a/client/src/dojo/manifest_octoguns_sepolia.json +++ /dev/null @@ -1,2404 +0,0 @@ -{ - "world": { - "class_hash": "0x139239a99d627697b19b9856beaef7896fc75375caf3d750dd76982a7afeb78", - "address": "0x633afc7ba46094bb158889ba55487886c5748439433a555ca3ac16f502d7dc", - "seed": "fdsafdasasdsssfasdfssf", - "name": "Octoguns", - "abi": [ - { - "type": "impl", - "name": "World", - "interface_name": "dojo::world::iworld::IWorld" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "enum", - "name": "dojo::world::resource::Resource", - "variants": [ - { - "name": "Model", - "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" - }, - { - "name": "Event", - "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" - }, - { - "name": "Contract", - "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" - }, - { - "name": "Namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "World", - "type": "()" - }, - { - "name": "Unregistered", - "type": "()" - } - ] - }, - { - "type": "struct", - "name": "dojo::model::metadata::ResourceMetadata", - "members": [ - { - "name": "resource_id", - "type": "core::felt252" - }, - { - "name": "metadata_uri", - "type": "core::byte_array::ByteArray" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "enum", - "name": "core::bool", - "variants": [ - { - "name": "False", - "type": "()" - }, - { - "name": "True", - "type": "()" - } - ] - }, - { - "type": "enum", - "name": "dojo::model::definition::ModelIndex", - "variants": [ - { - "name": "Keys", - "type": "core::array::Span::" - }, - { - "name": "Id", - "type": "core::felt252" - }, - { - "name": "MemberId", - "type": "(core::felt252, core::felt252)" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "dojo::meta::layout::FieldLayout", - "members": [ - { - "name": "selector", - "type": "core::felt252" - }, - { - "name": "layout", - "type": "dojo::meta::layout::Layout" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "enum", - "name": "dojo::meta::layout::Layout", - "variants": [ - { - "name": "Fixed", - "type": "core::array::Span::" - }, - { - "name": "Struct", - "type": "core::array::Span::" - }, - { - "name": "Tuple", - "type": "core::array::Span::" - }, - { - "name": "Array", - "type": "core::array::Span::" - }, - { - "name": "ByteArray", - "type": "()" - }, - { - "name": "Enum", - "type": "core::array::Span::" - } - ] - }, - { - "type": "interface", - "name": "dojo::world::iworld::IWorld", - "items": [ - { - "type": "function", - "name": "resource", - "inputs": [ - { - "name": "selector", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "dojo::world::resource::Resource" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "uuid", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "external" - }, - { - "type": "function", - "name": "metadata", - "inputs": [ - { - "name": "resource_selector", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "dojo::model::metadata::ResourceMetadata" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "set_metadata", - "inputs": [ - { - "name": "metadata", - "type": "dojo::model::metadata::ResourceMetadata" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "register_namespace", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "register_event", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "register_model", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "register_contract", - "inputs": [ - { - "name": "salt", - "type": "core::felt252" - }, - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "external" - }, - { - "type": "function", - "name": "init_contract", - "inputs": [ - { - "name": "selector", - "type": "core::felt252" - }, - { - "name": "init_calldata", - "type": "core::array::Span::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "upgrade_event", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "upgrade_model", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "upgrade_contract", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [ - { - "type": "core::starknet::class_hash::ClassHash" - } - ], - "state_mutability": "external" - }, - { - "type": "function", - "name": "emit_event", - "inputs": [ - { - "name": "event_selector", - "type": "core::felt252" - }, - { - "name": "keys", - "type": "core::array::Span::" - }, - { - "name": "values", - "type": "core::array::Span::" - }, - { - "name": "historical", - "type": "core::bool" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "entity", - "inputs": [ - { - "name": "model_selector", - "type": "core::felt252" - }, - { - "name": "index", - "type": "dojo::model::definition::ModelIndex" - }, - { - "name": "layout", - "type": "dojo::meta::layout::Layout" - } - ], - "outputs": [ - { - "type": "core::array::Span::" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "set_entity", - "inputs": [ - { - "name": "model_selector", - "type": "core::felt252" - }, - { - "name": "index", - "type": "dojo::model::definition::ModelIndex" - }, - { - "name": "values", - "type": "core::array::Span::" - }, - { - "name": "layout", - "type": "dojo::meta::layout::Layout" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "delete_entity", - "inputs": [ - { - "name": "model_selector", - "type": "core::felt252" - }, - { - "name": "index", - "type": "dojo::model::definition::ModelIndex" - }, - { - "name": "layout", - "type": "dojo::meta::layout::Layout" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "is_owner", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "grant_owner", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "revoke_owner", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "is_writer", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "grant_writer", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "revoke_writer", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableWorld", - "interface_name": "dojo::world::iworld::IUpgradeableWorld" - }, - { - "type": "interface", - "name": "dojo::world::iworld::IUpgradeableWorld", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [ - { - "name": "world_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::WorldSpawned", - "kind": "struct", - "members": [ - { - "name": "creator", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::WorldUpgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::NamespaceRegistered", - "kind": "struct", - "members": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "hash", - "type": "core::felt252", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ModelRegistered", - "kind": "struct", - "members": [ - { - "name": "name", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "namespace", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::EventRegistered", - "kind": "struct", - "members": [ - { - "name": "name", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "namespace", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ContractRegistered", - "kind": "struct", - "members": [ - { - "name": "name", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "namespace", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "salt", - "type": "core::felt252", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ModelUpgraded", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "prev_address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::EventUpgraded", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "prev_address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ContractUpgraded", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ContractInitialized", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "init_calldata", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::EventEmitted", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "system_address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "historical", - "type": "core::bool", - "kind": "key" - }, - { - "name": "keys", - "type": "core::array::Span::", - "kind": "data" - }, - { - "name": "values", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::MetadataUpdate", - "kind": "struct", - "members": [ - { - "name": "resource", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "uri", - "type": "core::byte_array::ByteArray", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::StoreSetRecord", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "entity_id", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "keys", - "type": "core::array::Span::", - "kind": "data" - }, - { - "name": "values", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::StoreUpdateRecord", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "entity_id", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "values", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::StoreUpdateMember", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "entity_id", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "member_selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "values", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::StoreDelRecord", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "entity_id", - "type": "core::felt252", - "kind": "key" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::WriterUpdated", - "kind": "struct", - "members": [ - { - "name": "resource", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "value", - "type": "core::bool", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::OwnerUpdated", - "kind": "struct", - "members": [ - { - "name": "resource", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "value", - "type": "core::bool", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::Event", - "kind": "enum", - "variants": [ - { - "name": "WorldSpawned", - "type": "dojo::world::world_contract::world::WorldSpawned", - "kind": "nested" - }, - { - "name": "WorldUpgraded", - "type": "dojo::world::world_contract::world::WorldUpgraded", - "kind": "nested" - }, - { - "name": "NamespaceRegistered", - "type": "dojo::world::world_contract::world::NamespaceRegistered", - "kind": "nested" - }, - { - "name": "ModelRegistered", - "type": "dojo::world::world_contract::world::ModelRegistered", - "kind": "nested" - }, - { - "name": "EventRegistered", - "type": "dojo::world::world_contract::world::EventRegistered", - "kind": "nested" - }, - { - "name": "ContractRegistered", - "type": "dojo::world::world_contract::world::ContractRegistered", - "kind": "nested" - }, - { - "name": "ModelUpgraded", - "type": "dojo::world::world_contract::world::ModelUpgraded", - "kind": "nested" - }, - { - "name": "EventUpgraded", - "type": "dojo::world::world_contract::world::EventUpgraded", - "kind": "nested" - }, - { - "name": "ContractUpgraded", - "type": "dojo::world::world_contract::world::ContractUpgraded", - "kind": "nested" - }, - { - "name": "ContractInitialized", - "type": "dojo::world::world_contract::world::ContractInitialized", - "kind": "nested" - }, - { - "name": "EventEmitted", - "type": "dojo::world::world_contract::world::EventEmitted", - "kind": "nested" - }, - { - "name": "MetadataUpdate", - "type": "dojo::world::world_contract::world::MetadataUpdate", - "kind": "nested" - }, - { - "name": "StoreSetRecord", - "type": "dojo::world::world_contract::world::StoreSetRecord", - "kind": "nested" - }, - { - "name": "StoreUpdateRecord", - "type": "dojo::world::world_contract::world::StoreUpdateRecord", - "kind": "nested" - }, - { - "name": "StoreUpdateMember", - "type": "dojo::world::world_contract::world::StoreUpdateMember", - "kind": "nested" - }, - { - "name": "StoreDelRecord", - "type": "dojo::world::world_contract::world::StoreDelRecord", - "kind": "nested" - }, - { - "name": "WriterUpdated", - "type": "dojo::world::world_contract::world::WriterUpdated", - "kind": "nested" - }, - { - "name": "OwnerUpdated", - "type": "dojo::world::world_contract::world::OwnerUpdated", - "kind": "nested" - } - ] - } - ] - }, - "contracts": [ - { - "address": "0x3451db8ccea9054ec016d1bd9ec40cde6ba895e92762bfb0a7f4136aee7652", - "class_hash": "0x18ecc8ded7425656bfdf18bf4fcb86a12f6bc94183de10ef17c4e9704fa01e", - "abi": [ - { - "type": "impl", - "name": "actions__ContractImpl", - "interface_name": "dojo::contract::interface::IContract" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::interface::IContract", - "items": [ - { - "type": "function", - "name": "dojo_name", - "inputs": [], - "outputs": [ - { - "type": "core::byte_array::ByteArray" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "ActionsImpl", - "interface_name": "octoguns::systems::actions::IActions" - }, - { - "type": "enum", - "name": "core::bool", - "variants": [ - { - "name": "False", - "type": "()" - }, - { - "name": "True", - "type": "()" - } - ] - }, - { - "type": "struct", - "name": "octoguns::types::IVec2", - "members": [ - { - "name": "x", - "type": "core::integer::u64" - }, - { - "name": "y", - "type": "core::integer::u64" - }, - { - "name": "xdir", - "type": "core::bool" - }, - { - "name": "ydir", - "type": "core::bool" - } - ] - }, - { - "type": "struct", - "name": "octoguns::types::Shot", - "members": [ - { - "name": "angle", - "type": "core::integer::u64" - }, - { - "name": "step", - "type": "core::integer::u32" - } - ] - }, - { - "type": "struct", - "name": "octoguns::types::TurnMove", - "members": [ - { - "name": "sub_moves", - "type": "core::array::Array::" - }, - { - "name": "shots", - "type": "core::array::Array::" - } - ] - }, - { - "type": "interface", - "name": "octoguns::systems::actions::IActions", - "items": [ - { - "type": "function", - "name": "move", - "inputs": [ - { - "name": "session_id", - "type": "core::integer::u32" - }, - { - "name": "moves", - "type": "octoguns::types::TurnMove" - } - ], - "outputs": [], - "state_mutability": "view" - } - ] - }, - { - "type": "function", - "name": "dojo_init", - "inputs": [], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "impl", - "name": "WorldProviderImpl", - "interface_name": "dojo::contract::components::world_provider::IWorldProvider" - }, - { - "type": "struct", - "name": "dojo::world::iworld::IWorldDispatcher", - "members": [ - { - "name": "contract_address", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::components::world_provider::IWorldProvider", - "items": [ - { - "type": "function", - "name": "world_dispatcher", - "inputs": [], - "outputs": [ - { - "type": "dojo::world::iworld::IWorldDispatcher" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableImpl", - "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" - }, - { - "type": "interface", - "name": "dojo::contract::components::upgradeable::IUpgradeable", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "enum", - "variants": [ - { - "name": "Upgraded", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "nested" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "enum", - "variants": [] - }, - { - "type": "event", - "name": "octoguns::systems::actions::actions::Event", - "kind": "enum", - "variants": [ - { - "name": "UpgradeableEvent", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "nested" - }, - { - "name": "WorldProviderEvent", - "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "nested" - } - ] - } - ], - "init_calldata": [], - "tag": "octoguns-actions", - "systems": [] - }, - { - "address": "0x7219a096b58c54f88c9d61943a3e6e278056a7d01e3ad8cb73d778a5aaa364d", - "class_hash": "0x5ebb65ccfaced79072fed9661f6c70a71389e2ea0bafe73b91ee2da13657f7a", - "abi": [ - { - "type": "impl", - "name": "mapmaker__ContractImpl", - "interface_name": "dojo::contract::interface::IContract" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::interface::IContract", - "items": [ - { - "type": "function", - "name": "dojo_name", - "inputs": [], - "outputs": [ - { - "type": "core::byte_array::ByteArray" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "MapmakerImpl", - "interface_name": "octoguns::systems::mapmaker::IMapmaker" - }, - { - "type": "interface", - "name": "octoguns::systems::mapmaker::IMapmaker", - "items": [ - { - "type": "function", - "name": "create", - "inputs": [ - { - "name": "grid1", - "type": "core::felt252" - }, - { - "name": "grid2", - "type": "core::felt252" - }, - { - "name": "grid3", - "type": "core::felt252" - } - ], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "function", - "name": "default_map", - "inputs": [], - "outputs": [], - "state_mutability": "view" - } - ] - }, - { - "type": "function", - "name": "dojo_init", - "inputs": [], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "impl", - "name": "WorldProviderImpl", - "interface_name": "dojo::contract::components::world_provider::IWorldProvider" - }, - { - "type": "struct", - "name": "dojo::world::iworld::IWorldDispatcher", - "members": [ - { - "name": "contract_address", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::components::world_provider::IWorldProvider", - "items": [ - { - "type": "function", - "name": "world_dispatcher", - "inputs": [], - "outputs": [ - { - "type": "dojo::world::iworld::IWorldDispatcher" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableImpl", - "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" - }, - { - "type": "interface", - "name": "dojo::contract::components::upgradeable::IUpgradeable", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "enum", - "variants": [ - { - "name": "Upgraded", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "nested" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "enum", - "variants": [] - }, - { - "type": "event", - "name": "octoguns::systems::mapmaker::mapmaker::Event", - "kind": "enum", - "variants": [ - { - "name": "UpgradeableEvent", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "nested" - }, - { - "name": "WorldProviderEvent", - "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "nested" - } - ] - } - ], - "init_calldata": [], - "tag": "octoguns-mapmaker", - "systems": [] - }, - { - "address": "0x4a9b6ecaa6a57875a7e1b3600d42cf6e6fd260dd85e5a4f5aa8288c08dbfd6d", - "class_hash": "0x6c3d6a7a56075c6868564c9bae1171a31267c4654d407692137940f9ad94f27", - "abi": [ - { - "type": "impl", - "name": "spawn__ContractImpl", - "interface_name": "dojo::contract::interface::IContract" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::interface::IContract", - "items": [ - { - "type": "function", - "name": "dojo_name", - "inputs": [], - "outputs": [ - { - "type": "core::byte_array::ByteArray" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "SpawnImpl", - "interface_name": "octoguns::systems::spawn::ISpawn" - }, - { - "type": "interface", - "name": "octoguns::systems::spawn::ISpawn", - "items": [ - { - "type": "function", - "name": "spawn", - "inputs": [ - { - "name": "session_id", - "type": "core::integer::u32" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "function", - "name": "dojo_init", - "inputs": [], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "impl", - "name": "WorldProviderImpl", - "interface_name": "dojo::contract::components::world_provider::IWorldProvider" - }, - { - "type": "struct", - "name": "dojo::world::iworld::IWorldDispatcher", - "members": [ - { - "name": "contract_address", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::components::world_provider::IWorldProvider", - "items": [ - { - "type": "function", - "name": "world_dispatcher", - "inputs": [], - "outputs": [ - { - "type": "dojo::world::iworld::IWorldDispatcher" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableImpl", - "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" - }, - { - "type": "interface", - "name": "dojo::contract::components::upgradeable::IUpgradeable", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "enum", - "variants": [ - { - "name": "Upgraded", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "nested" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "enum", - "variants": [] - }, - { - "type": "event", - "name": "octoguns::systems::spawn::spawn::Event", - "kind": "enum", - "variants": [ - { - "name": "UpgradeableEvent", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "nested" - }, - { - "name": "WorldProviderEvent", - "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "nested" - } - ] - } - ], - "init_calldata": [], - "tag": "octoguns-spawn", - "systems": [] - }, - { - "address": "0x7f938d33e2a6938082a094102d9cdd765a7688389b0de5f90e2dc8e4ee6dfcd", - "class_hash": "0xca73b71b52f9ae4fce269442a08868ef9b83aeacfbf9f32eb3e6ff69128d62", - "abi": [ - { - "type": "impl", - "name": "start__ContractImpl", - "interface_name": "dojo::contract::interface::IContract" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::interface::IContract", - "items": [ - { - "type": "function", - "name": "dojo_name", - "inputs": [], - "outputs": [ - { - "type": "core::byte_array::ByteArray" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "StartImpl", - "interface_name": "octoguns::systems::start::IStart" - }, - { - "type": "struct", - "name": "octoguns::types::Settings", - "members": [ - { - "name": "bullet_speed", - "type": "core::integer::u64" - }, - { - "name": "bullet_sub_steps", - "type": "core::integer::u32" - }, - { - "name": "bullets_per_turn", - "type": "core::integer::u32" - }, - { - "name": "sub_moves_per_turn", - "type": "core::integer::u32" - }, - { - "name": "max_distance_per_sub_move", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "octoguns::systems::start::IStart", - "items": [ - { - "type": "function", - "name": "create", - "inputs": [ - { - "name": "map_id", - "type": "core::integer::u32" - }, - { - "name": "settings", - "type": "octoguns::types::Settings" - } - ], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "create_closed", - "inputs": [ - { - "name": "map_id", - "type": "core::integer::u32" - }, - { - "name": "player_address_1", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "player_address_2", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "settings", - "type": "octoguns::types::Settings" - } - ], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "join", - "inputs": [ - { - "name": "session_id", - "type": "core::integer::u32" - } - ], - "outputs": [], - "state_mutability": "view" - } - ] - }, - { - "type": "function", - "name": "dojo_init", - "inputs": [], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "impl", - "name": "WorldProviderImpl", - "interface_name": "dojo::contract::components::world_provider::IWorldProvider" - }, - { - "type": "struct", - "name": "dojo::world::iworld::IWorldDispatcher", - "members": [ - { - "name": "contract_address", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::components::world_provider::IWorldProvider", - "items": [ - { - "type": "function", - "name": "world_dispatcher", - "inputs": [], - "outputs": [ - { - "type": "dojo::world::iworld::IWorldDispatcher" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableImpl", - "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" - }, - { - "type": "interface", - "name": "dojo::contract::components::upgradeable::IUpgradeable", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "enum", - "variants": [ - { - "name": "Upgraded", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "nested" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "enum", - "variants": [] - }, - { - "type": "event", - "name": "octoguns::systems::start::start::Event", - "kind": "enum", - "variants": [ - { - "name": "UpgradeableEvent", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "nested" - }, - { - "name": "WorldProviderEvent", - "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "nested" - } - ] - } - ], - "init_calldata": [], - "tag": "octoguns-start", - "systems": [] - }, - { - "address": "0x2adbf7a614d31d427d8227104e6796eb9c88439ccc240c5a5f9d3a19d0ea6d5", - "class_hash": "0x5e3a52d7af64c0ccba8fa8490cc790ac58c4a7694f3c872f78091e653bbbca1", - "abi": [ - { - "type": "impl", - "name": "planetelo__ContractImpl", - "interface_name": "dojo::contract::interface::IContract" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::interface::IContract", - "items": [ - { - "type": "function", - "name": "dojo_name", - "inputs": [], - "outputs": [ - { - "type": "core::byte_array::ByteArray" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "PlaneteloInterfaceImpl", - "interface_name": "octoguns::planetelo::IPlanetelo" - }, - { - "type": "struct", - "name": "planetelo_interface::interfaces::octoguns::Settings", - "members": [ - { - "name": "bullet_speed", - "type": "core::integer::u64" - }, - { - "name": "bullet_sub_steps", - "type": "core::integer::u32" - }, - { - "name": "bullets_per_turn", - "type": "core::integer::u32" - }, - { - "name": "sub_moves_per_turn", - "type": "core::integer::u32" - }, - { - "name": "max_distance_per_sub_move", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "octoguns::planetelo::IPlanetelo", - "items": [ - { - "type": "function", - "name": "create_playlist", - "inputs": [ - { - "name": "maps", - "type": "core::array::Array::" - }, - { - "name": "settings", - "type": "planetelo_interface::interfaces::octoguns::Settings" - } - ], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "spawn_default_playlist", - "inputs": [], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "function", - "name": "get_result", - "inputs": [ - { - "name": "session_id", - "type": "core::integer::u32" - } - ], - "outputs": [ - { - "type": "core::integer::u8" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "OneOnOneImpl", - "interface_name": "planetelo_interface::interfaces::planetelo::IOneOnOne" - }, - { - "type": "enum", - "name": "planetelo_interface::interfaces::planetelo::Status", - "variants": [ - { - "name": "None", - "type": "()" - }, - { - "name": "Active", - "type": "()" - }, - { - "name": "Draw", - "type": "()" - }, - { - "name": "Winner", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "interface", - "name": "planetelo_interface::interfaces::planetelo::IOneOnOne", - "items": [ - { - "type": "function", - "name": "create_match", - "inputs": [ - { - "name": "p1", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "p2", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "playlist_id", - "type": "core::integer::u128" - } - ], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "external" - }, - { - "type": "function", - "name": "settle_match", - "inputs": [ - { - "name": "match_id", - "type": "core::integer::u128" - } - ], - "outputs": [ - { - "type": "planetelo_interface::interfaces::planetelo::Status" - } - ], - "state_mutability": "external" - } - ] - }, - { - "type": "function", - "name": "dojo_init", - "inputs": [], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "impl", - "name": "WorldProviderImpl", - "interface_name": "dojo::contract::components::world_provider::IWorldProvider" - }, - { - "type": "struct", - "name": "dojo::world::iworld::IWorldDispatcher", - "members": [ - { - "name": "contract_address", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::components::world_provider::IWorldProvider", - "items": [ - { - "type": "function", - "name": "world_dispatcher", - "inputs": [], - "outputs": [ - { - "type": "dojo::world::iworld::IWorldDispatcher" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableImpl", - "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" - }, - { - "type": "interface", - "name": "dojo::contract::components::upgradeable::IUpgradeable", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "enum", - "variants": [ - { - "name": "Upgraded", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "nested" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "enum", - "variants": [] - }, - { - "type": "event", - "name": "octoguns::planetelo::planetelo::Event", - "kind": "enum", - "variants": [ - { - "name": "UpgradeableEvent", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "nested" - }, - { - "name": "WorldProviderEvent", - "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "nested" - } - ] - } - ], - "init_calldata": [], - "tag": "planetelo-planetelo", - "systems": [] - } - ], - "models": [ - { - "members": [], - "class_hash": "0x544d7440f53fd5cc2b484764334e97513c5dae47f892fe355f74b6da315e2cb", - "tag": "Bullet" - }, - { - "members": [], - "class_hash": "0x6c2aa2877c5127152ed5e97f4a2c36669b195ec880a7c786772ab274c01ee13", - "tag": "CharacterModel" - }, - { - "members": [], - "class_hash": "0x7650a39f52821e1d059df1220bc13a9197443a022c53dadfeebccdb083e5e98", - "tag": "CharacterPosition" - }, - { - "members": [], - "class_hash": "0x262b6417ae8473f6b637cc69bf987cbcf269ca52b90093deafeab7a52a5b9be", - "tag": "Global" - }, - { - "members": [], - "class_hash": "0x56c20192cd4dfc7fa2a2671052e324fa7b0a5ef8cfcea568359a27c006eb1ce", - "tag": "Map" - }, - { - "members": [], - "class_hash": "0x2b7cac4dbe2c765532068f745b9405fb4d4e47a8fd9a854c0f2c80dc400ec80", - "tag": "Player" - }, - { - "members": [], - "class_hash": "0x548a938b43e277e2d4e666f75f314140d836509a944c900fc9f302516ff36e7", - "tag": "Playlist" - }, - { - "members": [], - "class_hash": "0x165b93c1ab8c040de62631000c083e2fa890ab0769c821ee92b9c06bea0304e", - "tag": "PlaylistGlobal" - }, - { - "members": [], - "class_hash": "0x55429b96a3e0c2a711cd57ce27c028ce19d1dde7a090ca351743351b1672d28", - "tag": "Session" - }, - { - "members": [], - "class_hash": "0x6418324f638b2054ad0c7efd5c3579e90c1be56b44e808eda54e8fcc716677f", - "tag": "SessionMeta" - }, - { - "members": [], - "class_hash": "0x68c24665a78264d14c4a58a852a3699563f66889c09b94f32f4144ec9cd6d39", - "tag": "SessionPrimitives" - }, - { - "members": [], - "class_hash": "0x2327e0e59700b9c414026b8d39440b27bf57e9cc41f4777834a4bb12caa3970", - "tag": "TurnData" - } - ], - "events": [] - } \ No newline at end of file diff --git a/client/src/dojo/manifest_sepolia.json b/client/src/dojo/manifest_sepolia.json deleted file mode 100644 index 3465de7f9..000000000 --- a/client/src/dojo/manifest_sepolia.json +++ /dev/null @@ -1,1809 +0,0 @@ -{ - "world": { - "class_hash": "0x139239a99d627697b19b9856beaef7896fc75375caf3d750dd76982a7afeb78", - "address": "0x1924653b0f449dad3ba9b1d3d354a219cd8241b63cf31f8d90728ceb3bfc7cf", - "seed": "aaasdfdasdfasffdas", - "name": "Planetelo", - "abi": [ - { - "type": "impl", - "name": "World", - "interface_name": "dojo::world::iworld::IWorld" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "enum", - "name": "dojo::world::resource::Resource", - "variants": [ - { - "name": "Model", - "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" - }, - { - "name": "Event", - "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" - }, - { - "name": "Contract", - "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" - }, - { - "name": "Namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "World", - "type": "()" - }, - { - "name": "Unregistered", - "type": "()" - } - ] - }, - { - "type": "struct", - "name": "dojo::model::metadata::ResourceMetadata", - "members": [ - { - "name": "resource_id", - "type": "core::felt252" - }, - { - "name": "metadata_uri", - "type": "core::byte_array::ByteArray" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "enum", - "name": "core::bool", - "variants": [ - { - "name": "False", - "type": "()" - }, - { - "name": "True", - "type": "()" - } - ] - }, - { - "type": "enum", - "name": "dojo::model::definition::ModelIndex", - "variants": [ - { - "name": "Keys", - "type": "core::array::Span::" - }, - { - "name": "Id", - "type": "core::felt252" - }, - { - "name": "MemberId", - "type": "(core::felt252, core::felt252)" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "dojo::meta::layout::FieldLayout", - "members": [ - { - "name": "selector", - "type": "core::felt252" - }, - { - "name": "layout", - "type": "dojo::meta::layout::Layout" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "enum", - "name": "dojo::meta::layout::Layout", - "variants": [ - { - "name": "Fixed", - "type": "core::array::Span::" - }, - { - "name": "Struct", - "type": "core::array::Span::" - }, - { - "name": "Tuple", - "type": "core::array::Span::" - }, - { - "name": "Array", - "type": "core::array::Span::" - }, - { - "name": "ByteArray", - "type": "()" - }, - { - "name": "Enum", - "type": "core::array::Span::" - } - ] - }, - { - "type": "interface", - "name": "dojo::world::iworld::IWorld", - "items": [ - { - "type": "function", - "name": "resource", - "inputs": [ - { - "name": "selector", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "dojo::world::resource::Resource" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "uuid", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "external" - }, - { - "type": "function", - "name": "metadata", - "inputs": [ - { - "name": "resource_selector", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "dojo::model::metadata::ResourceMetadata" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "set_metadata", - "inputs": [ - { - "name": "metadata", - "type": "dojo::model::metadata::ResourceMetadata" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "register_namespace", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "register_event", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "register_model", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "register_contract", - "inputs": [ - { - "name": "salt", - "type": "core::felt252" - }, - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "external" - }, - { - "type": "function", - "name": "init_contract", - "inputs": [ - { - "name": "selector", - "type": "core::felt252" - }, - { - "name": "init_calldata", - "type": "core::array::Span::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "upgrade_event", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "upgrade_model", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "upgrade_contract", - "inputs": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [ - { - "type": "core::starknet::class_hash::ClassHash" - } - ], - "state_mutability": "external" - }, - { - "type": "function", - "name": "emit_event", - "inputs": [ - { - "name": "event_selector", - "type": "core::felt252" - }, - { - "name": "keys", - "type": "core::array::Span::" - }, - { - "name": "values", - "type": "core::array::Span::" - }, - { - "name": "historical", - "type": "core::bool" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "entity", - "inputs": [ - { - "name": "model_selector", - "type": "core::felt252" - }, - { - "name": "index", - "type": "dojo::model::definition::ModelIndex" - }, - { - "name": "layout", - "type": "dojo::meta::layout::Layout" - } - ], - "outputs": [ - { - "type": "core::array::Span::" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "set_entity", - "inputs": [ - { - "name": "model_selector", - "type": "core::felt252" - }, - { - "name": "index", - "type": "dojo::model::definition::ModelIndex" - }, - { - "name": "values", - "type": "core::array::Span::" - }, - { - "name": "layout", - "type": "dojo::meta::layout::Layout" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "delete_entity", - "inputs": [ - { - "name": "model_selector", - "type": "core::felt252" - }, - { - "name": "index", - "type": "dojo::model::definition::ModelIndex" - }, - { - "name": "layout", - "type": "dojo::meta::layout::Layout" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "is_owner", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "grant_owner", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "revoke_owner", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "is_writer", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "grant_writer", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "revoke_writer", - "inputs": [ - { - "name": "resource", - "type": "core::felt252" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableWorld", - "interface_name": "dojo::world::iworld::IUpgradeableWorld" - }, - { - "type": "interface", - "name": "dojo::world::iworld::IUpgradeableWorld", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [ - { - "name": "world_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::WorldSpawned", - "kind": "struct", - "members": [ - { - "name": "creator", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::WorldUpgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::NamespaceRegistered", - "kind": "struct", - "members": [ - { - "name": "namespace", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "hash", - "type": "core::felt252", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ModelRegistered", - "kind": "struct", - "members": [ - { - "name": "name", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "namespace", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::EventRegistered", - "kind": "struct", - "members": [ - { - "name": "name", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "namespace", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ContractRegistered", - "kind": "struct", - "members": [ - { - "name": "name", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "namespace", - "type": "core::byte_array::ByteArray", - "kind": "key" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "salt", - "type": "core::felt252", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ModelUpgraded", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "prev_address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::EventUpgraded", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - }, - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "prev_address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ContractUpgraded", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::ContractInitialized", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "init_calldata", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::EventEmitted", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "system_address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "historical", - "type": "core::bool", - "kind": "key" - }, - { - "name": "keys", - "type": "core::array::Span::", - "kind": "data" - }, - { - "name": "values", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::MetadataUpdate", - "kind": "struct", - "members": [ - { - "name": "resource", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "uri", - "type": "core::byte_array::ByteArray", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::StoreSetRecord", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "entity_id", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "keys", - "type": "core::array::Span::", - "kind": "data" - }, - { - "name": "values", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::StoreUpdateRecord", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "entity_id", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "values", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::StoreUpdateMember", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "entity_id", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "member_selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "values", - "type": "core::array::Span::", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::StoreDelRecord", - "kind": "struct", - "members": [ - { - "name": "selector", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "entity_id", - "type": "core::felt252", - "kind": "key" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::WriterUpdated", - "kind": "struct", - "members": [ - { - "name": "resource", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "value", - "type": "core::bool", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::OwnerUpdated", - "kind": "struct", - "members": [ - { - "name": "resource", - "type": "core::felt252", - "kind": "key" - }, - { - "name": "contract", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "value", - "type": "core::bool", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::world::world_contract::world::Event", - "kind": "enum", - "variants": [ - { - "name": "WorldSpawned", - "type": "dojo::world::world_contract::world::WorldSpawned", - "kind": "nested" - }, - { - "name": "WorldUpgraded", - "type": "dojo::world::world_contract::world::WorldUpgraded", - "kind": "nested" - }, - { - "name": "NamespaceRegistered", - "type": "dojo::world::world_contract::world::NamespaceRegistered", - "kind": "nested" - }, - { - "name": "ModelRegistered", - "type": "dojo::world::world_contract::world::ModelRegistered", - "kind": "nested" - }, - { - "name": "EventRegistered", - "type": "dojo::world::world_contract::world::EventRegistered", - "kind": "nested" - }, - { - "name": "ContractRegistered", - "type": "dojo::world::world_contract::world::ContractRegistered", - "kind": "nested" - }, - { - "name": "ModelUpgraded", - "type": "dojo::world::world_contract::world::ModelUpgraded", - "kind": "nested" - }, - { - "name": "EventUpgraded", - "type": "dojo::world::world_contract::world::EventUpgraded", - "kind": "nested" - }, - { - "name": "ContractUpgraded", - "type": "dojo::world::world_contract::world::ContractUpgraded", - "kind": "nested" - }, - { - "name": "ContractInitialized", - "type": "dojo::world::world_contract::world::ContractInitialized", - "kind": "nested" - }, - { - "name": "EventEmitted", - "type": "dojo::world::world_contract::world::EventEmitted", - "kind": "nested" - }, - { - "name": "MetadataUpdate", - "type": "dojo::world::world_contract::world::MetadataUpdate", - "kind": "nested" - }, - { - "name": "StoreSetRecord", - "type": "dojo::world::world_contract::world::StoreSetRecord", - "kind": "nested" - }, - { - "name": "StoreUpdateRecord", - "type": "dojo::world::world_contract::world::StoreUpdateRecord", - "kind": "nested" - }, - { - "name": "StoreUpdateMember", - "type": "dojo::world::world_contract::world::StoreUpdateMember", - "kind": "nested" - }, - { - "name": "StoreDelRecord", - "type": "dojo::world::world_contract::world::StoreDelRecord", - "kind": "nested" - }, - { - "name": "WriterUpdated", - "type": "dojo::world::world_contract::world::WriterUpdated", - "kind": "nested" - }, - { - "name": "OwnerUpdated", - "type": "dojo::world::world_contract::world::OwnerUpdated", - "kind": "nested" - } - ] - } - ] - }, - "contracts": [ - { - "address": "0x5be332148f819892b4f47b6404d04832b9afa9cbca1adf2175842d51be4fcd2", - "class_hash": "0x74f099c340933c8552a0616e8b8c91e7b4cd02f849e89de95fc217ff48dfb59", - "abi": [ - { - "type": "impl", - "name": "queue__ContractImpl", - "interface_name": "dojo::contract::interface::IContract" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::interface::IContract", - "items": [ - { - "type": "function", - "name": "dojo_name", - "inputs": [], - "outputs": [ - { - "type": "core::byte_array::ByteArray" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "QueueImpl", - "interface_name": "planetelo::systems::queue::IQueue" - }, - { - "type": "struct", - "name": "planetelo::models::QueueMember", - "members": [ - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - }, - { - "name": "index", - "type": "core::integer::u128" - }, - { - "name": "player", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "timestamp", - "type": "core::integer::u64" - }, - { - "name": "elo", - "type": "core::integer::u64" - } - ] - }, - { - "type": "interface", - "name": "planetelo::systems::queue::IQueue", - "items": [ - { - "type": "function", - "name": "queue", - "inputs": [ - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "dequeue", - "inputs": [ - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "matchmake", - "inputs": [ - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "settle", - "inputs": [ - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "game_id", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "get_elo", - "inputs": [ - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - } - ], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "get_queue_length", - "inputs": [ - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - } - ], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "get_status", - "inputs": [ - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - } - ], - "outputs": [ - { - "type": "core::integer::u8" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "get_queue_members", - "inputs": [ - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - } - ], - "outputs": [ - { - "type": "core::array::Array::" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "get_player_game_id", - "inputs": [ - { - "name": "address", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - } - ], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "function", - "name": "dojo_init", - "inputs": [], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "impl", - "name": "WorldProviderImpl", - "interface_name": "dojo::contract::components::world_provider::IWorldProvider" - }, - { - "type": "struct", - "name": "dojo::world::iworld::IWorldDispatcher", - "members": [ - { - "name": "contract_address", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::components::world_provider::IWorldProvider", - "items": [ - { - "type": "function", - "name": "world_dispatcher", - "inputs": [], - "outputs": [ - { - "type": "dojo::world::iworld::IWorldDispatcher" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableImpl", - "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" - }, - { - "type": "interface", - "name": "dojo::contract::components::upgradeable::IUpgradeable", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "enum", - "variants": [ - { - "name": "Upgraded", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "nested" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "enum", - "variants": [] - }, - { - "type": "event", - "name": "planetelo::systems::queue::queue::Event", - "kind": "enum", - "variants": [ - { - "name": "UpgradeableEvent", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "nested" - }, - { - "name": "WorldProviderEvent", - "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "nested" - } - ] - } - ], - "init_calldata": [], - "tag": "planetelo-queue", - "systems": [] - }, - { - "address": "0x55782055ef3378f23bb9d73b11112490066e235fb35393dc36ab47247ce17ae", - "class_hash": "0x23d67862ab72cf3252f37e2aff0db2cc3eb4d0ed57d10bc35138b4bd162b93a", - "abi": [ - { - "type": "impl", - "name": "tournament__ContractImpl", - "interface_name": "dojo::contract::interface::IContract" - }, - { - "type": "struct", - "name": "core::byte_array::ByteArray", - "members": [ - { - "name": "data", - "type": "core::array::Array::" - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::interface::IContract", - "items": [ - { - "type": "function", - "name": "dojo_name", - "inputs": [], - "outputs": [ - { - "type": "core::byte_array::ByteArray" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "TournamentImpl", - "interface_name": "planetelo::systems::tournament::ITournamentActionsDispatcher" - }, - { - "type": "struct", - "name": "planetelo::systems::tournament::TournamentConfig", - "members": [ - { - "name": "swiss_rounds", - "type": "core::integer::u8" - }, - { - "name": "top_cut", - "type": "core::integer::u8" - }, - { - "name": "entry_time", - "type": "core::integer::u64" - } - ] - }, - { - "type": "interface", - "name": "planetelo::systems::tournament::ITournamentActionsDispatcher", - "items": [ - { - "type": "function", - "name": "create_tournament", - "inputs": [ - { - "name": "game", - "type": "core::felt252" - }, - { - "name": "playlist", - "type": "core::integer::u128" - }, - { - "name": "config", - "type": "planetelo::systems::tournament::TournamentConfig" - } - ], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "external" - }, - { - "type": "function", - "name": "join_tournament", - "inputs": [ - { - "name": "tournament_id", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "start_tournament", - "inputs": [ - { - "name": "tournament_id", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "advance_tournament", - "inputs": [ - { - "name": "tournament_id", - "type": "core::integer::u128" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "function", - "name": "dojo_init", - "inputs": [], - "outputs": [], - "state_mutability": "view" - }, - { - "type": "impl", - "name": "WorldProviderImpl", - "interface_name": "dojo::contract::components::world_provider::IWorldProvider" - }, - { - "type": "struct", - "name": "dojo::world::iworld::IWorldDispatcher", - "members": [ - { - "name": "contract_address", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "type": "interface", - "name": "dojo::contract::components::world_provider::IWorldProvider", - "items": [ - { - "type": "function", - "name": "world_dispatcher", - "inputs": [], - "outputs": [ - { - "type": "dojo::world::iworld::IWorldDispatcher" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "UpgradeableImpl", - "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" - }, - { - "type": "interface", - "name": "dojo::contract::components::upgradeable::IUpgradeable", - "items": [ - { - "type": "function", - "name": "upgrade", - "inputs": [ - { - "name": "new_class_hash", - "type": "core::starknet::class_hash::ClassHash" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "struct", - "members": [ - { - "name": "class_hash", - "type": "core::starknet::class_hash::ClassHash", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "enum", - "variants": [ - { - "name": "Upgraded", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", - "kind": "nested" - } - ] - }, - { - "type": "event", - "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "enum", - "variants": [] - }, - { - "type": "event", - "name": "planetelo::systems::tournament::tournament::Event", - "kind": "enum", - "variants": [ - { - "name": "UpgradeableEvent", - "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", - "kind": "nested" - }, - { - "name": "WorldProviderEvent", - "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", - "kind": "nested" - } - ] - } - ], - "init_calldata": [], - "tag": "planetelo-tournament", - "systems": [] - } - ], - "models": [ - { - "members": [], - "class_hash": "0x2b80b08ba832f3f4977bfdb4fc79c79e2a40c272c6b23b5f8d03fa5491f5ddb", - "tag": "Elo" - }, - { - "members": [], - "class_hash": "0x72addb0bbcd04d2137b1459ab713a08651084c1b64614a6fe02b29bce2f84a2", - "tag": "Game" - }, - { - "members": [], - "class_hash": "0xb499568eb655fa0603345a4070852a56a118cb50c4bdc477fd67bd2aa77c8b", - "tag": "Global" - }, - { - "members": [], - "class_hash": "0x4d9d93a52718ad7da24a04a55bcd70c05ad83142472bc8ad771381978fef7d9", - "tag": "GlobalTournament" - }, - { - "members": [], - "class_hash": "0x7d950a261d8e32a4507cd9d9d9df0c0e31dc429e889258792dc15099fdc7fb8", - "tag": "Player" - }, - { - "members": [], - "class_hash": "0x278202613e13d3c314f620a4ca593ad686cecb39a9c362a6c4734882af212cf", - "tag": "PlayerStatus" - }, - { - "members": [], - "class_hash": "0x6d86d7da1b9814f7868e210a297f25d31b57b9dd28815f82f4306cfaa380bdc", - "tag": "Pool" - }, - { - "members": [], - "class_hash": "0x4182b0a5e8e5e60e91084285042cc25ffb9793c8273be65db87a07cff6d7f3b", - "tag": "Queue" - }, - { - "members": [], - "class_hash": "0x4875c7172d1e43019ddefe8365b00c88b0984edb4b53514c39de445f1bcbe56", - "tag": "QueueMember" - }, - { - "members": [], - "class_hash": "0x71ecb997451de7da9fde253581db3df54973fe1e45df22f7b1ed9cfb5f8981c", - "tag": "Tournament" - } - ], - "events": [] - } \ No newline at end of file diff --git a/client/src/dojo/setup.ts b/client/src/dojo/setup.ts index 18234deca..adf2ab2be 100644 --- a/client/src/dojo/setup.ts +++ b/client/src/dojo/setup.ts @@ -9,27 +9,24 @@ import { Account } from 'starknet' import type { ArraySignatureType } from 'starknet' import { BurnerManager } from '@dojoengine/create-burner' import { getSyncEntities, getSyncEvents } from '@dojoengine/state' -import { account } from '$src/stores/account' -import manifest from './manifest_sepolia.json' import { Contract } from 'starknet' -import { planeteloStore } from '$src/stores/dojoStore' +import { planeteloStore } from '$stores/dojoStore' +import manifest from '../../../contracts/planetelo/manifest_sepolia.json' + +console.log(manifest.world.address) + + export type SetupResult = Awaited> -export async function setup( - worldAddress: string | undefined, - { ...config }: DojoConfig -) { +export async function setup({ ...config }: DojoConfig) { // torii client const toriiClient = await torii.createClient({ - rpcUrl: 'https://api.cartridge.gg/x/starknet/sepolia', - toriiUrl: 'https://api.cartridge.gg/x/planetelo/torii', + rpcUrl: config.rpcUrl, + toriiUrl: config.toriiUrl, relayUrl: '', - worldAddress: - '0x633afc7ba46094bb158889ba55487886c5748439433a555ca3ac16f502d7dc', + worldAddress: '0x05b92750cd85e7cdb33fd9f03a8ac2222deccfaea94cf8d49737441e90d3ab76' }) - - // create contract components const contractComponents = defineContractComponents(world) @@ -37,47 +34,43 @@ export async function setup( const clientComponents = createClientComponents({ contractComponents }) // create dojo provider - const dojoProvider = new DojoProvider(config.manifest, 'https://api.cartridge.gg/x/starknet/sepolia') - console.log(dojoProvider) + const dojoProvider = new DojoProvider(config.manifest, config.rpcUrl) + + console.log(JSON.parse(JSON.stringify(manifest))); - const sync = await getSyncEntities( - toriiClient, - contractComponents as any, - undefined, - [] - ) + const sync = await getSyncEntities(toriiClient, contractComponents as any, undefined, []) let contracts = JSON.parse(JSON.stringify(manifest.contracts)); console.log(contracts[0]); const myTestContract = new Contract(contracts[0].abi, contracts[0].address, dojoProvider.provider).typedv2(contracts[0].abi); + console.log(myTestContract); planeteloStore.set(myTestContract); // setup world - // setup world const client = await setupWorld(dojoProvider) + // create burner manager - const burnerManager = new BurnerManager({ - masterAccount: new Account( - { - nodeUrl: config.rpcUrl, - }, - config.masterAddress, - config.masterPrivateKey - ), - accountClassHash: config.accountClassHash, - rpcProvider: dojoProvider.provider, - feeTokenAddress: config.feeTokenAddress, - }) + // const burnerManager = new BurnerManager({ + // masterAccount: new Account( + // { + // nodeUrl: config.rpcUrl, + // }, + // KATANA_PREFUNDED_ADDRESS, + // KATANA_PREFUNDED_PRIVATE_KEY + // ), + // accountClassHash: config.accountClassHash, + // rpcProvider: dojoProvider.provider, + // feeTokenAddress: config.feeTokenAddress, + // }) - try { - console.log('Starting burner!') - await burnerManager.init() - if (burnerManager.list().length === 0) { - await burnerManager.create() - } - } catch (e) { - console.error('An error occurred while creating burner:', e) - } + // try { + // await burnerManager.init() + // if (burnerManager.list().length === 0) { + // await burnerManager.create() + // } + // } catch (e) { + // console.error(e) + // } return { client, @@ -88,7 +81,7 @@ export async function setup( }, config, dojoProvider, - burnerManager, + // burnerManager, toriiClient, torii, diff --git a/client/src/dojoConfig.ts b/client/src/dojoConfig.ts index fa0f96117..4934821c5 100644 --- a/client/src/dojoConfig.ts +++ b/client/src/dojoConfig.ts @@ -1,12 +1,18 @@ -import { get } from 'svelte/store' -import manifest from './dojo/manifest_octoguns_sepolia.json' -import { createDojoConfig } from '@dojoengine/core' -import { CONFIG } from '$stores/network' +import { get } from 'svelte/store'; +import manifest from '../../contracts/octoguns/manifest_dev.json'; +import { createDojoConfig } from '@dojoengine/core'; +import { CONFIG } from '$stores/network'; -export const dojoConfig = createDojoConfig({ - toriiUrl: 'https://api.cartridge.gg/x/octoguns-alpha2/torii', - rpcUrl: 'https://api.cartridge.gg/x/octoguns-alpha2/katana', - manifest, -}) +export function getDojoConfig() { + const configValue = get(CONFIG); + console.log(configValue); -export type Config = typeof dojoConfig + + const dojoConfig = createDojoConfig({ + rpcUrl: 'https://api.cartridge.gg/x/starknet/sepolia', + toriiUrl: 'https://api.cartridge.gg/x/planetelo/torii', + manifest, + }); + + return { dojoConfig }; +} diff --git a/client/src/lib/3d/Scene.svelte b/client/src/lib/3d/Scene.svelte index 2decc46ac..612e1fca0 100644 --- a/client/src/lib/3d/Scene.svelte +++ b/client/src/lib/3d/Scene.svelte @@ -3,7 +3,18 @@ import { onDestroy, onMount } from 'svelte' import Map from './components/Map.svelte' import Characters from './components/Characters.svelte' - + import { + recordingMode, + replayMode, + recordedMove, + rendererStore, + } from '$stores/gameStores' + import { + handleKeyDown, + handleKeyUp, + handleMouseDown, + handleMouseUp, + } from '$lib/handlers' import BirdView from './components/Cameras/BirdView.svelte' import SplitScreen from './components/Cameras/SplitScreen.svelte' import { @@ -11,41 +22,47 @@ resetCamera, } from './components/Cameras/SplitScreen/CameraUtils' import { birdView } from '$stores/cameraStores' + import { recordMove, replayMove } from '$lib/3d/utils/moveUtils' import { PerspectiveCamera } from 'three' import Bullets from './components/Bullets.svelte' - + import { shoot, replayShot, simulate } from './utils/shootUtils' + import { + isMouseDownStore, + playerCharacterId, + frameCounter, + } from '$stores/gameStores' + import { inPointerLock } from '$stores/cameraStores' import { writable } from 'svelte/store' - import getGame from '$lib/api/svelte/context' - import { rendererStore } from '$src/stores/gameStores' + import { RECORDING_FRAME_LIMIT } from '$lib/consts' + import { Inspector } from 'three-inspect' let { renderer, scene } = useThrelte() - const { controls, currentPlayerCharacterId, frameCounter, move } = getGame() - - let cameras: PerspectiveCamera[] = $state([]) + let cameras: PerspectiveCamera[] = [] let numCameras = 1 - let birdViewCamera: any = $state() + let birdViewCamera: any + + let characterId: number = 0 + $: characterId = $playerCharacterId - let characterId: number = $derived($currentPlayerCharacterId!) let hasShotInCurrentRecording = writable(false) let animationFrameId: number const addEventListeners = () => { - window.addEventListener('keydown', controls.handleKeyDown) - window.addEventListener('keyup', controls.handleKeyUp) - window.addEventListener('mousedown', controls.handleMouseDown) - window.addEventListener('mouseup', controls.handleMouseUp) + window.addEventListener('keydown', handleKeyDown) + window.addEventListener('keyup', handleKeyUp) + window.addEventListener('mousedown', handleMouseDown) + window.addEventListener('mouseup', handleMouseUp) } const removeEventListeners = () => { - window.removeEventListener('keydown', controls.handleKeyDown) - window.removeEventListener('keyup', controls.handleKeyUp) - window.removeEventListener('mousedown', controls.handleMouseDown) - window.removeEventListener('mouseup', controls.handleMouseUp) + window.removeEventListener('keydown', handleKeyDown) + window.removeEventListener('keyup', handleKeyUp) + window.removeEventListener('mousedown', handleMouseDown) + window.removeEventListener('mouseup', handleMouseUp) } - // TODO(Red): Start to refactor this const animationLoop = () => { try { if ($birdView) { @@ -56,12 +73,26 @@ } } } else { - if (cameras.length > 0 && cameras.every((cam) => cam && cam.isCamera)) { + if (cameras.length > 0 && cameras.every(cam => cam && cam.isCamera)) { renderCameras(cameras, numCameras, renderer, scene) } } - move.update(cameras[0]) + if ($recordingMode) { + recordMove(cameras[0], characterId) + if ($isMouseDownStore && $inPointerLock && !$hasShotInCurrentRecording) { + shoot(cameras[0]) // currently only works with one camera + hasShotInCurrentRecording.set(true) + } + } + if ($replayMode) { + if ($frameCounter > RECORDING_FRAME_LIMIT) { + console.log('eyyy, tf') + replayMode.set(false) + } + replayMove($recordedMove, characterId) + replayShot($recordedMove, cameras[0]) + } animationFrameId = requestAnimationFrame(animationLoop) } catch (error) { @@ -72,6 +103,10 @@ } } + $: if ($frameCounter) { + simulate() + } + onMount(() => { addEventListeners() animationLoop() @@ -85,6 +120,10 @@ } }) + $: if ($recordingMode) { + hasShotInCurrentRecording.set(false) + } + onDestroy(() => { removeEventListeners() renderer.setAnimationLoop(null) @@ -100,4 +139,5 @@ - + + \ No newline at end of file diff --git a/client/src/lib/3d/components/Bullet/Bullet.svelte b/client/src/lib/3d/components/Bullet/Bullet.svelte index f0a4041c5..22e8584c6 100644 --- a/client/src/lib/3d/components/Bullet/Bullet.svelte +++ b/client/src/lib/3d/components/Bullet/Bullet.svelte @@ -1,45 +1,29 @@ -{#each $bullets ?? [] as bullet} - +{#each bulletPairs as { bullet, initialBullet, uniqueKey } (uniqueKey)} + {/each} diff --git a/client/src/lib/3d/components/Cameras/BirdView.svelte b/client/src/lib/3d/components/Cameras/BirdView.svelte index ef72285d0..d30fb10d5 100644 --- a/client/src/lib/3d/components/Cameras/BirdView.svelte +++ b/client/src/lib/3d/components/Cameras/BirdView.svelte @@ -2,7 +2,7 @@ import { T } from '@threlte/core' import { OrbitControls } from '@threlte/extras' import { useThrelte } from '@threlte/core' - let { camera = $bindable() } = $props(); + export let camera let {renderer} = useThrelte() diff --git a/client/src/lib/3d/components/Cameras/SplitScreen.svelte b/client/src/lib/3d/components/Cameras/SplitScreen.svelte index 56a18306e..482e0a4dc 100644 --- a/client/src/lib/3d/components/Cameras/SplitScreen.svelte +++ b/client/src/lib/3d/components/Cameras/SplitScreen.svelte @@ -2,42 +2,18 @@ import { T } from '@threlte/core' import { PerspectiveCamera } from 'three' import PointerLock from './SplitScreen/PointerLock.svelte' - + import { playerCharacterId } from '$stores/gameStores' + import { playerCharacterCoords } from '$stores/coordsStores' import { birdView } from '$stores/cameraStores' import { useThrelte } from '@threlte/core' import Hand from '../models/hand.svelte' - import getGame from '$lib/api/svelte/context' - import type { Position } from '$lib/api/gameState' - import { onDestroy } from 'svelte' - - let { currentCharacter } = getGame() - - let playerCoords: Position | undefined = $state(undefined) - - // Red: For some reason the object is not reactive if I do not subscribe manually - const unsubscribe = currentCharacter.subscribe( - (char) => (playerCoords = char?.coords) - ) - - onDestroy(unsubscribe) - - function normalizeCoords(coords: Position): Position { - return { - x: coords.x / 1000 - 50, - y: coords.y / 1000 - 50, - } - } - let normalizedPlayerCoords = $derived( - normalizeCoords(playerCoords ?? { x: 0, y: 0 }) - ) + $: playerCoords = $playerCharacterCoords[$playerCharacterId] - interface Props { - cameras?: PerspectiveCamera[] - numCameras?: number - } + let {renderer} = useThrelte() - let { cameras = $bindable([]), numCameras = 1 }: Props = $props() + export let cameras: PerspectiveCamera[] = [] + export let numCameras: number = 1 {#if !$birdView} @@ -46,11 +22,10 @@ {#each Array(numCameras) as _, index} { - console.log('plz') - cameras[index] = obj - obj.lookAt(0, 1, 0) + position={[playerCoords.x, 1, playerCoords.y]} + on:create={({ ref }) => { + cameras[index] = ref + ref.lookAt(0, 1, 0) }} > diff --git a/client/src/lib/3d/components/Cameras/SplitScreen/PointerLock.svelte b/client/src/lib/3d/components/Cameras/SplitScreen/PointerLock.svelte index ef6ba6dd5..e5c5d4cfd 100644 --- a/client/src/lib/3d/components/Cameras/SplitScreen/PointerLock.svelte +++ b/client/src/lib/3d/components/Cameras/SplitScreen/PointerLock.svelte @@ -1,30 +1,22 @@ diff --git a/client/src/lib/3d/components/Character/Character.svelte b/client/src/lib/3d/components/Character/Character.svelte deleted file mode 100644 index 155acc0eb..000000000 --- a/client/src/lib/3d/components/Character/Character.svelte +++ /dev/null @@ -1,50 +0,0 @@ - - -{#if $character != null} - - - - -{/if} diff --git a/client/src/lib/3d/components/Characters.svelte b/client/src/lib/3d/components/Characters.svelte index 0f25a72db..e1489a5a6 100644 --- a/client/src/lib/3d/components/Characters.svelte +++ b/client/src/lib/3d/components/Characters.svelte @@ -1,13 +1,33 @@ - {#each characters as character} - - {/each} + + {#each Object.entries(player_coords) as [key, data]} + + + + + {/each} + + + {#each Object.entries(enemy_coords) as [key, data]} + + + + + {/each} + diff --git a/client/src/lib/3d/components/map/Blocks.svelte b/client/src/lib/3d/components/map/Blocks.svelte index 4486a4eaa..7b3a344f6 100644 --- a/client/src/lib/3d/components/map/Blocks.svelte +++ b/client/src/lib/3d/components/map/Blocks.svelte @@ -1,63 +1,62 @@ {#each coordsArray as coord} - - + + diff --git a/client/src/lib/3d/components/map/Ground.svelte b/client/src/lib/3d/components/map/Ground.svelte index f76d8e80c..433cbe80d 100644 --- a/client/src/lib/3d/components/map/Ground.svelte +++ b/client/src/lib/3d/components/map/Ground.svelte @@ -1,9 +1,11 @@ + diff --git a/client/src/lib/3d/components/map/GroundBox.svelte b/client/src/lib/3d/components/map/GroundBox.svelte index 262b71beb..cf7ff6e71 100644 --- a/client/src/lib/3d/components/map/GroundBox.svelte +++ b/client/src/lib/3d/components/map/GroundBox.svelte @@ -1,5 +1,7 @@ diff --git a/client/src/lib/3d/components/map/Light.svelte b/client/src/lib/3d/components/map/Light.svelte index 6ad7e3cdc..51e687d4d 100644 --- a/client/src/lib/3d/components/map/Light.svelte +++ b/client/src/lib/3d/components/map/Light.svelte @@ -1,5 +1,9 @@ diff --git a/client/src/lib/3d/components/map/Object.svelte b/client/src/lib/3d/components/map/Object.svelte index fd2ea9673..6cb0aa770 100644 --- a/client/src/lib/3d/components/map/Object.svelte +++ b/client/src/lib/3d/components/map/Object.svelte @@ -3,7 +3,7 @@ import * as THREE from 'three' const textureLoader = new THREE.TextureLoader() - const wallTexture = $state(textureLoader.load('/sprites/wall.png')) + const wallTexture = textureLoader.load('/sprites/wall.png') wallTexture.wrapS = THREE.RepeatWrapping wallTexture.wrapT = THREE.RepeatWrapping diff --git a/client/src/lib/3d/components/map/Splat.svelte b/client/src/lib/3d/components/map/Splat.svelte index 423f8276b..5382214c1 100644 --- a/client/src/lib/3d/components/map/Splat.svelte +++ b/client/src/lib/3d/components/map/Splat.svelte @@ -1,16 +1,13 @@ diff --git a/client/src/lib/3d/components/map/Walls.svelte b/client/src/lib/3d/components/map/Walls.svelte index d82d8d79d..6d4ff4970 100644 --- a/client/src/lib/3d/components/map/Walls.svelte +++ b/client/src/lib/3d/components/map/Walls.svelte @@ -1,8 +1,10 @@ diff --git a/client/src/lib/3d/components/models/container.svelte b/client/src/lib/3d/components/models/container.svelte index 34f688fd2..01ba72fda 100644 --- a/client/src/lib/3d/components/models/container.svelte +++ b/client/src/lib/3d/components/models/container.svelte @@ -1,79 +1,35 @@ - + {#await gltf} - {@render fallback?.()} + {:then gltf} - {:catch err} - {@render error?.({ error: err })} + {:catch error} + {/await} - {@render children?.({ ref })} - + + diff --git a/client/src/lib/3d/components/models/hand.svelte b/client/src/lib/3d/components/models/hand.svelte index cee03f549..58ded432f 100644 --- a/client/src/lib/3d/components/models/hand.svelte +++ b/client/src/lib/3d/components/models/hand.svelte @@ -1,87 +1,23 @@ - - + {#await gltf} - {@render fallback?.()} + {:then gltf} - {:catch err} - {@render error?.({ error: err })} + {:catch error} + {/await} - {@render children?.({ ref })} - + + diff --git a/client/src/lib/3d/utils/moveUtils.ts b/client/src/lib/3d/utils/moveUtils.ts new file mode 100644 index 000000000..646f3b5d9 --- /dev/null +++ b/client/src/lib/3d/utils/moveUtils.ts @@ -0,0 +1,147 @@ +import { Vector3 } from 'three' +import { + keyStateStore, + isMouseDownStore, + recordedMove, + currentSubMove, + frameCounter, + recordingMode, + isMoveRecorded, + replayMode, +} from '$stores/gameStores' +import { playerCharacterCoords } from '$stores/coordsStores' +import { inPointerLock } from '$stores/cameraStores' +import type { TurnData } from '$stores/gameStores' +import { get } from 'svelte/store' +import { Camera } from 'three' +import { + SCALING_FACTOR, + FRAME_INTERVAL, + RECORDING_FRAME_LIMIT, + SUBMOVE_SCALE, +} from '$lib/consts' +import { normalizeAndScaleVector, clamp } from '$lib/helper' + +export function recordMove(camera: Camera, characterId: number) { + const moveDirection = new Vector3() + const { forward, backward, left, right } = get(keyStateStore) + const isMouseDown = get(isMouseDownStore) + + if (forward) moveDirection.z -= 1 + if (backward) moveDirection.z += 1 + if (left) moveDirection.x -= 1 + if (right) moveDirection.x += 1 + let shoot: boolean = false + if (isMouseDown && get(inPointerLock)) shoot = true + + if (moveDirection.length() > 0) { + // Scale move direction and convert to integers using Math.round + + if (camera.quaternion) { + moveDirection.applyQuaternion(camera.quaternion) + } else { + console.warn('Camera quaternion is undefined.') + } + + // Normalize and scale the move direction to maintain consistent speed + const normalized = normalizeAndScaleVector( + moveDirection.x, + moveDirection.z, + SUBMOVE_SCALE / 3 + ) + moveDirection.x = normalized.x + moveDirection.z = normalized.y + + // Ensure y-axis movement is zero (assuming 2D movement) + moveDirection.y = 0 + + // Update player coordinates with clamped values to stay within grid bounds + playerCharacterCoords.update((coords) => { + const newX = coords[characterId].x + moveDirection.x / SCALING_FACTOR + const newY = coords[characterId].y + moveDirection.z / SCALING_FACTOR + + // Check if new coordinates are out of bounds and set move direction to 0 if they are + if (newX < -50 || newX > 50) { + moveDirection.x = 0 + } + if (newY < -50 || newY > 50) { + moveDirection.z = 0 + } + + coords[characterId].x = clamp(newX, -50, 50) + coords[characterId].y = clamp(newY, -50, 50) + return coords + }) + + currentSubMove.update((subMove) => { + subMove.x += moveDirection.x + subMove.y += moveDirection.z + return subMove + }) + + if (get(frameCounter) % FRAME_INTERVAL === 0) { + const current = normalizeAndScaleVector( + get(currentSubMove).x, + get(currentSubMove).y, + SUBMOVE_SCALE + ) + + let move = { + x: Math.abs(current.x), + y: Math.abs(current.y), + xdir: current.x >= 0, + ydir: current.y >= 0, + } + recordedMove.update((rm) => { + rm.sub_moves.push(move) + return rm + }) + currentSubMove.set({ x: 0, y: 0 }) + } + + // Increment frame counter + frameCounter.update((fc) => fc + 1) + } + + if (get(frameCounter) === RECORDING_FRAME_LIMIT) { + recordingMode.set(false) + isMoveRecorded.set(true) + document.exitPointerLock() + + console.log(get(isMoveRecorded)) + } + + // Reset move direction is not necessary since moveDirection is now scoped within the function +} + +export function replayMove(move: TurnData, characterId: number) { + if (get(frameCounter) === RECORDING_FRAME_LIMIT) { + frameCounter.set(0) + replayMode.set(false) + } + + let move_index = Math.floor(get(frameCounter) / FRAME_INTERVAL) + if (move_index >= move.sub_moves.length) { + console.warn('Move index exceeds recorded sub-moves.') + return + } + let sub_move = move.sub_moves[move_index] + console.log(move) + + if ( + get(frameCounter) % FRAME_INTERVAL === 0 && + get(frameCounter) < RECORDING_FRAME_LIMIT + ) { + let x_dif = sub_move.x + let y_dif = sub_move.y + if (!sub_move.xdir) x_dif *= -1 + if (!sub_move.ydir) y_dif *= -1 + playerCharacterCoords.update((coords) => { + coords[characterId].x += x_dif / SCALING_FACTOR + coords[characterId].y += y_dif / SCALING_FACTOR + return coords + }) + } + + frameCounter.update((fc) => fc + 1) +} diff --git a/client/src/lib/3d/utils/shootUtils.ts b/client/src/lib/3d/utils/shootUtils.ts index d1078abd8..f39f46ac7 100644 --- a/client/src/lib/3d/utils/shootUtils.ts +++ b/client/src/lib/3d/utils/shootUtils.ts @@ -1,3 +1,163 @@ +import { frameCounter, recordedMove } from '$stores/gameStores' +import { get } from 'svelte/store' +import type { TurnData } from '$stores/gameStores' +import { PerspectiveCamera } from 'three' +import * as THREE from 'three' +import { + type BulletCoords, + bulletRender, + bulletStart, + bulletInitialPosition, + bulletRenderOnchain, + bulletInitialPositionOnchain +} from '$stores/coordsStores' +import { playSoundEffect } from './audioUtils' +import { splat } from '$stores/eyeCandy' +import { isTurnPlayer } from '$stores/gameStores' +import { truncate, getYawAngle, inverseMapAngle } from '$lib/helper' +import { BULLET_SPEED, BULLET_SUBSTEPS } from '$lib/consts' + +function applyBulletToStore(newBullet: BulletCoords) { + bulletRender.update((bullets) => { + bullets.push(newBullet) + return bullets + }) + + // Also store the initial position + bulletInitialPosition.update((bullets) => { + bullets.push(newBullet) + return bullets + }) + + playSoundEffect('/audio/sfx/shot.wav') +} + +export function shoot(camera: PerspectiveCamera) { + if (!camera || !camera.isCamera) { + console.error('Invalid camera object') + return + } + + let move_index = Math.floor(get(frameCounter) / 3) + + let direction = getYawAngle(camera) + if (direction < 0) { + direction = 360 + direction + } + + direction = Math.round(truncate(direction, 8) * 10 ** 8) + + console.log( + `Bullet shot at move index ${move_index} with angle ${direction} degrees` + ) + + recordedMove.update((rm) => { + if (!rm || !Array.isArray(rm.shots)) { + console.error('Invalid recordedMove structure') + return rm + } + rm.shots.push({ angle: direction, step: move_index }) + console.log(rm.shots) + return rm + }) + + let vx = Math.cos(THREE.MathUtils.degToRad(direction / 10 ** 8)) + let vy = Math.sin(THREE.MathUtils.degToRad(direction / 10 ** 8)) + + const cameraPosition = camera.position + const newBullet = { + coords: { + x: cameraPosition.x, + y: cameraPosition.z, + }, + shot_at: { + x: cameraPosition.x, + y: cameraPosition.z, + }, + velocity: { x: vx, y: vy }, + + shot_by: get(isTurnPlayer) ? 1 : 2, + id: 0, + } + + applyBulletToStore(newBullet) +} + +export function replayShot(move: TurnData, camera: PerspectiveCamera) { + let move_index = Math.floor((get(frameCounter) + 1) / 3) + + let shot = move.shots.find((shot) => shot.step === move_index) + if (shot) { + let angle = shot.angle + + console.log(`Bullet shot at move index ${move_index} with angle ${angle}`) + + let vx = Math.cos(THREE.MathUtils.degToRad(angle / 10 ** 8)) + let vy = Math.sin(THREE.MathUtils.degToRad(angle / 10 ** 8)) + + frameCounter.update((fc) => fc + 1) + + const cameraPosition = camera.position + const newBullet = { + coords: { + x: cameraPosition.x, + y: cameraPosition.z, + }, + shot_at: { + x: cameraPosition.x, + y: cameraPosition.z, + }, + velocity: { x: vx, y: vy }, + id: 0, + //TODO: Fix this + shot_by: get(isTurnPlayer) ? 1 : 2, + } + + applyBulletToStore(newBullet) + } +} + +export function resetBullets() { + // Set bulletRender back to the original state from onchain store + bulletRender.set(get(bulletRenderOnchain)) + + // Set bulletInitialPosition back to the original state from onchain store + bulletInitialPosition.set(get(bulletInitialPositionOnchain)) +} + +export function simulate() { + + // Update temp / new bullets + bulletRender.update((bullets) => { + let newBullets: BulletCoords[] = [] + bullets.map((bullet) => { + const newX = bullet.coords.x + (bullet.velocity.x / 10) + const newY = bullet.coords.y + (bullet.velocity.y / 10) + + + // Use the new function to check if the bullet is outside the map boundaries + const isOutsideMap = isOutsideMapBoundary(newX, newY) + + if (!isOutsideMap) { + newBullets.push({ + ...bullet, + coords: { + x: newX, + y: newY, + }, + }) + } + if (isOutsideMap) { + splat.update((splat) => { + splat.push({ x: newX, y: newY }) + return splat + }) + } + }) + return newBullets + }) +} + // Add this new function export function isOutsideMapBoundary(x: number, y: number): boolean { const mapBoundary = { diff --git a/client/src/lib/MiniMap.svelte b/client/src/lib/MiniMap.svelte index ed0a468e8..002c35f5e 100644 --- a/client/src/lib/MiniMap.svelte +++ b/client/src/lib/MiniMap.svelte @@ -1,13 +1,14 @@ - @@ -53,11 +44,11 @@ {/if} -{#if pendingSessions.length > 9} +{#if pendingSessions && pendingSessions.length > 9}
diff --git a/client/src/lib/handlers.ts b/client/src/lib/handlers.ts new file mode 100644 index 000000000..c34879f0b --- /dev/null +++ b/client/src/lib/handlers.ts @@ -0,0 +1,70 @@ +import { keyStateStore, isMouseDownStore } from '$stores/gameStores' +import { get } from 'svelte/store' + +export function handleKeyDown(event: KeyboardEvent) { + let keyState = get(keyStateStore) + if ( + event.key === 'w' || + event.key === 'a' || + event.key === 's' || + event.key === 'd' + ) { + keyState[event.key] = true + } + switch (event.key.toLowerCase()) { + case 'w': + keyState.forward = true + break + case 's': + keyState.backward = true + break + case 'a': + keyState.left = true + break + case 'd': + keyState.right = true + break + } + keyStateStore.set(keyState) +} + +export function handleKeyUp(event: KeyboardEvent) { + let keyState = get(keyStateStore) + if ( + event.key === 'w' || + event.key === 'a' || + event.key === 's' || + event.key === 'd' + ) { + keyState[event.key] = false + } + switch (event.key.toLowerCase()) { + case 'w': + keyState.forward = false + break + case 's': + keyState.backward = false + break + case 'a': + keyState.left = false + break + case 'd': + keyState.right = false + break + } + keyStateStore.set(keyState) +} + +export function handleMouseDown(event: MouseEvent) { + if (event.button === 0) { + // Left mouse button + isMouseDownStore.set(true) + } +} + +export function handleMouseUp(event: MouseEvent) { + if (event.button === 0) { + // Left mouse button + isMouseDownStore.set(false) + } +} diff --git a/client/src/lib/helper.ts b/client/src/lib/helper.ts index 1e00ef51b..9a6f0cabc 100644 --- a/client/src/lib/helper.ts +++ b/client/src/lib/helper.ts @@ -1,20 +1,12 @@ -import { Vector3, Quaternion, Euler, PerspectiveCamera } from 'three' -import * as THREE from 'three' -import { - SCALING_FACTOR, - SUBMOVE_SCALE, - BULLET_SUBSTEPS, - BULLET_SPEED, -} from '$lib/consts' -import { type Bullet } from '../dojo/models.gen' - -export function areAddressesEqual( - address1: string, - address2: string | bigint -): boolean { +import { Vector3, Quaternion, Euler, PerspectiveCamera } from "three"; +import * as THREE from "three"; +import { SCALING_FACTOR, SUBMOVE_SCALE, BULLET_SUBSTEPS } from "$lib/consts"; +import { type Bullet } from "../dojo/models.gen"; + + +export function areAddressesEqual(address1: string, address2: string | bigint): boolean { const bigIntAddress1 = BigInt(address1) - const bigIntAddress2 = - typeof address2 === 'bigint' ? address2 : BigInt(address2) + const bigIntAddress2 = typeof address2 === 'bigint' ? address2 : BigInt(address2) return bigIntAddress1 === bigIntAddress2 } @@ -113,19 +105,20 @@ export function inverseMapAngle(angle: number): number { } export function getBulletPosition(bullet: Bullet, step: number) { - let vx = Number(bullet.velocity.x) - let vy = Number(bullet.velocity.y) - - let x = Number(bullet.shot_at.x) - let y = Number(bullet.shot_at.y) + let vx = parseInt(bullet.velocity.x.toString()) / SCALING_FACTOR + let vy = parseInt(bullet.velocity.y.toString()) / SCALING_FACTOR + //@ts-ignore + let x = parseInt(bullet.shot_at.x.toString()) / SCALING_FACTOR + //@ts-ignore + let y = parseInt(bullet.shot_at.y.toString()) / SCALING_FACTOR let x_dir = bullet.velocity.xdir ? 1 : -1 let y_dir = bullet.velocity.ydir ? 1 : -1 - let new_x = x + vx * step * x_dir - let new_y = y + vy * step * y_dir + let new_x = x + (vx * step * x_dir) + let new_y = y + (vy * step * y_dir) - const pos = { x: new_x, y: new_y } - - return pos + return {x: new_x - 50, y: new_y - 50} } + + diff --git a/client/src/lib/ui/Background.svelte b/client/src/lib/ui/Background.svelte index 2a6e95895..dd29a37c3 100644 --- a/client/src/lib/ui/Background.svelte +++ b/client/src/lib/ui/Background.svelte @@ -1,21 +1,12 @@
- import { run } from 'svelte/legacy' - import { createEventDispatcher } from 'svelte' import { cn } from '$lib/css/cn' import { clickSound } from '$lib/3d/utils/audioUtils' - interface Props { - inline?: boolean - small?: boolean - href?: string | undefined - selected?: boolean - className?: string - children?: import('svelte').Snippet - [key: string]: any - } - - let { - inline = false, - small = false, - href = undefined, - selected = false, - className = '', - children, - ...rest - }: Props = $props() + export let inline = false + export let small = false + export let href: string | undefined = undefined + export let selected = false + export let className: string = '' const dispatcher = createEventDispatcher() - let classes = $derived( - cn( - 'box-border border-4 border-black rounded-lg hover:bg-gray-300 btn shadow-md text-center', - className, - { - 'm-2': !inline, - 'px-5 py-2': !small, - 'bg-lime-100 hover:bg-lime-100 selected': selected, - } - ) + let classes = '' + $: classes = cn( + 'box-border border-4 border-black rounded-lg hover:bg-gray-300 btn shadow-md text-center', + className, + { + 'm-2': !inline, + 'px-5 py-2': !small, + 'bg-lime-100 hover:bg-lime-100 selected': selected, + } ) function handleClick(event: MouseEvent) { @@ -46,12 +29,12 @@ {#if href} - - {@render children?.()} + + {:else} - {/if} diff --git a/client/src/lib/ui/ControllerModal.svelte b/client/src/lib/ui/ControllerModal.svelte index 43b80c659..21a0b3df0 100644 --- a/client/src/lib/ui/ControllerModal.svelte +++ b/client/src/lib/ui/ControllerModal.svelte @@ -3,13 +3,8 @@ import { goto } from '$app/navigation'; import { username, account, clearAccountStorage } from '$stores/account'; import Button from '$lib/ui/Button.svelte'; - - interface Props { - show?: boolean; - children?: import('svelte').Snippet; - } - - let { show = false, children }: Props = $props(); + import { connect } from '$lib/controller'; + export let show = false; const dispatch = createEventDispatcher(); function closeModal() { @@ -19,10 +14,9 @@ function logout() { clearAccountStorage(); closeModal(); - goto('/'); } - let showCopied = $state(false); + let showCopied = false; function compressAddress(address: string): string { if (!address) return 'Not available'; @@ -41,19 +35,20 @@ } -{#if show && $account && $username} +{#if show && $username}
Controller
+ {#if $account?.address}

{$username.toUpperCase()}

{compressAddress($account?.address)}
- {@render children?.()} +
+ + {:else} + + {/if}
diff --git a/client/src/lib/ui/Game.svelte b/client/src/lib/ui/Game.svelte deleted file mode 100644 index 5d34b09c7..000000000 --- a/client/src/lib/ui/Game.svelte +++ /dev/null @@ -1,32 +0,0 @@ - - -{#if $session?.state === 0} - -{/if} - -
- -
-
- - - -
diff --git a/client/src/lib/ui/Splash.svelte b/client/src/lib/ui/Splash.svelte deleted file mode 100644 index 0deba3ab9..000000000 --- a/client/src/lib/ui/Splash.svelte +++ /dev/null @@ -1,31 +0,0 @@ - - -
- bg -
- - diff --git a/client/src/lib/ui/StartGame.svelte b/client/src/lib/ui/StartGame.svelte index 8ff8d0d97..9739268fd 100644 --- a/client/src/lib/ui/StartGame.svelte +++ b/client/src/lib/ui/StartGame.svelte @@ -1,24 +1,29 @@ -{#if sessionState === 1} +{#if $gameState == 1} {/if} diff --git a/client/src/lib/ui/StepBar.svelte b/client/src/lib/ui/StepBar.svelte index e66511306..1f2c1f53a 100644 --- a/client/src/lib/ui/StepBar.svelte +++ b/client/src/lib/ui/StepBar.svelte @@ -1,9 +1,7 @@
diff --git a/client/src/lib/ui/TxToast.svelte b/client/src/lib/ui/TxToast.svelte index 156b7014d..31b6ab98b 100644 --- a/client/src/lib/ui/TxToast.svelte +++ b/client/src/lib/ui/TxToast.svelte @@ -1,19 +1,21 @@ {#if visible} @@ -27,9 +29,7 @@ {:else if status === 'error'} - + {/if}
@@ -68,28 +68,24 @@ } @keyframes spin { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } } - .checkmark, - .cross { + .checkmark, .cross { fill: currentColor; } .checkmark { - color: #4caf50; + color: #4CAF50; } .cross { - color: #f44336; + color: #F44336; } p { margin: 0; } + diff --git a/client/src/lib/ui/Ui.svelte b/client/src/lib/ui/Ui.svelte index 93f3d4fd6..300529cf6 100644 --- a/client/src/lib/ui/Ui.svelte +++ b/client/src/lib/ui/Ui.svelte @@ -1,58 +1,115 @@
- {#if $session?.state === 3} + {#if $isEnded} {:else} - {#if $hasRecorded && !$isReplaying} + {#if isRecorded && !$replayMode}

Time is up!

- {:else if !$isRecording && !$isReplaying && $isCurrentPlayersTurn && !justRecorded} + + {:else if !$recordingMode && !$replayMode && $isTurnPlayer && !justRecorded}

Your turn!

- {:else if !$isCurrentPlayersTurn || justRecorded} + {:else if !$isTurnPlayer || justRecorded} {/if} diff --git a/client/src/lib/ui/YouWin.svelte b/client/src/lib/ui/YouWin.svelte index 45cbaea46..9f3e2c8ce 100644 --- a/client/src/lib/ui/YouWin.svelte +++ b/client/src/lib/ui/YouWin.svelte @@ -2,7 +2,7 @@ import { isEnded } from '$stores/gameStores' import { onDestroy } from 'svelte' import { goto } from '$app/navigation' - let win = $state(false) + let win = false const unsubscribe = isEnded.subscribe((value) => { win = value @@ -23,8 +23,8 @@

You Win

diff --git a/client/src/lib/ui/ingame/InGameOverlay.svelte b/client/src/lib/ui/ingame/InGameOverlay.svelte index 739799e48..014934848 100644 --- a/client/src/lib/ui/ingame/InGameOverlay.svelte +++ b/client/src/lib/ui/ingame/InGameOverlay.svelte @@ -1,11 +1,11 @@
@@ -25,7 +25,7 @@ class={cn('rounded-md p-1 border-2', { 'bg-white': $birdView, })} - onclick={() => ($birdView = true)} + on:click={() => ($birdView = true)} > @@ -35,7 +35,7 @@ class={cn('rounded-md p-1 border-white border-2', { 'bg-white': !$birdView, })} - onclick={() => ($birdView = false)} + on:click={() => ($birdView = false)} > @@ -46,6 +46,15 @@ >
+ +
+ +
+ +
+ + +
+ +
+ {#each Array(totalCells) as _, index} +
+ +{#if showToast} + +{/if} diff --git a/client/src/routes/[slug]/client/maps/+page.svelte b/client/src/routes/[slug]/client/maps/+page.svelte index 868e4c94d..be97177bc 100644 --- a/client/src/routes/[slug]/client/maps/+page.svelte +++ b/client/src/routes/[slug]/client/maps/+page.svelte @@ -1,84 +1,112 @@ - -
-
-

Available maps

- - -
- -
- {#if maps} + + async function createMap() { + goto(`/${$env}/client/mapmaker`) + } + + + +
+
+

Available maps

+ + +
+ +
{#each maps as map} {#if map} - {/if} {/each} - {/if} +
-
- - + + + + \ No newline at end of file diff --git a/client/src/routes/[slug]/client/matchmaking/+page.svelte b/client/src/routes/[slug]/client/matchmaking/+page.svelte index c972f355a..38e7eaa84 100644 --- a/client/src/routes/[slug]/client/matchmaking/+page.svelte +++ b/client/src/routes/[slug]/client/matchmaking/+page.svelte @@ -4,6 +4,7 @@ import { goto } from '$app/navigation' import { type Entity, getComponentValue } from '@dojoengine/recs' import MiniMap from '$lib/MiniMap.svelte' + import Button from '$lib/ui/Button.svelte' import TxToast from '$lib/ui/TxToast.svelte' import { cn } from '$lib/css/cn' import { account } from '$stores/account' @@ -25,7 +26,6 @@ let planetelo: any = get(planeteloStore); let {config, dojoProvider}: any = get(dojoStore); - console.log(config) const actions = new Contract(config.manifest.contracts[4].abi, config.manifest.contracts[4].address, dojoProvider.provider).typedv2(config.manifest.contracts[4].abi); @@ -35,7 +35,7 @@ [{ contractAddress: planetelo.address, entrypoint: 'queue', - calldata: ["0x6f63746f67756e75", "0x0"] + calldata: ["0x6f63746f67756e77", "0x0"] }] ); console.log(res); @@ -47,7 +47,7 @@ [{ contractAddress: planetelo.address, entrypoint: 'matchmake', - calldata: ["0x6f63746f67756e75", "0x0"] + calldata: ["0x6f63746f67756e77", "0x0"] }] ); console.log(res); @@ -66,7 +66,7 @@ [{ contractAddress: planetelo.address, entrypoint: 'settle', - calldata: ["0x6f63746f67756e75", game_id!] + calldata: ["0x6f63746f67756e77", game_id!] }] ); console.log(res); @@ -74,12 +74,12 @@ const get_status = async () => { - status = parseInt(await planetelo.get_status($account!.address, "0x6f63746f67756e75", "0x0")); - elo = await planetelo.get_elo($account!.address, "0x6f63746f67756e75", "0x0"); + status = parseInt(await planetelo.get_status($account!.address, "0x6f63746f67756e77", "0x0")); + elo = await planetelo.get_elo($account!.address, "0x6f63746f67756e77", "0x0"); console.log(elo) - queue_length = parseInt(await planetelo.get_queue_length("0x6f63746f67756e75", "0x0")); + queue_length = parseInt(await planetelo.get_queue_length("0x6f63746f67756e77", "0x0")); if (status == 2) { - game_id = parseInt(await planetelo.get_player_game_id($account!.address, "0x6f63746f67756e75", "0x0")); + game_id = parseInt(await planetelo.get_player_game_id($account!.address, "0x6f63746f67756e77", "0x0")); console.log(actions) } console.log(status) diff --git a/client/src/routes/[slug]/game/[slug]/+page.svelte b/client/src/routes/[slug]/game/[slug]/+page.svelte index 5e735dcf8..8910ceb98 100644 --- a/client/src/routes/[slug]/game/[slug]/+page.svelte +++ b/client/src/routes/[slug]/game/[slug]/+page.svelte @@ -1,35 +1,295 @@ -{#await gameStorePromise} -

Game is loading...

-{:then gameStore} - -{/await} +{#if $gameState === 0} + +{/if} + +
+ +
+
+ + + +
diff --git a/client/src/routes/[slug]/game/[slug]/+page.ts b/client/src/routes/[slug]/game/[slug]/+page.ts index 9a30f4c90..63989526b 100644 --- a/client/src/routes/[slug]/game/[slug]/+page.ts +++ b/client/src/routes/[slug]/game/[slug]/+page.ts @@ -1,6 +1,5 @@ -export function load({ url }) { - const firstSegment = url.pathname.split('/').filter(Boolean)[0]; // Extract the first path segment +export function load({ params }) { return { - network: firstSegment, - }; + gameId: params.slug, + } } diff --git a/client/src/stores/account.ts b/client/src/stores/account.ts index 598c51dc4..f247cf4c6 100644 --- a/client/src/stores/account.ts +++ b/client/src/stores/account.ts @@ -1,46 +1,38 @@ -//TODO(Red): Upgrade this to a proper store with funciton calls. - -import { writable } from 'svelte/store' -import type { AccountInterface } from 'starknet' -import { controllerMainnet, controllerSlot, controllerSepolia } from '$lib/controller' // Add this import +import { writable } from 'svelte/store'; +import type { AccountInterface } from 'starknet'; +import { controllerMainnet, controllerSlot } from '$lib/controller'; // Add this import function createPersistentStore(key: string, initialValue: T) { - const storedValue = localStorage.getItem(key) - let initial = initialValue + const storedValue = localStorage.getItem(key); + let initial = initialValue; if (storedValue !== null && storedValue !== 'undefined') { try { - initial = JSON.parse(storedValue) + initial = JSON.parse(storedValue); } catch (e) { - console.error(`Error parsing stored value for ${key}:`, e) + console.error(`Error parsing stored value for ${key}:`, e); } } - const store = writable(initial) + const store = writable(initial); - store.subscribe((value) => { + store.subscribe(value => { if (value === undefined) { - localStorage.removeItem(key) + localStorage.removeItem(key); } else { - localStorage.setItem(key, JSON.stringify(value)) + localStorage.setItem(key, JSON.stringify(value)); } - }) + }); - return store + return store; } -export const account = createPersistentStore( - 'octoguns_account', - undefined -) -export const username = createPersistentStore( - 'octoguns_username', - undefined -) +export const account = createPersistentStore('octoguns_account', undefined); +export const username = createPersistentStore('octoguns_username', undefined); export async function clearAccountStorage() { - localStorage.removeItem('octoguns_account') - localStorage.removeItem('octoguns_username') - account.set(undefined) - username.set(undefined) - await controllerMainnet.disconnect() - await controllerSlot.disconnect() -} + localStorage.removeItem('octoguns_account'); + localStorage.removeItem('octoguns_username'); + account.set(undefined); + username.set(undefined); + await controllerMainnet.disconnect(); + await controllerSlot.disconnect(); +} \ No newline at end of file diff --git a/client/src/stores/cameraStores.ts b/client/src/stores/cameraStores.ts index 54f835b06..1a125c22a 100644 --- a/client/src/stores/cameraStores.ts +++ b/client/src/stores/cameraStores.ts @@ -1,8 +1,7 @@ -// TODO(Red): Migrate this to an API store. - import { writable } from 'svelte/store' export const birdView = writable(true) export const inPointerLock = writable(false) export const cameraAngle = writable(0) + diff --git a/client/src/stores/dojoStore.ts b/client/src/stores/dojoStore.ts index 4baa49ed1..1b7031d13 100644 --- a/client/src/stores/dojoStore.ts +++ b/client/src/stores/dojoStore.ts @@ -1,66 +1,40 @@ -import { dojoConfig } from '../dojoConfig' -import { setup } from '$dojo/setup' -import { get, writable } from 'svelte/store' -import { Account } from 'starknet' -import { Contract } from 'starknet' -import { connect } from '$lib/controller' +import { getDojoConfig } from '../dojoConfig'; +import { setup } from '$dojo/setup'; +import { writable } from 'svelte/store'; -type SetupResult = Awaited> +export const dojoStore = writable(); +export const isSetup = writable(false); +export const planeteloStore = writable(); -export const dojoStore = writable() -export const accountStore = writable() -export const isSetup = writable(false) -export const settingUp = writable(false) - -export const planeteloStore = writable() - -export async function initializeStore() { - if (get(settingUp)) { - console.warn('Concurrent setting up!') - return await getDojo() - } - settingUp.set(true) +let setupPromise: Promise | undefined; +async function setupInternal() { try { - console.log('Initializing store...') - const result = await setup( - '0x633afc7ba46094bb158889ba55487886c5748439433a555ca3ac16f502d7dc', - dojoConfig - ) - console.log('setup complete') - dojoStore.set(result) - - let res = await connect('sepolia'); - console.log(res) - - console.log('set stores') - isSetup.set(true) - - dojoStore.subscribe((value) => { - console.log(value) - }) + console.log('Initializing store...'); + const { dojoConfig, WORLD_ADDRESS } = getDojoConfig(); + const result = await setup(dojoConfig); + console.log('Setup complete'); + dojoStore.set(result); + isSetup.set(true); } catch (error) { - console.log('Failed to initialize store:', error) - isSetup.set(false) - } finally { - settingUp.set(false) + console.error('Failed to initialize store:', error); + isSetup.set(false); } } -export async function getDojo(): Promise { - return new Promise((ok, err) => { - dojoStore.subscribe((val) => { +export async function initializeStore(force = false) { + if (!setupPromise || force) { + setupPromise = setupInternal(); + } + return setupPromise; +} + +export function waitForInitialization(): Promise { + return new Promise((ok, _) => { + isSetup.subscribe(val => { if (val) { - ok(val) + ok() } }) - isSetup.subscribe((val) => { - err('Failed to initalize store.') - }) }) -} - -export async function getDojoContext(): Promise<[Account, SetupResult]> { - const dojo = await getDojo() - return [get(accountStore)!, dojo] -} +} \ No newline at end of file diff --git a/client/src/stores/gameStores.ts b/client/src/stores/gameStores.ts index 4859db47f..6bd97c2a5 100644 --- a/client/src/stores/gameStores.ts +++ b/client/src/stores/gameStores.ts @@ -2,4 +2,69 @@ import { writable, get } from 'svelte/store' import { type Bullet } from '$src/dojo/models.gen' import { WebGLRenderer } from 'three' -export const rendererStore = writable() \ No newline at end of file +export const rendererStore = writable() + +// Game meta data +export const gameState = writable() +export const sessionId = writable() +export const isEnded = writable(false) +export const currentPlayerId = writable(null) +export const turnCount = writable(0) + +//characters +export const characterIds = writable([]) +export const playerCharacterId = writable(0) +export const enemyCharacterId = writable(1) +//true for recording, false for replaying +export const recordingMode = writable(false) +export const replayMode = writable(false) + +// Holds informations about if you are the second player or not +export const isSecondPlayer = writable(false) + +export const recordedMove = writable({ + sub_moves: [], + shots: [], +}) + +export const currentSubMove = writable<{ x: number; y: number }>({ x: 0, y: 0 }) + +export const frameCounter = writable(0) +export const isMoveRecorded = writable(false) + +export type TurnData = { + sub_moves: { x: number; y: number; xdir: boolean; ydir: boolean }[] + shots: { angle: number; step: number }[] +} + +export type MapObjects = { + grid1: bigint + grid2: bigint + grid3: bigint +} + +export const mapObjects = writable() + +export const keyStateStore = writable<{ + w: boolean + a: boolean + s: boolean + d: boolean + forward: boolean + backward: boolean + left: boolean + right: boolean +}>({ + w: false, + a: false, + s: false, + d: false, + forward: false, + backward: false, + left: false, + right: false, +}) + +export const isMouseDownStore = writable(false) + +export const isTurnPlayer = writable(false) diff --git a/client/src/stores/network.ts b/client/src/stores/network.ts index 4ad5e3490..9f0e9c063 100644 --- a/client/src/stores/network.ts +++ b/client/src/stores/network.ts @@ -1,6 +1,6 @@ import { writable, derived } from 'svelte/store'; -export const env = writable<'mainnet' | 'slot'>('slot'); +export const env = writable<'mainnet' | 'slot' | 'sepolia'>('slot'); export const MAINNET = { PUBLIC_TORII_URL: import.meta.env.VITE_MAINNET_PUBLIC_TORII_URL, @@ -16,10 +16,10 @@ export const SLOT = { ENV: 'slot' }; -export const SEPOLIA: any = { - PUBLIC_TORII_URL: 'https://api.cartridge.gg/x/planetelo/torii', - PUBLIC_RPC_URL: 'https://api.cartridge.gg/x/starknet/sepolia', - PUBLIC_WORLD_ADDRESS: '0x049d36570d4e46f48e99674bd3fcc84c25dd2c13b1b4909766fee4c92cc389ed', +export const SEPOLIA = { + PUBLIC_TORII_URL: import.meta.env.VITE_SEPOLIA_PUBLIC_TORII_URL, + PUBLIC_RPC_URL: import.meta.env.VITE_SEPOLIA_PUBLIC_RPC_URL, + PUBLIC_WORLD_ADDRESS: import.meta.env.VITE_SEPOLIA_PUBLIC_WORLD_ADDRESS, ENV: 'sepolia' }; diff --git a/client/static/3d/container.svelte b/client/static/3d/container.svelte index c1c582e80..e7943b23f 100644 --- a/client/static/3d/container.svelte +++ b/client/static/3d/container.svelte @@ -1,4 +1,3 @@ -