updated diary entries

small-nav
chimchooree 3 years ago
parent 62d81d56ae
commit dba79f113c

@ -1,19 +1,34 @@
<!--210429,210402--> <!--210429,210402-->
<h1>how my characters follow a moving target </h1> <h1>follow a moving target </h1>
june 10, 2021<br> june 10, 2021<br>
#ai #character #movement <br> #ai #character #movement <br>
<br> <br>
After redesigning movement to support <a href="../210429">patrols</a>, I realized the path remains static even if the target moves. Time to tweak the design and debug. <br> After redesigning the movement system to support <a href="../entries/210429">patrols</a>, I realized the path remains static even if the target moves. Time to tweak the design again. <br>
<br> <br>
<h2>what must be done </h2><br> <h2>what must be done </h2><br>
Autopathing to attack targets, skill targets, and item targets still partially rely on an old version of the movement system. Also, characters never update their pathfinding, so they cannot pursue moving targets. With some changes, the movement system can officially support following any of these targets, no matter where they go. <br> Autopathing to attack targets, skill targets, and item targets still partially relies on an old version of the movement system. Also, characters never update their pathfinding, so they cannot pursue moving targets. With some changes, the movement system can officially support following any of these targets, no matter where they go. <br>
<br> <br>
For now, I'll update the movement system so that the character can autopath after a moving item then pick it up once within reach. Since autopathing to items works identically to the others, the fix for them will be the same, too. <br> For now, I'll update the movement system so the character can autopath after a moving item then pick it up once within reach. Since autopathing to items works identically to the others, the fix will be the same, too. <br>
<br> <br>
<h2>upgrading the movement system </h2><br> <h2>upgrading the movement system </h2><br>
I can keep the same system more or less, but one function is going to have to be rewritten: the character's path_to_object method. <br> I can keep the same system more or less, but one function is going to have to be rewritten: the character's path_to_object method. <br>
<br> <br>
Before, it only set the next waypoint and built a path between the character and the waypoint. In order to follow moving targets, it needs to use the goal object itself. Also, it needs to be know when to only rebuild part of the path. <br> Before, it only set the next waypoint and built a path between the character and the waypoint. <br>
<br>
<h3>old path_to_object </h3><br>
<code># Set Dots Between Character + Given Object<br>
func path_to_object(goal):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if goal.is_in_group("waypoint"):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_next(goal)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else: <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;room.add_waypoint(goal.get_gpos())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;path_to_position(goal.get_gpos())<br>
<br>
# Set Dots Between Character + Given Position<br>
func path_to_position(goal_pos):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_dots(find_dots_pos(goal_pos))</code><br>
<br>
In order to follow moving targets, it needs to use the goal object itself. Also, it needs to be know when to only rebuild part of the path. <br>
<br> <br>
<h3>the character receives a waypoint instead of the target, so he is unaware of his target's movement </h3><br> <h3>the character receives a waypoint instead of the target, so he is unaware of his target's movement </h3><br>
It took waypoints instead of the goal in the first place for consistency's sake. Since a target can either be a position (as with click-to-move) or an object (as with autopath-to-item) and the movement system only has one entry point, the old system only accepted objects. So when clicking-to-move, a Position2D waypoint is generated at the global mouse position. <br> It took waypoints instead of the goal in the first place for consistency's sake. Since a target can either be a position (as with click-to-move) or an object (as with autopath-to-item) and the movement system only has one entry point, the old system only accepted objects. So when clicking-to-move, a Position2D waypoint is generated at the global mouse position. <br>
@ -29,23 +44,77 @@ For two, it's bad for performance. Generally, the efficiency of a lightweight Go
<br> <br>
The next playable release after the bingo version will have a teleporting boss, so I'll probably need to be more thoughtful about pathfinding then. For now, though, these two fixes should do it... <br> The next playable release after the bingo version will have a teleporting boss, so I'll probably need to be more thoughtful about pathfinding then. For now, though, these two fixes should do it... <br>
<br> <br>
<h3>new path_to_object </h3><br>
# Set Dots Between Character + Given Object<br>
func path_to_object(goal):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Next Waypoint<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_next(goal)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var goal_pos = goal.get_gpos()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var dots = get_dots()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var cd = get_current_dot()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# If no current dot, set dots between user and goal<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if cd == null:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_dots(find_dots_pos(get_gpos(), goal_pos))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBus.publish("moved", self)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var last_dot = cd if len(dots) == 0 else dots.back()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Make sure goal has moved significantly<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if goal_pos.distance_to(last_dot) <= get_intimate_space():<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# If goal moved further away<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if get_gpos().distance_to(last_dot) > find_distance(goal):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# If no dots, generate new ones<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if len(dots) == 0:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_dots(find_dots_pos(get_gpos(), goal_pos))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBus.publish("moved", self)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# If dots, only recalculate part of the path<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var near = get_dots()[0]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for dot in get_dots():<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if dot.distance_to(goal_pos) < near.distance_to(goal_pos):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;near = dot<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var i = get_dots().find(near)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_dots(get_dots().slice(0, i - 1) +<br> find_dots_pos(get_dots()[i-1], goal_pos))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# If goal moved closer<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_dots(find_dots_pos(last_dot, goal_pos))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBus.publish("moved", self)</code><br>
<br>
<h2>testing </h2><br> <h2>testing </h2><br>
Now let's test it. I don't have any items that move around, so I'll quickly throw that in. I'll add some movement based on a sine wave into the _process method.<br> Now let's test it. I don't have any items that move around, so I'll quickly throw that in. I'll add some movement based on a sine wave into the _process method.<br>
<br> <br>
<code>var time = 0 <code>var time = 0
func _process(delta): func _process(delta):
time += delta &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time += delta
var mod = Vector2(delta, cos(time) * 2) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var mod = Vector2(delta, cos(time) * 2)
set_gpos(get_gpos() + mod)</code><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_gpos(get_gpos() + mod)</code><br>
<br> <br>
<br> <br>
<h3>the character never stops autopathing, even after picking up the item </h3> <h3>the character never stops autopathing, even after picking up the item </h3>
<br> <br>
Okay, one more fix, then I'll have it. <br> Okay, one more fix, then I'll have it. <br>
<br> <br>
Previously, the movement AI relied on conditional statements in its process to detemine arrival at the goal. Instead, the <a href="../210402">achievement system</a> handles arrival for the new movement system. Since the process is called faster than the event handlers can function, the old AI system picked up and queue_free'd the floor item before the new system could recognize it had arrived at the goal. This meant the character never truly arrived and never knew to halt the movement process or clear movement variables. <br> Previously, the movement AI relied on conditional statements in its process to detemine arrival at the goal. Instead, the <a href="../entries/210402">achievement system</a> handles arrival for the new movement system. Since the process is called faster than the event handlers can function, the old AI system picked up and queue_free'd the floor item before the new system could recognize it had arrived at the goal. This meant the character never truly arrived and never knew to halt the movement process or clear movement variables. <br>
<br> <br>
Moving the conditional statements from _process to the function that handles the outcome of movement events. <br> Moving the conditional statements from _process to the function that handles the outcome of movement events. <br>
<br> <br>
<h3>new result code </h3><br>
<code>#enum MOVED {ARRIVED, NOT_MOVING, TOO_SLOW, WRONG_DIRECTION}<br>
func handle_moved_result(result, new_user):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if result == 0:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new_user.think("UserMove/Arrived")<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if get_user().get_target() != null:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if track:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if get_user().find_distance_to_target() <= get_user().get_intimate_space():<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;emit_signal('item_arrived')<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get_waypoints().pop_front()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new_user.clear_movement()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return</code><br>
<br>
<h2>just a few changes makes a big difference </h2><br> <h2>just a few changes makes a big difference </h2><br>
<center>
<img src="/static/img/ent/follow.gif" alt="(image: Angel adjusts her pathfinding to follow a moving item.)"></center><br>
<br>
Last Updated June 12, 2021
<br>

