PlayMaker News > General Discussion

Playmaker version of Inheritance?[SOLVED]

(1/3) > >>

craigz:
Hiya! :D

I was wondering whether anyone has found a good way to go about doing inheritances with Playmaker?

Ref: https://unity3d.com/learn/tutorials/topics/scripting/inheritance

This is a common issue I've been running into when dealing with enemy types and their AI.

While certain FSM's such as a Health FSM can be templated out and used well, assigning subtemplates/setting variables WITHIN those gets pretty messy :/ (without having already predeclared variables on the parent FSM that you may not use in the child)

Example: Using an Navigation template that controls how an enemy navigates TO the player. But when they get within range you want to do a more customized style attack.

Enemy 1: Goes up to the player, when near, attacks.
Enemy 2: Gets within 10 feet of player, teleports behind them and attacks.

Is it best to just try and keep getting clever with Run FSM to do something like this?

Sorry if there's confusion, starts to fry my brain after a bit of thinking :P

-craigz

Fat Pug Studio:
You can something similar with Playmaker too, though it requires a few more steps. Same features, like moving towards an enemy can be the same, and then you have the branching of actions based on the name of the FSM owner.

Something like this



It's even easier then inheriting, you can put a template that will define health, attack mode, movement mode, whatever you want based on the objects name or whatever variable you want to compare.

craigz:
That's very true, that's kind of the general point I'm currently sitting at :)

The only issue is that (and maybe this doesn't matter?) it has to cycle through those branching actions EVERY time it has to move/attack etc. And many of those attack patterns require unique variables that would otherwise sit empty on the parent FSM.

Granted now you've got me thinking... maybe most of them DONT need uniquely set variables, but nothing more than a target object... hmm :)

Thanks for the brainstorming Krmko! :D

-craigz

jeanfabre:
Hi,

 you could be using gameobjects that you stack up and parent one another, and each fsm would call its child or parent depending on the order you want to execute them.

 another way would be to create a data layer for these combos and so you don't hardcode the sequence of things in your code but rather use a text file or xml or json, or csv ( whatever) to tell what has to be executed and in which order. You can then either have a set of templates you are going to run based on that data ( you can save all templates in an hashtable for reference against a key for example)

 Bye,

 Jean

Fat Pug Studio:

--- Quote from: craigz on October 11, 2017, 02:16:24 AM ---That's very true, that's kind of the general point I'm currently sitting at :)

The only issue is that (and maybe this doesn't matter?) it has to cycle through those branching actions EVERY time it has to move/attack etc. And many of those attack patterns require unique variables that would otherwise sit empty on the parent FSM.

Granted now you've got me thinking... maybe most of them DONT need uniquely set variables, but nothing more than a target object... hmm :)

Thanks for the brainstorming Krmko! :D

-craigz

--- End quote ---

It does have to cycle, but that would be done in a few frames at most. The approach itself is basically like inheritance.

@Jean

How exactly would that work in playmaker? How can i create a set of templates based on a data layer?

Navigation

[0] Message Index

[#] Next page

Go to full version