Tuesday, January 24, 2017

(Hopefully) Quick Break

Hey guys. So I've been more sick than usual lately. I'm going to take a coding break until I start feeling better.

It's frustrating, because from just after Christmas to the first week in January, I'd really felt better. I'd gotten out of the house for short bursts. I had coffee in a coffee shop...

Then the day before yesterday I could barely walk ten feet without collapsing like an aluminum folding chair. Normal blood pressure, but growing faint even laying down with my head up. I saw the neurologist, decided to stop taking one of my drugs that had changed lately, and the symptoms went down... but even now today, I don't trust myself to walk across the apartment without needing to stop and rest. ... So, so frustrating. To have your world limited to your bed and what's in arms reach; to know that everything's filthy outside the bedroom because you don't have the strength to clean, to read news on the internet as if the universe outside is on fire...

So, yeah. That's my week.

I'll put up neat things when I'm a little more alive. :)

Tuesday, January 17, 2017

Okay, I Lied

I promise, I'm refactoring. Really.

Only, I like to refactor by starting with a clean, empty project and carefully moving the good, important parts over. It's a nice way to focus on the big picture. But after playing some Rimworld and thinking about gameplay, I realized I ought to have had my task system as the central pillar to everything I'm doing.

So, now I'm in a mostly empty project, working on how tasks are assigned-- from the UI, from the main buttons, to object oriented tasks versus component tasks. I've mocked up some UIs-- any feedback on these would be lovely. :)

The Wireframe

The Menu
I do feel like I'm ripping off Rimworld a bit, but after several drafts and sketches and brainstorming I've decided that I just can't think of a better way to do it. So... sorry, Tynan? You made awesome stuff.

Sunday, January 15, 2017

Announcement: Time for a Code Refactor

Hey everyone! This is just to let you guys know that progress will be paused on the game for a bit while I go back and refactor old code.

For those of you who aren't programmers, refactoring is a good thing. Taking the time to go back and organize my approach and get rid of unused first-attempt functions can save me a lot of pain down the road. Think of it as a workshop deep-clean.

Deep cleaning, however, doesn't have a lot of exciting pictures to show off, so the blog will probably be pretty quiet. Come back next week, and I'm sure I'll have more progress screen shots for you all.


Saturday, January 14, 2017

Character Ethnotypes and Names

At the beginning of The Last Score, the player will start with twenty randomly generated characters from all over the world, and I wanted their looks and names to reflect that. Right now my code only has a handful of names in a handful of languages to draw from, with coordinating skin and hair color ranges.

In time I'd like to have a range of eyes, mouths, noses, hair types, face shapes, and be able to track genetic heritage as the generations progress. But this is a start.

(Also, the portraits are temporary things. Need to put hair in.)

Friday, January 13, 2017

Circle of Life: Game Edition

As of the last couple of weeks, my migraine's been getting better. No more getting fish hooks through my temporal lobe! Rejoice!

Unfortunately, this doesn't quite get me out of the woods yet; I've been on quite a few rather heavy-duty drugs for months now, and these last few days have been very hard because drug withdrawal while tapering the dosage is a very real, very nasty thing. I've barely been able to move these last few days. Brushing my teeth has been exhausting. My brain's been in a 'ugh can't think' fog for days.

So, coding hasn't been an option. But I did manage to do some pixel art in the meantime, and I've rather proud of the result. Here's the pixel babies (mine), and the recolored adults (originals done by Redshrike) and children (originals done by kheftel).

Tuesday, January 10, 2017

A break from the job system: Characters!

I've got plenty more work on assigning the characters tasks, but I'm taking a break today to code something more fun-- characters!

I'm fairly decent at realism with character portraits myself, but as much as I tried to make my own art work, I couldn't get anything congruent with the retro style. Since I'm going to want to stack features to get a wide range of different looks, I decided that the solution to this problem was proper pixel artists. Specifically, doll-makers.

Modified from these portrait bases.
I've been corresponding with JuliePM about using her work; this stuff is the free, temporary non-commercial placeholder. I've modified it a bit, but the real art will be commissioned later. Still, not bad for a temporary piece?

Also, Julie has an art blog. Go look at it. :)