@ -20,15 +20,15 @@ july 1, 2021<br>
<br> <br>
<h3>tuesday, june 8 </h3> <h3>tuesday, june 8 </h3>
<ul> <ul>
<li>First time going by myself to work on my laptop at the cafe since 2018! They let you go maskless if you're vaccinated and it's usually empty anyway, so I actually got to emote at people. </li> <li>First time going by myself to work on my laptop at the cafe since 2018! They let you go maskless if you're vaccinated and it's usually empty anyway, so I finally got to smile at the barista. </li>
<li>Finally got to wear my new lipstick, too. Too bad my rosy mauve Rush expired, and Urban Decay's discontinuing their perfect Vice lipsticks. Maybe I should have bought one last bullet, but I couldn't resist a fancy closeout Becca lipstick. Mauve Truffle was out of stock, so I got warm pink Sorbet. I wore it with Looxi Genesis and JD Glow Good Gawd for a silver-lavender eye with a green shift. </li> <li>Finally got to wear my new lipstick, too. Too bad my rosy mauve Rush expired, and Urban Decay's discontinuing their perfect Vice lipsticks. Maybe I should have bought one last bullet, but I couldn't resist a fancy closeout Becca lipstick. Mauve Truffle was out of stock, so I got pink Sorbet. I wore it with Looxi Genesis and JD Glow Good Gawd for a silver-lavender eye with a green shift. </li>
<li>Let's make a schedule for sewing my new capsule wardrobe: </li> <li>Let's make a schedule for sewing my new capsule wardrobe: </li>
<li>Today - 泣き虫 cutting done </li> <li>Today - 泣き虫 cutting done </li>
<li>??? - findings, trims, and accent fabric arrive </li> <li>June 10 - findings, trims, and accent fabric arrive </li>
<li>June 13 - turtleneck, pajama pants patterns done </li> <li>June 13 - turtleneck, pajama pants patterns done </li>
<li>June 20 - foil, tissue, nightshade cutting done </li> <li>June 20 - foil, tissue, nightshade cutting done </li>
<li>June 27 - turtleneck, pajama pants sewing done </li> <li>June 27 - turtleneck, pajama pants sewing done </li>
<li>whenever Mood coupon is good for - order Penitentiary, 4x2 knit </li> <li>July 4 - order Penitentiary, 4x2 knit </li>
<li>??? - those arrive </li> <li>??? - those arrive </li>
<li>July 4 - 泣き虫 sewing done </li> <li>July 4 - 泣き虫 sewing done </li>
<li>July 11 - bomber pattern done </li> <li>July 11 - bomber pattern done </li>
@ -56,14 +56,20 @@ july 1, 2021<br>
<br> <br>
<h3>wednesday, june 9 </h3> <h3>wednesday, june 9 </h3>
<ul> <ul>
<li>Kitty loves supervising all chores, but his favorite is changing the bedding. He loves when I make waves with the sheets. </li>
<li>Finally, the character follows a moving target. </li> <li>Finally, the character follows a moving target. </li>
</ul> </ul>
<br> <br>
<h3>thursday, june 10 </h3> <h3>thursday, june 10 </h3>
<ul> <ul>
<li>I got groceries at Target, so I had to peak into the Gamestop next-door. What happened? Even the Nintendo game section is small now, and 70% of the store is dedicated to Star Wars and anime clothes and toys. It's been trending this way for years, but at least they had a wall of Nintendo games before. They only had a few used games and controllers, and I didn't see any consoles at all. It looks like Hot Topic now, minus band merch. </li> <li>I got groceries at Target, so I had to peak into the Gamestop next-door. What happened? Even the Nintendo game section is tiny now, and 70% of the store is dedicated to Star Wars and anime clothes and toys. It's been trending this way for years, but at least they had a wall of Nintendo games before. They only had a few used games and controllers, and I didn't see any consoles at all. It might as well be Hot Topic now, minus the band merch. </li>
<li>Target had lots of corpo pride displays scattered through the store, but Gamestop didn't have any at all lol. </li> <li>Target had lots of corpo pride displays scattered through the store, but Gamestop didn't have any at all lol. </li>
<li>Blogging </li> <li>Blogging </li>
</ul> </ul>
<br>
<h3>saturday, june 12 </h3>
<ul>
<li>OBS hasn't been able to capture my windows since around February, so I stopped recording GIFs. (lol) I really do want some GIFs for my dev diary, so after looking around, it's apparently a widespread issue for Linux users with no real fix in sight. Dang, I guess it's a real issue. I'm not a fancy streamer with lots of scenes or anything, so I can just record my screen, but that's not good news for OBS at all. For now, my crops are just going to have be taken from the entire screen instead of just the little window. </li>
<li>At least ffmpeg, though very difficult to write, is able to make nice gifs. If OBS gets worse, I guess I'll have to use it for screen capture, too. </li>
<li>Anyway, now my latest article has a GIF, and I can get rid of the following-moving-target test assets. </li>
</ul>
<br>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

