Home Artists Posts Import Register

Content

Order up! Friday with extra cheese! Here's what I got done this week:

  • Made NPCs and heroes avoid the feet after the feet have stomped
  • Made NPCs and heroes always move away from walls while avoiding the feet if they're close enough to the walls
  • Made NPCs regain their vertical speed if they lost it from bumping an obstacle
  • Cleaned up NPC and hero movement code
  • Make the heroes follow the player much more tightly

Hoo boy, this week was a tricky one. There was a lot of programming to do, and every one of them was a very specific circumstance that required similarly specific code that seemed to get more and more complicated the further I went with it.

One such example was making the NPCs and heroes avoid the feet while they're walking down like they would obstacles. Just use waypoints, right? Well, I tried that... But those waypoints started interfering with the obstacle waypoints; if the hero/NPC tried to avoid a foot right next to an obstacle, they would just ignore the obstacle and travel to the foot's waypoint even if it put them in a worse position. So then I tried giving the foot its own waypoint system separate from the obstacle waypoints, including checks if the heroes/NPCs were already avoiding an obstacle... Like I said, more and more complicated the further down the rabbit hole I went.

Fortunately, since the feet will always be the same size and shape, I cobbled together a much simpler system of avoiding them. To quote a great movie: "Go that way really fast. If something gets in your way... turn." In other words, I compare the hero/NPC position with that of the foot that's in front of them. If the foot is on their right, make them go left. If it's on their left, make them go right. Much, much simpler!

(I also programmed in a system to spawn NPCs wherever I click. Testing would have been a nightmare otherwise!)

But what if the foot is on one side of the hero/NPC and a wall is on the other? I'm glad you asked, random figment of my imagination! I just have them check their global horizontal position. If they're at position x, that means they're close to this wall, which means they need to go the opposite direction. Is it elegant? Not at all. Is it simple? Absolutely. Will anyone even notice? Probably not. Hotel? Trivago.

One flaw that I'm only just realizing while writing this is that they can still get stuck on the sides of obstacles if the foot stomps in front of them in just the right place. If this becomes a prominent enough issue, I'll modify it accordingly. Fingers crossed that I don't have to!

Those were the two big things I accomplished this week, but there is one more big thing that I had to scrap due to just how complicated and messy it was getting: I attempted to make heroes move to the opposite waypoint (if one exists) if they run into a foot while avoiding obstacles. I was really hoping this would work out since heroes tend to get stuck behind obstacles because of this often enough to be noticeable. But the code... My goodness, the code...

I'm not gonna pretend to be a professional programmer. My coding skills are limited to how easy the problem is to Google. I'm proud to say that I got this feature nearly working, but even if I had gotten it fully working it still would have left a big mess code-wise. I'm going to settle for simple AI with little gimmicks to make up for their mistakes. In this case, if the hero gets sent below the screen, I'll just have them poof back up into visible space. No sense in punishing the player for simple AI. Now, if the player gets pushed down... that'll be a different story.

The bottom three bullet points were, very fortunately, easy peasy. Making the NPCs regain their speed after bumping an obstacle was literally one line of code put in the right place! :P  I'm also quite happy I took the time to clean up the movement scripts for NPCs and heroes, especially after the messes I caused within them this week.

Last but far from least, tightening the heroes' proximity to the player character has made a huge difference in how the gameplay feels! I mostly just increased their speeds so they follow closer (except when they scatter for obstacles). It's now much easier to keep your eyes on your character without having the other heroes buzzing around like flies!

Looking at this, I may need to make Undead's movement a little tighter... And of course Confused wandered off at just the right time to make their showcase pointless! >_<

Anyhoo, with all of that done and over with, there's just a handful of things left to do, and then I'll get the next game update out to you guys! That is, as long as I don't keep finding things to add to the to-do list. Sometimes it's one step forward, two steps back with design problems. ^^;

Now then, ask not for whom the taco bell tolls; it tolls for me. I'll see you guys again next week!

Comments

Bombur

Nothing like being stuck between a foot and a hard place! Making the party follow closer to the player is just the improvement we needed that for some reason no one thought of sooner. I can definitely see that tightening up the movement quite noticeably. I can see another gameplay test on the horizon... Prepare yourself, for I won't go quietly!

MilesMouse

Right? It's so obvious in hindsight, but before the tightening it was just this vague sense of "This doesn't feel good..." :P Give me all you've got! I want to be blasted apart by your criticism laser! I can take it. &gt;:o