Under review

Setting perception vision distance and fov from a stat or a variable [proof of concept included]

rexdefuror 4 months ago in Behavior updated by Marti (Lead Developer) 4 months ago 4

The title says almost everything. It would be nice to be able to configure perception at runtime based on either stats or variables.
I have created a proof of concept for vision distance to be read from a stat, which likely has some flaws but it works.

With this I was able to configure vision distance based on a stat which was in turn calculated by a formula.

Proxy Target. This is possibly an extra property which I added because method GetGameObject in an instance of a class  TargetGameObject needs to have a target of type GameObject. Thus I've made it into a field within the perception component. Perhaps there's a better way of handling this or maybe just ignoring the Invoker as an option.




Unity version:
Game Creator version:

Here's an update with using variables and updating it on runtime.



This version needs a setup. First is a local variable on the character that is being configured for perception, and upon adding perception you'd just name the variable.

And if synchronization with a stat and formula is needed, simply adding triggers like shown in example would suffice.

Purpose of this is to be able to influence vision of the characters at runtime based on stats so things like perception and stealth skills which are based on stats would work.

Next step would be to reduce both FOV and this calculated distance based on the stealth stat of the player, thus mimicking sneaking.

Under review

Thanks, this is something I'm looking forward adding. The problem with this approach is that it's a bit cumbersome (you need to transform a stat into a variable, and then use that variable with an Action to change the vision-distance / fov based on that value.

I'm looking into making a more generic solution, where the variable picker shows also stat values, among other things (the field would be dynamically generated based on all the modules you have).

Thanks! On a side note, I'm letting this one through because you put a lot of effort and I really appreciate the tests you did. But would you mind not sharing entire Game Creator C# scripts in the future? Just post the changes. This enters in conflict with Unity's EULA and can be considered partial distribution.

Hey, first off... Sorry... I thought that only folks with purchased content can get here.

Secondly, I have a complete feature implementation (still with stat coupling) with more perception/stealth logic. Please do contact me on discord if you get a chance and we can go through it.

Again, really sorry...

No problem. Sorry if that came out as rude. I'll leave it here since may help some users, at least until I figure if it's allowed or not to show big chunks of partial code. But make sure to just post the changes next time :-) Cheers!