Message Boards Message Boards

Share my game via the Wolfram Cloud?

Posted 8 years ago

I've made a game in the Wolfram Language. It is a notebook file. In Wolfram Desktop (v11), when I Shift-Return with the cursor anywhere in the code, it displays the game interface and allows the user to play by clicking on buttons. It works for me all the way through. (There are occasional error messages, but I'm not worried about that right now.)

Now I'd like to share the game, which I call Chicken Scratch. Maybe others will like to play. But I cannot figure out how to share it. I have tried Deploy, CloudDeploy, and various other promising functions as wrappers for the code, but so far none get the game running the same way it runs inside the notebook. How can I share the game with my friends?

I have included the notebook file with this post so you can see what I'm talking about.

Thank you,

Mark

Attachments:
POSTED BY: Mark Greenberg
7 Replies
Posted 8 years ago

Stas, thanks for your response. The core questions of this discussion is how can I share the game, considering that it works in the desktop Wolfram Language development environment but won't work when deployed to the cloud or to .cdf. So your response is a bit off topic.

However, what you say is relevant to the game because I do take into account the player's local here and now. It is a trivia type game with multiple choice questions. Some of the questions are formed from live time-sensitive or location-sensitive data. For instance, one question asks what phase the moon was in last night, which depends on where and when the game is being played. Others display plots of demographic data, ask about current temperatures, or quote current stock prices. These are particularly cool questions because they help set the game apart from the typical trivia game. As I get better with the Wolfram Language, I will certainly include more such questions.

Once I (we) solve this problem of sharing the game, it will be easier to have a discussion on a topic like this about using localized data in a game. Others will be able to see how I've done it and comment.

Thanks again for your response. : )

Mark

POSTED BY: Mark Greenberg

Well, for one thing, games can include more "real world" and "live" data. Imagine a "political" game level where the landscape topology represents some live statistics or even local geography/data associated directly with the user or their interests. Or enemy All agents who have taken on the appearance and interests of your facebook friends.

POSTED BY: Stas Pitovski
Posted 8 years ago

This is good, some progress. Now, what did you do differently? You used With[] to make a constant of cover. I'm not sure why that makes a difference, but it did. I read up on With[], and my understanding of the Hold attributes and scoping is still too fuzzy to get why the picture now shows up in the Cloud object when it didn't before.

Beep[] was just a placeholder for some interface changes, so it's not important. Beep[] is os-dependent; maybe that's why it doesn't work from the cloud.

Thank you, Rolf. This may be the toe-hold I need to solve the problem.

Mark

POSTED BY: Mark Greenberg

Beep[] does not work, but this does print (though too slow for my taste):

With[{cover = Import[CloudObject["https://www.wolframcloud.com/objects/16419ad5-6a01-4eb5-9b52-d9f18fb835d6"], ImageSize -> {600, 400}]},
CloudDeploy[Dynamic[Button[cover, Print["action"], Appearance -> "Frameless"]],Permissions -> "Public"]]
POSTED BY: Rolf Mertig
Posted 8 years ago

After experimenting and a brief exchange of emails with technical support, the best answer seems to be that some features of the Wolfram Language are not yet fully supported for cloud deployment. The offending function that I have been able to isolate is Dynamic[], but the above code shows that there may be more. Dynamic[] works in some cases, and in others it stops the evaluation in the cloud, leaving the game interface partially rendered. I don't think that it is possible for me to write the interface without Dynamic[], so I'm stuck at the moment. I get similar results when I try to export the file as a .cdf.

If anyone is interested in taking a look at the working .nb file, respond and I can send it to you. It is about 6 MB.

Mark Greenberg

POSTED BY: Mark Greenberg

I believe the lack of responses indicates that most of us are still somewhat confused by what will and won't work in the Cloud. Now that you've stated the minimal problem I have to say I'm also interested in this...

For what it's worth, a game consisting of a single Manipulate might work. A Manipulate could also be put into a CDF and distributed for use with the CDF Player. That said, I completely understand that that's not a desirable solution.

POSTED BY: Bianca Eifert
Posted 8 years ago

People have read this question, but no one has yet responded. I'm guessing that the notebook file I included doesn't open for you as it does for me.

After some experimentation, I've narrowed the question and will here provide a simplified example of where I'm stuck.

When I run this code in a notebook file in the Wolfram Desktop front end (v.11, Mac OS X 10.10.5)...

cover = Image[Import[CloudObject["https://www.wolframcloud.com/objects/16419ad5-6a01-4eb5-9b52-d9f18fb835d6"]], ImageSize -> {600, 400}];
coverBtn = Button[cover, Beep[], Appearance -> "Frameless"]

...it displays an image that beeps when I click on it. That's good. Now I want my friends to experience the beeping picture, so I try to deploy it to the Wolfram Cloud:

CloudDeploy[
   cover = Image[Import[CloudObject["https://www.wolframcloud.com/objects/16419ad5-6a01-4eb5-9b52-d9f18fb835d6"]], ImageSize -> {600, 400}];
   coverBtn = Button[cover, Beep[], Appearance -> "Frameless"], Permissions -> "Public"]

Instead of a beeping picture, the browser (Firefox) displays a very long string beginning with "Button[Image[RawArray["UnsignedInteger8", {{{127, 47, 22}, {115, 35, 12}, {113, 31, 10}, {126, 44, 23}, {126, 41, 21}, ..." I understand that this is the full form of the button including the raw data for the image's RGB values. What I don't understand is how to make the browser display the beeping picture.

I'm guessing that if I can get this simple example to work in a browser, I'll be well on my way to getting the whole game to work.

Thanks in advance for any help,

Mark Greenberg

POSTED BY: Mark Greenberg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract