NPBehave icon indicating copy to clipboard operation
NPBehave copied to clipboard

Randomized Nodes

Open Wokarol opened this issue 6 years ago • 16 comments
trafficstars

It would be really handy to have nodes such as "Random Selector" or "Random Sequencer". They would be helpful for creating more non linear enemy behaviours. Especially for bosses. (For clarity, by "Random Selector" I mean one where nodes are checked in random order and by "Random Sequencer" I mean one where nodes are sequenced in random order.)

Wokarol avatar May 29 '19 23:05 Wokarol

Interesting idea. For selectors it should be already possible to do that by putting a Random decorator at all subbranches of the Selector.

meniku avatar Jun 12 '19 10:06 meniku

Random on childs won't give correct probability I think. And even if, you would have to tweak probability everytime you change number of childs.

Wokarol avatar Jun 12 '19 11:06 Wokarol

Fair enough. I think that should be possible to implement. Right now I'm on vacation so it could take some time to do it myself... If you want to give it a try yourself, I'm happy to take pull requests ;-)

meniku avatar Jun 12 '19 16:06 meniku

Okay, I've done some tests and looks like Selector + Random method gives uneven results.

RandomDistribution (21 tests, each test was stopped when any bar reached 200 points)

You can see that 1st option is chossen more often. Almost twice as often as last one.

Wokarol avatar Jun 13 '19 08:06 Wokarol

I’ve merged your pull-request at https://github.com/meniku/NPBehave/pull/18 Thanks again for the contribution.

One thing that's a bit unclear to me right now is what should happen with the child priorities for the stops rules. Right now I kept it the original order (not the randomized one), but one could argue that the children priorities should change to the randomized order...

meniku avatar Jun 24 '19 06:06 meniku

@Wokarol may i ask you how you used the selector and random method? i can't quite get a hand of it.

Luuno avatar Jul 02 '19 08:07 Luuno

@Luuno // What Selector and Random methods you have in mind?

Wokarol avatar Jul 02 '19 09:07 Wokarol

@meniku // In theory, best way would be to keep randomised order, but I don't fully understand stop rules yet. I will probably change it, but first I have to understand how it even works.

Wokarol avatar Jul 02 '19 09:07 Wokarol

@Wokarol i would like a set of actions to be picked at random. so my animal behaviour is more random and natural.

Luuno avatar Jul 02 '19 09:07 Luuno

@Luuno // Just use Random Selector like Selector.

Wokarol avatar Jul 02 '19 10:07 Wokarol

@Wokarol but the library does not recognize random selector? so i am a bit confused

Luuno avatar Jul 02 '19 10:07 Luuno

@Luuno // You have it downloaded from Asset Store or Git? It's feature I've added recently. It's possible that it isn't on Asset Store yet.

Wokarol avatar Jul 02 '19 10:07 Wokarol

@Wokarol asset store indeed. thank you i will get it from here and try again!

Luuno avatar Jul 02 '19 10:07 Luuno

I didn't update the asset store version for quite a while. I've planned to do it soonish

meniku avatar Jul 05 '19 22:07 meniku

I agree that the pre-defined random order might make the most sense, although I'm not quite sure if it really makes sense to use stops rules with those random decorators at all.

meniku avatar Jul 05 '19 22:07 meniku

I think it makes sense, for end user randomised nodes are basically nodes that shuffle their childrens

Wokarol avatar Jul 05 '19 22:07 Wokarol