Category Archives: Programming

Test Timing Improvements

I was getting frustrated by long test times, so I did something about it. Previous data showed initialization took upwards of 80% of the total testing time, so that’s where I focused my effort. The results:


What took 2.2 seconds per test before now takes 1.4 seconds! Each test is 128 game playthroughs, which is enough to create visible trends in win percentage. This multiplied by eight different tests is a time savings of six seconds per total test run. While this may not seem like much (and maybe it isn’t), waiting 17 seconds is a lot different than waiting 11 seconds.

Now to resume figuring out how much to cost this tech! Clearly 200 Wood is too much, but what if I tweak the AI…

Update: I recreated the test from the last blog post by running 512 games per test. Compare the two times below.


Balancing Update

At long last, I’ve made progress. It’s just a tiny bit, but I’m hopeful.

2016-11-18-test-resultsThis is the result of a month’s work of balancing and testing. If I knew what I was doing, this would have taken a week at most. But I didn’t, so it went through many iterations.

I eventually scrapped everything I was working on and went back to the basics: one “harvest” equals 10 food. Then the first question becomes: how much meat does the AI gain per day?

I had to implement some smarter AI behavior, namely:

  • Only consider unlocking +Meat Skill technologies if it has already discovered the Hunting Grounds
  • If it has found the Hunting Grounds, travel there each morning. Otherwise, stay put (and look for the Hunting Grounds)

From there, I figured out how much food to consume per day. Then, I tested different food costs for the first technology. Then the second tech. Then the third, which is displayed in the table above. If I want a survival rate of say, 60%, I want to set the third technology’s cost to be 600 food. It’s that easy!

Before, I was aiming for final end-game amounts (like how to feed 1000 tribe members), but couldn’t fine-tune the early game like I wanted. The changes wouldn’t effect the survival rates in an expected way. I like this bottom-up approach because I can see how each alteration changes the game.

A friend suggested copying another game’s numbers. So simple I’m kicking myself for not doing that earlier. At least my current approach looks promising.

Testing Has Never Been So Fun

2016-10-28-test-resultsAfter many hours of brainstorming and programming, this is the final result. It doesn’t look like much, but I’m ecstatic. This means I can tweak numbers and see how it affects the game at a glance. No more guesswork!

Shown here are the final results of 16 tests. Not pictured are the 16 individual detailed breakdowns. Every test is a complete game play-through. The AI chooses a random direction at the start of each day, and moves to the farthest discovered locale. Event options are chosen at random. The AI unlocks tech in a specific order. At the moment, only Food tech is researched. The game ends at 100 days, or when the Tribe count reaches zero.

I ran 256 tests once. It took just under a minute to complete, and produced an 11 MB log file. Not that I read through it, but it’s good to know I can produce a test of that size if the need arises.

I already have ideas on how to expand the testing, what kind of events are needed in the game, and even different AI behavior. So much work, so little time!

Exploration Refactoring

This ends my first week using Scrum (see earlier post). While I didn’t complete everything on my to-do list (testing and balancing are for suckers), the system really helped me plan ahead and finish tasks. It’s also super simple to write the update notes this week; I just copied everything from the Completed list.

This week I took a look at exploration. Having the player click on the map, then click on the Explore button felt awkward. I did some research playing A Dark Room and realized I didn’t have to let the player see and do everything right from the start. Letting the player discover and unlock things as they go can be interesting. That’s also why technologies remain invisible until the player can unlock it: it prevents information overload.

I also realized that goals should be viewable at all times. Locking the tech tree in the home cave prevents the player from figuring out what resources they need right now. I limited the Ponder button to the cave because 1) the tech tree looks like a cave wall and 2) I thought it would be interesting for players to plan out their days every morning. Turns out it wasn’t so interesting.

Thus, I removed the Explore button and added location exploration events for players to randomly find. To get the player started, the home Cave now includes the Gather button to get a little bit of all resources, but also to give the player a chance to come across random events, namely, unlock location events. This also opens up the possibilities for specific cave events in addition to random morning events. Yay!

Update notes:

  • Stamina: Added stamina to the game. Each day the player starts at 100 stamina. When stamina reaches zero, the day ends. Note: stamina balancing not yet implemented: it minimally depletes
  • Skills: Resource gathering skills are now visible on the HUD underneath their respective resource amounts. Unlock the Club technology to see Meat and Fish skill go up.
  • Story Events: Events can be stringed together. I’ve added events for an alien experimenter who observes you over time. He’ll randomly pop in up to three times for the chance to get some major rewards. Hint: Knowledge-based technologies please the alien.
  • Locations are now unlocked through random events.
  • Ponder (viewing the tech tree) is accessible everywhere
  • The Cave has a Gather button: gets a little bit of all resources
  • Increased location resource amounts
  • Removed Explore button from travel map
  • Debug: Added FPS counter
  • Bug fix: Clicking on current location from the travel map will close the map

Play it here!

Bullet Journaling vs Scrumm

I’ve been in a programming rut lately. Yesterday I almost abandoned Caveman Sim. To me the game is Not Fun, usually a death sentence for games I code. I would start up Unity, and just stare at the game, wondering what went wrong.

