playMaker

Author Topic: Question about activate objects  (Read 2556 times)

cleave

  • Playmaker Newbie
  • *
  • Posts: 27
Question about activate objects
« on: September 05, 2018, 05:17:48 PM »
I am working on my avatar system. Simply, I set strings on character fsm, then switch strings to send which weapon is going to be activated or mesh enabled.

Here is the issue.

It would be fine if there is only 3 to 5 characters in rpg game. But I cannot do this if there are hundred of characters need to switch weapons in RTT/RTS games. Because it is impossible to drag object thousand times from Hierarchy to playmaker editor state or make hundred switch events to decide which character or weapon is the one I want.

Is there any actions could help this from Ecosystem?

I am new to playmaker. Actually I am looking for actions that could help me switch general objects or objects that created after Scene start. many of my fsm cannot reuse just because of there are lots of specific objects are from Hierarchy.

So any solution on this? Thanks a lot.

Doh

  • Full Member
  • ***
  • Posts: 124
Re: Question about activate objects
« Reply #1 on: September 05, 2018, 06:39:17 PM »
Could you not just set up a prefab of an avatar with all of the potential equipment and your FSM attached, then use a pooling system to hold the maximum number of avatars, then when one should be spawned pull it from the pool?

You'd only need to set up the avatar once.

You could also store all of the objects that need to be toggled on and off in an array, then you only need to find the correct index to pull up the correct item rather than converting strings etc.

Lets say you have a sword at the 4th slot of an array and the way you select the weapon is by clicking a GUI element, you could set it up so when the button is clicked it sets an integer on the highlighted avatar to "3" (the 4th item in the array) and then sends an event to that same avatar that makes it enter a state that gets that integer and applies it as the current item.

Sorry if this is a bit of a messy explanation but the request is a bit broad. Basically I'd setup one avatar completely and setup an array of the items (array actions or arraymaker actions), then pool it, then pull from the pool to spawn avatars (Playmakers new pooling system or PoolManager actions), then have GUI elements send instructions to each avatar when required (UI actions).

cleave

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Question about activate objects
« Reply #2 on: September 05, 2018, 08:29:36 PM »
Thank you for replying this. It sounds really helpful but a little complex for me.

So...en...What should I do step by step? Complete Weapons attached by a character prefab? Pooling system and array maker for next step? I am really appreciated if you could explain a little bit more.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Question about activate objects
« Reply #3 on: September 05, 2018, 10:45:06 PM »
Hi
If the Characters are players (not AI) pooling is not a good option.
But arrays are.

If the character have a few different equipment its ok to have then already set on the character and disable/enable the required weapon.

If there are many equipments then :
For a Player :
have an array to select from prefabs inside your project folder (probably best in resources folder)
and create the object on the player.
For AI
Have a pool for each equipment part.
You can use an array string to access equipment pools by name.

If player and AI use the same Equipment you can use pools for both.

There are 2 different array systems, one is the official, included actions.
and then there is Array Maker

Array maker is a bit more advanced (meaning you can do more things with it) than the included ones.
One big advantage is that it uses References which makes it easy to access from any Game Object/Fsm.

Pooling works similar as create/destroy but when reusing objects, create/destroy is bad for performance.

PlayMaker will have its own pooling system soon, and when it is 'Live' i will make some tutorial videos for this.

for now you can use Pooler ( you can find it on the Ecosystem)

Here are 2 videos about arrays and Array Maker :



Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Question about activate objects
« Reply #4 on: September 06, 2018, 01:09:41 AM »
Arrays via arraymaker all the way!
Available for Playmaker work

cleave

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Question about activate objects
« Reply #5 on: September 06, 2018, 01:53:00 AM »
Hi
If the Characters are players (not AI) pooling is not a good option.
But arrays are.

If the character have a few different equipment its ok to have then already set on the character and disable/enable the required weapon.

If there are many equipments then :
For a Player :
have an array to select from prefabs inside your project folder (probably best in resources folder)
and create the object on the player.
For AI
Have a pool for each equipment part.
You can use an array string to access equipment pools by name.

If player and AI use the same Equipment you can use pools for both.

There are 2 different array systems, one is the official, included actions.
and then there is Array Maker

Array maker is a bit more advanced (meaning you can do more things with it) than the included ones.
One big advantage is that it uses References which makes it easy to access from any Game Object/Fsm.

Pooling works similar as create/destroy but when reusing objects, create/destroy is bad for performance.

