Search Unity

Core GameKit! Pooling / Spawning / Combat

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

  1. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    Thanks for the tip! I'll look into killables - I didn't really since I had already implemented my own health/damage system so I thought I was covered. Having enemies just disappear probably doesn't work for me, but I may be able to leverage some of the functionality there in other ways. I'm a strange use case since I'm not spawning tons of stuff in my game, but CGK has still been a great tool to have.
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That's cool, you don't have to use the combat stuff from Killables. You can make them all "invincible" (there's a checkbox for that) and just use the despawn stuff if you want (and destruction options for Death Prefab etc, but you'll need to call DestroyKillable yourself if you don't use the combat features).

    Ideally you wouldn't want enemies to be stuck offscreen and try to set it up in a way that that never happens. But just in case, if they disappear instead of preventing a player from progressing occasionally, it should be "ok".
     
  3. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    When the Global Waves complete, then Core GameKit triggers "Game Over" and "Won" at the same time.
    Is it possible to prevent this and only get "Won" send by Core GameKit?

    I made a workaround by making the last Wave spawn an empty Gameobject which sends my own "Won" Event via Playmaker.
     
    Last edited: Jul 13, 2014
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    No. What are you trying to accomplish?

    The GameOver event in LevelSettingsListener tells you whether the player won or not (they might have just died), if that's what you need to know.
     
  5. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    To Win, the Player needs to eliminate all Enemies, Wave by Wave. Now when the last Wave is done and all Enemies killed, Core GameKit sends "Won" and "Game Over" at the same time, but i only want "Won" send by Core GameKit, since the Player actually has Won by completing all Waves.

    edit
    Never mind, i got a better Workaround by Testing if Playerlifes are still >0 when my WAVE Listener receives the GameOver Event by Core GameKit

     
    Last edited: Jul 13, 2014
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Oh I didn't realize you were using Playmaker. So it looks like the "hasWon" variable doesn't come over with GameOver event if you are. It looks like you're set then.
     
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You can also check the "HasPlayerWon" property of LevelSettings through Playmaker's GetProperty custom action (if it works on static properties).
     
  8. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Great Idea! Sadly i can't get it via GetProperty but i am OK with my current solution.
    BTW it would be useful to have a Playmaker Action for manually start a specific Level/Wave!
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You can start at a specific level/wave (this part is already built), but you can't suddenly decide to skip from level 1 to level 4. That is on my list of things to add though.
     
  10. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    Hi, thanks for your well done packages.

    Using both of them, Core GameKit & Audio Master rises a itzy titzy tiny problem: UndoHelper.cs
    Your packages rely on different versions and on every Update i have to copy & paste them back together.
    Could you please merge UndoHelper.cs?
     
  11. Deleted User

    Deleted User

    Guest

    is there a way to get the killable to receive damage from an explosion force?, not a direct collision..I was trying to incorporate this into an existing project, when I had a Flak explosion that causes hit points on a radius * explosion force.

    The only way(I could think of) was calling the killable object in script and modifying the hit points there..

    can you incorporate that type of damage system?

    Just curious..

    Patrick
     
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I don't think there's a way to do that other than calling the TakeDamage method on the Killable with the number of damage points. Explosion force should have a collider that hits the Killable anyway, that's how I always do it.
     
  13. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I just tested on the newest version of both and I didn't see a compile error. Can you update both plugins (delete the entire DarkTonic, Core GameKit and MasterAudio folders first) and let me know if there's still a problem for you? Take a backup of your project first of course.
     
  14. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    Problem solved :)
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,128
    I just wanted to let all Core GameKit users know that the latest Behavior Designer release includes support for Core GameKit. I've created a set of tasks which allow you to control Core GameKit from within a behavior tree. These tasks are similar to the Playmaker actions already available. In addition, there is a small sample project available which should help you get started using these tasks.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Amazing opsive! Thank you for the support. We love your product.
     
  17. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    When i click(touch)-destroy prefab with killable script it doesnt add score :S
    I watched videos and made listeners but its always 0
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Did you add a World Variable Modifier for those Killables? Which script are you using for the click/touch destroy?
     
  19. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    My World Variable Modifier is Score like your examples. Its OK

    I dont use any extra script for destroy. I am using Killables MouseDown Event. (Despawn and Death Triggers)
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Actually it looks like the MouseDown checkbox only despawns the Killable, it doesn't "destroy" which would trigger the World Variable modifiers.

    I will change that in the next update, I believe that's a mistake on my part.

    In the meantime, you can turn off that checkbox and use the "ClickToKillOrDamage" script. It does "destroy" the Killable.
     
  21. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Thanks for the info :)
     
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Core GameKit V3.2.2 will be live in 5 minutes. Changelog:

    • Added a new Playmaker Custom Action: "CoreGameKitKillableGetCurrentHitPoints". Does exactly what it sounds like.
    • Now resetting the velocity of Killables when they die, if it's a gravity Rigidbody.
    • Changed OnClick and NGUI Click events in Killable to Destroy, not just despawn. So now you get the death prefab and World Variable modifiers.
    • Added section labels to Killable to make it more clear which triggers are for despawn and destroy events.
    • Fixed bug: Damage prefabs didn't spawn from zero damage on "per hit" Spawn Frequency.
    • Fixed bug: Damage prefabs didn't spawn when invincible set on "per hit" Spawn Frequency.
    • Added "Damage World Variable Modifiers" section to Killables, which are modifed each time the prefab takes a hit.
    • Changed Killable Listener ModifyingWorldVariables method to ModifyingDeathWorldVariables. If you have created any subclasses, you will need to change the method name accordingly. Playmaker action was also updated, so install the optional Playmaker package as well.
    • Added ModifyingDamageWorldVariables method to the Killable Listener.
    • Added Killable death time delay (for death animation to play). It's under the Death Prefab section.
    • Added Respawn Delay to Killables. Now you can have them respawn after X seconds.
     
  23. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Now World Variables On click/touch works for me. Thanks for the update.
    I have a new problem after update. It says
    There is no 'Rigidbody' attached to the "XXXXXXXXXX" game object, but a script is trying to access it.
    But in my scenario i dont need a Rigidbody. My object is 2d and if i add rigidbody when they spawn they touch each other and death before touch.
    I ask a lot of question but can we change the font or size off the variables on screen ? No info in documents
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    What line number gives you the error? Please paste the error from console here.

    I have no idea how to change the font color or size of the Unity GUI stuff. We never use those because they are dreadfully slow. If you have NGUI, then sure. You might ask about the Unity GUI things on the Unity support forum here.
     
  25. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
     
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    This looks like it is caused by the velocity resetting code in the latest version. However, I'm not sure that Killable combat will work at all without a Rigidbody. Does it?

    You can solve the "touching each other" problem by putting enemies in a different layer or tag and modifying the layer / tag filter in the Killable.
     
  27. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    I am testing my ideas and its simple Touch and eliminate enemies.. Now i have 1 spawner and it spawns 1 prefab. It starts spawning 5 enemy with different moving speeds. Before touch if they touch each other they are death. If i understand layers correctly i cant use it because i have only 1 enemy(prefab).
    + i got this error but it works on my device too. So it isnt a problem ?
     
  28. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    Hi Brian

    I have a couple of suggestions for future enhancements if you don't mind.

    I have been using PoolBoss to handle object management in my game and in some cases I am finding that I need to hold separate lists of object types that have been spawned.

    I wondered whether it would be possible for PoolBoss to provide convenience methods that could help?

    The first one I was thinking of was a method that could despawn all objects of a specific type/name:
    e.g. SpawnUtility.DespawnAllOfType(transform);

    The other one was a method that could despawn all spawned objects, which would help when resetting a level/scene.
    e.g. SpawnUtility.DespawnAll();

    Is this feasible / does it make sense?


    cheers,

    Nalin
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Core GameKit v3.2.2.1 will be live in 5 minutes. Changelog:

    • Added Immediation Actions row of buttons at the top of Killable's Inspector. Actions are: Kill, Despawn and Take 1 Damage. These do not appear or work in edit mode, only while playing.
    • Fixed bug with rigidbody2d used on Killable script expecting 3d rigidbody to reset velocity.
     
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I apologize for the late reply, I got no notifications.

    You shouldn't let "enemy layer" (whatever the name of your layer is with enemies) collide with "enemy layer" if you don't want that to happen. You can either set up that non-collision in the Physics dialog for Unity, or apply a layer filter in the Killable itself to only register hits from other layers.
     
    Last edited: Jul 26, 2014
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That sounds like a good idea and should be pretty easy for me to do. I'll put it on the list for the next update. Thanks!
     
  32. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    Excellent - many thanks!

    Nalin
     
  33. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Noob question.
    When i set 3 lives and lost all the lives it activates Game Over event spawners stop spawning. How can i track it with playmaker and when my lives is 0 ex: show gameover menu or texture ?
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Use the LevelSettingsPlaymakerListener script.
    1) Attach it to any GameObject with an FSM.
    2) Click on the LevelWaveSettings prefab in the Scene. There's a "Listener" field up in the top section.
    3) Drag the GameObject in #1 into the Listener field.
    4) Go back to #1 GameObject, select an FSM and state name to fire when "Game Over" event happens. There's also one for "Win".
     
  35. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Thanks jerotas it worked. You always answer my simple questions
    First i had a little problem. I used FINISHED state but it doesnt wait for Game Over. Than i changed to Mouse Over for testing and it worked :D
     
  36. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    The listeners start by sending an event. You shouldn't have a "finished" on the current state or it won't wait for an event and will move on to the next state.
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Just finished a cool new feature! For each level, you can now choose to play the waves in random order! This will be coming in the next update.
     
  38. Fahrettin

    Fahrettin

    Joined:
    Mar 10, 2014
    Posts:
    81
    Super team, super support !
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Core GameKit V3.2.2.2 will be live in 10 minutes. Changelog:

    • Changed Core Game Kit Killable Attack Or Hit Points Change (Playmaker custom action) to the name Core Game Kit Killable Attack Or Hit Points Add because the name was not accurate. If you were using this action, you will need to remove it and add again with the new name.
    • Added new Playmaker Custom Action "Core Game Kit Killable Attack Or Hit Points Mod", which can change the remaining hit points and/or attack points of a Killable.
    • Added "Wave Order" dropdown within each Level. Choices are "Specified Order" (the default), and "Random Order". If you choose Random, all waves within the Level will be randomly rearranged before the first wave starts. Note that starting on a Custom Start Wave of 1/3 will actually start on whatever the 3rd wave is of Level 1 after randomly ordering the waves.
    • Fixed bug where Killables colliding with another KillableChildCollision would not do combat (big bug).
    • Added demo version of Behavior Designer (with their new Core GameKit integration, which duplicates all the Playmaker custom actions) as an optional package. Their package requires Unity 4.0 or higher. Do not open it on Unity 3, it will crash.
    • Changed folder of 3rd party optional packages now we have a few different ones, to reduce clutter.
     
  40. twpeaks

    twpeaks

    Joined:
    Jul 9, 2014
    Posts:
    1
    hey jerotas! First of all, thanks for the awesome Core Gamekit! Works like a charm ( as far as i could tested it)
    I've run into some struggles integrating the gamekit into my actual game. what I'm trying to create:

    2 type of spawner:
    1) spawn on a invisible collision 2) "auto-spawn". setup for these are super easy, no problem. both spawners should have Elimination as a wave type ( -> this means, i killed all the spawned enemies = next wave, right?)

    so, the only part I'm struggling with (because my scripting skills are limited). I have my own health & weapon system, so when my 1 of my enemies is destroyed, I assume something i my c# code must be "activated" to tell the spawners/wave settings: "hey, hes dead, spawn some new bad guys :D" could you help me out with that?

    here is my health script for the enemies:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5.  
    6. public class Enemyz : EnemyzBase
    7. {
    8.  
    9.     public GameObject ExplosionPrefab;
    10.     public GameObject coinh;
    11.  
    12.  
    13.     int m_Health = 20;
    14.  
    15.     public int Health
    16.     {
    17.         get
    18.         {
    19.             return m_Health;
    20.         }
    21.     }
    22.  
    23.     Vector3 m_StartPosition;
    24.     Quaternion m_StartRotation;
    25.  
    26.     bool m_IsVisible = true;
    27.  
    28.  
    29.  
    30.     public bool IsVisible
    31.     {
    32.         get
    33.         {
    34.             return m_IsVisible;
    35.         }
    36.     }
    37.  
    38.  
    39.     void Start()
    40.     {
    41.  
    42.      
    43.     }
    44.  
    45.  
    46.  
    47.     public void DealDamage( int damage )
    48.     {
    49.         m_Health -= damage;
    50.      
    51.         OnHealthChanged();
    52.     }
    53.  
    54.  
    55.  
    56.     void OnHealthChanged()
    57.     {
    58.         if( m_Health <= 0 )
    59.         {
    60.             m_Health = 0;
    61.  
    62.          
    63.             Instantiate (coinh, transform.position, transform.rotation);
    64.             Debug.Log ("spawn coin");
    65.          
    66.             Destroy(this.gameObject);
    67.             Destroy(transform.parent.gameObject);
    68.  
    69.             /// SOMETHING GOODZ HERE FOR CORE GAMEKIT !?
    70.          
    71.         }
    72.      
    73.  
    74.     }
    75.  
    76.  
    77.  
    78.     void OnHeal()
    79.     {
    80.         m_Health = 50;
    81.         OnHealthChanged();
    82.     }
    83.  
    84.  
    85.  
    86. }
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    1) Spawn on invisible collision, that's probably supposed to be a Triggered Spawner, which has nothing to do with Level Wave Settings or "sequenced waves", and also has no elimination wave type, because there are over a dozen waves they need to track (for different events). There is this that you can call from code to advance to the next wave:

    LevelSettings.EndWave();

    However, the wave will automatically advance to the next wave if you have set up the previous wave as Elimination type, I believe...

    At least take that Destroy code out of your script and use SpawnUtility.Despawn. You should never Instantiate or Destroy anything for performance reasons.
     
    Last edited: Aug 1, 2014
  42. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Core GameKit V3.2.2.3 will be live in 10 minutes. Changelog includes many improvements to Pool Boss!

    • Pool Boss now automatically renames spawned prefabs with numbers, like "Enemy (Clone 1)" for easier debugging when the names aren't all the same.
    • Added max field to each Pool boss item. If you have Allow Instantiate More checked, this field is visible and controls the max that will be allowed to be created. Otherwise it is not used.
    • Added "Kill all" and "Despawn all" buttons to each Pool Boss item. Kill all will kill all of that game object active in the Scene, if it's Killable (otherwise no effect). Despawn all will return all active prefabs of that type to the Pool Boss and deactivate them.
    • Added "Kill all" and "Despawn all" buttons to top-level of Pool Boss (and to SpawnUtility.cs if you wish to script them). It's the same as the previous per-item button, but does it for all items at once.
    • Added new methods to SpawnUtility.cs: KillAllOfPrefab, DespawnAllOfPrefab, KillAllPrefabs, DespawnAllPrefabs.
     
  43. Cidstyles

    Cidstyles

    Joined:
    Jul 15, 2012
    Posts:
    5
    Hi

    First of all, thank you for your great plugins(well, I still can't use it properly but it does seem great ^^ )
    In the beggining I bought this only for the spawner system, wich work perfectly.. but now that I looked at the other possibilites, I might use this for more than expected..

    Now, my questions are:

    _How to add a coin pick up system using the killable script(or other method..)?

    _I want the coin to reappar some other place once collected(like the Snake game), As it should have maximum 2 coin at same time on the screen, (1 show first, then the other 1 second later, until collected) How can I manage to spawn another piece each time 1 coin is collected?. (again, exactly like the snake game)

    Thx for your answer and sorry if my english seem weird(It's not my native language ^^)
     
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You can either place the 2 coins in the Scene, or have them spawn from spawners.

    Use Killable script for pickups like coins. Use zero attack points so they don't hurt the player. Killable script has a respawn settings section. You can make them respawn after X seconds after you collect them. However they will reappear in the same location they disappeared from unless you set their Respawn Location via script (or Playmaker).

    You should change the Respawn location each time they are spawned.
     
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    The cool plugin AI for Mechanim has just added support for Master Audio and Core GameKit too! Now you have several choices for your no-code programming with our plugins! Playmaker / Dialogue System / Behavior Designer / AI for Mechanim / built-in Dark Tonic rich scripts!

    Enjoy :)
     
  46. Cidstyles

    Cidstyles

    Joined:
    Jul 15, 2012
    Posts:
    5
    Thank you for your quick answer!

    I already make them spaw using the spawner, but once I collect them, no respawn.. I checked the respawn settings but wether it's on infinite or set number(whatever number), it won't respawn :(
    I did'nt modify "damage prefabs" or "death" settings, should I do something there?
     
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Respawn settings should work regardless of damage or death settings, but just for kicks go assign a death prefab (an explosion or something) and see if it respawns. Note that it will only respawn in the same location it initially spawned from (unless you set the respawn position property via code), so it actually might be respawning instantly, and you're picking it up again instantly before you can even see it? Try putting a delay on the respawn and Log the events from the Killable to tell what it's doing if it's too fast.
     
  48. Cidstyles

    Cidstyles

    Joined:
    Jul 15, 2012
    Posts:
    5
    Thank you

    Okay, I will try this once I am back home.
     
  49. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    Hi, i have (another) couple of questions.

    Code (CSharp):
    1. public class WaveSplinePatternListener: WaveSyncroSpawnerListener
    2. {
    3. [...]
    4. public override void WaveStart(WaveSpecifics spec)
    5. {
    6.         Debug.Log("spec.SpawnLevelNumber " + spec.SpawnLevelNumber);   // prints 0 on Level 1
    7.         Debug.Log("spec.SpawnWaveNumber " + spec.SpawnWaveNumber); // prints 2 on Wave 3
    8.  
    9. SetMySpaningPatternTo(spec.SpawnLevelNumber, spec.SpawnLevelNumber);
    10. }
    11. }
    Is this a counting problem or meant to work like this?

    I am trying to spawn a mirrored object for each spawned one, immediately in
    Code (CSharp):
    1. public override void ItemSpawned(Transform spawnedTrans){
    2. spawnedTrans.AddMyBehaviour();
    3.  
    4. }
    How can i make the Spawner spawn it? I tryed SpawnUtility.Spawn but i got into trouble with the SpawnTracker. Also spawner.SpawnOneItem() doesn't give acces to the spawned item so that i could and the pattern behaviour for Level/Wave (and causes to loop if called in ItemSpawned).

    I'd like to add custom (complex) spawning patterns to waves, for instance wave 1 pattern A, wave 2 pattern B and wave 3 pattern A.
    What would be the way to add this custom level/wave information for spawning behaviour?
     
    Last edited: Aug 9, 2014
  50. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Question 1, yes it's supposed to work like that. It's zero-based. The UI shows you 1-based because non-programmers are used to it. Just add 1 for any display stuff to the player.

    I don't really understand what the other thing is you're trying to do. Please re-explain. It looks like you want to add a script to the spawned object at runtime. Why don't you just put that script on the object prefab?
     
    Binary42 likes this.