Rift Devlog #3: Tutorial Overhaul

Find the current version here: Itch.io Link

If you find any issues, please report them here: Github Issues Page

What’s New?

A bunch of stuff, not all of I remember. I’ll start tracking my changes better soon, I swear.

If you go to play, you may notice it is currently only available on Windows and not WebGL. I will attempt to look into this soon, there are some strange memory issues that I have to look into further.

This update has an overhaul of a lot of systems, mainly concerning the AI. They have been completely rewritten from the ground up, even the pathfinding has been custom made now. Originally I was using Unity’s NavMesh, as a NavMeshSurface on a rotated cube – this was kind of hacky and continued to give me issues.

Pathfinding

So instead I went ahead and tried to write my own system. Taking some notes from this online solution I went ahead and created my own grid defining it’s size with a custom editor. I’m also updating this grid every partial of a second, this way theoretically AI will avoid each other without steering behaviors. This may result in issues in the future, but I was curious to see how this method works in the future.

Here’s a early GIF from when I had first been making it. It only generates nodes on walkable areas, so I’m not updating more nodes than needed.

After the grid was working (and it went through several other adjustments) I went on to write the A* pathfinding for the enemies. It’s nothing extremely special, it’s pretty much the normal A* with slightly adjustments, such as having enemies ignore the “bad” nodes theyre standing on, so it doesnt attempt to ignore itself. It also tries to align the pathfinding to line of sight, so it doesn’t have enemies walking in weird stair shapes.

I actually went ahead and published what I had to GitHub, and while it’s still a bit messy and could use some improvements, you can take a look at what I did here.

Behavior Tree

Next I had to move on to actually defining the enemies behavior moment to moment. I was a little stumped on this at first, or how to approach it. Originally I started writing a state machine system at first, with support for enums that could be passed in to serve as states and then link to other state machines as sub-state machines.

This seemed to be a bit unwieldy however, and then I was reminded of behavior trees. I was suggested to try out Behavior Designer, a Unity asset. However it’s a very expensive asset, and while it looks very impressive it doesn’t look like it works in the way I expected or wanted for this. So I decided to make my own basic version.

It ended up working extremely well for my purposes. While there are still a few issues and limitations I have to look at solving, it was extremely simple but very powerful and easy to use. All the logic for the Employee AI is in this simple code chunk:

tree = new RepeaterNode(
    new AnyNode(
        //If the employee knows about the players existence
        new SequenceNode(
            new RunNode(HasBeenAlerted),
            new RunNode(SetDestinationToHidingSpot),
            new RunNode(IsPathNull),
            new RunNode(SetNewPath)
        ),
        //Check if the employee sees the player
        new SequenceNode(
            new RunNode(HasNotBeenAlerted),
            new RunNode(CheckIfSeesPlayer),
            new RunNode(SetPathNull)
        ),
        //Idle
        new SequenceNode(
            //If there is no path available continue on
            new RunNode(IsPathNull),
            new WaitDynamicNode(IdleWaitTime),
            new RunNode(ToggleIdleState),
            new RunNode(SetDestination),
            //Create new path
            new RunNode(SetNewPath)
        )
    )
);

I’ve also put this up on Github here.

With this system, I was able to create both the Employee AI and the Security AI pretty easily.

Tutorial

Besides the AI, I also setup what I hope to be a much better tutorial. It’s still by no means perfect, but it’s much more clear than the loose text I had dropped in originally. Unfortunately that means it’s a bit more text heavy. Maybe I’ll be able to come up with a better solution for this in the future, but for now I think it does a good enough job at explaining the features and concepts.

There are two tutorial levels I have completed now, the first explains the actual mechanics and abilities of the player. Teleporting, attacking, slow motion, etc. The second explains the enemy types, primarily the employee and security types. These may be expanded later, specifically the 2nd level explaining enemy types.

Adjustments

  • The swapping mechanic has been returned to how it worked previously. I don’t think doing damage and they swapping was fun or just worked as well. The instant swap makes more sense it seems, it also lets you move employees to a place they can’t alert anyone without killing them.
  • A options menu has been added, with just a couple example menus. Very shortly the controls screen will be swapped in so you can change keybinds.
  • The backend setup for keybinds is setup – will be implemented soon.
  • Dying no longer brings up the end level screen, you’re simply teleported back to the start.
  • Stats such as deaths, and number of enemies killed are now tracked and displayed in the end screen.
  • Levels no longer end from killing all the enemies, but from entering the door (which later should be a elevator.
  • Temp art is less bad temp art – now it’s just super out of place art.
  • Lots and lots of backend adjustments.

To-do:

  • Keybind remapping
  • Stealth mechanics – was thinking about adding shadows, and having them affect how easy you are to see.
  • New AI – Specifically a shield enemy next, that will block teleports and bullets from the front.
  • More levels now that the tutorial levels have been created.
  • Upgrades – To tie into a special enemy type that will allow various upgrades, including abilities that are now locked by default.

Community Showcase

Don’t have anything standout that I was sent. If you try out my game and wanna send photos, videos, gifs, or anything else, feel free to email me at KoseckCory@gmail.com.

Support

Enjoying my game? Want to see development continue? You can contribute in several ways, sending me feedback reports on the Github Issues Page is extremely helpful, both text and videos of gameplay can help me to add to the game. All ideas are welcome! Bugs too, gotta fix those.

If you’re interested in supporting me personally, you can follow me on Twitter or Instagram. If you want to support me financially, I have a Patreon and a Ko-fi.

0 comments on “Rift Devlog #3: Tutorial OverhaulAdd yours →

Leave a Reply

Your email address will not be published. Required fields are marked *