Post news Report RSS Stairs, ledges, and AI companions

This past week I've been working on some new ways to get around the levels, such as climbing stairs and jumping off ledges, as well as the systems which deal with AI-controlled NPC companions.

Posted by on

Ledges, puddles, and stairs

Despite the gameplay mostly taking place on a "single plane", you will occasionally encounter elevated platforms or small height drops. Their goal is not to add verticality to the gameplay, but rather to provide "one-way passages" (you can jump down, but not climb back up) and branching paths, as well as providing focus on important items (for example a weapon or keycard could be placed on an elevated platform, coupled with smart lighting to draw attention to it).

For backers who intend to get into modding: ledges are tagged directly in the tileset, so once you have setup your tileset there is no need to manually tag every possible ledge in the entire level :)

The same trick is used to tag things like puddles, which should produce little splashes of water when stepped into:

On the last gif you can catch a glimpse of more collision masks on the right wall. Each color used in the collision mask has a specific meaning, not just "this is a wall, you can't get through", but also things like ledges, puddles, stairs, and much more. When combining each color's three channels (red, green, and blue), this system can be used to convey a lot of information.

For example a mask color with a RED value of 1 means the tile is "stairs", while the value in the GREEN channel will indicate in which direction the stairs are facing. This makes it easy to alter the character movement to give the impression of the character climbing up or down the stairs (if the character kept moving in a straight line when going over stairs it would look very wrong of course).

Another way we use the "collision color" is to automatically tag "underwater tiles" which require altering the character sprites to make it look like they are semi-submerged. Here you can see both stairs and "underwater tiles" in the collision mask (notice how the character moves up and down the stairs, even though all I'm pressing is left and right to move around):

AI Companions

The other big feature of the past ten days or so are the systems supporting "AI companions". In other words, the ability for NPCs to follow you around (without getting in the way), pick up items (and equip them in the case of weapons), and of course engage enemies!

Each AI companion's behavior is determined by four "stats":

- Aggressiveness : this stat determines how willing the NPC is to engage targets

- Fear : this stat determines how afraid the NPC currently is, and is influenced by the number of enemies present on the screen and how much health the NPC has left

- Greed : this stat determines how willing the NPC is to go out of his way to collect loot or weapons, and how willing he is to share health and ammo packs with you

- Loyalty : this stat determines how likely the NPC is to abandon you when things turn sour

Each AI companion has essentially 4 main states : following you around, fighting enemies, collecting items, and running away.

When the time comes to make a decision on what to do next, each state is attributed a weight based on the current situation: for example having a lot of loot around will give weight to the "collect items" state, while having a lot of enemies on the screen will give weight to the "fighting" state, and so on.

These weights are then multiplied by each NPC's unique profile: for example a greedy NPC will have a big "greed multiplier" resulting in a disproportionate weight in the "collect items" state compared to an NPC with a low "greed" stat.

Multipliers can also be negative, for example a high "loyalty" stat will reduce the weight of the "run away" state, resulting in NPCs which will potentially fight to the death rather than abandon you.

Of course friendly fire is on with AI companions, so nothing is stopping you from shooting deserters ^_^'

Here I am playing as the Don, while the Beggar is controlled by the AI:

Cheers and have a great Sunday everybody!

Marco / benitosub

Post comment Comments
drjd24
drjd24 - - 299 comments

So the ledges are like the ones in Pokemon? (forgive my ignorance if that's not what you were trying to go on)

ALSO! i love the loyalty factor. Even the best get going when the going gets hard :)

Reply Good karma Bad karma+2 votes
benitosub Author
benitosub - - 136 comments

Here comes the awkward moment where I'm forced to admit I've never played a Pokemon game ^_^'

Reply Good karma+3 votes
TheUnbeholden
TheUnbeholden - - 3,605 comments

Wow, never seen AI have such well appropriate stats for interactions you'd expect to happen in real life.

Reply Good karma Bad karma+4 votes
benitosub Author
benitosub - - 136 comments

Thanks :) The idea is to focus on the kind of interactions that will take place, no need for an AI with super advanced flanking tactics if it will never get a chance to use it ;)

Reply Good karma+1 vote
Sph!nx
Sph!nx - - 722 comments

Awesome update!

Reply Good karma Bad karma+1 vote
benitosub Author
benitosub - - 136 comments

Thanks!

Reply Good karma+1 vote
booman
booman - - 3,651 comments

Thanks for the update. Love the companions capability! Its always nice to explore with someone helping you, specially NPC's

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: