codeyam-ai / Sui8192

A fully on-chain version of the popular 2048 game. Built on Sui by Ethos.
MIT License
92 stars 394 forks source link

Creating new MOVE Contract leaves game non-functioning (works normally on default contract and leaderboard) #8

Open degen-alpha opened 1 year ago

degen-alpha commented 1 year ago

Whenever i create a new MOVE contract, and publish correctly both Immutable and Shared values for Contract and Leaderboard. I am able to play the game, but game never gets saved but it is still visible in my Wallet. If i open the Leadeboard page again game just vanishes and never gets saved. This is reccuring and can be reproduced on every new MOVE contact creation.

degen-alpha commented 1 year ago

Everytime i have no choice but to create a new game which is saved as NFT in my wallet but is never read by new contract.

degen-alpha commented 1 year ago

if (!games || games.length === 0) { const newGameArea = document.createElement("DIV"); newGameArea.classList.add("text-center"); newGameArea.classList.add("padded"); newGameArea.innerHTML = `

You don't have any games yet.

`;
gamesElement.append(newGameArea);

}

degen-alpha commented 1 year ago

this is becoming true even if i have games showing in my wallet on same contract.

jaredcosulich commented 1 year ago

I'm afraid I don't understand your issue. Are you able to mint games and save them to the leaderboard on the https://ethoswallet.github.io/Sui8192/ game?

degen-alpha commented 1 year ago

First i am creating a new MOVE contract in move folder, it runs without issues and generates a new contract address and leaderboard address. Then i populate constants.js with new addresses and launch the game. It asks me to create a new game as (its brand new contract and there is not game), game clearly gets minted in wallet as NFT but not getting saved or read anywhere by SUI 8192 and game data gets immediately lost if i switch tabs or refresh page (game can be seen in wallet as an NFT at this point but cannot be read by SUI 8192, this works fine for default contract and default leaderboard). SUI 8192 then asks me to create a new game everytime as there is no trace of old game on SUI8192 User interface as it just vanished. Game is still available in wallet as NFT.

Everything works really well on the default contract address and leaderboard that you provided with your example code. But it doesn't work if we are creating a new contract using MOVE folder provided. Both NEW GAME data saving and reading are not working for user interface of SUI 8192 (data saving is working fine on blockchain side and can be easily seen using explorer).

Simply put, on new contract i have a to create a new game everytime if i refresh page or logout wallet, it doesn't read any old game. Even if we keep on playing game its data is getting saved on blockchain (could be seen in wallet) but not read anywhere by SUI 8192 User interface. It says 'You don't have any games' even if my wallet contains 4-5 played games (with good score) on newly created contract.

degen-alpha commented 1 year ago

Please suggest some possible fix for this as i am kinda stuck at this step. I tried creating many new contracts and tested the game with them, issue is reccurring for every new MOVE contract , New game data is not getting read by SUI 8192 User interface for any new contracts. Thanks.

jaredcosulich commented 1 year ago

Have you pulled the latest code? Otherwise I would look at the javascript console to see if there are any errors there.

degen-alpha commented 1 year ago

I pulled latest code, will try to check the console and post the output. but there are no errors, have to do verbose.

degen-alpha commented 1 year ago

Everything was working fine before the recent pull.

build script failed, must exit now', /Users/est/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.49/src/lib.rs:1104:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: failed to compile sui v0.17.0 (https://github.com/MystenLabs/sui.git?branch=devnet#79100a56), intermediate artifacts can be found at /var/folders/wc/kkd930891fvbrxz0y1vwvq180000gr/T/cargo-installGmgohU

degen-alpha commented 1 year ago

Can you make a contract for me and provide me with the immutable and shared object, i am not able to.

degen-alpha commented 1 year ago

also i wanna ask the previous contracts addresses you shares in constants.js, do you delete all old data after updating a new contract and leaderboard.

degen-alpha commented 1 year ago

Failed to build Move modules: Not a directory (os error 20). this is the error that i am getting while creating contract.