Today’s blog post is brought to you by cupcakes and frustration!
So. Another week has passed, and I feel like I have accomplished practically nothing for this game, because naïve, past me decided that programming NPCs would be the next logical step to take. How hard could it be?
Very. As it happens.
If you tuned in on Tuesday, you’ll know that we got part of a system for NPCs up and running. We could set them up to rotate on the spot randomly and non-randomly, and we could tell others to follow a set path using a combination of variables and mover plates. Apart from a few small issues when interacting with the player character, it did what it needed to do. Great.
During the stream, the topic of state machines came up. And despite having a pretty good system already in place, in the back of my mind, I knew this was the kind of thing I should really be looking into. So off I went to do some research.
To begin with, it all seemed to be going swimmingly. I quickly got my spinning NPCs set up, with a random and non-random state, and they both work beautifully. We have one guy who turns 90º every second, and we have a lady who does that wonderful random-as-heck Pokemon style turning. Where, you know, she could be staring at a wall for five minutes before randomly deciding to turn your way, just as you walk by.
I even have some states defined for my walking NPCs. Their movement direction and state are set by an instance variable, which I can configure in the layout, which makes for easy testing. I have two instances of one NPC in the layout, and they move independently of each other when I set their variables. Lovely.
So where is the frustration, I hear you ask? It all sounds brilliant, right?
Ha. Seemingly, every time I try and create the path for my NPCs to follow (using a method proven to work in a separate project), they do something completely different. I won’t bore you with the details now; this is a blog post, not a bug thread. But suffice to say, I got hugely irritated with this whole system.
But. It did remind me (and so did my colleagues) – know your limits.
It’s pointless to keep hammering away at the same issue while frustrated with it. Take a step back, go and do something else and then come back to the problem with a clear head.
You can only produce your best work when you’re at your best, and pounding your head against a (proverbial) brick wall with frustration is hardly your best. A considerable part of any project like this is looking after yourself. After all, the work won’t get done if you’ve driven yourself to madness.
So that’s what I’m doing. I’ve taken a break, written this blog, and enjoyed a cup of tea and a cupcake. My brain has had time to reset, and I feel ready to tackle this problem again. I’ve stripped out my project to the bare essentials that I know work, and now I can focus on building up a new system. (I should probably mention that I’m building this NPC system in a separate project – I didn’t rip up my actual game in my frustration!)
So, to all of you out there working on a project. Look after yourself so that you can look after your masterpiece.