Author Archives: Nicholas

Strange Moods At Gaslamp Games

“Periodically, individual dwarves are struck with an idea for a legendary artifact and enter a strange mood. Dwarves which enter a strange mood will stop whatever they are doing and pursue the construction of this artifact to the exclusion of all else. They will not stop to eat, drink, sleep, or even run away from dangerous creatures. If they do not manage to begin construction of the artifact within a handful of months, they will go insane and die soon afterward.” – Dwarf Fortress Wiki

Strange moods abound in the office. It must be Autumn.

David screams "I must have steps!"

The programmer screams “I must have steps!”

I was seized with the strange mood recently after I got annoyed when implementing a new feature – more office code, I believe. Writing and testing my code required me to make a change to the Lua scripts, open the game, build an office, test the feature, see my stupid mistake, shut down the game, change the Lua script, open the game again, and continue ad infinitum. Uggh. Inspired by Casey Muratori’s Handmade Hero approach to hotloading – even though our approaches are totally, conceptually dissimilar – I decided to add the ability to reload Lua scripts on the fly to the game. The UI code is crude and nasty, but it looks something like this:

{ read this article }

Posted in Clockwork Empires | Tagged , , , , , , , ,
8 Comments

Technical Progress Updates as Viking Saga; or, “The Kalevining”

(With thanks to the Twitter user
who suggested that the history
of all of the code in Gaslamp
should, for comedy, be provided
in the form of Viking Saga.
Let it be known, this is your fault.)

pain_farm

Totally unrelated: the Battle of Sausage Farm.

I. THE CAFFEINATION

In the frozen lands of Gaslamp,
in the midst of record wind speeds,
while a power outage goes on,
and our coders, drenched with fever,
and the drippings of their noises,
hunker over scarred computers
plotting code for Clockwork Empires.
Verily, a mighty plotting.
Verily, it is cold season.
A plague descending through the office,
and our lungs are filled with wheezing.

ce_nicholas2

Nicholas Vining, attempting to transform himself into John Carmack.

In the midst of Gaslamp’s office,
strides the coder, Nicholas Vining,
holding two large pints of coffee,
in each hand, for double fisting
in the manner of a wizard,
or at the very least John Carmack –
here we use poetic license –
to do battle with the codebase.
(Also, let us now please note that
when a wizard double fists we’re
merely talking about drinking.)

“Tell me now,” asks Nicholas Vining,
“Tell me, what should I be coding?
Magic runes of lethal graphics,
to dazzle bitter game reviewers,
and the men of foulest Youtubes,
craving 60 frames per second?
Shall I work such magic runings,
shall I weave intricate codings,
in the mystic ‘Shader Language’
known to only true devotees
of the sacred graphics circles?”

ce_daniel2

Daniel Jacobsen, official Forbes Thirty Under Thirty over thirty.

Suddenly, there came a voicing
of a man of mighty Business,
as was recently acknowledged
by Forbes’ “Thirty Under Thirty”,
freshly returned from Seattle.
Proudly ringing was his laughter,
proudly calling, “Ha ha! Business!”,
freshly returned from Seattle,
not entirely sure what happened.
“Nay,” admonished Dan Jacobsen,
“do not cast your graphic weavings.
This is why the other indies
spend their coin to purchase engines,
such as Unity or Unreal.
But, instead, like proud Sisyphus,
pushing up a hill a boulder,
take from me these JIRA tickets,
full of tasks you’d rather not do.
Yet again the sprint is ending,
yet again you slack in coding.
Decision trees await your typing,
and the offices need writing,
‘ere we can proceed with getting
the hell out of Early Access.”

Thus ashamed, your poor narrator,
feeling not the least heroic,
slunk back to his mighty fortress,
clutching both his mighty coffees,
and slumped into his throne of Aeron.
Mighty was the throne of Aeron,
powerful its weaving,
for it keeps one sort of upright,
in an ergonomic posture.

We called it "Fort Murder".

We call it “Fort Murder”.

II. THE ACTUAL BLOODY UPDATE

So ashamed, our noble poet,
proud programmer Nicholas Vining,
sat down and split the building menu,
sundering the earth from heavens.
While the code was still compiling,
all the office heard him musing,
“We have far too many buildings,
and it is very confusing
for the poor neophyte user.
See, a GIF by Chris Triolo.
See, how well it’s animated.
See how intricate the detail.
Well, I’m sure not doing that, then.”
How noble is the Lead Programmer!
Knowing when he should be precious,
and knowing when his time is precious,
knowing when a thing can quickly
be swept under the rug for later.