Sunday, January 8, 2017

Animation Copies!

Dear Unity Engine,

You can't copy one animator onto a new sprite sheet? Really? ... Which the utmost respect, what the hell is wrong with you?

So, this is something I've been facing (and avoiding) for the last month or two: I have a ton of identical sprite sheets for different skin colors, hair colors, hair styles, different clothes. Each one has several different animations (idle, walk, cast spell, stab, thrust, shoot bow, die/hurt), and each one of those have four directions they could be facing, not to mention different sprite sheets for men, women, and children. So, assuming two hairstyles in four colors, five skin colors, two possible outfits... we're already looking at 2240 animations, not counting the children's walk cycle and hair and such (2 * 4 * 5 * 2 * 7 * 2 * 2).

2240 is not a nice number. Even though it only takes me about thirty seconds to set up each animation's Animator, that's still nearly 19 hours of animation prep. No. Uh uh. I refuse.

So every few days, I've been thinking that maybe, if I could just figure out how to phrase this problem in google, I could get a magic shortcut from some clever person who's come before me. Duplicating animations / animators is a waste of time, since the new animators point to the old animations, and it takes nearly as long to reset them all. Using an Animator Override still requires you to define each animation for each item. I needed a way to define it once and move on.

... So, it turns out that Unity doesn't support 2d Animator duplication (which is a huge oversight, in my opinion). BUT, there is a hacky workaround: a script on each animated character that replaces the default sprite with the correct one. ... Which is a bit of a memory/CPU hog and probably shouldn't be used for smartphone games, but it works.

I modified this code from a Unity conference video on workarounds for common 2d problems. Just in case anyone's struggling with the same thing.

using UnityEngine;
using System.Collections.Generic;

public class ReskinAnimation : MonoBehaviour {

public string spriteSheetName;
SpriteRenderer spriteRenderer;
Dictionary<string, Sprite> sprites;

void Start() {
sprites = new Dictionary<string, Sprite>();
this.spriteRenderer = this.GetComponent<SpriteRenderer>();
Sprite[] spriteList = Resources.LoadAll<Sprite>("Humans/" + spriteSheetName);

foreach(Sprite sprite in spriteList) {
this.sprites.Add(sprite.name, sprite);

void LateUpdate() {
string spriteName = spriteRenderer.sprite.name;

Sprite newSprite = null;
if (sprites.ContainsKey(spriteName)) {
newSprite = sprites[spriteName];
} else {
Debug.Log("Sprite not found: " + spriteName);

if (newSprite != null) {
spriteRenderer.sprite = newSprite;

Saturday, January 7, 2017

State of the Game

A very basic job system has been implemented! The test character can now:

  • walk to specified points (using the correct walking animations)
  • navigate around obstacles
  • go to bed
  • chop down trees
I've a few bugs to deal with on the last point because I reworked some code away from my original design, but that shouldn't take long. Harvesting a crop and eating a food item come next, and both will be easy and in quickly.

I've also implemented a test scene to quickly try out all these basics.

Test Scene Setup

I'm starting to really want a good code refactor, but I'm going to try to wait until I've finished with my goal list first.

Next up: character inventory, hauling to the stockpile, personal job queue and general public job assignments, character needs (food, rest) and character needs UI, building objects.

We're not out of the woods yet, but we're getting there. :)

Wednesday, January 4, 2017

Bug of the Day: Man Becomes Nudist When Facing West

... Because somehow, that makes sense. :pokes game engine with a stick:

(Still doing task-assignment stuff.)

Edit: Bug fixed. Have a video of it anyway. :)

Monday, January 2, 2017

In Which Everything Is Connected

I've been working on jobs, as promised.

Except... those jobs need to be connected to working, functional, responsive humans. Who need orders from the user interface. The placeholder human class was a cluttered, ugly mess of brainstormed wish-wash, and...

Well, it's been a bit slow-going because I went back and rewrote it all. On the plus side, I've neatly organized my humans into distinct pieces that will make them much easier to deal with.

In the absence of exciting 'this is done' announcements, have some slightly dishonest (Photoshop-ed) screenshots. I painted his eyes shut and added the speech bubble manually.

But, it will be a reality! Soon!