In my original plans, yesterday I also would have implemented a ranged attack, but the locomotion refinement took more time than expected.
I could do it now, but I think it's better to stick to my original plan, and start working on enemies.
After all, having something to hit will be needed to test the ranged attack when I get to it.
For starters, let's create a prefab from the "hittable" purple sphere added a few days ago.
That's going to become our basic enemy.
What minimal set of features do I need to add to it?
An enemy must be able to
be spawned
let's say… on a random platform
be destroyed
for now, with a single hit by the player
move around and attack the player
for starters, going towards them and applying some kind of damage when colliding with it
All three points, of course, will need successive iterations with more sophisticated behaviours, but we gotta start somewhere.
For the creation and destruction, I added a couple of super-simple procedural animations of the sphere scale.
The spawn uses a classic springy "pop" scaling from invisible to normal scale, while for the destruction a quick ease out to twice the normal scale, followed by a sharp disappearance, which works pretty well as explosion (together with the collision wave we already did). Not so bad for a placeholder in a prototype, IMHO.
What about the movement and attack?
I implemented a simple seeking behaviour towards the player, so the enemy tries to catch you but has limited steering capabilities, which makes it a little more interesting.
If you are not familiar with autonomous agents behaviour, you can start reading about it in The Nature Of Code.
To make it a bit more visually interesting, I also applied to the spheres the wobbling behaviour I already had used on the weapon, adding a randomized start so that the enemy balls do not wobble in a synchronous manner.
Just to see what happened, I configured a threshold so that to pop a sphere you need to really hit it and not gently touch it...
It's very simple things, but adjusting few parameters (steering, maximum speed, minimal hit strength needed for destruction) I could get different some quite different enemies.
Time for a little gameplay montage:
Things are starting to get interesting: this testing session definitely involved some sweating, but well worth it.
Just a quick note before calling it a day: until now, I have coded myself the little gameplay physics I wanted, and I'd like to keep it that way.
There's often too much physics in games that don't need it, and that often introduces all kinds of glitches and, sometimes, performance problems.
The core design idea of Particular Reality is building a game which brings you into a different kind of reality, not trying to simulate the "real" reality. So, I can design the physics of the world guided by the gameplay, keeping it simple and stable. Gameplay is king!
With the end of today, I'm exactly halfway the time I have allocated myself to build this prototype.
And I'm glad to say that, after putting in these enemies, it starts to resemble a game!
What's next? So many things.
For starters, the enemies don't damage the player, which definitely needs to be addressed.
Additionally, I'd like to add in that ranged attack I have postponed.
Well, let's see how things shape up tomorrow!