LINKS
This is an entry of the Fusion Forge, where we combine concepts from different fields and see what curiosities we can unlock!
ABSTRACT
We explore the idea of DnD innovation where we use mechanics of the game (dice rolling, ability scores, and skill checks) to guide the development of a news aggregation app.
The initial idea was to use Python to develop a quick prototype. However, investigation and dice rolls led to a solution using node-red. A new, more suitable technology was learned and implemented with success.
CONTENTS
INTRODUCTION
I’ve seen Dungeons and Dragons form the basis of Comedy, Film, Video Games, and more. It provides an elegant balance between luck and structure, giving us fruitful ground for creativity and improvisation.
Could we use that balance to help us innovate, and find new solutions to problems we might not have tried?
To explore this idea, I will create a news aggregator application using software, framework and methods decided entirely by the DnD innovation mechanism. This can also help with the news bias we found in a previous article. Let’s see what we end up with!
DnD MECHANISMS
Dungeons and Dragons is a tabletop role-playing game (RPG) in which players work together using rules to guide interactions, combat and decision-making. It can seem quite complicated (and to be honest, I’m no expert in the game), but there are some basic concepts we can break down.
- The ‘Players‘ – the people controlling the character in the game.
- The ‘Dungeon Master‘ (DM) – who narrates the world, controls non-player characters (NPCs), presents challenges and guides the overall story.
- Ability Scores – core attributes of the characters, which can help (or hinder) certain decisions and actions.
- Dice Rolling – performed when a character attempts an action. Usually a 20-sided die (d20) is used.
- Difficulty Class (DC) – a value that a player must meet to succeed on an action (their dice roll + modifiers from their abilities)
There’s a lot more to DnD than just the above, including spells, levels and classes. However, we will start with the basics and see what we can do with it!
APPLICATION TO SOFTWARE
The goal of this story, or adventure, is to build something that will aggregate and serve news articles.
Let’s put on the DM hat for a moment and create the ‘campaign’ our players will embark on. Some of the basic challenges that will need to be solved are:
- What technologies the app should use
- How and where to get the feeds
- How to combine or group the articles
- How to display the articles
We can even make some crude mappings for ability scores to something more relevant to what we’re doing
- Strength -> The ability to create code or designs (productivity)
- Dexterity -> Ability to switch between tasks or technologies (adaptability)
- Constitution -> Staying focused on large/longer tasks (stamina)
- Intelligence -> Domain-specific knowledge of technologies and implementation
- Wisdom -> Practical experience, best practices and ability to create suitable architecture
- Charisma -> Communication and Presentation skills
I went ahead and created a random character using DungeonMastersVault’s character builder.
We can also say that the characters have some proficiencies in certain technologies or skills, which we can realise as advantages (roll the die twice and take the higher amount).
Let’s use this character to build us a news aggregator using some DnD innovation!
THE ADVENTURE
For the record, I know this is probably the nerdiest thing that has ever graced the internet…
You will also have to trust me that the dice rolls I declared are true – there’s no place for fudging in the fusion forge (unless we work with actual fudge …)
We find ourselves in a tavern at the base of the Whistling Woods. The barkeep has tasked us with gathering rumours from the far corners of the realm, there is simply too much for them to handle on their own.
They direct us to a nearby town where we might find the equipment to build our Seeker of Chronicles. We look around to see what we can find.
We make our first roll of the game, an investigation check to see what kind of technologies we can use! On our sheet, we see we have a +4 to investigation. I will also say that we have advantage on this roll – this is our job after all.
That’s a 13 and a 2! We’ll take the higher 13 and add our modifier to get a score of 17 – not bad!
With that, we notice a few options. We’ve got all our basic languages (Python, Javascript, GoLang etc.), and we also note some other technologies we are not as familiar with, including node-red and Apache Camel.
I quite like Python for relatively quick tasks like this. I roll an insight check to see if I can progress with that. Lets set the DC to 12, and I again have a +4 to this roll. I just need to roll an 8 or higher.
That’s a 6! Despite my comfort with Python, luck does not swing my way. We’ll have to look at something else.
With the earlier investigation roll, I noticed node-red as an option. It sounds interesting but I’ve never used this before, so I’ll set the DC a little higher, lets say 15.
Another insight roll – let’s see what we get.
14 + 4, 18 beats the DC! We will use node-red to build our aggregator; our DnD innovation mechanism has deemed it so.
I quickly go through the node-red getting started docs to familiarise myself.
I recall the use of AI can help with the learning and building of new tech. This is the closest thing to magic we’ll find, so I roll an Arcana check, DC 12 to see if I can understand the dark arts.
ROLL: (17) + 2 = 19
That’s a success (thank goodness), so we will see what ChatGPT can offer us. It answers informing me of node-red’s ability to grab RSS feeds from the internet. After a bit of searching, I find a suitable RSS parser and put together the following flow:
I’ve added three sources, BBC News, the Guardian, and them.us. Should I add more? Let’s do a constitution check to see if I can handle it. DC 15, I’ve got a +1.
ROLL: (13) + 1 = 14
We will leave it there.
This looks promising, but we are still piping it out to a debugger. Where should it actually be going? In our story, we had a tavernkeeper asking for the combined rumours of the land. This tavernkeeper, believe it or not, has a smart mirror in the bar to display the articles.
Maybe we can package this up as a combined RSS feed? As always, we are at the mercy of our rolls. Lets do another insight, DC 10 as I have used RSS feeds in my smart mirror in the past.
ROLL: (9) + 4 = 13
Success! Node-red seems to have a few ways to handle RSS feeds. I started with the RSS function node, but it asks for feedOption and itemOption rules, which I have never heard of. I will roll a DC 15 strength check to see if I should try and figure it out or if I should pursue an alternative.
ROLL: (6) + 2 = 8
I will look elsewhere. Some more searching shows me that people have built their own RSS feeds using a template node. I will do the same and set up a simple /news/rss
endpoint.
Adventure complete! We have built something that collates news from multiple sources, and presents it in a format that can be used by the smart mirror tavernkeeper! All using our DnD innovation method.
If you’re curious, here’s the node-red flow JSON:
[{"id":"6c298807de969ae2","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"f0a8426dfe3db54d","type":"debug","z":"6c298807de969ae2","name":"Payload View","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1080,"y":760,"wires":[]},{"id":"054eec10f0b2eac8","type":"feedparser-simple","z":"6c298807de969ae2","name":"Parse RSS feed","x":480,"y":460,"wires":[["45c2077ed5ce36f6"]]},{"id":"a0493fc05aeff95e","type":"feedparser-simple","z":"6c298807de969ae2","name":"Parse RSS feed","x":480,"y":520,"wires":[["d8315aad797be2b9"]]},{"id":"d8315aad797be2b9","type":"html","z":"6c298807de969ae2","name":"Extract Text","property":"payload","outproperty":"payload","tag":"p","ret":"text","as":"single","chr":"_","x":670,"y":520,"wires":[["2765c0d63455e745"]]},{"id":"2765c0d63455e745","type":"function","z":"6c298807de969ae2","name":"Join Array","func":"msg.payload = msg.payload.join('. ');\nreturn msg","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":520,"wires":[["45c2077ed5ce36f6"]]},{"id":"150ed31ca5384481","type":"feedparser-simple","z":"6c298807de969ae2","name":"Parse RSS feed","x":480,"y":600,"wires":[["45c2077ed5ce36f6"]]},{"id":"0d85ebc90897bd97","type":"template","z":"6c298807de969ae2","name":"Feed","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n <channel>\n {{#payload.feed}}\n <title>News</title>\n <link>127.0.0.1:1880/rss</link>\n <description>Combined News Articles</description>\n <pubDate>{{lastModified}}</pubDate>\n <generator>Node-RED</generator>\n <atom:link href=\"127.0.0.1:1880/rss\" rel=\"self\" type=\"application/rss+xml\" />\n {{#items}}\n <item>\n <title>{{source}}</title>\n <description>{{content}}</description>\n <link>{{url}}</link>\n <guid isPermaLink=\"false\">{{url}}</guid>\n <pubDate>{{retrieved}}</pubDate>\n </item>\n {{/items}}\n {{/payload.feed}}\n </channel>\n</rss>\n","x":890,"y":680,"wires":[["f0a8426dfe3db54d","dd31d658d1eb3eed"]]},{"id":"da7d41e56cd8310b","type":"http in","z":"6c298807de969ae2","name":"RSS Feed","url":"news/rss","method":"get","upload":false,"swaggerDoc":"","x":160,"y":520,"wires":[["d0852ac11e57c4ee","035739a7768f8911","6515bb3d06addc50"]],"info":"DnD Innovation Test"},{"id":"45c2077ed5ce36f6","type":"join","z":"6c298807de969ae2","name":"Combined News Sources","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"1","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1070,"y":520,"wires":[["9f80b699472031d4"]]},{"id":"1009384c6d06a69c","type":"http response","z":"6c298807de969ae2","name":"","statusCode":"","headers":{},"x":1190,"y":680,"wires":[],"info":"Output created as part of DnD innovation"},{"id":"035739a7768f8911","type":"change","z":"6c298807de969ae2","name":"BBC","rules":[{"t":"set","p":"payload","pt":"msg","to":"https://feeds.bbci.co.uk/news/rss.xml?edition=uk","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"BBC","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":460,"wires":[["054eec10f0b2eac8"]]},{"id":"d0852ac11e57c4ee","type":"change","z":"6c298807de969ae2","name":"Guardian","rules":[{"t":"set","p":"payload","pt":"msg","to":"https://www.theguardian.com/uk-news/rss","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Guardian","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":520,"wires":[["a0493fc05aeff95e"]]},{"id":"6515bb3d06addc50","type":"change","z":"6c298807de969ae2","name":"them.us","rules":[{"t":"set","p":"payload","pt":"msg","to":"https://www.them.us/feed/rss","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"them","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":600,"wires":[["150ed31ca5384481"]]},{"id":"9f80b699472031d4","type":"function","z":"6c298807de969ae2","name":"Prepare Articles","func":"function transformArticles(articles) {\n const lastModifiedDate = new Date().toUTCString();\n const output = {\n feed: {\n lastModified: lastModifiedDate, // Current time in GMT format\n items: []\n }\n };\n\n // Loop through each entry in the DnD Innovation object\n for (const [url, content] of Object.entries(articles)) {\n // Extract the domain name (source)\n const source = url.split('.')[1]; // Get the first part of the hostname\n\n // Push the formatted DnD innovation item into the items array\n output.feed.items.push({\n url: url,\n source: source,\n content: content,\n retrieved: lastModifiedDate\n });\n }\n\n return output;\n}\n\nmsg.payload = transformArticles(msg.payload);\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":680,"wires":[["0d85ebc90897bd97"]]},{"id":"dd31d658d1eb3eed","type":"function","z":"6c298807de969ae2","name":"Type","func":"\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/rss+xml';\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1050,"y":680,"wires":[["1009384c6d06a69c"]]}]
CONCLUSIONS
We explored the idea of DnD innovation by creating a basic character with abilities that map to software. We introduced the element of luck using skill checks to determine what the route was and ended up with a different solution than initially anticipated, but that worked well.
I would like to refine this idea and try it out in a team. There is some implicit collaboration in DnD innovation which was not explored but could be valuable in bolstering creativity.
Although this was a simple challenge and implementation of DnD innovation, I would mark it as a success, and something worth improving!