The Magic Frog: Development Update

in #utopian-io6 years ago (edited)


avatar.png

In case you don't know yet... (Fool!)

The Magic Frog and his Magic Story Machine are a project around collaborative storytelling. Every day users can submit their suggestions on how the story should proceed and the community can vote on them. The suggestion with the most upvotes then gets appended to the story. The community can also decide to end a story and to start a new one. Whenever this happens all the author rewards that the daily story posts generated, will be given back to all participants. ("All" actually refers to the liquid SBD. The posts are set to 50/50.) There will be one lucky participant who wins half of the pot. The other half will be evenly distributed among all other participants, based on how much they contributed to the story.

Repositories

https://github.com/mktcode/the-magic-frog (website)
https://github.com/mktcode/the-magic-story-machine (bot)

New Features

Image Upload

The Magic Story Machine is now capable of attaching images to a story. You can add only text, only an image or a text and an image, and of course leave a comment.

For the upload/hosting I use the Imgur API.
https://github.com/mktcode/the-magic-frog/blob/master/pages/index.vue#L449

Automatic Voting

The bot now also takes care of upvoting all the submissions (comments) after 24 hours. The one submission, that actually gets appended to the story, gets a 100% upvote from @the-magic-frog. All other (valid) submissions get upvoted with 10%.

It's just a few lines at the bottom of the bot and helper script.
https://github.com/mktcode/the-magic-story-machine/blob/master/bot.js#L74
https://github.com/mktcode/the-magic-story-machine/blob/master/helper.js#L159

HTTPS enabled

I totally forgot to enable HTTPS on the server but recent incidents on the steem blockchain reminded me that this might be a good idea. And with let's encrypt and certbot it was a 5 minute job. The last time I set up let's encrypt it took me way longer. Awesome what an ease it is by now! HTTP requests are redirected to HTTPS and the certs are automatically renewed.

Changed Mechanics

I also changed the core mechanic. Formerly the story was only stored in the post's body and then extracted by looking for specific strings for the start and the end. ("Once upon a time," and "To be continued!")

Now all the story parts are stored in the json_metadata of each story post.

If you submit a comment via the website, the actual data is also stored in the json_metadata of the comment.
https://github.com/mktcode/the-magic-frog/blob/master/pages/index.vue#L387

(This is why you can only participate via the website from now on! At least regarding to commenting... voting of course still works on steemit etc...)

{
  type: 'append',
  author: 'enforcer48',
  appendText: 'The creature ran. It was in a state of confusion. Then, it stumbled upon the great party hosted by the Wizard. All the guests were not ready to face such monstrosity. They, too, were flabberghasted when they saw it upon the scene.',
  image: null,
  comment: 'Haha, this story just escalated way too quickly!'
}

Every day, when a the story continues, the json_metadata of the most upvoted comment gets added to a commands array in the post's json_metadata.
https://github.com/mktcode/the-magic-story-machine/blob/master/bot.js#L51

{
  day: 29,
  storyNumber: 1,
  commands: [{...}, {...}, {...}, ...],
  startPhrase: 'Once upon a time,'
  toBeContinued: 'To be continued!'
}

The story then gets built from this array, using a new StoryPart Vue component.

Proof of Work Done

https://github.com/mktcode

Commits

TODO

  • edit comments/submissions on the website
  • automatic reward distribution
  • image validation
  • more verbose logs
  • language specific versions
  • wallet integration
  • promotion

I am lazy as f*** and the sun is shining so much these days... so this will probably take some time. If you want this project to progress faster, feel free to help me with the development. At least for the wallet integration there will be a Utopian Task Request... probably. For the rest, just get in touch with me by commenting on this post.

Stay tuned! And in the meantime...
Participate!

Oh and by the way... this is what happens when you allow images:

hennifant

@hennifant... You're a freak! But I like you! :D

Sort:  

Thank you! @mkt :D

It's EXACTLY how I imagined the wizard! xD

Very cool contribution! I've been following the story nearly every single day and I am curious to see what ends up happening!

Also... nice picture @hennifant, haha.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thanks @amosbastian! I'm also curious what will happen in the next story... because there won't be a predefined protagonist like the wizard... it will start with only "Once upon a time,..." :D

Thank you very much @amosbastian!

never heard of this before..COOL! great community builder !

Thanks! Any form support is appreciated very much!

Hey @mkt
Thanks for contributing on Utopian.
We're already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Excellent very interesting post friend a great contribution greetings congratulations

Hi @mkt, is there any reference suggestion from you. How best practice to create integrated application with Steem API.

tbh... trial and error! :D and the docs of course but they are not really detailed.

Coin Marketplace

STEEM 0.25
TRX 0.11
JST 0.032
BTC 62062.59
ETH 3002.04
USDT 1.00
SBD 3.77