# april 2020: will patrols ever work?

may 1, 2021
#diary

### thursday, april 1 - April Fool's Day

- I got gnomed by my group leader, and FlightRising's rotated dragons made me think my graphics card was broken. I am the April Fool this year.
- To be fair, my graphics card did spark yesterday. It was scary.

### friday, april 2

- maintained blessfrey.me. I like my website and it's starting to get a nice amount of content on it. I should do a graphics update sometime and make the diary + diary snippets pretty. I should at least choose my own color scheme instead of continuing to use the first scheme Coolors gave me.
- refactored AI and character movement.
- Before, moving in a direction (like WASD movement) and moving to a point (like point and click) were completely separate systems. I brought them together as one system. This is necessary if I want to be able to modify character vectors through status effects, but it's also easier to maintain.
- I had several ways to initiate different phases of movement scattered throughout the program. I brought them together with an entry point.

### wednesday, april 7

- Added handlers. The character shouldn't be its own handler because a handler can only handle one thing. I don't view this as an issue to correct, so instead the AI generates a handler to interpret the results of its attempts to move. Since NPCs use state machines as AI, they will do this during setup upon entering the Movement state and free them upon exiting.
- Added support for speed and velocity modifiers.

### thursday, april 8

- Refactored pathfinding.

### friday, april 9

- Utter confusion over Slime Patrol begins. The slime won't move no matter what. I didn't spot the issue that prevented slime move-to-point until the very end of the month, which is frustrating but led to catching and fixing tons of potential issues in movement and related systems. It also got me to clean up the pathfinding debugger and make its output more detailed.
- Of course I end up spending way more time than expected on the final update before my first release version...Can't wait to have something up, even if it will be really bare bones! Once slime patrol works, movement is refactored, Bingo's tossed back in, and any noticeable issues are ironed out, I'll ship an HTML5 version to embed on my website.

### saturday, april 10

- Refactoring and debugging...Broke WASD movement and fixed it.

### sunday, april 11

- Refactoring and debugging...Broke mouse movement and fixed it.

### monday, april 12

- Refactoring and debugging...Slime moves in the wrong direction for an indisernible reason. Massively simplified how the slime identifies the order in which patrol points should be followed.

### tuesday, april 13

- I've been writing and drawing more lately.
- I feel more comfortable defining the mayor's character now, which is great because she's a major antagonist. She's supposed to be somewhat close in age and maturity to the teen protagonists, despite being in control of a city. I like the idea of a manchild leader with a powerful artifact. Since I'm not necessarily comfortable with writing conflicts between her and the main characters as life-or-death maximum evil encounters, I've been coming up with other stakes for the cast. It's more like petty maximum evil encounters.
- She's always been "the mayor" lol. I finally have an idea what her name should be. Since the player's default name is Helia (a sunny name), the mayor will be given a moon name in contrast. Celeste and Selene feel overused in fantasy, and Liviana is too strongly associated with Magic: The Gathering for me. I was considering Chandra, Lunette, Charon, Dione, Liviana, and Mona...Do you think Chandra is too Hindi? For me, it has a strong local association with the Chandra space mission which is local to the setting + it's similar to the boomer name Shondra.

### wednesday, april 14

- I'm partially vaccinated against COVID now. It hurts...

### friday, april 16

- I was stuck in Sender Station in Anachronox for a while and finally got to Sunder. Finally! Progress in something!
- The slime moves in a different direction depending on where it spawned.

### saturday, april 17

- Refactoring and debugging...

### sunday, april 18

- The first major problem is found, although correcting it doesn't change the slime's bizarre behavior yet. I was declaring that the slime reached a waypoint when it merely reached a dot.
- In Blessfrey, pathfinding is made from a discrete line of "dots" and "waypoints." Waypoints are goal destinations, including waypoints along a patrol route and the global mouse position where the player point and clicked. Dots are the AI-determined positions inbetween the character and the next waypoint.
- Refactoring and debugging...Make sure all entities are at position 0,0.

### wednesday, april 21

- The player and NPCs need specialized movement handlers, so I create an Events plugin for Godot as a base movement handler. This allows me to fix player click-to-move, which was broken again. The individualized slime movement handler brings out the slime's first intended behavior! Even though he is moving in the wrong direction, he is selecting the nearest waypoint then cycling through them in order.

### thursday, april 22

- I've been playing Just Dance 4 every day since my arm recovered from the vaccine. I plateaued for a long time with it and am finally making progress. Selfish & Beautiful Girl came up in autoplay and it always sets me off on a Just Dance craze when that happens. I wish Dance Corporation was real so so so bad.
- I determine the slime is patrolling as intended, but his first dot is always 51, -13 even though it's way out of the way. Since that's imbedded in a wall, he never reaches it and never continues his patrol.
- Modifying the position of the slime's spawnpoint sometimes changes the first destination. Modifying the shape of the room's navigation also changes the first destination. I don't see any pattern.
- Debugging and refactoring...

### friday, april 23

