March Updates, Object Pools, AI, Hamsters

Hello humans. Here’s an update.

Recycling

I knew I needed to add this at some point so I went ahead and did it. This enables the game to recycle objects instead of constantly buying new ones and then throwing them away right after. This means better performance during game play. People often call this “object pooling” but I decided just now that I’ll call it recycling. So if an enemy is shooting a ton of bullets the game will only create enough as it needs to show them all on screen at once. As soon as a bullet isn’t needed anymore (it hits a wall or flies to far away), it will be hidden (not destroyed) and prepared to be shot out of the gun again.

AI System Update

I coded another enemy using the AI system I wrote the other month. This is the illustrious Whicket. They’re a tribe of sassy tree folk who live in the swamp. They wear tastefully carved masks. Well it’s more of a hollowed out log that they wear, over their whole body. Anyway those little red berry bullets are recycled. That little bit of spit that flies out the end of its blowgun is recycled. That’s cool right.

whicket-3.gif

I ended up making some big simplifications to the AI system that also make it more flexible. Pretty happy about it. Below is a shot of the colliders used to trigger different behaviors. The box in front is the “Ima shoot at you” box and the one behind is the “did I just hear something behind me box?”. These colliders are references by “ObjectDetected” scripts that are used to transition states. I call a state a “conduct” in code. State = behavior = conduct.

whicket-triggers.PNG

And here’s a shot of the prefab hierarchy for this little guy.

whicket-prefab.PNG

As you can see I’ve decided to be pretty liberal with my use of game objects as organizational tools. Some of this hierarchy is required by design, but other parts are strictly for the human (me) who’s trying to keep everything understandable (by me). The ShootAttackZone and InvestigateZone are game objects that host the colliders mentioned above.

The Conducts object and its children represent the brain of the enemy. The ConductController component, which is hosted in the Conducts object, makes sure the correct conduct object is enabled and all others are disabled. Here you can see the Wander, ShootAttack, and Stunned conducts. Let me grab a screenshot of the Wander object for you.

wander-object.PNG

There it is. So this ^ is a Conduct object. When this conduct becomes the active one, an animator trigger is set to start the walk animation, the “simple walk behavior” is started, and a conduct transition is enable called ChangeConductOnObjectDetected. You just give this transition the a collider, a layermask, and a target conduct to transition to. We add a separate transition that checks the InvestigateZone and that will target the Investigate conduct (that’s not on this object for now).

Anyway I plan on putting this code up on GitHub in case anyone is interested in it. I want to make a more detailed post about this later.

Sounds, Music, FMOD

Zach, the composer for Glace, is building up his refreshed versions of the music tracks. They sound great of course. You’ll definitely recognize the music. It hasn’t changed such that you’ll miss the original tracks. These are the same songs but with extra polish and some more variation.

We’re giving FMOD a shot. Haven’t integrated it into Unity yet but I’m looking forward to it. I also grabbed a really great sound effects pack that will fit in great with the game.

Other Things

The overworld and stages are on speaking terms now. You can exit a level at a gate stone and appear at a specific place on the overworld. You can go to a landmark on the overworld map and enter the stage for it and appear at the right place in the stage. I’m happy with how it’s turning out but lots more work to do. I’m working on a smarter camera and an improved background system with parallax features and what not.

I’m mostly just really excited to show you this game. I think you’re going to love it. More updates to come.