Author Topic: One Of Them  (Read 2830 times)

Galavant Garde

  • Full Member
  • ***
  • Posts: 129
  • Cayelan Mendoza
    • View Profile
    • Galavant Garde - Dark Electro Disco Pop
    • Email
Re: One Of Them
« Reply #30 on: November 05, 2017, 03:40:09 PM »
Oh hai, little update after putting this project on hold while working on some music stuff...

Here's a little screen grab showing you how all of the gameplay mechanics I've been working on have come together to make the game a game:  https://youtu.be/Vsn_fAD3Rpk

I know it's a small thing, but I just scripted in a different way of handling walking backwards in that it's always slower than running forward with an awkward backward walk animation.  I mention it because your forward speed and animation changes depending on your health, but your backward speed is always slow, so I had to get the script to remember speeds and animations based on health each time you change direction. Really basic I know, but details count. Seeing though guys script little details like this all the time bringing your projects to life, you'll appreciate how fun it can be when unpolished stuff starts to work seamlessly

Still on the list of things to do is avoiding enemy clumps in small spaces  :o

Galavant Garde

  • Full Member
  • ***
  • Posts: 129
  • Cayelan Mendoza
    • View Profile
    • Galavant Garde - Dark Electro Disco Pop
    • Email
Re: One Of Them
« Reply #31 on: November 14, 2017, 03:03:21 PM »
Another little update - have ditched crawling as I'm not really happy with how the model interacts with the map when laying down. Instead the player can crouch down to hide, as you can see in this little clip:

https://youtu.be/SUiaud1XJ4k

Have decreased the default gamma and chosen a darker ambient light colour, added in a graphical representation of noise you make through vents, and worked a little on the enemy AI. Now they shouldn't start teleporting all over the map when they get stuck on each other; they pass through each other until they find space (still needs work - the clip shows one little teleport but that's triggered  by wall collisions rather than contact with other bots) let me know what you think  :D

Galavant Garde

  • Full Member
  • ***
  • Posts: 129
  • Cayelan Mendoza
    • View Profile
    • Galavant Garde - Dark Electro Disco Pop
    • Email
Re: One Of Them
« Reply #32 on: November 16, 2017, 01:31:40 PM »
I know it's quiet around here, but IDC Imma keep postin

Been trying to work out how best to get my enemies to stop clumping when they're in narrow corridors.  I realised why my code wasn't working how I intended it to - I was using the Touch event whenever they bumped into each other to trigger their who-should-stay-put-and-who-should-get-out-of-the-way logic.  However, it turns out bumping into each other also triggered the Collide event every now and again, which I was using for wall collisions...I was using a totally different logic for bumping into walls after straying from a node path than touching another object, hence my bots sometimes just got stuck and did stupid things like teleporting and running in circles etc.

SO, I've stopped using the collide event all together, and it's already working better!

Now my biggest bugbear is how the closest node for a bot to run to is often on the other side of the bot to where the following node in the path is...hard to explain without a diagram, but essentially the bot runs one direction for a short distance, then beelines the other direction because that's where the next node in the path is.  Know what I mean?  Ideas on how to avoid that??  I know I could probably do a calculation for which is closer - the first or the second node in the path...but that seems too manual and clunky.  IDK I might give that a try and see how efficient I can make it

Galavant Garde

  • Full Member
  • ***
  • Posts: 129
  • Cayelan Mendoza
    • View Profile
    • Galavant Garde - Dark Electro Disco Pop
    • Email
Re: One Of Them
« Reply #33 on: November 19, 2017, 05:37:11 AM »
Yay coding breakthrough  ;D my bots don't get stuck on each other anymore!  They're almost ready for prime time!!

This was such a pain, it may be of help to anyone coding their own combat bots to share what I did to make them work:

- If a bot touches another object, they check the object's name to see if it's another bot, something they should ignore (i.e. an invisible checkpoint etc), or the player
- If they touch a bot, they decide who dodges and who stays put by working out which one has a bigger ID (this way there can be no error - one MUST get out of the way)
- If the one who has to get out of the way (I'll call him the dodge bot from now on) is stationary, they will turn off contact allowing the other bot to run through them
- The stationary dodge bot then checks on a timer to see if they're obscured while contact is switched off - if not they turn contact back on and resume what they were doing
- If the stationary dodge bot is still obscured (i.e. the other bot stopped on top of where he's standing) the dodge bot will sidestep a few map units then check again if they're obscured
- If the dodge bot was actually moving at the time they bumped into the other bot, they'll side-step the other bot and carry on along their path completely avoiding any obscuring issues
- The bot which doesn't have to get out of the way (I'll call him the boss bot from now on) will carry on uninterrupted so that at least one enemy is always focussed on the player in any multi bot combat scenarios
- If the dodge bot runs in front of the boss bot in order  to get out of his way, therefore obstructing his view of the player, the dodge bot will engage the player until another bot accidentally bumps into him, and the original boss bot will readjust his position to get a clear shot of the player

It's a nebulous logic map, but it works.  It scales up too - there can only be one boss bot in any multi bot clump, so every other bot will become dodge bots and run out of the way. When they sidestep or whatever, the original boss bot will no longer be obscuring them, so one of the remaining dodge bots will become the boss bot, and so on until they are all spaced out (it happens quite quickly actually).  Side-stepping and dodging use a combination of nodes, and uncharted parts of the map the bot has verified is free from objects by firing invisible rays at the ground, meaning even if there's only one nearby node, they will be able to spread out wherever there is physical space irrespectively.  Also the timing is pretty tight, so you won't really notice bots occupying the same space for long if at all.

I've probably explained that poorly, but I'm just happy it works! You'll be able to pick it apart when I put the project data folder up for download again soon.

So now THAT'S done, I'm going to start working more on the player's abilities.  On the menu is being able to infect bad guys (which will completely change their behaviour and make their scripts that much more massive - here we go), and even just being able to yell/make noise to startle or mislead bad guys.  Because right now the baddies are a bit too fearless I find

EDIT:  Just added the ability to, well, basically just yell and make zombie noises.  It's SUPER useful when you're running around the dark as it allows you to trick enemies and run them around in circles trying to find you!