- How did Just Dance released Big Bang songs without me hearing about it? Not only Big Bang, but also G-Dragon's solo career. Amazing!!! Fantastic Baby is Japanese only. I thought the Wii was region-free, but apparently not...Guess I'm stuck to playing 'pretend Just Dance' with Youtube recordings lol. But Bang Bang Bang got a real American release for 2019 that I will definitely investigate.
- There are two entry points for movement: move_to_position and move_to_object. I decide to make move_to_object the only entrypoint. This means a waypoint is generated at the position the player wants to move to. This allows for player movement to be more similar to character patrol movement, and it opens up the possibility of allowing the player to select multiple movement points or to draw his own patrol route.
- Debugging and refactoring...

### saturday, april 24

- Breakthroughs all around. I've been developing a quinoa recipe for years and finally used molasses. Molasses isn't really sweet but has more of that robust, almost spicy flavor that is the key to my vision. I tried with brown sugar before, but it mostly just makes quinoa taste sweet which I dislike. For two people I cook 2/3 c soaked quinoa (remove the frothy saponins), 4/3 c water, 1 tsp onion powder, 1 tsp garlic powder, 1/4 tsp salt, 1 tbsp squeezed lemon juice (no seeds), 1 tbsp olive oil, between 1/2 and 1 tbsp molasses, some lemon pulp, and four halved kalamata olives together in an uncovered saucepan. For molasses, 1/2 is too mellow and sweet, while 1 tbsp is strong and spicy but still good. Stir occasionally. After most of the water is boiled away, cover and steam the quinoa at reduced heat. Before serving, mix in mint and chives. It goes really well with tomatos, cucumbers, and spinach, but any vegetables will do. Finally, the taste I envisioned in my head! I'm still tweaking the proportions, but those are definitely the right ingredients. If only kitty didn't force me to give up my chive and mint garden. That would have been even better.
- The flavor's supposed to be reminiscent of how I used to prepare Near East's Rosemary & Olive Oil Quinoa & Brown Rice blend. It got bland with the recipe change a while back, then a few years ago, stores stopped carrying it at all. It was the only box food I ever liked, though, and I've never stopped trying to recreate it. (Even though my version doesn't have rosemary, brown rice, or pretty much any of the same ingredients and tastes completely differently but whatever lol.)
- The player character is the original character, and the slime was modified from that base. Apparently it had a camera. I reordered the spawn order of the characters, which caused the viewport to follow the slime instead of the player character. It looks like the first camera in the tree is the active one.
- I write some story for the Abyss and the Slime Kingdom, but it's not very interesting or funny. At least if I write a lot, I can be choosy and only take the few best events.

### sunday, april 25

- I fixed it. It's not the best fix, but I understand the problem. The slime finally patrols perfectly, no hiccups or unexpected behavior. If the player interrupts him, he can return to the patrol route and resume patrolling.
- The problem has to do with initialization. Apparently, the slime's initial global position is 0,0 before it is set to it's spawner's location.
- In pathfinding, the first dot is always the character's current global position (the starting point). If pathfinding is performed during this split-second, it will set the starting point as near the origin as possible. The room's navigation polygon didn't always contain the origin and I guess it wasn't always formed correctly, so that's why 51, -13 and points to the left, right, top, and bottom where being set as the first dot.
- The pathfinding should take place after everything is ready. I couldn't find the proper order to make this happen naturally. Even with the AI's setup dead last, the global position was not yet set. Delaying the first state transition with a .1 timer does the trick.
- The slime spawner sets the slime's global position during its _ready method. Since it's at the top of the tree, I think all the children have to complete their _ready methods before the global position will be set. A major part of the last character refactor was differentiating between logic that should be called at ready in an arbitrary order and logic that should be called in a separate setup method in a controlled order. To really correct this problem, I'll have to do something similar across all game objects so that the room can be set up before the slime is set up.
- More refactoring and debugging so everything's clean and pretty.

### monday, april 26

- Now time to make sure all movement uses the new system. Move_to_skill_target, move_to_item, and move_to_target were all handled separately.
- The first thing I'd like to tackle is moving to a moving target. I draw diagrams and decide that having move_to_object only consider waypoints may be inferior to also taking targets. Setting the target as the next waypoint allows the player to tab through other targets without interrupting autopathing. Also, tracking movement is probably a job once again for the Knowledge Base and event handlers.

### friday, april 30

- Website maintenance day. I'm starting to wonder if anyone reads this? I don't share links, but it's probably somewhere in Google by now. Especially since I write about Godot Engine some, and that's definitely a topic not a ton of people write about. To see visitors, you need to use trackers, though, and the big ones are overly invasive and by companies I don't particularly like. Maybe I'll have to do some research and see what's available.
- It's kind of annoying that the server is in almost a day ahead since it's in a different country. I should change the time zone to match mine sometime. I know it's online, so people in every time zone can read it if they want, but it sure makes predicting articles releases more confusing for me.

Last Updated: June 6, 2021