create account

The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€) by stuffbyspencer

View this thread on: hive.blogpeakd.comecency.com
· @stuffbyspencer ·
$1.17
The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€)
<center>![zeldabannerLARGEcolorpaletten.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/FeJCjttw-zelda-banner-LARGE-colorpalette-n.png)</center>

| <center>[**previous dev-log**](https://steempeak.com/gamedev/@stuffbyspencer/tweet-dungeon-dev-log-3)</center> | <center>~~next dev-log~~</center> |
|-|-|

# The Dungeons Of [**Tweet_Dungeon**](https://twitter.com/Tweet_Dungeon)
> *Can't have a **dungeon**-crawler without **dungeons**! Today we'll look at how the dungeons in [**Tweet_Dungeon**](https://twitter.com/Tweet_Dungeon) take form, and what you can expect to encounter while traversing these dangerous-depths!*

<center>![divider.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/5gl4OUlI-divider.png)</center>

### Making Fun Dungeons
In [**yesterday's dev-log**](https://steempeak.com/gamedev/@stuffbyspencer/tweet-dungeon-dev-log-3), I talked about the tools we're using to help build **Tweet_Dungeon**. In it, I showed-off the "**Cavern Crafter**" app I made to help speed up the process of making rooms (*or as they're referred to in **Tweet_Dungeon** terms: **caverns***).

<center>![](https://files.steempeak.com/file/steempeak/stuffbyspencer/9e2K7o7O-cavern-crafter-HI.gif)</center>

Due to the way the game is played (*turns taking 20 minutes to resolve*), it's important that each cavern you enter is fun & filled with interesting stuff. That's why I decided to skip "total-random-generation", and instead opt for more of a "semi-random" method. Me & my project-partner, [**ROLLINKUNZ**](https://twitter.com/ROLLINKUNZ) use the **Cavern Crafter** to design a bunch of caverns, then my code takes care of the rest. This gives us a little more control over what you'll encounter, ensuring fun & fair gameplay.

### Making Dungeons. Fun?
The first version of this code actually just generated a bunch of totally random sized "pockets" and placed them randomly all over a map:
<center>![](https://files.steempeak.com/file/steempeak/stuffbyspencer/jozKKmCw-dungeon-no-hallways.png)</center>

Each of these "pockets" of open, walkable space, were added to a list. I then iterated over that list, adding connection hallways between room to room:
<center>![](https://files.steempeak.com/file/steempeak/stuffbyspencer/h2kWYpX9-dungeon-random.png)</center>

This worked well enough, but was a bit too linear. Plus, we decided on implementing a `MAP` command, where players could request to see an overview of the entire dungeon that they've explored so far. The `MAP` command would return an emoji-based map, like the following:
<center>![image.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/7UbaLONu-image.png)</center>

Because of this feature, we would have to ensure that each room / cavern in the dungeon is aligned to a grid. Thus, the new dungeon-generation method was born!

### Making Fun, Dungeons?
Well... of course, it wasn't without a few bumps & bruises along the way... Glitches are, in every game-dev project, to be expected:
<center>![sometimes things get glitchy...](https://files.steempeak.com/file/steempeak/stuffbyspencer/z4CpNDC3-dungeon-glitched.png)</center>

But this got remedied and thankfully dungeons now look pretty. Here's a bit of a step-by-step in how this all goes down:

| <center>PREVIEW</center> | <center>EXPLANATION</center> |
|-|-|
| <center>![dungeonfixedglitched.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/bU4H5VjE-dungeon-fixed-glitched.png)</center> | <center>First, we create a grid based on how many caverns wide & how many caverns tall we want our dungeon to be, multiplied by the size of each cavern</center> |
| <center>![dungeonrandomcaverns.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/INfs4Vao-dungeon-random-caverns.png)</center> | <center>Then, we randomly choose caverns from our "cavern stack" (*which is just an array of caverns that we've created by hand*) and place them into these empty grid slots. **BUT!** That doesn't look so good, we should add hallways connecting the rooms together!</center> |
| <center>![dungeonhallwaypurpleindicatorcleancaverns.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/nZFn5qyy-dungeon-hallway-purple-indicator-clean-caverns.png)</center> | <center>So, we add a 1-tile sized buffer between all rooms, this will be the hallway. Then, we need our code to find where we placed our "hallway entry points" (*the little 1-tile sized holes in the wall*) for each cavern (*in this example, they all match up & are aligned, but that's not always the case*)</center> |
| <center>![dungeonhallwayhorizontalconnections.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/eXfthBjk-dungeon-hallway-horizontal-connections.png)</center> | <center>We then add these entry points to one of four lists: *Top points, Right points, Bottom points, Left points*, depending on where they're located. We loop through the "Right points" list, connecting each point to their neighbor in the "Left points" list.</center> |
| <center>![dungeonhallwayverticalconnections.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/EHKrgOsl-dungeon-hallway-vertical-connections.png)</center> | <center>Apply the same loop from the above step, but do so for the "Top points" list & the "Bottom points" list. **Now you've got connected caverns!**</center> |
| <center>![divider.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/5gl4OUlI-divider.png)</center> | <center>![divider.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/5gl4OUlI-divider.png)</center> |

### Making Dungeons Fun!
Now that we got a stack of caverns to randomly place throughout the dungeon, as well as hallways that connect to various points, our dungeon system is ready for prime-time fun, and it looks great as well!
<center>![bunch of randomly-generated dungeons, with no duplicated rooms per map](https://files.steempeak.com/file/steempeak/stuffbyspencer/0HUpasU7-bunch-o-dungeons.gif)</center>

And there you have it, semi-random, grid-based, cute little emoji dungeons that you can keep exploring until the inevitable heat-death of the universe! **Enjoy!**

<center>![divider.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/5gl4OUlI-divider.png)</center>

<center>![newbanner.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/L424Nxbt-new-banner.png)</center>

### **What Is Tweet_Dungeon? πŸ˜ΆπŸ’€**
> **Tweet_Dungeon** is a Twitter-based dungeon-crawling roguelike game, where the entire game (*moves, attacking, looting, exploring, etc.*) takes places entirely on Twitter. Players vote on what the little adventurer will do using Twitter polls. Turns are 20 minutes long, and updates constantly all day long.
> ***
> Follow along with my progress where each day I'll post a short dev log showcasing the latest stages of the gameplay. Will I be able to make the deadline of Thanksgiving (*November 28th, 2019*)? **Only the game-dev-gods can tell...**

# <center>***`T-4 DAYS...`***</center>
| <center>[**πŸ‘‰ Follow Tweet_Dungeon On Twitter To Play When The Game Launches! πŸ‘ˆ**](https://twitter.com/Tweet_Dungeon)</center> |
|-|

| <center>[**previous dev-log**](https://steempeak.com/gamedev/@stuffbyspencer/tweet-dungeon-dev-log-3)</center> | <center>~~next dev-log~~</center> |
|-|-|

<center>![divider.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/5gl4OUlI-divider.png)</center>

<center>[![BlankBanner.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/J0uGpoaL-BlankBanner.png)](https://steempeak.com/@stuffbyspencer)</center>

| <center>twitter</center> | <center>instagram</center> | <center>main website</center> | <center>mystery attic</center> |
|-|-|-|-|
| <center>[![Twitter.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/zUhMs4Ti-Twitter.png)](https://twitter.com/StuffBySpencer)</center> | <center>[![Instagram.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/koHXKh0G-Instagram.png)](https://www.instagram.com/stuffbyspencer/)</center> | <center>[![StuffBySpencer.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/oUTcZxfV-StuffBySpencer.png)](https://www.stuffbyspencer.com/)</center> | <center>[![MysteryAttic.png](https://files.steempeak.com/file/steempeak/stuffbyspencer/9019gszR-MysteryAttic.png)](https://steempeak.com/@mysteryattic)</center> |

<center>***take care! :^)***</center>
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 273 others
πŸ‘Ž  
properties (23)
authorstuffbyspencer
permlinktweet-dungeon-dev-log-4
categorygamedev
json_metadata"{"app":"steempeak/2.1.1","format":"markdown","description":"Tweet_Dungeon Dev-log #4: Time to hop into some dungeons and figure out how they're generated!","countdown":"2019-11-28T17:00:00.000Z","tags":["gamedev","gaming","indiegame","creativecoin","neoxian","palnet","games","programming","development","stem"],"users":["stuffbyspencer","mysteryattic"],"links":["/gamedev/@stuffbyspencer/tweet-dungeon-dev-log-3","https://twitter.com/Tweet_Dungeon","https://twitter.com/Tweet_Dungeon","/gamedev/@stuffbyspencer/tweet-dungeon-dev-log-3","https://twitter.com/ROLLINKUNZ","https://twitter.com/Tweet_Dungeon","/gamedev/@stuffbyspencer/tweet-dungeon-dev-log-3","/@stuffbyspencer","https://twitter.com/StuffBySpencer","https://www.instagram.com/stuffbyspencer/"],"image":["https://files.steempeak.com/file/steempeak/stuffbyspencer/FeJCjttw-zelda-banner-LARGE-colorpalette-n.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/5gl4OUlI-divider.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/9e2K7o7O-cavern-crafter-HI.gif","https://files.steempeak.com/file/steempeak/stuffbyspencer/jozKKmCw-dungeon-no-hallways.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/h2kWYpX9-dungeon-random.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/7UbaLONu-image.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/z4CpNDC3-dungeon-glitched.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/bU4H5VjE-dungeon-fixed-glitched.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/INfs4Vao-dungeon-random-caverns.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/nZFn5qyy-dungeon-hallway-purple-indicator-clean-caverns.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/eXfthBjk-dungeon-hallway-horizontal-connections.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/EHKrgOsl-dungeon-hallway-vertical-connections.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/0HUpasU7-bunch-o-dungeons.gif","https://files.steempeak.com/file/steempeak/stuffbyspencer/L424Nxbt-new-banner.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/J0uGpoaL-BlankBanner.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/zUhMs4Ti-Twitter.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/koHXKh0G-Instagram.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/oUTcZxfV-StuffBySpencer.png","https://files.steempeak.com/file/steempeak/stuffbyspencer/9019gszR-MysteryAttic.png"]}"
created2019-11-25 11:39:06
last_update2019-11-25 11:39:06
depth0
children6
last_payout2019-12-02 11:39:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value1.171 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length8,383
author_reputation13,003,870,677,623
root_title"The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€)"
beneficiaries
0.
accountlikwid
weight10,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,816,834
net_rshares9,526,004,809,314
author_curate_reward""
vote details (338)
@archdruid ·
<div class="pull-left">
https://i.imgur.com/OExRVwP.png
</div>
Your post was upvoted by the @archdruid gaming curation team in partnership with @curie to support spreading the rewards to great content. Join the Archdruid Gaming Community at https://discord.gg/6yD2Emr. Good Game, Well Played!
πŸ‘  
properties (23)
authorarchdruid
permlinkq1iz3o
categorygamedev
json_metadata{"users":["archdruid","curie"],"image":["https://i.imgur.com/OExRVwP.png"],"links":["https://discord.gg/6yD2Emr"],"app":"steemit/0.1"}
created2019-11-25 12:38:12
last_update2019-11-25 12:38:12
depth1
children1
last_payout2019-12-02 12:38:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length292
author_reputation662,521,596,261
root_title"The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,818,107
net_rshares2,061,841,965
author_curate_reward""
vote details (1)
@stuffbyspencer ·
Cheers! **:^)**
properties (22)
authorstuffbyspencer
permlinkre-archdruid-q1j28o
categorygamedev
json_metadata{"tags":["gamedev"],"app":"steempeak/2.1.1"}
created2019-11-25 13:46:03
last_update2019-11-25 13:46:03
depth2
children0
last_payout2019-12-02 13:46:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length15
author_reputation13,003,870,677,623
root_title"The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,819,656
net_rshares0
@c-squared ·
$0.04
c-squared-comment
<div class="pull-left">https://cdn.steemitimages.com/DQmVHt1f2jqCViLk6dX2SZsajYRWBpmdQA7sQDEbuQBxFB3/c2100.png</div><br>This post was shared in the <a href="https://discord.gg/B8JFmJ4">Curation Collective Discord community</a> for curators, and upvoted and resteemed by the @c-squared community account.<br/> If you are a community leader and/or contest organizer, please <a href="https://discord.gg/B8JFmJ4">join the Discord</a> and let us know you if you would like to promote the posting of your community or contest.<br/>@c-squared runs a <a href="https://steemit.com/witness/@c-cubed/announcing-the-launch-of-the-new-c-squared-witness">community witness</a>. Please consider using one of your witness votes on us <a href="https://steemconnect.com/sign/account-witness-vote?witness=c-squared&approve=true">here</a>
πŸ‘  ,
properties (23)
authorc-squared
permlink20191125t152300663z
categorygamedev
json_metadata{"tags":["c-squared"]}
created2019-11-25 15:23:00
last_update2019-11-25 15:23:00
depth1
children1
last_payout2019-12-02 15:23:00
cashout_time1969-12-31 23:59:59
total_payout_value0.019 HBD
curator_payout_value0.018 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length818
author_reputation8,872,520,093,091
root_title"The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,822,080
net_rshares230,278,725,385
author_curate_reward""
vote details (2)
@stuffbyspencer ·
much appreciated :^)
properties (22)
authorstuffbyspencer
permlinkre-c-squared-q1jjr2
categorygamedev
json_metadata{"tags":["gamedev"],"app":"steempeak/2.1.1"}
created2019-11-25 20:04:15
last_update2019-11-25 20:04:15
depth2
children0
last_payout2019-12-02 20:04:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length20
author_reputation13,003,870,677,623
root_title"The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,829,057
net_rshares0
@likwid ·
likwid-comment-1575286856951
This post earned a total payout of 1.015$ and 0.763$ worth of author reward which was liquified using @likwid. [To learn more.](https://steemit.com/steem/@likwid/announcing-likwid-the-reward-liquifier)

πŸ‘  
properties (23)
authorlikwid
permlinklikwid-comment-tweet-dungeon-dev-log-4
categorygamedev
json_metadata{"app":"likwid"}
created2019-12-02 11:40:57
last_update2019-12-02 11:40:57
depth1
children0
last_payout2019-12-09 11:40:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length203
author_reputation36,087,507,440,149
root_title"The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€)"
beneficiaries
0.
accountsteemium.vote
weight10,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,031,743
net_rshares177,033,609
author_curate_reward""
vote details (1)
@steemitboard ·
Congratulations @stuffbyspencer! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@stuffbyspencer/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@stuffbyspencer) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=stuffbyspencer)_</sub>


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
πŸ‘  
properties (23)
authorsteemitboard
permlinksteemitboard-notify-stuffbyspencer-20191211t235154000z
categorygamedev
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-12-11 23:51:54
last_update2019-12-11 23:51:54
depth1
children0
last_payout2019-12-18 23:51:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length644
author_reputation38,975,615,169,260
root_title"The Dungeons Of Tweet_Dungeon (😢 Tweet_Dungeon dev log #4 πŸ’€)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,330,313
net_rshares3,466,457,777
author_curate_reward""
vote details (1)