update diary

This commit is contained in:
chimchooree
2020-12-31 21:27:08 -06:00
parent 213d270cdd
commit 4c4436e1c9
2 changed files with 53 additions and 0 deletions
-35
View File
@@ -1,35 +0,0 @@
<!--200810-->
<h1>slimeAI - state transition diagram </h1>
december 10, 2020<br>
#ai #programming<br>
<br>
<br>
blessfrey's slimes use finite state machines. <b>Finite state machines</b> (FSM) are models with a finite number of states that either decide to generate output or transition to a new state based on input. They can only be in one state at a time. <br>
<br>
<br>
<h2>why use a finite state machine? </h2><br>
Because they are simple and flexible, while still allowing for interesting behavior. FSMs reflect our own mental model of how slimes behave (attack mode, wander mode, sleep mode, etc). These different modes or states are written as manageable chunks that easy to code, debug, update, and refactor. It's also efficient with processor time, since the behavior is abstracted to basic conditionals. <br>
<br>
A state can be as broad or specific as you need, so long as it's granular. So they can be more easily debugged and swapped out with one another, it's a good idea to have one entry point and one exit point for all your states.<br>
<br>
Of course, since FSMs can be used for anything with states and transitions. You can think of specific menus, mechanics or even your entire game in terms of states. I'm just using them here for understanding the AI for my slime monster. <br>
<br>
<br>
<h2>designing AI </h2><br>
Planning ahead is extra important, since any dead-ends will halt your slime. I used a state transition diagram to design the slime's AI. In the diagram, circles represent states and arrows represent transitions, triggered by some kind of event. I marked the initial state with a star, but Buckland recommends a double circle. <br>
<br>
The slime is a simple creature. It idles, chases anything that gets too close, and attacks until its target dies. Here's the diagram version of that:<br>
<br><center>
<img src="/static/img/ent/slimeai_diagram.png" alt="(image: a state transition diagram for slime ai.)" width="500" height="250"><br>
</center>
<br>
The states are Idle, Choose Target, Attack, and Move to Target. The initial state is Idle. <br>
<br>
If there's a valid target, the slime enters Choose Target. If there's no longer a valid target, it returns to Idle. If it successfully gets a target, it begins moving to target. If the target becomes invalid, it returns to Idle. Once the target is in attack range, it enters Attack. If the foe moves out of range, it returns to Move to Target. If the target becomes invalid, it returns to Choose Target. And the cycle continues. <br>
<br>
No matter how you follow the arrows, there are no dead-ends and all states can be reached eventually, so it'll work okay when it's implemented as code. <img src="/static/img/emo/heart.gif" alt="<3"><br>
<br>
<br>
<h2>reference </h2><br>
<a href="https://www.goodreads.com/book/show/161139.Programming_Game_AI_by_Example"><b>Programming Game AI by Example by Mat Buckland</b></a>. It's an easy to understand introduction to game math + AI concepts. The code examples are in C++, but they are still useful for understanding the underlying principles. I didn't even know where to begin before I started reading and it got me pretty decent groundwork for AI creatures with different behavior that reacts to the players.<img src="/static/img/emo/heart.gif" alt="<3"> <br>
<br>
+53
View File
@@ -0,0 +1,53 @@
<!--201201,210201-->
<h1>december 2020: holiday season☆</h1>
january 1, 2021<br>
<br>
<br>
I didn't keep a diary very well this month;; This is mostly pieced together from my git history. I did play Legacy of Kain: Soul Reaver and Planescape: Torment a lot, though. <br>
<br>
<h2>week 1, december 1-5 </h2><br>
#python <br>
<br>
<ul>
<li>worked on Skillmaker, a Python script that can use JSON data to generate skill scenes + scripts for Godot Engine </li>
<li>Skillmaker can generate descriptions that fit a standard format. It's not used in-game, though, it's just plopped in a comment on the skill script. In the future, I want Skillmaker to generate a CSV file, so Godot can read in the generated description instead of the text being hard-coded inside the engine. That way, editing + translating will be easier. </li>
<li>those descriptions use variables. In the future, those variables will allow skill values to grow with the character's stats. </li>
</ul>
<br>
<h2>week 2, december 6-12 </h2><br>
#python<br>
<br>
<ul>
<li>updated Skillmaker's readme, since expected input has changed a lot </li>
<li>after 8 years, Cyberpunk 2077 finally came out. I can't do $59.99 + 100GB, so the closest I can do is watch Batman Beyond instead. </li>
<li>lots of FlightRising. my flight competed against Light for Dominance. They won, but they had to raffle off a <a href="https://www1.flightrising.com/game-database/item/910">priceless Kickstarter item</a> during the final hours to flip us off the top. I can't imagine how costly that win was for Light, and even then, it wasn't definitive...I wish I tried harder. </li>
</ul>
<br>
<h2>week 3, december 13-19 </h2><br>
<br>
<ul>
<li>probably nothing really very productive</li>
<li>finished reading <a href="https://www.gutenberg.org/files/19942/19942-h/19942-h.htm">Voltaire's Candide</a>. Not sure if it was the best year for a literary attack against the optimistic view that everything turns out for the best, but it's a fun + easy read nonetheless. </li>
<li>started reading <a href="http://www.gutenberg.org/files/32825/32825-h/32825-h.htm">William Bradshaw's The Goddess of Atvatabar</a>, a Utopian hollow Earth novel. If inner earth is interesting, I attached a list to a <a href="https://www1.flightrising.com/dragon/62304375">dragon</a>...credits go to all the article writers I didn't credit </li>
</ul>
<br>
<h2>week 4, december 20-26 </h2><br>
#python #skills #statuseffects<br>
<br>
<ul>
<li>Merry Christmas!! </li>
<li>(keywords are the smallest component of a skill - reusable segments of code for producing a skill effect) </li>
<li>added summon + bleeding keywords </li>
<li>added Skillmaker support for generating skills that use those keywords </li>
<li>maintain this website a little </li>
</ul>
<br>
<h2>week 5, december 27-31 </h2><br>
#dia #events #story<br>
<br>
<ul>
<li>I finally found a diagram editor I like - <a href="http://dia-installer.de/index.html.en">Dia</a> :) It's in Mint's package manager, too. </li>
<li>it's nice for planning branching the flow of events and branching dialog. I wrote a few events with it and made an outline for the game. </li>
<li>I keep the events in my GDD repository now. I used to keep these all over the place, in paper + text documents. (Why didn't I do this earlier?) </li>
</ul>
<br>