BLOG of the LOST GOD

Happy Christmas, I guess

Even though I haven't written anything for a while, I've still been honing my craft. I've been reading a lot -- this repository of design patterns, and this collection of tips for implementing Clean Code in PHP. I feel like I've learnt a lot in the last few weeks, and I'm very happy with that. Hopefully it will result in a better project in the long run.

I'v been reviewing the Event and Rulebook objects I have already, and I thnk the Rulebooks need a quick refactor -- such that the individual books (like MazeRats) implement the core Rulebook interface, for example. This will let me be a lot more flexible when I'm writing Events, and should allow for events which implement rules from multiple rulebooks (for example). I've also got this nascent idea for implementing some rudimentary "AI" that will let NPCs interface with the world by running their own events -- and the same events that player characters do -- which could result in some really fun interactions.

It also implies players could own -- or subcontract -- NPCs to run events for them; so henchmen, artisans-for-hire and the like become a distinct possibility. I really like that idea.

No more zero days

There was no changelog discussion blog post this weekend, and neither was there a r/roguelikedev Sharing Saturday thread. I didn't have anything to share. Over the last week, according to cloc, I added only 45 lines of code to the project. It was a slim week. I'm still going though, albeit much slower than I would like. Honestly, this weekend, I just couldn't be bothered, and working on BotLG seemed like a colossal waste of time. I'm going to chalk that up to a general melancholy, and continue on regardless. What else can I do?

undefined

The whole "No More Zero Days" thing is irritatingly twee, but there's probably something to it, nonetheless.

So where are we up to? We have characters, locations, and a sense of location. We have some dummy items and a dummy item-creating process, so we're ready for events. The handful of lines of code I produced last week are working towards that -- there's a skeleton Event object, and a corresponding ItemFactory.

The EventFactory's main method is generateRandomEvent, which is passed both a Character and a Location. It then consults a list of template events (stored in the database) to find a suitable Event for the character and location, and then customises it -- by adjusting duration and difficulty, producing values for any random qualities, and so on -- and then returns a complete Event object. These Events can then be stored away on a per-player basis, so each player gets their own selection of things to do, based on their specific party. So far it seems like a nice, flexible system that will allow me to serve up a mix of hand-made and procedurally generated things to do.

Next steps -- write a few example Events, and come up with a first-pass at the UI for displaying and starting them.

Account creation, in progress

I'm in the middle of writing the sign-up pages and I've hit a bit of a creative roadblock; I'm hoping that writing about it will help.

It's perhaps a little early to be doing player sign-up, but I thought I'd get it out of the way early for a number of reasons. First, it lets me to get some basic, boring, but essential functionality out of the way, so I can get onto the more entertaining parts. Second; it forces me to answer a bunch of fundamental structural questions about the game: how are the Player and Character objects arranged and stored? What are the minimal set of properties a character needs to function within the mechanical rules of the game?

Over the last few days, I've made some good progress on the object side of things; I now have Player and Character objects with a good set of methods on them, and a neat and easy way to generate new characters, save and load them, and assign them to players. Where I've started to struggle is with the UI for displaying and selecting characters -- the first action a new player will take upon signing up is selecting and customising their first party member from a roster of pre-generated characters.

Here's some freshly rolled examples:

Orion Berrycloth
corpulent, matted hair, deep voiced
STR 2, DEX 0, WILL 1

Mortimer Slitherly-Belvedere
coltish, gold tooth, whispers
STR 0, DEX 2, WILL 1

Fitzhugh Culpepper
trim, missing teeth, spouts random facts
STR 1, DEX 0, WILL 2

Cleopha Graveworm
statuesque, sunburned, flowery speech
STR 1, DEX 2, WILL 0

Elsbeth Slitherly
brawny, acid scars, nervous
STR 2, DEX 1, WILL 0

Fox Southwark
gorgeous, battle scars, squeaky
STR 2, DEX 1, WILL 0

Godwin Tumbler
aquiline, birthmark, gravelly voice
STR 0, DEX 2, WILL 1

Jilly Dankworth
gorgeous, sallow skin, protective
STR 1, DEX 2, WILL 0

Despite what I wrote earlier; I have settled on using Bootstrap for the front-end (and I have a nifty Bootstrap object for outputting pre-canned HTML fragments). My initial thought was to use the Carousel component to allow the player to flip through their roster of pre-generated characters. It works decently, and I can hook into it's slide events to show additional details alongside the carousel, but I'm not happy with how it looks on mobile. Late last night I hit on the idea of using a more square layout -- two side-by-side on desktop, then stacked on top of each other on mobile -- and having the player swipe through characters, Tinder style. That might work better, but I think for now I'm just going to do the simplist thing that could work -- a list with some radio buttons. Fancy styling can come later.

 

To Bootstrap (or not)

The main project that I'm cannibalising to form the bones of Bones (if you'll excuse the pun) uses Bootstrap 3.3.7 for its front end framework, which presents a couple of issues:

  • Bootstrap is now up to version 4.1.3, so it's out of date.
  • Bootstrap is a huge framework

I'm not 100% sure how to proceed from here. I could convert the existing frontend over to version 4.1, and leave it at that, or, I could ditch Bootstrap entirely and write my own (minimalist) CSS framework. Either way, I'll continue to use jQuery, as there's going to be a lot of interactive widgets and AJAX, and coding them all in base JS makes me nervous. At the moment, the UI makes heavy use of the Bootstrap navbar, plus modal popups and progress bars. They look great, and being mobile-first is a must, but the big problem with Bootstrap is that every site that uses it really looks like it uses it. It's very hard to theme sufficiently to the point where it goes away.

What I'll need from a framework, however it's implemented:

  • Mobile friendly, first and foremost
  • Modern browser support for mobile, desktop (and potentially tablet middle ground)
  • Navigation that works and gets out of the way when necessary 
  • Alerts/badges that work across page loads
  • Responsive images: large banner style and smaller icons

Bones of the Lost God has a solid black-and-white aesthetic that's inky and photocopied and a little haphazard; I worry that Bootstrap looks too clean to really do it justice. Deciding to ditch it would be a huge choice with far-reaching implications -- not least on the amount of time I'll have to devote to hand-crafting UI elements in it's stead -- but it's increasingly the direction I'm leaning in.

Home