In a previous frozen winter,
workshop code was quickly written
by that mighty Wizard Whitman,
for our original intentions.
The intentions of the workshop
slowly changed throughout the course of
making a game in early access.
(Once upon a time, the system
did not have building interiors!
We then threw out much of our artwork
and code to add building interiors
so that the actions of your people
could be observed in fussy detail.)
Yes, bits were often bolted to it
by many hands, in great big hurries,
adding one thing, then another.
In fact, it was a load of bollocks.

Previously, it was rewritten,
and the code was moved from Lua,
where it was a great big pile of
oozing from a, well, never mind.
Now the workshop code is cleaned up
and rewritten in C Plus Plus
and it smells like new mown daisies
and the smell of hay in summer.
(Hopefully it lasts a few weeks.)

“Now,” he said, “the workshop code calls.
In previous days, the artisan
would have to wait for an assignment
to be complete, before he could start
a new one, with a fresh mandate.
From now on, let all of our workshops
be full of happy, healthy labour,
and let every citizen amongst them
do whatever work is able
to be done in these conditions.
Let’s instead have one assignment,
which all jobs inside a workshop
shall be attached to when created.”
This was shipped in a fresh alpha,
known as “Alpha forty-two-C.”
Player feedback was quite lovely;
we are thinking about letting
the work crew affixed to a building
also perform such small repairs
to modules as may often occur
when a proud and mighty module,
over-used in its employment,
becomes broken and needs repair.
We may not; we’re not quite sure yet.

From this revision, sprung a framework
for running tasks inside a building.
Now, when we look for a new job,
if the building is an office,
we examine all the jobs that
are stored up inside this building.
(We might have covered this already.)
Thus a person’s wounds are treated
by a happy half-crazed barber,
or a demand for confession
may be soon sated by a vicar,
preaching their own choice of gospel
depending on their mental status
and alternative religions.
A new “F-S-M” is added,
where a member of your township
may wait in place to have a job done,
and will get angry when it’s not done,
and thus forcing timely obesiance
to your colonist’s ambitions
to receive prompt medical attention
before bleeding on the carpet,
or for spiritual salvation,
lest they do something they should not have.

These disgusting organs require science.

These disgusting organs require Science!

III. THE CALL OF THE KING-UNDER-THE-MOUNTAIN

From the hills there came a shouting,
and the hoarding of quinoa,
(which only scans if read incorrectly,
for actually it’s pronounced “keen-wah.”)
Yes, t’was artist David Baumgart,
freshly full of vegan lunchmeat,
puzzling about a problem,
vexed by user interactions.

“Here again,” he muttered idly,
“things are put in the event system,
things that maybe should not be there.
For instance, bandit interactions.
Should you wish to shoot a bandit,
with your mighty flint and musket,
you cannot change your past decisions,
unless a new event is firing,
caused by, maybe, other bandits,
than the ones ripping your stuff off.
In the past, we’ve said that buildings
are the source of interactions
with your townsfolk, and their worldview.
Let us place, in-game, an office,
a foreign office, where the player
may make wise policy decisions –
or not, as the case may yet be.
Yes, a mighty foreign office,
the perfect place for dreaded Novorus
and Stahlmarkian interactions,
and other sorts of jingo-ism.”

ce_david2

David Baumgart, filled with vegan lunchmeats and vexed by quinoa.

“For these things,” said Nicholas Vining,
“we shall need all sorts of widgets.
Yes, our code has many widgets,
many widgets of all sizes,
humble scroll bars and small buttons,
text entry fields and tree view widgets,
all hooked up by mighty signals,
to a model view controller.
Long ago, I cast these widgets,
wrest them in a fiery furnace,
actually a small apartment,
and now they have grown fat and sassy.
Yet, who amongst us can go in and
write UI code for all offices?
Alas, we must add widget code now,
designed for use in office buildings,
where the UI is configured
depending on the type of office,
and this must be done from Lua,
for the many types of office.”