PlayMaker will have its own pooling system soon, and when it is 'Live' i will make some tutorial videos for this.

for now you can use Pooler ( you can find it on the Ecosystem)

Here are 2 videos about arrays and Array Maker :



Yes, Thank you for your answer. You are absolutely right, which performance cost is the thing I am worrying about.

Actually the idea is very similar to Jagged Alliance mode. Characters could recruit betray or surrender, Which means these objects need to switch between player control and none player control. All characters have completely same objects, child objects,file hierarchy etc. The only difference is the mesh look.(Males Females etc.) Minimum 10 to Maximum 20 characters will display at the same time in total.

Is that the best choice by what you said? First of all, array maker. Secondly, Pooler or pooling in future? should I wait for the new one? When does it realize? I could wait if the new one would save more performance costs.

So... that' is everything you have mentioned, did I miss or misunderstood?

Cheers, dude

Doh

  • Full Member
  • ***
  • Posts: 124
Re: Question about activate objects
« Reply #6 on: September 06, 2018, 07:21:11 AM »
Ah sorry I took from the mention of a hundred characters that you might be doing something like Command & Conquer, if it's more Jagged Alliance then my suggestion about pooling characters is probably not a great place to go then. I should have gotten that from your mention of avatars.

Pooling will likely help with other reusable things though (AI, bullet decals, loot drops, sound effects etc).

Djaydino's approach sounds spot on.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Question about activate objects
« Reply #7 on: September 06, 2018, 11:56:40 AM »
Hi.
I will ask jean how near a 'release' is coming which will include pooling.

But you could play around with pooler already to understand how it works :)

cleave

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Question about activate objects
« Reply #8 on: September 06, 2018, 05:48:49 PM »
Ah sorry I took from the mention of a hundred characters that you might be doing something like Command & Conquer, if it's more Jagged Alliance then my suggestion about pooling characters is probably not a great place to go then. I should have gotten that from your mention of avatars.

Pooling will likely help with other reusable things though (AI, bullet decals, loot drops, sound effects etc).

Djaydino's approach sounds spot on.

Fine, Very clear answer to let me know what pooling is. I am very appreciated, Thanks.

cleave

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Question about activate objects
« Reply #9 on: September 06, 2018, 05:51:41 PM »
Hi.
I will ask jean how near a 'release' is coming which will include pooling.

But you could play around with pooler already to understand how it works :)

Yes, you are absolutely right. By the way, how is Audio toolkit actions going, any news about that,dude?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Question about activate objects
« Reply #10 on: September 07, 2018, 06:42:51 AM »
Hi,

 PlayMaker Pooling is done pretty much, but will likely make it later in the update cycle. so I would not count on this for short terms.

 Bye,

 Jean

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Question about activate objects
« Reply #11 on: September 07, 2018, 09:14:51 AM »
In the more short term, pooler is available on the ecosystem (which is fairly basic). Also, on the asset store, there is Pooly, which is pretty great and has playmaker actions. He has some good videos to explain it.

https://assetstore.unity.com/packages/tools/utilities/pooly-professional-pooling-system-82941

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Question about activate objects
« Reply #12 on: September 07, 2018, 09:54:56 AM »
There's also Pool Boss, but each have their own weaknesses and strengths. Pooly is a bit stingy with Playmaker actions, and some of them aren't implemented well. For example, all of the actions miss "use owner" for despawning and spawning, so you have to get owner which is an action more in the state. Then there's "no other game object selected" warning when you are using referenced game object for the spawn point. There's no warning only if you drag and drop the object into that box, which is silly, and so on. Lastly, but not least important, is tht support is a bit wonky and sometimes you need to wait days for an answer from the dev, if you're lucky.

On the other side is Pool Boss, which has great actions, great support and overall works like a clock, BUT, it misses an important feature that Pooly has, and i'm quite astonished why something like that hasn't been impemented. You can have separate pools which are not filled until activated, which means you can have pooled items in different pools for first and second level, but you activate the second level pool when you get to the second level, thus improving loading and compiling times a lot. You can manually add items to the pool from array to achieve something similar but its nonsense. That's the situation, so choose wisely.

I hope Playmaker will address all those things, since Pooler actions are really too simple to be of much use for some advanced usage.
« Last Edit: September 07, 2018, 12:45:42 PM by krmko »
Available for Playmaker work

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Question about activate objects
« Reply #13 on: September 08, 2018, 02:33:00 AM »
Hi.
i have an older tutorial video doing that. myself i use rewired now (with a similar key select fsm)