Message Boards Message Boards

Create an online version of a desktop WL-based puzzle game?

Posted 8 years ago

Hello. I wrote the code for a puzzle game. It's written in a notebook that I would like to share on the internet:

game[] := 
  Dynamic[DynamicModule[{pt = {0, 0}}, 
    Magnify[EventHandler[
      ClickPane[Dynamic@Graphics[display[]], (pt = #) &], 
        {"MouseClicked" :> clicks$manager[pt[[1]], pt[[2]]]}], 7]]];

display[] calls a Graphics[...] user interface. There is a

{background$color,Rectangle[{0,0},{1024,1024}]} 

background and images appear in top of it. clicks$manager[x,y] triggers actions depending on what is currently displayed by the UI. game[] is the single-line input I shift-enter to begin playing the game.

When I shift-enter the code, the game imports the images that will be used by the UI from "path/images/image01.jpg", "path/images/image02.jpg", ... . All images a stored on my computer.

The game is single player: one vs the AI. The AI has a few difficulty levels. One level calls a log of all the previous games to be able to pick the best decisions. This database is actually only a table written in a log.txt file stored on my computer. At the end of each game, the log is exported to "path/log/log.txt". At the beginning of each game, log.txt is imported from "path/log/log.txt"

My question is from that point, what do I need to do to share this game on the internet? I'd like to have a webpage that starts to display the UI at once. I consider webmathematica to let anyone, not only Mathematica users, have access to my UI. Is that the only option? If yes, where will I put the notebook, the images and the log.txt that the game requires? What modification will I have to make to the code? Am I sure that I will be the only one to have access to the log.txt file? Are there examples of websites for puzzle games made by amateurs that are powered by webmathematica? (I googled it but I can only find www.wolfram.com pages)

Thank you.

POSTED BY: Dominic Biron
2 Replies
Posted 8 years ago

Indeed, It is also posted on mathematica.stackexchange.com with the same question name. I don't know if the answer is sufficient until I actually tried it, but you are welcome to give any tips about how to make people play my game on a website if it's written in mathematica.

POSTED BY: Dominic Biron
Posted 8 years ago

You should acknowledge that you have simultaneously asked this exact question on another forum (Mathematica StackExchange) and keep both forums updated with links to answers. Otherwise, if you have an answer, folks are then wasting their time helping you on the other forum.

POSTED BY: Jim Baldwin
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