The Ebonheim Chronicle

Development Blog for Chronicles IV: Ebonheim

I have fully embraced the modern nightmare of containerized web servers and the page you're reading right now is served up by a laptop in my home office. One of the nice things about this is I use File Browser which allows me to very easily upload files to my website from anywhere, and it even has a code editor for html and such!

Having direct access to all of this running on my own machine has empowered me to indulge in silly ideas. The most recent being thought of displaying a live-updating view of how much code I've written for my game.

I am in a weird spot where I think that LoC is a terrible metric for code quality or code complexity whilst simultaneously being absolutely addicted to a big number going up.

I have long had a script for running cloc, a neat full-featured utility to count LoC with a ton of options. The script runs the utility with options designed around ignoring dependencies, generated files, or any other “not lines I wrote myself” and I often enjoy checking in on it after a while to see how much larger the number has gotten.

Sometimes I even want to post that number to social media, but I worry about the optics of that and so I figured why not embrace the silliness and just make a place where anyone can easily see my big number and observe how big it is!

First we need some python that will update a copy of the repository, run cloc, and then send the output of the final line count to a file...

#!/usr/bin/env python3

import os
import subprocess
import json


# Define your repository path and the path to cloc.exe
REPO_PATH = '<path_to_checked_out_repo>'
CLOC_PATH = 'cloc'
OUTPUT_FILE = '<path_to_static_web_files>/cloc_out.txt'


def extract_sum_code(cloc_output):
    """Extract the SUM->code value from cloc JSON output."""
    cloc_data = json.loads(cloc_output)
    sum_code = cloc_data["SUM"]["code"]
    print(f"Found sum code: {sum_code}")
    return sum_code

def update_repo():
    """Pull the latest changes from the git repository."""
    os.chdir(REPO_PATH)
    subprocess.run(['git', 'pull', 'origin', 'master'], check=True)