Broken down, we see each office,
has two types of interaction:
some policies, and then a job list.
Policies are sent as messages
from the widgets, to the building
and may be global or per-building
depending on the type of office.
For instance, inside a barracks,
we may choose our choice of firearm,
or the nature of our training,
or when soldiers shall be training,
requiring many types of widgets –
rows of icons, and checkboxes,
all drawn upon a WACOM tablet.
Here your narrator is still coding,
but stopped today to pen this update,
in trochaic tetrameter,
which may have been a poor idea. Hmm.

What a lovely kitchen!

What a lovely kitchen!

IV. EXHORTATION

Go about your daily grumblings,
post today upon our forums!
Send us all your broken save games,
so we may yet fix nagging issues,
for Early Access is like toothache,
but the tooth is in a serpent.
(Apparently, that’s like a cobra.)
Bravely, we salute the warriors
fighting on through Early Access,
and are horrified to see that
Prison Architect is coming
out after thirty-six revisions.
Now we pray to mighty Odin
that he will take our souls in combat,
which is why today we ordered
many cans of silver spraypaint
to adorn each other’s mouths with.

(Next week’s blogpost is haiku, now.)

Posted in Clockwork Empires | Tagged , , , , , , ,
13 Comments

Stockpiles and Gabions

It’s instructive to just sit down for a quick, relaxing game of Clockwork Empires and then make a note of all of the little things that one finds frustrating or otherwise demanding improvement. As a result of this particular exercise, gabions are now built in assignments in the upcoming experimental build, rather than as individual elements. (Once certain graphics code is made to work again, we can also leverage this code to do things like brick walls and fences, so that at long last we may be Perfectly Safe.) I think we still need to do some more UI work on the gabion line placer tool in order to make it something you would actually want to use, though; however, large walls are now a thing you can have. Following the same line of thought – “does this annoy me? YES” – I finally fixed the overseer counter so that it only displays overseers and not artisan workers (including but not limited to vicars, artisans, naturalists, barbers, and basically anybody not in Her Majesty’s 5th Regiment of Swole); artisans now get their own idle counter. (We probably need to change the term “artisan” soon as well, as it doesn’t make a whole lot of sense anymore.) This way, you can see how many people are doing the base work of resource mangling, and how many people need to get new stockpile jobs assigned to them. Management!

Get to it, layabouts!

Get to it, layabouts!

I have also spent a certain amount of time this week rewriting the stockpile code, which I’m hoping to have rolled out in the next experimental. There are two parts to this.

{ read this article }

Posted in Clockwork Empires | Tagged , , , , ,
8 Comments

Quality of Life Improvements, Offices, Forest Meat

With Clockwork Empires becoming significantly more stable over the course of the last few patches, we are seeing a lot of people playing the game for much longer, which means that – in turn – when a bug happens, it’s the sort of thing that gets at you rather than just being something to be ignored. The pain threshold has, shall we say, shifted.

These things happen.

These sorts of things happen.

I’m trying to deal with a few long-standing issues this week, which mainly means dealing with small annoyances that detract from the quality of life of a Clockwork Empires player.

For instance, we have now fixed the work crew window slowing the game down when you are faced with > 100 citizens (and Daniel is busy doing Experiments on the work crew window anyway, so who even knows what it will look like after we’re done.) Similarly, the code base now correctly picks a random object from the list of items that can fulfill a job instead of just the last one; this has the nice and useful effect of making it so that citizens randomly distribute themselves in buildings to sleep in at nap time, instead of just choosing the last building chosen. David is in the process of sorting out the problem of citizens getting stuck in an infinite loop of burial, which occurs when a bandit corpse somehow thinks it’s at (0,0) on the game map which is usually stuck in a mountain. There is some work going on to make things more consistent, like ensuring that you can consistently cancel jobs and assignments in consistent places with consistent interfaces, that sort of thing.

And then there is the problem of people dropping meat onto forest meat.

{ read this article }

Posted in Clockwork Empires | Tagged , , , , , , , , , , , ,
5 Comments

Personal Property and Desires

Systems are interesting in sandbox games because they connect to each other. You can have a system that talks to another system, and then emergent gameplay what happens when the systems interact in interesting and novel ways. Re-usable, data-driven gameplay code is also cool, because it gives you a way to leverage work you’ve previously done on one system to make another system more powerful. Case in point: personal property.

Maybe all Wilbert Pickles desires is to own a bushel of sausages. Why not?

Maybe all Wilbert Pickles desires is his own bucket of sausages. Why not?