A quick talk with Vince made me rethink how feature-complete the game really is. Him nor I can’t tell what’s fun or not because the game isn’t even there.

After brainstorming a bit, I realized my To Do list wasn’t working. I’ve been trying out a bullet journal on Trello. While its useful in anticipating upcoming events, it transformed into a personal calendar rather than a workflow for the game. So I decided to throw the baby out with the bath water and tried out…

Scrum! While Silicon Valley poked fun at the method, I decided to check it out anyway. Once I got done cringe-reading through the wikipedia page, I created my very first Scrum board.


Putting my business degree to good use.

“Stories” are a list of things I want players to experience. I decided my “sprints” would be one week long, ending on Mondays (when I usually upload builds). Acknowledging that, I created a To Do list that I estimate I’ll be able to complete before the first deadline.

And there you go. My motivation has returned; I’ve already completed some of the missing features. So we’ll see soon enough if Caveman Sim answers the do-or-die question of game development: Is It Fun?

More Locations Update

Update notes:

Added the rest of the locations (with placeholder graphics). More events, including one event that won’t reappear if you choose the wrong option. Extinction is tough, yo. Also added snazzy floating numbers for event rewards. Neat!

Play it here!

Act of Balancing

The problem: how do I know how much stuff to give the player? And by stuff, I mean inventory, specifically food, wood, stone, etc. So far I’ve been using a 0-100 scale, where 10 is a little, and 100 is a ton. But this doesn’t scale. If we want the player to be challenged in year 10 just as they were in year 1, how much do we give them?!

Luckily, I have Balancing Equipment for Math-hating Game Designers bookmarked. The author has an awesome spreadsheet to download, letting you plug your own numbers in and getting the data you want.

First thing I did was decide what the final year’s tribe count should be. I chose 1,000  members. That seems like a lot of people to govern, especially for a primitive caveman. Using a exponential curve (exponential because the more people there are, the more babies they’re gonna have), I fiddled with the spreadsheet until I had an equation that started from ~5 and went to ~1000 in ten steps. Perfect!


y = x^2.8809

Next, I needed to figure out how many days the game would take. I want Winter to be a separate phase. If one phase is, let’s say, 30 days, and Winter is one quarter of the year, the full year would be 120 days. Note: 90 days of playtime seems like a slog to go through, especially when you times it by ten years, but we’ll stick with it for now.

If we assume each tribe member consumes 10 food a day, 7 tribe members consume 8,400 (7 * 10 * 120) food a year. We can use this equation throughout the game, since food scales with population; the more people there are, the more food they’re gonna eat. So in year 10, the tribe will consume 1,200,000 (1,000 * 10 * 120) food for the year. That’s a lot of food!

Unlike food, I didn’t want wood to scale directly with tribe count. There should be some sort of economies of scale. Using the spreadsheet’s logistic function, I capped wood consumption to 50,000 wood per year..



All of this amounts to what the tribe needs for survival. What about when purchasing technologies? They should cost something, right? I figured if it takes 3,000 wood to survive the year, the player should try to save half that for tech, or 1,500. That means the total yearly wood goal is 4,500. I used the same costs for stone, but doubled the food requirements since there are two locales in which to get food (meat and fish).

Assuming the year is 120 days, with 90 days of playable time (reserving 30 for winter), in the first year the player needs to find on average 128 food per day, 52 wood per day, and 17 stone per day.


Final figures

Assuming the player visits all four locales evenly (meaning each locale should give the player four times the average amount), so 256 meat, 256 fish, 208 wood, and 68 stone per visit. Now assume 12 hours of harvesting, and we get, on average, 21 meat, 21 fish, 17 wood, and 6 stone per hour. In year 10, it would be 2,313 meat, 2,313 fish, 275 wood, and 92 stone per hour. That’s a ton. Hope the caveman is up to the task!

Now that we have target resources per hour, we can start writing in sensible resource rewards! We did it!

‘Nother Week ‘Nother Build

This weeks build brings you: Sun! Watch the sun move across the sky as you work through the day. Behold the changes in color as it rises and sets each day. Witness its…actually, I think that’s it.


This build also includes a Main Menu at the beginning, more tech and event sounds, inventory totals, a toggle-able debug mode, and a heckuva lot more events.

Play it here!

Game Update: Tech Tree and Sounds

In this update, we’ve added sounds when finding new locations via the Explore button, and the tech tree now looks and behaves like the real thing!


Fully unlocked tech tree. Most icons are placeholder grass skirts. That’s a LOT OF SKIRTS.

There’s a bunch of new events to find. Or rather, ideas for events. Instead of writing out fully fleshed-out stories and choices, which would take forever, we added a lot of one-sentence story prompts. All those Creative Writing classes finally being put to good use. All locations except the cave and quarry should have them.

Just realized you can’t see your inventory when the debugger is off. I’m gonna have to add a placeholder inventory screen in the next update. In fact, there’s a few things I left in because of debugging (such as techs no longer having to require multiple hours). I have to get better when making builds.

I’ve started to make a list of assets we need (sounds, music, and graphics). Louis and Vince are getting antsy, eager to make some more content. I’ve had them on the back-burner for awhile now while I got a solid code base working. We’ve been talking about adding animations… Exciting times!

Check out the newest build here!