def get_loc_count():
    """Run cloc.exe and get the lines of code count."""
    result = subprocess.run([CLOC_PATH, 'chron4/', '--exclude-dir=assets,x64', '--exclude-ext=inl,filters,vcxproj,recipe,ini,user,chrep,chf,temp,natvis,x', '--exclude-list-file=cloc-exclude.txt', '--json'], capture_output=True, text=Tru>
    cloc_output = result.stdout
    return cloc_output

def write_loc_to_file(loc_count):
    """Write the lines of code count to a file."""
    with open(OUTPUT_FILE, 'w') as file:
        file.write(str(loc_count))
        print("Wrote to file")

def main():
    try:
        update_repo()
        loc_count = get_loc_count()
        sum_code = extract_sum_code(loc_count)
        write_loc_to_file(sum_code)
    except Exception as e:
        print(f"An error occurred: {e}")


if __name__ == "__main__":
    main()

Next we add our script to cron...

0 0 * * * /usr/bin/python3 /<path-to>/runcloc.py >> /<path-to>/cron.log 2>&1

We sent cloc_out.txt to our static files on our nginx web server so referencing the content on our new website is as easy aaaas....

    <div style="text-align:center;">
       <img style="width:25%;" src="pikachu.gif" />
       <p><b><span id="loc"></span></b> lines of code have been written.</p>
       <p><a href="https://blog.brianna.town">Follow Development Updates</a></p>
       <p><a href="https://brianna.town">Return to Author's HomePage</a></p>
       
    </div>

    <script>
        async function fetchLoc() {
            const response = await fetch('cloc_out.txt');
            let loc = await response.text();
            loc = Number(loc).toLocaleString();
            document.getElementById('loc').textContent = loc;
        }
        fetchLoc();
    </script>

And there you go! Please enjoy the awkwardly-domain-named https://chrongame.com and look forward to a release date when the number is much much larger ♥

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

Today is June 28th which means that two years ago today I decided to try to #gamedev again and made my first commit to a new repo for a new engine attempting (for the fourth time) to make a game with the title “Chronicles IV: Ebonheim

Past Attempts

I thought it might be fun to talk about some pre-2022 project history and show some never-before-seen development gifs!

sEGA

Back in 2015, I started a new game engine with the constraints of being

  • 100% pure C
  • low-dependency
  • emulating EGA graphics cards

In the end I think the most powerful result of that endeavor was reshaping my brain around C. It forced me to learn so much about how code actually works and what is going on and completely revolutionized my coding style and ability.

The EGA emulation came as an idea of trying to create a cool arbitrary limitation on the graphical capabilities because old EGA games is some of the first games I ever played as a kid.

You can access that old engine here!

sEGA Games

The original idea for the engine was a point-and-click adventure title called Borrowed Time (BT) in the repo. I have nothing to show for this except for some scattered design documents but the general premise involved using a pocket watch to traverse over a clockwork Majora's Mask -style slice of time and solve a murder (still waiting for my check from the Obra Dinn devs).

By the time the engine was up and running and the graphics all worked I had “shifted” my idea to a turn-based tactical RPG called Shift which involved going on runs by diving into other planes of existence via D&D-style color pools. This project didn't get a lot further but it was influenced a lot by me being into DotA at the time and attempting to come up with new ways to accomplish complex deterministic combat resolution which was a constant pain point in BladeQuest.

BOMBILLAS.BAS

I used sEGA a little later to make a clone of the old QBASIC game GORILLAS.BAS for the Giant Bomb Game Jam!

You can download and play it here and see it being played by the Giant Bomb staff here!!

Chronicles IV (1)

After taking a break, moving apartments, losing a lot of weight, and getting exceptionally into a tabletop game called Burning Wheel, I had the idea of using sEGA to try and make some kind of Burning Wheel, Morrowind, Ultima, completely unrealistic game.

A big part of the pitch was that the whole game world would have (hundreds of) years worth of history mapped out in scripts. You create a starting character whose background would determine their age and starting location. You would then pick and poke and interact with the world to try and cause the course of history to change to accomplish your goals. It was this incredibly ambitious idea of having an RPG character who could literally grow too old and die of natural causes, where learning new skills took months or years of training.

Despite this idea never really coming together or having much hope of turning into anything, it's something I tinkered and played with for three years. It had no ImGui or in-engine edit UI but I still wanted to do all asset editing in-engine. This lead to creating a Lua console and building the map editor into the running instance. It had very tight lua integration for all of the actors. It's honestly wild to me just how much stuff this tech demo did in the end.

Here's some gifs from that project!

Thank you!

To everyone who has been following this project, it has been a joy to share my game's development with you!

Here's to a great third year!!

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

I've been actively developing this game for two years as of this month and have enjoyed keeping a tightly-curated blog of development progress and technical write-ups. But, as that body of work has grown, I've felt less and less easy about having that horse hitched to a platform I can't control or export from.

So now welcome to The Ebonheim Chronicle! All posts and their content from the last two years have been migrated manually here to a laptop in my office at home running Writefreely, a great minimal blog app that also has activitypub federation!

I've added a line of links to the signature of every post with how to access the RSS feed or follow the blog on mastodon or your federated feed of choice!

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

Spent this week building the art and UI around items and equipment. Items are the key to progression in the game! I can't wait to have them actually start affecting combat in meaningful ways 😁

#gamedev #chron4 #pixelart

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

In the combat demo, I had created a system called “Dodge Locking” described by the game's instruction screen as


The idea went something like this:

  • If you go before someone in the turn order you can always just move away from an incoming melee attack, dodging it.
  • Going first should be an advantage but there should still be a cost associated with disengaging from melee range
  • So rather than taking the hits, one or more lockers causes a 1-damage “dodge cost” for disengaging

Here's an example of disengaging from two lockers:

But there were issues with this when playtesting:

  • Few testers understood this mechanic, the closest being individuals asking if it's like Attack of Opportunity in D&D
  • There's already a problem with that demo where kiting enemies to get stamina back is overpowered
  • The dodge cost isn't high enough to make much impact

I worry because I think as a game designer you should trust your weird ideas most of the time and should try to never change something for the purpose of “Will people understand that” Sometimes teaching someone to understand your weird thing can be very impactful! But I did also feel like this system wasn't going to work out in the long run.

So I thought why not just turn it into Attacks of Opportunity! Essentially, if you're locked by an attack or ability, that attack will play out normally in reaction to you moving away. Here it is working:

I believe that this is an overall improvement for a few reasons:

  • Taking the attack that was declared as a cost to moving away makes disengaging much harder and makes melee much more dangerous
  • There's still room to modify this system via passive abilities that can modify the damage, create dodging effects, or adding counters
  • Adding locking to powerful ranged abilities is on the table now too with the same UI messaging

Finally, I am so proud that making this change was just a few lines of code! The combat execution is so modular and structured so nicely that making this enormous change was trivial and automatically works with enemy behavior and preview UI!

#gamedev #chron4

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

I've always wanted to nick this design ever since playing Divinity Original Sin 2.

Tiles that accept surface elements can now be made wet, frozen, shrouded, oiled, or burning. Applying elements interact with the existing status in a (mostly) intuitive way: Fire melts ice, water puts fires out, oil burns, etc. etc.

Since pushing is a big part of the game's combat, pushing an enemy through fire can be an extremely powerful tool. And anyone moving or getting pushed onto an ice tile will cause them to slide until they hit something!

Burning tiles also emit light and smoke from doused fires blocks vision for a few turns before dissipating.

The great thing about the enemy behavior system is that it has a very generic function for calculating value and cost from resultant game states. So the high-value things like getting close to an enemy or avoiding damage automatically incorporate the tile hazards and I'm already seeing enemies be smart about ice sliding usage.

There's so much to be done with all of this, I can't wait to start using it all with some encounter design and create synergies with different abilities ♥

#gamedev #chron4

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

Light and Vision are critical components for Chronicles with the dark areas of the world requiring torches to light your way.

Additionally, your character will remember tiles you've seen which appear on the screen like a map when they're not currently visible.

This knowledge persists between runs! It's an iterative effort from dozens of runs to map the world 😄

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

Chronicles uses 2D tiles like other RPG's but organizes the world into an arbitrary tree of map layers. In the end, every position in the entire game is in the same world coordinate system with all exteriors and interiors existing on the same continuous map.


To make this work performantly, the tiles are chunked and then stored in a QuadTree. Temporary static rendering takes place at higher zoom levels to allow you to fully explore and edit tiles even at a 10k x 10k scale while maintaining 60fps.

Buildings and towns and caves and dungeons and lakes and islands can all be separated into individual layers whose children will then be located relative to them. In the video I move a town to a different island layer and then move it around, which in turn moves around the town's child layer which is the buildings. I then add an event for a player origin so that when the game actually starts, it spawns a player-controlled actor at that point in the world. Moving the town would move this origin as well automatically!

The effect of all of this is new content can be created arbitrarily using the asset system. It's simple to mod in a new town or a new island on top of the existing geography and everything stacks up together.

A critical feature to this is that layers can be conditional based on the world state, allowing the world to change between runs. Towns can be destroyed, rivers flooded, bridges built, and all just by conditionally loading the correct layers when a run starts.

Querying the content of an individual tile in this massive world map is lightning-fast in this structure and allows a ton of freedom for creating content. Really proud of how all of this has come together!

#gamedev #chron4

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

There's some relevant game design talk going around today, and I kind of shy away from some of my not-implemented and not-playtested design ideas waiting to be poured into my game, not because they're secret but just because I'd rather show it all actually working instead of just talking about it.

But I feel like it for this so here we go!


When it comes to the larger run-based structure of Chronicles, I've talked a lot before about how the world isn't procedural but that it changes between runs. This is inspired by the notion of “Faction Turns” which I first heard about from Stars Without Number, and then also used to great effect running a modded 5e campaign through the Caverns of Thracia.

I believe Blades in the Dark does something similar to this but I haven't played it! Essentially, after enough time has passed, the world's factions get to “play a turn” wherein time passes in the larger world and macro-scale events take place including wars, changes of territory ownership, travel of key characters, etc. etc.

For Chronicles, the idea is that when your character falls in battle, the world will tick forward in time which will affect any of a very large list of possible variables. This can be as simple as shuffling around the enemy placement within a dungeon or as complicated as the defeat and razing of a population center. The world map system I'm working on uses a concept of “tile layering” to be able to phase in different states of the world piecemeal based on flags and counters that change from run to run.

This has a huge influence on how the player interfaces with the scale of the world. The only “fast travel” during one run is picking a starting point in the world from those you have unlocked. After that, it is a combination of just-plain-walking along with morrowind-style public transportation routes.

This is on my mind with the Dragon's Dogma Fast Travel quote going around today because the goal in my game is to create an environment where you aren't being forced to manually travel distances to create difficulty or friction, but rather that you get to traverse these distances because they'll be changing in subtle or not-so-subtle ways regularly!

Whether or not this actually works in practice or is achievable by a single creator remains to be seen, but I am fairly confident in my approach, primarily optimizing for how quick and easy it is to add new conditions and throw together a variety of layers. The next milestone should show off this working on a smaller scale :eggbug:

Edit: Here's a Masto post from last year talking about the new map system a bit!

From a commenter:

This is really cool and actually was the thing that caught my attention when I first read about Chronicles. I think no matter how successful you are with the execution, it's bound to produce something interesting!

If you're looking for inspo within video games, Unexplored 2: The Wayfarer's Legacy does something similar to this! Not quite the same and the implementation sounds very different than yours, but there are various factions in the game (ranging from clans and empires to “giant spider monster”) that act when your character dies, with imperial forces that are hunting you down spreading out on the map and the giant spider moving between caves to nest in (they're still updating the game so this might be somewhat outdated).

In theory it works great – every time you die the game world can become harder to traverse, but you do have allied factions and if you power them up they can beat back the imperial forces so you're encouraged to help these factions instead of beelining towards the main quest. In practice though, at least when I last played the game, dying wasn't a super common occurrence if you were careful and the actions during a tick weren't very drastic so it felt out of sync with the rest of the gameplay (I think they might have actually updated it to happen more than just on deaths now but it's been a while since I've given it a go).

I guess all that to say, maybe some questions to think about as you're building this out, if they're not already on your mind:

  • What happens to someone who's really good at the game and will not die a lot? Will they miss part of the intended experience with this?
  • What happens if someone sucks at the game and dies a lot? Does playing poorly always lead to a worse map state? Could that lead to snowballing failures? (Not always a bad thing!)
  • How much variation can this system provide? If someone dies a bunch, will they end up in the same scenarios quickly?
  • Can there be a set of conditions that make the map unplayable? Or just not fun to play?
  • Could a large gap of time between deaths make the faction turns seem inconsequential, or in the opposite case, overwhelming? Should the amount of time since the last death factor into how many actions are taken between turns? Would it make sense within the story you're trying to tell?

I was already looking forward to the next milestone after playing the combat demo, but now I'm real excited for it!

Thank you for the very thorough response!! I will have to look into Unexplored 2, that sounds really interesting!

To address some of your questions, I have a few philosophical rules for faction turn consequences that should try to alleviate most of the obvious pitfalls.

1) Death is expected. Never or rarely dying on a blind playthrough would be highly unexpected partly due to a component of the difficulty being knowledge-based instead of only skill/tactical. Death isn't something that's generally punished with a worse game state, subscribing to the notion of “failing forward” where the progression of time may produce complications or variations, but avoid the snowball of everything getting harder. There's a lot of checks and balances needed to make this work.

2) Changes to the world have scope and can be heavily localized; being reactive to what areas were visited or where enemies were defeated or where the death took place. Series of events set in motion may not be strictly tied to a global clock, only beginning when the player has encountered it. A key trick here is to show evidence of things happening over the course of multiple runs to hint at progress being made or something having only recently happened. An example is a tunnel being dug where lanterns and pickaxes and miners are present and the passage widens or lengthens as time progresses.

