Archive:
My little hamster wheel has pickups, and spikey things on splines that’ll kill you.
Today I learned: An EnsureMsg
started triggering in debug builds, asserting every time I debugged from Rider. My ARespawnPoint
class (a USceneComponent
), which has two child components – a billboard (icon) and an arrow to let me see player’s re-spawn location and direction in the editor – was causing the issue:
Template Mismatch during attachment. Attaching instanced component to template component.
Confooozed. I’ve not seen this before, and I’ve not touched the code in ARespawnPoint
since I wrote it. But, after a bit of digging, it started to make some sense. I was setting up the attachment for the child components in the constructor, which gets the Class Default Object
, not the instance. And worse, I was attaching them to the root of the parent, not the instance of ARespawnPoint
. Derp, and chalk up another “why did this ever work!” bug. (And I’m 100% sure I’ve made this mistake elsewhere… 😑)
Why did it pop up now? I have no idea. But, it’s fixed, and every day’s a school day.
Not my brightest day. I’ve been making a room that rotates around a central origin. The walls need to do a quick Dot Product against the camera, so the back facing walls can fade out. All things I’ve done before, but surprise(!) things didn’t work the first time, and it took me far too long to work out why. Short story, the meshes I exported for the wall pieces didn’t share the same rotation, so when I was rotating the Blueprint Actors into place, I was lining things up visually, not looking at the actor’s rotation. Cue half the morning stepping through code, scratching my head... As soon as I dropped an ArrowComponent
into the actor, the derp was painfully obvious.
Top tip: always add an arrow whenever facing is important. They’re editor-only, and you never know when they’ll save you from yourself. Facepalm
The pickups rotate with the room. I had to go with Predator style ones, in the end, as they’re more fun to collect than when they faded out with the walls.
6/10. Looks alright, feels like filler.
I did a little more work on the Intro sequence, last night. I’ve brought in a Meta Human, and I spent a few hours in the Level Sequencer, messing around with the character’s control rig. The intention was to block things out, then refine, in passes, in my spare time. I was making good progress… in the sequence editor… but when I pressed play, the animation was jittering about all over the place. Er…
I ended up reverting my work (burning an evening), but I think I know why it was jittering. I should have baked what I had to an animation asset, set up the meta human’s animation blueprint, and then used the baked animation asset in the level sequence, rather than keying the control rig. I don’t think control rigs are meant to be animated in that way. (It’s a running Blueprint, so it kinda makes sense that it’ll do stupid things in a level sequence…)
Anyway, lesson learned. I think I’ll duplicate the level sequence, use one copy to animate everything and preview what the Intro’s doing, then bake out the character’s animation as a single asset. I’ll use a duplicate of that at runtime, playing baked animations. That should prevent me from making too many mistakes, or losing all my keys.
–
One of the early rooms in the first game required you to push a button, which turned on some fans, which made some boxes float, that you could then use to jump across to a door on the far side. For lols, I thought I’d take that a step further:
I’ve used Cube Grid, again, to block out the room (it’s soooo handy), and got a fair chunk going.
Fans have a new option; you can ask them to apply force to the lowest actor, rather than anything and everything that’s over them. (I’m not supporting all directions because I don’t know if I’ll ever need horizontal fans to be blocked by moving objects…) and Push Blocks implement the ForceActorResponder
interface, so fans can talk to them. The blocks themselves have a very simplistic way of rising, literally a lerp to a given height, so I can make it appear as if objects have different weights. I’ll get them to bob up and down slightly, when they’re up there…
Tomorrow I’ll see if I can make the fans clockwork, and get the valve to wind them up. And yeah, there’s stuff to do on the walls that you can’t see. I’ve had a nice idea that I’ll come back to.
Got the screw to unwind itself over time, and the fans are hooked up to it via some Twiddlers
. It’s a nice effect. Added some safety checks to the push blocks, and made sure they’re robust going in and out of the fan’s trigger capsule.
My bright idea, yesterday, was to have a gate baring access to a door, hidden on the far side of the room’s central column. You’d lift the gate up with a well-placed weight, pushed over a fan. I thought, for a change, that I’d make an actual proper physics object for the gate. I try and avoid using actual physics objects as much as possible in my games. They’re often a pain in the arse, and real-world physics tends to feel shit. Unless you’re playing a racing game, or something. So yeah, kinematic all the way. Most of the time.
Anyway, knocked up a model, and set up the mesh with a collider, simulating physics, in the blueprint. Locked its rotation, and X/Y movement – it can only go up – added a collider to catch the push block, and tweaked all the settings for mass, centre of gravity, CCD etc… I push the block over the fan, it pings up, physics does its thing and the gate slides up with it! Yus!
And then I notice: it’s ever so slightly on the wonk. The push block moves down, and the gate gets stuck in the frictionless wall. Or if it does make it all the way down, occasionally jitters on the ground because physics.
And to be even more annoying, it takes ages to fall down, cos, you know, that’s how gravity works! Except I’d made my push blocks fall really quickly, because that looked better.
Nice idea. I’ll make a kinematic one, tomorrow, and lerp it up to match the movement of the push block. (Like I should have done in the first place… F physics).
Edge cases, gorra love ‘em. Today’s:
But it’s all in, including the kinematic gates. The gates are a bit hacky, but I’m not using them again. And it’s a Friday.
I also made some new VFX for the fans – the one from Moonbase were far too faint – then cleaned up the Cube Grid blockout in Blender, unwrapped, and textured it. Only things left to add are some pickups, and the exit.
Friends:
If you like any of my work, please consider checking out some of the fantastic games made by the following super talented people: