Devlog #1 - Pathfinding [English]
First version of the Pathfinding System!
It took me a while, and it's far from being finished, but I feel that it's a good initial attempt.
While building this functionality, I tried to learn and apply two things: Custom Editors and Automated Testing
In addition to having fun and learning, I want to use this project to share with anyone who is interested the things I have been learning in the process. So, let´s begin:
Custom Editors
The tool I'm working on is designed to simplify the process of developing adventure games. Consequently, I'll need to create a variety of tools to achieve this goal. While researching how to get started, I discovered that Unity has developed a package called UI Toolkit. This package includes an editor that allows you to design the UI by dragging and dropping UI elements (WYSIWYG). Additionally, you can create your own UXML files to build the UI. What's particularly appealing about the UI Toolkit is that it allows you to separate behavior from the look and feel by writing UI styles in a USS file. If you come from a web development background, this should feel somewhat familiar.
Unfortunately, the UI Toolkit is not currently configured for use in custom Unity package development. (If you're aware of a solution to address this issue, I'd greatly appreciate your insights.) As a result, I've been building the editors programmatically.
So far, the editor is relatively straightforward. You can define the walkable area using a PolygonCollider2D. At the moment, it allows you to create only one area and doesn't support defining holes within it

The editor includes a button to "bake" the walkable area.

Under the hood it creates a graph which is stored in a Scriptable Object. The its used later by the pathfinding algorithm.
Automated Testing
In my regular job as a developer, I write a lot of automated tests. I usually follow Test-Driven Development (TDD), which means I write a test before writing any actual code. But this video game development world is completely new to me, so writing tests is quite a challenge, yet absolutely necessary.
These are all the test I wrote at the moment:
I wrote two types of tests: unit tests and functional tests.
Regarding the latter, I'm testing two scenarios: one where the user clicks inside the area, and another when they click outside the area.

After the tests finish, I capture a screenshot. This helps me identify the path the agent took in case the test fails.


I won't dive into technical details here, but if anyone's interested, I'd be happy to write another blog on this topic.
Simple Adventure Maker
Simple Adventure Maker (or SAM) is an Unity tool for creating your own 2D point-and-click adventures
| Status | In development |
| Category | Tool |
| Author | algiorgi |
| Tags | Asset Pack, Point & Click, tool, Unity |
More posts
- Devlog #1 - Pathfinding [Spanish]Oct 18, 2023
- Devlog #0 [English]Jun 20, 2023
- Devlog #0 [Spanish]Jun 20, 2023
Leave a comment
Log in with itch.io to leave a comment.