3) Macro-scale changes driven by factions and larger timelines should be created with the goal of being able to be observed and interrupted. I want to avoid hidden timers that cut you off from content and I want the game to be completable with 0 or 10 thousand deaths. That being said, noticing something major in the world that took place is a great motivation to attempt to circumvent it or explore interactions with it on subsequent playthroughs!

#gamedev #chron4

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |

I've had my project manager hat on for the last month+ trying to figure out the next standalone milestone that gets me closer to the full game. Originally, I assumed that I would just focus on creating the early game experience more or less as it would appear in the final product. Upon further thinking, if the combat mechanics milestone was designed around getting a bunch of mechanics and systems put together and working, then the next milestone should aim to do the same, just with a new set of systems.

So Milestone 2 is going to be: The Mid-Game Dungeon

Here's some major highlights for this milestone to get excited about:

  • A large, sprawling handcrafted dungeon to crawl through
  • Line-of-Sight, Fog-of-War, and Dynamic Lighting
  • Inventory and Equipment: Your strength comes from your loot
  • Sneaking
  • Enemy awareness: Baddies can see and hear you and hunt you down
  • Death is permanent and time progresses between runs
  • Some of your loot can be salvaged if you fall, the rest may be dispersed
  • A selection of abilities for both combat and exploration: experiment with different builds
  • Combat Mechanics cut from the last demo: Tile Hazards, Sigils, Stuns, Roots

I really want the next playtest to be more of what someone might expect to experience roughly halfway through a campaign.

I've spend the last week working on a complete overhaul of the map system to be able to support the new interconnected world, and it's probably onto lighting and sight from there! I really feel like the work required for this is a lot less intense that everything that has come before it so I hope this one will come together rather quickly!

#gamedev #chron4

Wishlist Chronicles IV: Ebonheim! | 🌐 | | | 🙋‍ |