Post news Report RSS WeekendWhut #1: (Ranged) combat

Welcome to the first ever edition of WeekendWhut (tm, copyright, etc) where I talk about what I achieved over the weekend!

Posted by on

WeekendWhut #1

Hello everyone. I am trying to get development back up to speed and as a part of that, I intend to do a news post every weekend talking about what I did over the course of said weekend.

So, without further ado, let's kick off our first ever WeekendWhut! This week, I worked primarily with the combat system.

Going medieval on mobs, ranged style!

Ranged combat was totally missing until yesterday. I've built my base combat system so that it was easy enough - mechanics wise - to bring ranged combat in. I didn't need much changes or additions in the combat or targeting mechanics, but I did spend a while tweaking the animations and stuff.

ranged combat animation states


This is what the animation states for ranged combat currently look like. Messy messy, but works somewhat..

So, with the animations in place and the needed code additions and changes done, I took it for a little test drive.

ranged combat no target


As I said, ranged combat uses the same mechanics that were already there for melee combat, with slight changes and/or additions. As such, determining the target, hit/miss, inflicted damage, etc all worked pretty much out of the box.

ranged combat


ranged combat


While we're here..

While I was working with the combat system code, I decided to add a check if there is anything in between the attacker and the target that would block the attack. This is easy enough, I just added a simple function that takes the origin point, the target point and the intended target as parameters and returns whether or not there is something else in the way. It does this by doing a simple ray cast between the points and checking what the ray hits.

ranged attack obstructed


Again, this works the same in both ranged and melee combat modes.

melee attack obstructed


It ain't no Skynet..

With the environment now being able to restrict where you can attack your targets from, this calls for a need to start working on the enemy AI at some point. As of now, the enemies just look for a spot near their target that is within their attack range. If their attack ends up being blocked by environment, they don't currently care: they'll just keep attacking and failing at it miserably.

This of course needs to be worked on, I wouldn't want just anyone being able to trick the mobs into a spot where they can't hit you (although that more often than not also means that you can't hit them either!).

So, when an enemy's attack is blocked by something, they need to look for a new spot near the player and head off there. This is just a small part of what I will need from the mob AI, though, so I'll have to think about the big picture first.

Until next time!

-saku / underRadar Games

Post a comment

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