Home Artists Posts Import Register

Content

Continues from the last journal.


Let's imagine this kind of monster's placed on the map, and player needs to get pass over it. It has large hitbox, and doesn't move while it's getting attacked. I'll be too easy to handle this monster.

I want to make more difficult, want to make it to be hit only when player attacks its 'core'. The core will move along with its slime part.


I've wrote a code for 'follower behaviour' long time ago. It wrote that code to make sphere to move smoothly, having some delay.

This code I have makes object to follow the destination, regardless how extreme its change is.


If we assign proper destination for the core along with the monsters movement, we can get a nice result.


In game, when monsters gettting hit, they generally display their status by changing their color to white. but as this '???' basically invincible except its core part, we can't use that method.

Instead, we can slightly modifity the bounce effect we already have. then we can express if its hit or not, seperated from the 'health reduced' effect.


┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

┃ Boring part begins from now on. For the gist, just watching the images would ┃

┃ be enough. other followed sentences are just for the clarifications. ┃

┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

- AI part.

The monster need to decide its destination by its own. There's two options to we can choose to implement this AI function. First is to give it a speed, and make it move until it meets the wall. Second is to calculate the destination before it moves, just like we see stuffs and think before we grab actually them.

First method is far more easy and lighter than the second one. but sadily we can't use the first method, as situations like these will happen :

If we don't manage its destination, there will be occasion where it lands on absurd position. So we need to calculate which position is valid and which is not.


And even validity checking is not enough, as situation like below can also be count as invalid.

If this kind of occasion is checked as invalid, monster won't attack the protagonist and we don't want that to happen. We need to check if it's 'adjustable' than mere validity.


There's lots of occasions to check when it comes to adjustment. There might be even more that I've missed.

But all these occasions can be handled with one condition.

=> If parallelogram contatins retangles edge(s), the edges that makes the line which has the differnt gradient sign compared to parallelogram, adjust parallelogram according to it. Else, consider it as invalid.


But that's the solution for only one platform to consider. If there's two or more platforms, there will be a problem.

Once parallelogram adjusted, it's adjusted very tightly. so if it gets adjuested again to opposite direction, we can assume that It's not valid. same applies to other types of adjustments.

Other 'possibly can go wrong' parts can be handled by doing another checking routine repeatedly.


So with all of these, if we stitches up these requirement nicely, we can finally have disred result. we can make it run by its own.


It's really been a long journey, but now everything is done(except some bugs). It'll be able to be seen in the game soon. Merging it with the game will definately be a struggle, but I think It won't be that bad :3


Files

Comments

Anonymous

Such a cool enemy! I love the intricate thought behind the changes you make and that you haven't compromised once.

Anonymous

Wow, that's so amazing

Slapyousilly

Amazing breakdown of trying to get the AI to do a proper scan of an area to move around. Have found some issues when there's a Platform (Wall) too near to it, the adjustment will ignore the wall. Seeing the potential problems of the overlap, I think you can potentially do another quick check if there's still a overlap. If there is still overlap, it' can be marked as unable to traverse. I not sure if you can do something like a "Raycast" by trying to check the path from both points of the parallelogram and the middle of it - to the desired path it wants to travel to. It's like shooting a bullet from the points to check if it hits anything in it's path before reaching the destination, if it doesn't reach the intended y-axis, there's a obstacle and the area will be marked as unmovable/cannot reach platform. It can be expensive but I think can be used to check your "Two or more platform" problem. I hope it might help.

applepopsicle

You've seen it right. As I can't be 100% about the case you've experimented, I can't say it clear but it happens in some case. this "two or more platform" that you've experienced happens in case where the closest platform is ignored by range limitation I've implemented. (250pxl ~ 750pxl). let's say there are two platform that 'stretcher' is about to heading. if those both platform is in the range, It acts properly as it planned. but if one of the platform is close enough to be ignored (if it's expected bridge length is shorter than 250pxl) and the other one is not, it will looks like it goes through the wall. To be said, this 'glitch' won't happen if there's no range limitation. So why there's range limitation? limit on far range is understandable but why even in short range? it's because of the texture distortion can't be handled in that range. with several testing I've concluded that by using only the bezier curve can't shorten the texture further naturally.