@ -7,11 +7,25 @@
<language>en-us</language> <language>en-us</language>
<webMaster>chimchooree@mail.com (chimchooree)</webMaster> <webMaster>chimchooree@mail.com (chimchooree)</webMaster>
<item> <item>
<title>Writing a Game Design Document </title> <title>follow a moving target </title>
<link>https://www.blessfrey.me/diary/entries/210522</link> <link>https://www.blessfrey.me/diary/entries/210610</link>
<description>After redesigning the movement system to support patrols, I realized the path remains static even ... </description>
<pubDate>Thu, 10 Jun 2021 05:00:05 GMT</pubDate>
<guid>https://www.blessfrey.me/diary/entries/210610</guid>
</item>
<item>
<title>may 2020: mostly GDD and CSS</title>
<link>https://www.blessfrey.me/diary/entries/210601</link>
<description>wednesday, may 5 Still trying to find a nice way to organize my GDD (game design document). ... </description>
<pubDate>Tue, 01 Jun 2021 05:00:05 GMT</pubDate>
<guid>https://www.blessfrey.me/diary/entries/210601</guid>
</item>
<item>
<title>writing a game design document </title>
<link>https://www.blessfrey.me/diary/entries/210527</link>
<description>A game design document (GDD) is a detailed document used to communicate the vision for a videogame. ... </description> <description>A game design document (GDD) is a detailed document used to communicate the vision for a videogame. ... </description>
<pubDate>Sat, 22 May 2021 05:00:05 GMT</pubDate> <pubDate>Thu, 27 May 2021 05:00:05 GMT</pubDate>
<guid>https://www.blessfrey.me/diary/entries/210522</guid> <guid>https://www.blessfrey.me/diary/entries/210527</guid>
</item> </item>
<item> <item>
<title>playing FlightRising with spreadsheets </title> <title>playing FlightRising with spreadsheets </title>
@ -86,7 +100,7 @@
<item> <item>
<title>new year's resolution - making the most of 2021 </title> <title>new year's resolution - making the most of 2021 </title>
<link>https://www.blessfrey.me/diary/entries/210204</link> <link>https://www.blessfrey.me/diary/entries/210204</link>
<description>Everyone had difficulties during 2020. A small part of that was losing my energy for programming ... </description> <description>Most of 2020 passed without significant progress towards shipping Blessfrey and perfecting my ... </description>
<pubDate>Thu, 04 Feb 2021 05:00:05 GMT</pubDate> <pubDate>Thu, 04 Feb 2021 05:00:05 GMT</pubDate>
<guid>https://www.blessfrey.me/diary/entries/210204</guid> <guid>https://www.blessfrey.me/diary/entries/210204</guid>
</item> </item>
@ -97,19 +111,5 @@
<pubDate>Mon, 01 Feb 2021 05:00:05 GMT</pubDate> <pubDate>Mon, 01 Feb 2021 05:00:05 GMT</pubDate>
<guid>https://www.blessfrey.me/diary/entries/210201</guid> <guid>https://www.blessfrey.me/diary/entries/210201</guid>
</item> </item>
<item>
<title>web development resources</title>
<link>https://www.blessfrey.me/diary/entries/210121</link>
<description>I'll collect frequently used resources for web design here. CSS Grid Generator - build a ... </description>
<pubDate>Thu, 21 Jan 2021 05:00:05 GMT</pubDate>
<guid>https://www.blessfrey.me/diary/entries/210121</guid>
</item>
<item>
<title>inventory as a system diagram </title>
<link>https://www.blessfrey.me/diary/entries/210107</link>
<description>System diagrams illustrate how components interact within a system. It saves so much headache to ... </description>
<pubDate>Thu, 07 Jan 2021 05:00:05 GMT</pubDate>
<guid>https://www.blessfrey.me/diary/entries/210107</guid>
</item>
</channel> </channel>
</rss> </rss>

@ -4,9 +4,9 @@
<br><br> <br><br>
<h1>chimchooree</h1> <br> <h1>chimchooree</h1> <br>
<h2>hello</h2> <br> <h2>hello</h2> <br>
I'm a US-based indiedev who's learning to program through game development + web development. My hobbies include enjoy studying Japanese, translating isekai manga for others, and playing 90s/00s CRPGs + JRPGs. <br> I'm a US-based indiedev who's learning to program through game development + web development. My hobbies include playing 90s/00s RPGs, translating shoujo isekai manga from Japanese to English, and sewing clothes. <br>
<br> <br>
To practice different languages, I bounce among some solo projects in Godot Engine, Java, + Python. My main project is a widely scoped ARPG dungeon crawler called Blessfrey. Hopefully the demo will be ready sometime 2021, so keep watching! <br> To practice different languages, I bounce among solo projects in Godot Engine, Java, + Python. My main project is a widely scoped ARPG dungeon crawler called Blessfrey. Hopefully some playable releases will be ready sometime 2021, so keep watching! <br>
<br> <br>
Feel free to say hello, especially if you're interested in gamedev, too. <br> Feel free to say hello, especially if you're interested in gamedev, too. <br>
<br> <br>

Loading…
Cancel
Save