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
    yeah some of them will haha.
     
  2. elusive52

    elusive52

    Joined:
    May 14, 2013
    Posts:
    38
    yes i'd be glad to. i think i will be able to point out quite a few enhancements you could make to the playmaker actions.

    i dont suppose theres anyway you could send me a pm with the action asap? like i said, im pretty stuck without it and im swapping out now?

    you will go to heaven...
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Sure, here it is.
    View attachment $CoreGameKitPoolBossSpawn.zip

    It doesn't seem to want to download. PM me with your email address.
     
  4. elusive52

    elusive52

    Joined:
    May 14, 2013
    Posts:
    38
    yes it download fine and works perfectly! hows that for service. huge thanks!

    couple of things. on that action it would be cool to have (as welll as the vector3 option) the option to spawn from a gameObject. that way you can just drag an object from the scene onto the action or drag a prefab onto it and spawn from there, that has come in handy for me lots of times before.

    2. a select random object from pool action and store result in gameObject variable to spawn as and when you wish say using the normal core spawnaction. kind of like what i asked you for in the beginning, but with the store option this action would give you total control of the random object once spawned. because when you spawn from the method you showed me earlier its cool but not as much control.

    its late here so ill have another look tomorrow.
     
  5. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok, yes, you should be able to specify a Prefab Pool by dragging it in, instead of a prefab (#2).
    #1 you could already do with a couple more built-in Playmaker actions, this is just a convenience thing. I'll add both.
     
  6. elusive52

    elusive52

    Joined:
    May 14, 2013
    Posts:
    38
    man just looking through my project now and realized i use the spawn from gameObject transform loads lol, so if you add it can you post on here again. thanks.
     
  7. gshape

    gshape

    Joined:
    Aug 8, 2012
    Posts:
    104
    Core GameKit suits most of my case but I am trying to let one of the boss AI to spawn more enemies based on situation (e.g. distance between Boss and player is more than 10). Sometimes calling from code is easier. :)
     
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok that's a good use. I just wanted to make sure that you weren't writing code that wasn't necessary :)
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I added the other 2 things. Can't post here because it required modifications to LevelSettings.cs as well, which is one of the main files for the plugin. I won't post that for people to copy. Please email me at support@darktonic.com or wait for the next update.
     
  10. RobDaPraia

    RobDaPraia

    Joined:
    May 18, 2014
    Posts:
    9
  11. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    $2 is a steal! BOUGHT ! :D

    Now I am your best customer! (Being the customer of ALL of your products :D)
     
    Last edited: May 22, 2014
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Thank you bawss!
     
  13. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    I had a quick look, this is seriously a good kit, I don't know why this isn't getting the love it deserves from the community...
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    The screen shots in the store need many more...that's my only thought.
     
  15. jerotas

    jerotas

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

    • Updated Pool Boss Spawn Playmaker Custom Action with more options for prefab pool, game object to use position of, and more.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'm adding some functionality to allow Killables to respawn X times (or infinitely) instead of dying, from their original position. Pretty cool! It will be in the next update.
     
  17. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Heads up, we will be moving our default folder into the Plugins folder so that JavaScript users won't need to move things.
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
  19. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    False alarm, actually we're not going to move the plugin into the "Plugins" folder. It causes other problems with other plugins not in the Plugins folder. I would like to move it, but it's not worth the trouble for the smaller amount of JavaScript users unfortunately :(
     
  20. jerotas

    jerotas

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

    • Added Respawn section to Killable. You can choose to have the Killable respawn in its original spawn position instead of despawning when it dies - a set number of times, or infinite.
    • Bug fix: Now if Killable records zero point damage, it doesn't register on the Retrigger time or frame.
    • Bug fix: Setting Int or Float World Variable value directly didn't correct for negative values and won't fire "is game over". Now it does.
    • Bug fix: Race condition in Killable sometimes wouldn't kill Killable when its spawner was destroyed if you had turned that setting on.
    • Added lazy lookup of the cached Transform property in Killable to prevent errors in race conditions.
    • Added more overridable methods to Killable for subclasses, including DespawnThis, Despawned, and a cached lazy-lookup property of the Transform component.
    • Added optional "parent Game Object" to Pool Boss Spawn custom action, which will parent the spawned object under a parent Game Object you specify.
    • Added "end wave when opposite event occurs" checkboxes (that's not what they really say, they are labeled more coherently) for Triggered Spawner events, so for example: you can have the "visible" event stop when "invisible" triggers, regardless of whether you have an event configured for invisible.
    • Attention: your custom start level / wave settings will be wiped out from this version. Now we have made the custom start level / wave option in Level Settings able to use World Variables now.
     
  21. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    Hi Jerotas, I am using Unity 4.5 and the latest version of core gamekit.
    I encountered a bug with the collision using 2d physics where my player missile appear to hit the enemy (as the missile is despawned) but the enemy does not die. I have to spam missile until 1 of the missile successfully registered the collision and kill the enemy.
     
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    PrisonerOfLies, did this used to work pre-Unity 4.5? Also, are you getting any errors in the console window? Have you tried turning on the "Log Events" checkbox in Killable and noticed anything weird in the console? It should tell you why it's an illegal hit and things like that.
     
  23. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    It works pre 4.5 but with tons of errors which is fixed in 4.5 but now collision detection is bugged. I haven't tried logging the message, will do so when I am home
     
  24. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    I found out that the reason collision is sometimes registered and not is because of killable despawning race condition.

    After switching to normal physics (3D), the problem goes away lol.
    4.5 2d physics seems to work differently now.
     
  25. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    PrisonerOfLies, do you have details on the race condition?
     
  26. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    When the missile got despawned before the enemy can detect that it had collided. And vice versa
     
  27. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    PrisonerOfLies, can you tell me do the example Scenes in Core GameKit have this problem as well? I would think they would since it sounds like a similar setup.
     
  28. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    Seems like there is no prob with 3d physics
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Well I've confirmed the bug in Unity 4.5. I'm not sure if there's a way to fix it on our end. We may have to report the bug and wait for Unity for fix it :(

    Any suggestions on something I should try as a workaround?
     
    Last edited: Jun 4, 2014
  30. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    Oh alright, since the problem is in unity then i think i will stick with 3d physics for now, and wait for 4.5 bugs to be fixed.
     
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'll check to see if there's a way for us to work around it. Bad Unity!
     
  32. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    haha ok thanks
     
  33. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I've reported the bug to Unity using the example project you sent, PrisonerOfLies. Thanks! We're still trying to find a way to work around it, there may be one.
     
  34. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
  35. dabaq

    dabaq

    Joined:
    Apr 20, 2014
    Posts:
    14
  36. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    #1 - sure, you can add custom code or Playmaker actions to the "TakingDamage" section in the Killable Listener for that, to do anything you want.

    #2 - you can add whatever behavior you want to the things you spawn, including using the free version of Aren Granberg's A* Pathfinding, RAIN or whatever AI you like. None of that is included though.
     
  37. jerotas

    jerotas

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

    • Fixed all inspectors so that they don't require a Scene save unless a field is actually changed (most already did this).
    • Changed the labels of Killable Attack Points and Hit Points to "Start Attack Points" and "Start Hit Points" so it's more clear.
    • Now allowing negative attack points for Killable. That will allow you to increase the health on your player by pickup up drops automatically, and other such things.
    • Added "Max Hit Points" to Killable. This value can not be exceeded by gaining HP from collisions with negative hit points Killables.
    • Note: you will need to check and re-set the value of all your Killables' Attack points because I had to change the variable for negative hit points and they will be lost.
    • Note: you will need to install the latest Master Audio plugin as well if you use that to get it to compile again.
    • Note: you will need to delete and re-install the Core GameKit Playmaker package as well if you use that to get it to compile again.
    • Moved the Taking Damage listener point into the TakeDamage method in Killable. That method virtual and can use overrides.
    • Added a DamagePrevented method to KillableListener. This is called when your Killable gets hit while invincible.
    • Added an overridable method "IsInvincible" to Killable so you can subclass it and add your own custom logic if you like.
    • Added an overridable method "DetermineScenario" to Killable so you can subclass it and add your own custom logic if you like.
    • Added "band-aid" code to get around the new Unity 4.5 2D collision despawn bug. It has been reported fixed in the next Unity version but you don't have to wait now.
    • Bug fix: Keep Velocity variable for Death Prefab in Killable wasn't checked. It always kept the velocity.
    • Added "follow player" checkbox to Player Spawner. Previously it always respawned you exactly where you died. Now you can choose whether this happens or not. This defaults to off, which is the opposite of the old behavior.
    • Added "Update Spawn Position" method to Player Spawner. This way you can update the spawn position based on checkpoints or things like that.
    • Player Spawner now works if you already have a Player in the Scene, and won't spawn another one if you do until the player dies.
     
  38. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Fixed in the new version I just uploaded!
     
  39. dabaq

    dabaq

    Joined:
    Apr 20, 2014
    Posts:
    14
    Ah damn been saving up so i could buy your asset, but now it's 66% off and not 90% :( when did this happen?
     
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Early this week. You never know when the prices will change unfortunately.
     
  41. dabaq

    dabaq

    Joined:
    Apr 20, 2014
    Posts:
    14
    Ah well guess I have to wait for next sale then
     
  42. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    How does wave completion % work with multiple spawners? I have a wave that uses two different spawners, and spawns one enemy each. I'd like to move on to the next wave when one enemy dies. But both spawners have individual % settings. Does it matter if I set one or both to 50%? Thanks!
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    The wave completion percentage is for that spawner only. So having a wave of 1 with 50% completion doesn't make any sense. That means the wave is complete when you destroy 0.5 enemies.

    Are you sure you can't use one spawner with Incremental Settings to do the job of your two spawners? That way you could actually use completion %.
     
  44. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    Thanks. I figured that's how they might work.

    Re: Incremental settings - It'd be tough. Right now I have it set up with multiple spawners around my playfield since I want enemies to come in from prescribed places. What would be most useful for me is to have a global count of enemies per elimination wave and be able to set the percent complete there. I may look at hacking something like that in. In the short term, it's not a big deal.
     
  45. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    So I decided to go for it. Took a little more doing than I anticipated but I hacked up a solution. I added an int to the LevelWave data and linked it to a slider for Elimination waves (basically just copied the duration slider code and renamed variables).

    Then I saved off the max value of eliminationSpawnersUnkilled.Count for each wave when it's setup, and did the division between that and the current eliminationSpawnersUnkilled.Count to get the current completion percent. And lastly I just compare that to the LevelWave value in CoUpdate for the elimination case, and let it end if it meets the criteria.

    Maybe not the prettiest hack but it seems to do what I need. Let me know if you can spot any gotchas with that method. Thanks!
     
  46. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I don't think I fully understand (I'm a visual thinker) but let me know if it works for you.
     
  47. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    Ah sorry, got mired in details. Basically I just hacked up LevelSettings.cs to compare how many enemies you've killed to the total that were spawned for the wave. I do it in the CoUpdate coroutine, which seems to work.

    The issue for me is that I use up to 8 different spawners for each wave. Situations can arise where one last enemy gets stuck in a corner offscreen or something, and so for a pure elimination wave where you have to kill off ALL enemies, the pace of the game just dies. Since the enemy that's stuck might have spawned from any spawner, I need to be able to say "when you've killed 90% of enemies from the entire wave total, just move on."

    Pretty sure this is what this guy was asking for - http://forum.unity3d.com/threads/re...es-with-no-coding.167910/page-17#post-1567813

    Works well so far. Thanks a bunch for this plug-in. It's definitely been a time saver for me.
     
  48. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Well "stuck in a corner offscreen" - we already thought of that and you're apparently not using the feature :)

    Killable has a section called Death & Despawn Triggers, and there's a checkbox there called "Not visible too long". If you check it, then set a value for "Not Visible Max Time" to like 2 seconds or whatever. What will now happen is: if that Killable is spawned offscreen and doesn't come onscreen within 2 seconds, it will be despawned. So you don't need to destroy it.

    I urge you to use that as well. It's possible that you don't even need your hacks with it?
     
  49. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I'm loving it so far ^^ a couple of little extra things I think could help:

    -Respawn time delay. (Maybe I don't want the enemy to respawn immediately? But to wait a couple of seconds?)
    -Death time delay (Maybe I don't want the enemy to disappear and call it's exploding prefab pool immediately, but to animate death and stay on the ground a bit?)
    -Respawn Position change (What If I want my player to respawn from a check point? It'd be nice to be able to feed a Vector3 to the respawn)
    -Limit the colliders killable is checking, I can't use any triggers for other purposes as children of the killable because killable will think I want to get damaged there ><;
     
  50. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I've added respawn time delay to the to do list, I like it. I'll add Death time delay as well.

    You can change the Killable property "RespawnPosition" any time, and that's where it will respawn if you're using the Respawn mode. That's already in there, but it wasn't in the readme. Just added it :)

    Actually to limit the colliders is impossible via code or layer configuration. Child colliders and triggers automatically connect with the parent collider if they don't a rigidbody of their own. And this is how making complex colliders is possible. So if you want child colliders to not register additional fake combat hits, you have to give them their own rigidbody. Usually this would be a kinematic one, and you're not going to change its position anyway. I have added the following to address this in the readme (below).

    Note: If you have child objects under a Killable that have their own triggers or colliders, this can cause unwanted "combat hits" to occur from colliding with the other child triggers. To prevent this, give the child collider Game Objects a Kinematic Rigidbody.
     
    DanielSnd likes this.