DevLog: Navigating Complex Structures


Hey folks,

I hope you had a great start into the new year! After a few days off, I committed myself to some interesting problems that came up while working on the new base building system, which I'd like to share with you.

BattleJuice Alchemist is mainly played in top-down view, so it is more difficult to deal with buildings, especially multistory ones than let's say in an FPS game. Our game has to set elements invisible in a clever way, here is how we handle it:


Now that base building comes into play, I did not want a floor/story based system, but one that provides more freedom for players who want to create things like this:


The solution is quite simple: blocks that are at a certain height above the player and obstructing vision on the player are turned transparent. But there is another problem to tackle that is related to movement. The common way to move in BattleJuice Alchemist is "mouse click to move", no problem here. But you can also move with direct input keys such as WASD. All movement takes place on a navigation mesh, which can pose a problem.


So with the possibility for all kind of weird structures that players can come up with, we can't simply move right, when the player presses the key for moving right. I came up with a solution that takes into consideration the angle between the player's current and target location, but also the ratio between linear distance and navigation path length. When pressing right, it is desirable that your character automatically navigates around a pillar instead of bumping into it and stopping, but you would not want the character to walk the way as shown in the right image above.

I hope this small peek into the everyday challenges of development was interesting to you. I'm always open to suggestions of which direction to take with this devlog. If you have ideas or suggestions, you can message me on our Discord.

Thanks for reading and have great weekend!

Alain

Leave a comment

Log in with itch.io to leave a comment.