GUI Update

By no means finished, but a solid foundation going forwards. I tried to make it adaptive, mostly for my own sake: it should work with any resolution more or less properly.

Anyway, here goes:

Besides GUI, I’ve also been moving most of the stuff that’s been hardcoded out into the data. It’s mostly a “what I wish the data would look like” at this point, but the build tree is already loaded from disk in the video. Here’s what a Rasvelg (Coven T7 unit) file looks like:

id: rasvelg
tier: 7
statistics:
    offense: 18
    defense: 18
    damage: 30..40
    hits: 150
    speed: 7
    initiative: 10
    growth: 1
    cost: 4000g+1cr
abilities:
    - flying
    - giant
    - <inline>:
        id: transform
        type: action
        when:
            - battle
            - army
        condition: >
            (inTown() && town.isFaction("coven") && town.built("coven/walking-hut")) ||
            (inHeroArmy() && hero.visited("coven/walking-hut"))
        effect: |
            stack.trainTo("coven/yaga");

That <inline> ability should allow creature-unique abilities to be defined in-place. Normally you’d reference a shared ability (e.g., flying, spellcaster).

Last but not least: scripting! After some deliberation I’ve settled on ChaiScript over Lua, as it promises smoother integration with modern C++. We’ll see about that, but meanwhile it’s been fairly frictionless. In fact, that drop-down console feeds into a ChaiScript interpreter.

+ Credits

Coven town background by u/revesvans.

Witch portrait placeholder — Witch by Mark Belokopytov under CC BY-ND 2.0.

Raven icon by Lorc under CC BY 3.0.

Castle (heavily modified) by Delapouite under CC BY 3.0.

Hero sprite placeholder — capital "H" of Morris Roman font by W. Morris, 1893.

Breaking: Programming is Hard

I may have rewritten the entire source code since last post. Let me explain.

So I started restructuring the game based on stuff you've seen in previous post, and some small stuff you haven't. GUI was getting overcomplicated, so I started to pull different states into dedicated classes. Then it turned out pathfinding was coupled with almost everything, such that when I tried to move it from movement component to the game board everything broke. After I jumped from file to file adjusting little details I thought it'd be easier to just throw everything away and rewrite it from scratch.

Wasn't as bad an idea as it might seem. Of course, I didn't really throw everything out. I just started writing from scratch, taking parts of old code and fitting them where appropriate. And it's worked out okay so far, the only thing missing from this new version is movement. So fingers crossed, and please put all your comments about how stupid that was in the reddit discussion.

Also (who would have thought) GUI programming is hard! It seemed so much simpler at first. I mean, it's just a button, right? Well, a simple button drags with it enough stuff that I'm already considering putting GUI aside until later. Bu-u-ut I suppose there's no better time to figure it out than now. Although now that philosophy lectures have ended my productivity might decline.

Bloody hell, October already?

Don't have much to show for all that time, to be honest. Life's been kinda hectic, and RoH had to take a back seat. In the brief moments of free time I thought a bit about code structure and how to best manage modules without too much coupling. Even drew a few diagrams, like I'm an adult or something.

Apparently I'm most productive during philosophy lectures.

So what came out of all that was basically an overhaul of the graphics system. It's still in progress, but it's not really impeding anything else. (Side note: I really need to use git more for proper feature branch management. The way I'm doing things right now is a mess.)

As the stuff I can show for all this time — minimap! Also, the game board isn't restricted to the size of the window anymore, and I've added some basic scrolling, but I'm not going to make a whole video just for that. Just gaze upon that glorious minimap for now.

Screenshot at 2017-10-13 20:04:02.png

... Okay, turns out I've done more than I remembered at first. Good on me.

Town screen and music

I think it's a good sign that I was able to pick the project back up after almost two months long break. Though, to be fair, I am the one who wrote the code in the first place. Still, one can hope it's not going to be an unreadable mess once released into open-source.

So last time in the "I'm not dead" post I showed you the first steps with the resource manager. It's grown since then. Sprites, sounds, and music, oh my. Parallel with that, I started working on game states, and made a faux-town screen to show. See for yourself:

It really is coming together, isn't it.

Next up — probably some basic GUI, with some more polish for graphics and sounds, fade-outs and transitions and whatnots.

Town screen background is Coven by brilliant reddit user u/revesvans.

Sprites are Cavalry, Stone Pile, and heavily edited Castle by Delapouite and Crystal growth by Lorc. Music is Angevin by Kevin MacLeod. Horse sound effect lifted from HoMM III (you're not gonna believe how hard it is to find a suitable free gallop sound effect!).

Interactions!

This week was a little bit painful. This little addition called for pretty substantial reworking of both pathfinding and map logic, and all because the resource piles are both obstacles and something you'd want to be able to interact with.

On the bright side, game logic is now pretty much decoupled from most of the rest of the game, and I thought I'd throw in some basic sound effects while I'm at it. Behold!

Ideally, when an object gets removed from the map, it should fade out rather than just disappear like that, but I'll save that until I've got sprites to fade out in the first place.

Next up — proper resource management. I have some static placeholder sprites and sound effects prepared, now to get some tiles and generic music.

And Now It Moves

And so, quite a bit more groundwork has been laid. There's your basic animation, mouse interface, and a few more pieces of API for pathfinding and drawing. You can make Kaz move and stop, change direction, all the sweet stuff.

Do you see how yellow cell shading lags behind Kaz? That's how the Map object sees the scene. You can't stop Kaz moving midway between two cells, so Map only updates when Kaz has reached the one he was moving towards. That's when Kaz's Path updates, too.

Next up — interacting with objects on the overworld map. Let's pick some gold up!

Pathfinding

Booyah! I may be overly excited for this, but cut me some slack, I'm pretty new to this.

So yeah. Pathfinding. Each time the map changes, each hero's pathfinding component will recalculate costs and paths to each cell. That shouldn't happen often. In fact, far more often the cursor will move and have to show how many days it will take to reach the cell it's hovering over.

The hero, whom I shall dub Kazimir (or Kaz for short) from now on, cannot yet move. That's the next step!

These posts may be cutting the development a bit too thinly, but I think it's going to be great seeing how far this game has come in the end, and having all these screenshots from the very beginning.

It Begins

After a few months since posts on reddit and Celestial Heavens, I am feeling confident in actually starting a devlog. I mean, look at this beauty!

Well alright, it doesn't look like much, or even do much, but there is a lot going on in the background. I'm actually fairly proud of the ECS system I've got going on. No, it didn't take me five months to make that, although the source already spans 27 files, despite my intentions to keep premature abstraction to a minimum. I was drafting the GDD for most of that time, which is very helpful for keeping my priorities in check.

I was going to make this project crowdsourced, but I'm not sure about that anymore. I will release the source on github once I'm comfortable with it, for all to see, judge, and submit pull requests.

End goal for phase 1: something remotely playable. A hero, couple creatures, town screen, combat.