The Code Structure Of Tweet_Dungeon (😶 Tweet_Dungeon dev log #2 💀)

By StuffBySpencer | Spencer's Stuff | 23 Nov 2019


zeldabannerLARGEcolorpaletteh.png

🧬 The Code Structure Of Tweet_Dungeon

Making a game can be a hefty ordeal. Various API's, complex algorithms, and a lot of code go into making Tweet_Dungeon what it is. Today, we're going to take a nerdy look into how I manage the game logic behind the scenes, and tips I'm using to stay sane working in this codebase.

 

divider.png

 

📂 Folder Structure

In an effort to stay sane, I decided to split up the code into various, isolated parts.

The CORE folder contains the core mechanics of Tweet_Dungeon (dungeon generation, player controller, world config, enemy behavior, etc.). This code won't actually display anything onto your screen, and won't exactly work on its own.

Then, we have the... Well, everything else. The beauty of isolating the CORE game code, is that you can then basically "drag + drop" it into your own game version.

For instance: There's currently a rough prototype of Tweet_Dungeon available here. This can be considered a game "version". Any changes I make to the core Tweet_Dungeon logic can be automatically pulled into the prototype to keep it updated.

If you're aware of the concept of the Git File System, then you can think of the core Tweet_Dungeon logic being a repo (that's because it actually is...) that you can fork, modify, clone, and include in your own variant of Tweet_Dungeon.

 

as you can see, we store the isolated core game logic in its own folderas you can see, we store the isolated core game logic in its own folder

 

Speaking about Git...

😻 Open-Source, Of Course!

Tweet_Dungeon will, in fact, be open-sourced upon release. There are currently 3 GitHub repo's that we use:

  1. Tweet_Dungeon-CORE : the main code & game logic that is required to run Tweet_Dungeon
  2. Tweet_Dungeon-TWITTER : the specific Twitter bot code that allows play through Twitter
  3. Tweet_Dungeon-CAVERN-KIT : a set of pre-made dungeon "rooms", called caverns, allowing you to quickly bootstrap your own version of Tweet_Dungeon

In addition to these main game repo's, there's also a handful of tools that I've made to help with the development of Tweet_Dungeon, and I plan on open-sourcing those in the future, after the game launch, as well :^)

🛠️ ️ How Do You Work With It?

Actually, it's a rather simple method! First, you'd clone the CORE game logic into your version that you're working on, and then you'll need to import the objects that we export in each script.

import WORLD from '@/core/world.js'
import RENDERER from '@/core/renderer.js'
import PLAYER from '@/core/player.js'
import ENEMIES from '@/core/enemies.js'

When you're game is set-up and ready to run, call the WORLD.init() function, and pass it the reference to RENDERER, PLAYER, and ENEMIES. Remember, call this method when booting up your game (for instance, if using VueJS, put this into the mounted() life-cycle hook):

mounted() {
    WORLD.init(RENDERER, PLAYER, ENEMIES) // initializes the game world
    WORLD.generate_random_dungeon() // generates a random dungeon
}

This will take care of initializing the game code, and you can then start playing your own version of Tweet_Dungeon! Additionally, this makes it easy to swap out any code that we provide, with your own custom code, giving you full control & customization over the game. Everyone gets a game!!!

 

you get a game! and you get a game! EVERYONE GETS THEIR OWN GAME VERSION!you get a game! and you get a game! EVERYONE GETS THEIR OWN GAME VERSION!

 

We want to give indie-game-devs a jump start with making their own clones of Tweet_Dungeon. We have big plans for this game. First? Twitter. Then? THE WORLD!
(no, but seriously, we have tons of stuff planned for the future. various game versions, wonderful new worlds, many different mediums, and much much more!)

ℹ️ Nitty-Gritty-Code-Details

Here're some Tweet_Dungeon development fun-facts to end on:

  • Programming Language: JavaScript, my favorite language
  • Emoji Library: Twemoji (twemoji.twitter.com)
  • Frontend Framework: VUEJS (vuejs.org)
  • Current CORE Game Code Size: ~50kb, so far ;^)

 

divider.png

 

 

newbanner.png

 

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...

T-6 DAYS...

👉 Follow Tweet_Dungeon On Twitter To Play When The Game Launches! 👈

 

divider.png

 

 

BlankBanner.png

How do you rate this article?

0


StuffBySpencer
StuffBySpencer

follow for content 👍


Spencer's Stuff
Spencer's Stuff

A place to talk about the various projects & stuff that I'm working on.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.