One of the TODOs on my task list for awhile has been personal property. While you can build lower/middle/upper-class houses and beds, you can’t necessarily assign those beds to people, nor do people want a bed assigned to them. Instead, people just sleep wherever, whenever. This is going to change.

{ read this article }

Posted in Clockwork Empires | Tagged , , , , , , , ,
11 Comments

World Generation And You

I am super happy with Revision 40, and how it turned out. We have had only one reported Windows crash that was a true crash, apparently due to very elderly AMD drivers, and a couple of OS X issues (apparently in the OpenGL driver stack for OS X.) The new problem we have, of course, is that people are now able to produce very large colonies. Consequently, we have had some issues where certain parts of the game (stockpile management, work crew menu, jobs menu) start freezing up under the strain. The new UI code that Daniel has been diligently working on should help fix the problems with the job and work crew menus; this has necessitated a complete rewrite of how UI widgets are resized, a job that is labour intensive, gross, and involves rewriting code that I first wrote back in 2001 or so. Still, I’m very happy with Revision 40. So happy, in fact, I took a tiny vacation for… well, for the first time I can remember. It was really, really weird.

Above: artistic depiction of Nicholas' vacation based on description provided.

Above: artistic depiction of Nicholas’ vacation based on description provided.

For Revision 41, we’ve basically gotten two messages. First, there is a large portion of the populace who want to see us doing more work like we did (from a technical side) in revision 40 – continuing to build on and refine the features that are in the game right now, and fixing long-standing issues with things like military units and stockpiles. There is an equally large portion of the populace, some of whom also belong to the first portion, who are desperately after new content. From the perspective of a game developer, you have to push on with new content in early access because, otherwise, it never gets done. Plus, there is a feature cost. The sooner you get a feature started, the easier it is to retrofit the existing code to support the feature.

So, we’re going to try to find a balance for this patch: cleaning up a bunch more outstanding issues, now that stability seems to be taken care of, while also trying to finish more of the systems that need to be done in order for us to get the game done. There are two big, BIG technology pieces that need to go in right now that don’t exist yet, and which we need to deal with with some degree of urgency because the cost of retrofitting the game to support them gets increasingly higher as we continue development. The first of these is multiplayer, which I’m not working on right now. The second one of these is the global world, because – let’s face it – we’ve all colonized New Antipodea and New Sogwood a million times right now, and it’s time to go fail Make The Empire Proud somewhere else!

{ read this article }

Posted in Clockwork Empires | Tagged , , , , , , , ,
7 Comments

Hunting the Pointer Wumpus

First, a bit of scheduling news: the monthly update of Clockwork Empires, revision 40, will be released next week. Due to E3 and a giant Steam sale there’s not a lot of point in releasing anything this week.

Last time I wrote a blog post, I had written half of the Clockwork Empires codebase in order to fix various issues with autosaves being reported by users. Naturally, these things never happen when I am playing the game; instead, we got DMP files and sorted through them. (I wrote a little in house tool to process these for me; now I can run a batch file and it runs all the DMP files we get through a little script which automatically outputs their call stacks and other pertinent information.)

The moment of truth.

The moment of truth.

To try and fix these issues, I rewrote the entire jobs system in order to move everything into nice, flat arrays, and to get rid of direct references to pointers. My original hope was that this would fix the save game crashes we were experiencing, which were due to various instances of dead pointers to jobs being left in Lua space. Well, it fixed *some* of those crashes. Once Revision 39A came out, we got a bunch more crash reports: various people’s assignments were crashing, due to assignments being held in Lua after they were dead. Well, it wasn’t part of my original plan, but they got the same treatment – assignment handles are now first class citizens, and we can now actually tell if an assignment handle exists or not, and is deleted or not. Starting from Revision 39B, all the workshop assignments were also moved over to a new system where they were controlled by C++, and we were able to remove huge chunks of broken Lua code. Now the workshops were starting to feel good, in a way that they hadn’t felt since… well, since we first put them in – but yet, we still had save game crashes.

{ read this article }

Posted in Clockwork Empires | Tagged , , , , , , , , ,
7 Comments

You have to refactor all the jobs!

Practice makes perfect; once you have a system, you can improve it and you can refine it, but the hardest part is getting the system up in the first place. As a wise man once said:

mcedd

Case in point: I’ve spent the period since the release of Revision 39 and today rewriting a good part of the jobs system.

{ read this article }

Posted in Clockwork Empires | Tagged , , , , , , , ,
7 Comments