27 year old Geologist and amateur game dev

Report RSS Finding Pathfinding

Posted by on

Preamble

Good afternoon all! I'm back with another update on the game. Everything is moving along quite nicely, now that I've recovered from my trip to see the family. I had time to get a few more art assets done last week before I left, and I'll be posting those up soon on in my image gallery. Really looking for a critique on the art when it goes up. This is the first time I've done pixel art for something like this, and I'm under no illusions that I'm some kind of great artist. So, please tear up what I do in the comments section for the images, if you feel like you need to. I'll probably throw a whole update on art work up one day too, but today is all about detection and complicating things so... on to the update!


Update

Last time I posted, I mentioned that I was working on adding in a rudimentary state machine, that would swap between separate behavior states (read: Scripts) when certain criteria were met. Well, that went in without a hitch. Actually, I scaled the state machine down from what I talked about in the last blog post, so that the cases for each state are now just references to the scripts. My intention was to do that First, and then for each case, add in the logic I'd been using to swap between states; thereby cleaning up my scripts a bit. Thing is, when I implemented that first iteration, the state machine actually did more than I anticipated, and shone a light on an issue that I had been having. What I have come to find out, is that with each individual script I had before, the scripts were still running even when I didn't tell them to. This was causing conflicts when the monster was trying to decide on which state to swap to. With the state machine in place, that doesn't happen anymore. Infact, since I implemented it, my monsters have been reacting much more smoothly than before, which is good. So, close the door on state swapping issues, and state scripts conflicting with each other...


...Open the door on new issue: Monster movement. Basically, I'm backtracking and tearing my hair out over how the monsters should walk around the dungeon. Setting paths would work, but I don't know if I want to break down and assign all the paths. If I do that, the monsters will run predictable routes, and you'll just need to memorize said routes to avoid danger. Thing is, setting up a monster that will wander in random directions, covering a 45 block area... and setting up monsters that will wander a path that makes sense (Walking down hallways, checking through rooms, etc) are two Entirely different things. I've got some ideas on how to do this, and it's fast coming the time when I'll need to implement something.. but for now the monsters are just stationary (I took out their wandering script). By the way, this is only in the idle, wandering state. Every other form of monster movement: Chasing, detecting through scent, etc. all work perfectly, obeying collisions and everything. Why random wandering is such an issue, is that it ties directly into the next thing...


...Which is the sight cone. Since the majority of your time will be spent sneaking around, I want there to be a sight cone on all the monsters. The system by which the cone detects is working pretty well. Basically, there is a distance from the player, angle to the player, a line that detects collisions between the monster's LOS and the player, and the angle the monster is facing. If the player walks into a 60 degree cone centered around the angle the monster is facing, player detected, as long as there is no wall or other obstacle in the way. The coding is all in for the cone itself (And the cone's sight distance scales based on the light level), I just need to get the monster pathfinding put in, to test it all out.


Upcoming

Detection is the major goal for now, as it's one of those core mechanics, but avoidance will come next. This will probably take the form of ducking to get under furniture, places to hide in, odorous areas that can throw off tracking, etc. But, if there are areas that help you Avoid monsters, there should be areas that make it more likely you'll be caught. Some of this will be part of dungeon design: Well lit rooms, lack of cover, etc. That said, I'm thinking of adding an echo effect that means that walking in open rooms or halls, will make the sound travel down the hall. We'll see about that once we get hearing detection in.


I have also been considering the game's objective. So my goal this whole time, has been to make it so that you'll be searching for incriminating evidence, that will get the owner of the dungeon locked up. Documentation will be a big part of this, but it occurs to me, it could also mean other things, that could be spread around the dungeon. Some of it, even requiring the killing of monsters. I am Hoping that I can make it so that the player can leave the dungeon at any time... walling them in for limited amounts of time at most. In doing this, I'm hoping I can encourage people to go deeper and find more stuff, and create a more rogue-like atmosphere. Just playing with this idea though, and if anyone has any thoughts comment below.


Anyway, that is today's update. Should have another up in a few more days. Thanks as always for reading!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: