Search Unity

Core GameKit! Pooling / Spawning / Combat

Discussion in 'Assets and Asset Store' started by jerotas, Jan 27, 2013.

  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    If you turn that off, then later after you change your World Variable, you can start the waves with the following code:

    Code (csharp):
    1.  
    2. LevelSettings.UnpauseWave();
    3.  
    And then your Active Mode for any Spawner set up to use Level 1-1 would work.
     
  2. c6u2

    c6u2

    Joined:
    Nov 15, 2013
    Posts:
    31
    Oh thank you very much for help,and how can I change the World Variable by code?
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    From the Readme, World Variable section:

    Code (csharp):
    1.  
    2. var variable = WorldVariableTracker.GetWorldVariable("yourVarName");
    3.  
    4. variable.CurrentIntValue = 45; // or CurrentFloatValue for a float!
    5.  
     
  4. c6u2

    c6u2

    Joined:
    Nov 15, 2013
    Posts:
    31
    Than
    Thank you:)
     
    jerotas likes this.
  5. c6u2

    c6u2

    Joined:
    Nov 15, 2013
    Posts:
    31
    Hi jerotas:
    I want use custom event like the example 4 and my setting:
    1.
    1.jpeg
    2.
    2.jpg
    3.
    3.jpg

    Why there is nothing happened..Thank you for help.
     
  6. c6u2

    c6u2

    Joined:
    Nov 15, 2013
    Posts:
    31
    I found the setting("Auto Start Waves") must be checked Through debugging.But the setting panel is very confusion for the "Use Global Waves",because checked it means using "Syncro Spawner"and not checked it means using Trigger Spawner instead of Syncro Spawner",and the setting("Auto Start Waves") is be hided and it also effect the Trigger Spawner!
     
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You have "Game over behavior" for the Triggered Spawner set to "disable". So if you have "use global waves" checked in Level Settings but don't actually have any global waves, or reach the end of the global waves, at that point "game over" is triggered and your Triggered Spawners won't work any more.

    But if you uncheck "use global waves" because you're not using global waves (syncro spawners), then this problem will not occur.

    You also can set Game Over Behavior to "Behave as normal" to get around this.

    If you do have Global waves but don't want to auto-start them, then set "Wave pause behavior" to "behave as normal" to get around that.
     
  8. c6u2

    c6u2

    Joined:
    Nov 15, 2013
    Posts:
    31
    As you say it is.The problem is because "Game Over Behavior" and "Wave pause behavior". Thank you!
     
    jerotas likes this.
  9. JesterMaster

    JesterMaster

    Joined:
    Oct 29, 2014
    Posts:
    34
    Hi

    I have problem with spawned enemies.

    If I use multiple spawnes for example 5 and spawn 1 enemy in each of them, all them become really slow and stupid. They can not follow the player and get stuck in every corner etc.

    If I just make one spawner and spawn there 20 enemies they stay smart and have no problems to follow the player and kill him.

    Why my enemies get stupid when I spawn them with multiple spawners, but keep them smart if I just use one spawner?
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You probably will need to send me an example project so I can see the problem.

    I'm not sure exactly what you did in that Scene.
     
  11. JesterMaster

    JesterMaster

    Joined:
    Oct 29, 2014
    Posts:
    34
    Hi

    I just noticed that the problem is not the spawners. I get the the same problem if I spread the enemies manually through my scene. So multiple enemies in one group keeps them smart but spreding them around scene makes them stupid and get them stuck. This must be unitys nav mesh agent problem.
     
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We're not using any Nav mesh, have you added that?

    One thing to look into is that each Custom Event has a optional setting to notify only "Listeners within X Distance" instead of all Listeners. You may have turned that on.
     
  13. JesterMaster

    JesterMaster

    Joined:
    Oct 29, 2014
    Posts:
    34
    My AI is using this navmesh. I just use this asset to spawn the enemies around the scene. All of them have a navmesh agent and when the scene is complex this navmesh agents starts to lag when it calculates new paths when there is just couple of enemies around the scene.

    I managed to fix it. Now I activate the navmesh agent only if the enemy has seen my player and starts to hunt me. So all the enemies that are idle state dont have this navmesh agent activated and no more lag.

    Core GameKit works just perfect :)
     
    jerotas likes this.
  14. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Hi Brian,

    I am looking for something to change the weight of the items in the prefab pool,based on the world variable parameters.

    e.g. for medium/difficult game setting the weight of tougher enemies can be increased making them appear more thereby resulting in tougher enemy wave on increased difficulty levels.

    Or is there any existing settings which i can use the achieve the desired results.

    Thanks.
     
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes, on the "weight" field of the prefab pool item you can choose "Variable" instead of "Self" and pick a World Variable. Note that the value of the World Variable is only checked each time the pool is filled up (after emptied and on initial creation).
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Master Audio and Core GameKit are now on sale for half off! Pool Boss is also FREE for a few days, so grab it while you can!
     
  17. c6u2

    c6u2

    Joined:
    Nov 15, 2013
    Posts:
    31
    Yeah,I bought them on sale:D.
    Hi jerotas, I use the custom event and trigger spawner to spawn enemy,and the enemy will chose a way to walk. When the enemy die it will respawn by the pool boss. I want to know how Let the enemy know which spawner let it respawn, because the enemy will respawn by another spawner instead of original spawner. I want to let it chose another way closer to the spawner.:)
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Things spawned by Triggerred Spawners don't know where they came from. Only Syncro Spawners have that ability. But if it's a Killable you're spawning, there's a

    SpawnedFromObject

    property on the Killable you can use.
     
  19. c6u2

    c6u2

    Joined:
    Nov 15, 2013
    Posts:
    31
    I can't use the Syncro Spawners... So may be there is the only way When the enemy spawned from the Triggerred spawners it get the nearest spawner by compare with distance...and then chose the right way to walk...
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    As I said, just grab the SpawnedFromObject property of the Killable component on whatever you're spawning from the Triggered Spawners. I never spawn anything without it being a Killable.
     
  21. c6u2

    c6u2

    Joined:
    Nov 15, 2013
    Posts:
    31
    Finally I make my class extend from the killable.cs. And the code in Triggerred spawners get effect. But may be the killable should be interface instead of class. I try to avoid using killable's property in project because I need to control the spawned object's property use my own code.:p
     
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You can control them and use Killable at the same time.No, an interface would be no good.
     
  23. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    320
    Hi @jerotas

    I'm making a 2D top down shmups. I want to apply the knockback effect to objects the player is shooting at, but I don't want the object constantly to fall down. Any workarounds? Why do we actually have to enable gravity though for the knockback to happen?
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    It needs gravity because that's how you tell Unity that it's a physics object. There's an option on the rigid body to lock certain axes (x\y\z). You might try those.
     
  25. bizfu

    bizfu

    Joined:
    Apr 19, 2014
    Posts:
    3
    I started getting this message and can't figure out how to debug it.

    IndexOutOfRangeException: Array index is out of range.
    PreviewLabs.PlayerPrefs.Deserialize () (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Utility/PlayerPrefs.cs:239)

    Any Idea what might cause this or how to go about debugging it?

    [EDIT]
    I recently upgraded to unity 5.3.0f4 from 5.2 and updated Dark Tonic plugins Master Audio and Core Game Kit to the latest also. Based on your suggestion, I deleted and re-installed Dark Tonic plugins. I am still getting the error, but have followed up through the Dark Tonic support email with more detail. Any additional help there would be appreciated.

    Thanks!
    -bizfu
     
    Last edited: Dec 16, 2015
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I haven't got that one for a long time. I think maybe deleting and reinstalling the plugin may solve it.
     
  27. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    V 3.2.6.4 changelog:

    • Now 2 versions of the Visualized Wave Item icon. One for disabled game objects (blue) and one for enabled (light gray).
    • UndoHelper moved into the DarkTonic.CoreGameKit namespace to avoid naming conflicts with other plugins.
    • Fixed error when dealing 1 damage to Killable from Inspector button.
    • Fixed compile errors on Unity 5.3
    • Added new World Variable code to support oldValue and newValue in the Listeners.
    • Updated optional packages for NGUI, Playmaker and TextMeshPro to compile with new World Variable changes.
    • Fixed compile errors for Unity 4.7
     
  28. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    saw your upcoming game, looks fun. Does this mean you might be incorporating networking to CGK soon (i.e. coop)?
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes, we will have beta optional Photon-enabled switch code for a later version :) It lets PoolBoss work on multiple clients for pooling on networked games and other things automatically work multi-player.
     
    Tinjaw and 99thmonkey like this.
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Core GameKit V 3.2.6.6 has been submitted to the Asset Store. This is a big one! Changelog:

    • Added optional Custom Wave Classes feature (for your own use, no base implementation) to classify Global waves as whatever you like - you specify the names. Useful to display custom icons per wave or other things.
    • Added property drawer for Custom Wave Classes. Decorate a string variable with CoreWaveClassAttribute to use it.
    • Fixed bug where changing the Prefab To Spawn in a Syncro Spawner wave would not update the visualization, if enabled.
    • Fixed bug where Recycle Oldest didn't work properly in PoolBoss.
    • Fixed bug where "Add to PoolBoss" had Inspector error when no LevelWaveSettings game object is in the Scene.
    • Fixed bug where TriggerEnter2D wave didn't spawn correctly on Triggered Spawners.
    • Added a "prefab icon" in Pool Boss so you can navigate to the prefab in Project View even when the Pool Item is collapsed.
    • Added a "New Item Category" dropdown above the drag area for Pool Boss so you can choose what category new items are created in when you drag them in.
    • Added fix for PoolBoss. Previously as pooled prefabs created the inactive clones during Awake, anything with a NavMeshAgent might log a warning about "NavMeshAgent not close enough to NavMesh". Now this is fixed, but make sure you turn off the NavMeshAgent component for each pooled prefab. PoolBoss will detect if it is there and enable it whenever it spawns.
    • Added ability to despawn all / kill all in Pool Boss Inspector for a single category.
    • Revamped Pool Boss Inspector. Now looks like the other custom Inspectors. Added a spawned prefab count widget at the category level for quick visual feedback.
    • Added PoolBoss.CategoryItemsDespawned and PoolBoss.CategoryItemsSpawned methods for programmers to use to get counts of items in a single category.
    • No longer displaying a "Kill All" button for a Pool Boss item if Killable is not on that prefab.
    • Added Inspector alert when having 2 wave settings of the same level / wave in syncro spawner. This is not supported and currently you had to click play to get an error in the Console.
    • Added LevelEnded method to LevelSettingsListener and PlaymakerLevelSettingsListener. Called when the last wave of a level is completed.
    • Added option for Wave Offsets in both spawner types to be chosen randomly or used in order. Defaults to the original setting of random.
    • Re-added missing methods to PoolBoss that were erroneously deleted in the last update.
    • Fixed bug in Unity 5.X where a Killable that takes lethal damage will only battle with a single other Killable even if it hits multiple at the same time.
    • Fixed bug where sometimes uGUI clicks would not work when using Triggered Spawner on that element.
    • Prefab Pools, where used, now have a gear to take you to them to edit / inspect.
    • Added a way to use less than all spawners for global waves (random 1-X spawners).
    • Make all prefab fields tell you when something is not set up in Pool Boss with option to add it with X copies in a category of your choice.
    • Buttons in LevelWaveSettings to refresh all / hide all / disable all Visualized waves from both spawner types so updated prefabs will have the correct clones when spawned prefabs were changed after the last visualization.
    • Added Visualize Wave and Hide Visualization buttons next to each Custom Event in the LevelWaveSettings Inspector. Will rebuild all clones of everything spawning from that Custom Event.
    • Changed some WorldVariable code to allow oldValue / newValue. To fix compile errors, please re-import all 3rd party plugin packages included in CGK if you use them.
     
    Tinjaw, julianr and danreid70 like this.
  31. istmo

    istmo

    Joined:
    Mar 5, 2015
    Posts:
    2
    Hello, I'm having this issue:

    Quite often, a clone doesn't spawn properly from the Pool Boss. I can't see it in Play Mode. Still it's counted in the Pool Boss inspector, but seems to overflow the Preload Quantity limit. If I click the yellow button [5/105 Spawned] it's shown in the Hierarchy as inactive, as you can see in the following pictures.

    1.jpg

    2.jpg

    3.jpg

    As soon as I active one of this missing clones, it's despawned, but the new max value in the Pool Box keeps unchanged (105 in this case).

    I'm using Triggered Spawners, with Global Waves disabled. Auto-add missing items is disabled as well.

    What could be happening here? Any idea?

    Thank you!
     
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Sorry, but this is the first report of this happening. I have no idea how that could happen. We use Pool Boss extensively and have never had this problem. Could you please email us with a sample project that reproduces this bug?

    Or you can email us with your Asset Store invoice PDF and we'll send you the most recent version of CGK so you can check if it's resolved first (not approved yet by Asset Store).

    You are on the newest version that on the store though right? Are you sure there's no Playmaker action or your own code that is setting the game object to disabled (getting around Pool Boss)? That's the only possibility I can think of.
     
  33. UsernameZero

    UsernameZero

    Joined:
    Feb 19, 2015
    Posts:
    29
    Hey all I was wondering if anyone knows if Core Gamekit is compatible with PUN, my game is VERY simple but becuase PUN needs "PhotonNetwork.Instantiate", along with many others like that I was unsure if Core Gamekit would be compatible with it, about 99.9% of my game uses Core Gamekit (literally I only had to create 1 custom script so far xD) so it will be a huge pain in the butt if I had to create my own pools and spawners.
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    We are currently working on making it compatible. Right now, no.

    A few things you'd have to do:
    1) Make LevelSettings spawn things only on the master client.
    2) Make Killables only take damage on the owner.
    3) Either not use Pool Boss by changing Pool Boss to use Network Instantiate or hook it to the new IPUNPrefabPool functionality we had them add (which is a major PITA).
     
  35. UsernameZero

    UsernameZero

    Joined:
    Feb 19, 2015
    Posts:
    29
    Thanks very much for the reply, I'll try to make the changes you listed later on, it's great to know you're working on it I'm sure when it's fully compatible you'll see more people pick up Core Gamekit since it seems to be the only major feature missing! :)
     
  36. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Good to know! There is more to it than what I listed too, but it slips my mind.
     
  37. UsernameZero

    UsernameZero

    Joined:
    Feb 19, 2015
    Posts:
    29
    Just wondering if it's possible to "pause" syncro spawners using the API?

    I see
    Code (CSharp):
    1. LevelSettings.PauseWave();
    But I don't see anything for pausing/disabling specific syncro spawners.

    I'm sure I can always despawn prefabs as they spawn but that has to be very inefficient. :S
     
  38. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes, you have to pause all syncro spawners at once.

    The spawners have controls to disable them via World Variable range, so you could set a World Variable to a "disabled value" before unpausing. I believe they might not check the value at that point though. If it doesn't work let me know and I'll see if I can make unpausing a wave check for valid spawners again.
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    V 3.2.6.7 has been submitted to the Asset Store. Changelog:

    • Fixed bug: selecting a prefab with Triggered Spawner visualization turned on in ProjectView would spam the Console window and create top-level visualization objects.
    • Added RelationsInspector integration (free version included). Can view Killable chains and what global waves spawn what prefab. Both are launchable with context from the CGK Inspectors.
    • Moved icons in Gizmos folder into a new subfolder "CoreGameKit" so it's more obvious what they are for.
     
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    The new RelationsInspector stuff looks like this. Pretty exciting! Here's the Killable hierarchy view.

     
    Tinjaw, 99thmonkey and danreid70 like this.
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    And here's the Syncro Spawner view. These are both included by default, with the free version of RelationsInspector that comes with CoreGameKit!

     
  42. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    when I add sound to group
    it create out side the masterAudio.
    the new version is not good.
    waiting for fix it soon .
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I think you posted on the wrong thread (this is Core Gamekit) but that issue is already fixed and submitted to asset store. Please email support@darktonic.com with your invoice PDF and ask for v4.0.2 so you don't have to wait!
     
    Dawar likes this.
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Master Audio is part of the madness sale starting today and running through June 3rd! It's 60% off, for only $18. Perfect time to grab multiple copies as it hasn't been this inexpensive for over a year.

    Our other plugins Core GameKit and Pool Boss are also 60% off "just because". Have a great week!

    -All at DT.
     
    Last edited: May 23, 2016
  45. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    HI,
    Finally getting around to using Core Gamekit for a project, and getting my head around it.

    I can't figure out how to do the following though:
    I have a spawner at the top of the screen and one at the bottom.
    For an easy introduction wave I'd like to spawn them in sequence not in synch, so the top spawns, then the bottom, then the top etc until they are both finished. Like a sequenced wave between spawners, or a round robin.
    But in Level Wave Settings for a Wave settings you can only select "All Above" or Random Subset of spawners, no sequence.

    Is there a way to do this?

    ty!
     
  46. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    A couple ways to do it:
    1) You can do it by changing the spawner settings so that spawner #2 delays before it starts the wave, by the amount of time it takes spawner #1 to finish spawning its stuff.
    2) You can put spawner #1 in wave 1 and spawner #2 in wave 2. Set up wave #1 to be timed only, and the time should be equal to "time to spawn all" for that spawners. Spawner #2 should be timed for "time to spawn all" for spawner #2.
     
  47. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    ty
     
    jerotas likes this.
  48. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    In Killable Death prefab settings, how do I specify or get a sound to play in addition to spawning a visual effect prefab?
     
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Can't configure audio things out of the box without coding. We have our own plugin Master Audio that can do it for you with no coding though using the EventSounds script.

    If you want to code it, you can create a subclass of KillableListener, hook it to the Killable and override the DestroyingKillable method in the Listener and play a sound however you like.
    There's also Playmaker versions of the Listeners that don't require coding. If you use KillablePlaymakerListener, for each event in the Listener, you can point it to a Playmaker FSM and tell it which event to fire.
     
  50. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    I have Master Audio, and Node Canvas - which I also hope to use.

    Can't see anything in the guide about setting up Master Audio to use with CGK, did I miss it?