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
    Killer Waves is now on sale for $20 since we were not able to finish the 3.0 release this week. It will be out soon though and full pooling is included!
     
  2. ddfire

    ddfire

    Joined:
    Dec 22, 2010
    Posts:
    53
    Is there any way to define the waves at run time?
    I know how many spawners i will use but not the waves and its elements.
    Any info?
    Thanks
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You can subclass the spawner and override the GetSpawnable method to tell the spawner what prefab you want to spawn. Any other properties you want to override?
     
  4. ddfire

    ddfire

    Joined:
    Dec 22, 2010
    Posts:
    53
    from WaveSyncroPrefabSpawner
    Code (csharp):
    1. protected virtual Transform GetSpawnable(WaveSpecifics wave) { 
    2.         if (wave == null) {
    3.             return null;
    4.         }
    5.        
    6.         switch (wave.spawnSource) {
    7.             case WaveSpecifics.SpawnOrigin.Specific:
    8.                 return wave.prefabToSpawn;
    9.             case WaveSpecifics.SpawnOrigin.PrefabPool:         
    10.                 return wavePool.GetRandomWeightedTransform();
    11.         }
    12.        
    13.         return null;
    14.     }
    docent look very friendly...
    in any case what i should do whit the new subclass?
    thanks!
    maybe create waves at runtine? or that will be harder?
    thanks for the fast replay
     
  5. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You can subclass that class, override only the GetSpawnable method, copy what's in the base class, and just modify the part with the switch statement to do whatever logic you might need to determine what prefab to spawn. That's all. Very short subclass.

    Mostly Killer Waves is aiming to make it so you have to code nothing, or just an occasional Listener method or two. However what you are asking for would definitely require code.

    I don't think there's a way to currently create a wave from code. Would you want to use a Syncro spawner or a Triggered spawner?

    Actually, tell me your scenario and why you wouldn't know what the wave will contain up front, and I'll tell you if there's some other way to do it with what we currently have. There's often more than one way to do lots of things with this package.
     
    Last edited: Jan 20, 2014
  6. ddfire

    ddfire

    Joined:
    Dec 22, 2010
    Posts:
    53
    Yes, both... it will start syncro, but if player do some stuff like have more than X amount of life for seconds i will trigger some spawners


    I MUST (it is beyond me) use some AI or AI like to make the waves.

    Thanks!!!
     
  7. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Syncro Spawners need to have everything defined up front, although you can skip waves based on player life amount and things like that. Also, every spawner value (number to spawn, time to spawn all, etc) will be assignable to a variable which you can change lots of ways, in V3.0. Prefab Pools also can hold items that are active or not based (and their weight, in V3.0) on a variable. Would any of those conceivably work?

    If not, this would be a new feature request.
     
  8. ddfire

    ddfire

    Joined:
    Dec 22, 2010
    Posts:
    53
    Hi,
    Ok is a new feature request :D
    Be able to make waves at run time like Wave.addPrefab(prefab,index); or wave.addprefab(prefab) and it is added at the end.
    then spawner.addWave(wave)
    Thanks!!!
    David
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Got it. This isn't at the front of the queue, but it's on the list. I've got a half dozen features in front of it. Thank you!
     
  10. ddfire

    ddfire

    Joined:
    Dec 22, 2010
    Posts:
    53
    Half dozen is six, at the amazing current rate of upgrades i will be using Wave.addPrefab at the end of the next week :D
    Amazing as always
     
  11. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    I've been camping on this page for dayyyys now! I can't wait for V. 3.0!! I really need that pooling!
     
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Hold tight, it's only a matter of days. We want to make sure the changes don't break anything we don't know about!
     
  13. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Now that I'm re-reading this at home - you need to realize that waves don't hold a series of prefabs. They hold only one of two things:

    1) Spawn a particular single prefab for the whole wave, X times

    or

    2) Spawn randomly from a Prefab Pool, which can contain any number of weighted prefabs, X times.

    We could possibly make one or both of these scriptable, but if these won't do what you want, let me know and we'll have to think some more. I don't want to spend time making these scriptable if it's not really useful to anyone.

    In any case, there wouldn't be a Wave.AddPrefab method, only a SetPrefab method...
     
  14. ChrisMaster

    ChrisMaster

    Joined:
    Dec 27, 2013
    Posts:
    87
    Hi Jerotas, I am thinking about buying your asset, I cannot find information does asset contains simple enemy AI? (movement, shots and so ?)

    Thanks for answer
     
  15. dreamlarp

    dreamlarp

    Joined:
    Apr 22, 2011
    Posts:
    854

    What we did for this was set flags for waves. We have some waves that will not activate and ones that will by what the flag is set to. Working with the Dialog system you can have a wave spawned just the way you need it by what the Dialog systems flag is sent.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes and no. The scripts are just to "move forward" and rotate. Very very simple. Some of our users use the Unity animation window to create enemy "swooping" behavior.
     
  17. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    I am implementing triggered spawners,with on triggerEnter event.
    After the wave has been successfully launched the spawner is repeating the wave even though i have kept retrigger mode as NONE(Is this the correct behaviour???).So in order to overcome this i set despawn this to true,on seeing the line 1037 of triggeredspawners.cs,it should despawn the object after the spawning wave item count.But it's removing the spawner after first object spawn only :( :(

    Also,there is a cap of 50 seconds to spawn all items in this case,can this caped value be increased?

    Please suggest on this scenario implementation of triggered spawner.

    Thanks.
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I can change the 50 second count. Maybe go to 1000?

    Don't use "despawn this" for your scenario.

    Was the wave repeating because you have "Repeat wave" turned on for TriggerEnter? Or was the Trigger Entered multiple times, each triggering a wave? I believe the Retrigger field is called Retrigger Limit, not Retrigger Mode. None means "no limit" - it can retrigger (and spawn another wave) the very next frame if the trigger is entered again. Sometimes Unity may fire off a TriggerEnter event from the same collision several times in one second - probably a Unity bug. To get around this, set Retrigger Mode to "time" and put 1 second, or the number of seconds of your "time to spawn all". This will prevent a TriggerEnter wave from being created for X seconds after one is started.

    Let me know if that works for you.

    Also should we add a "disable after single trigger" setting to totally disallow a future triggered wave?
     
    Last edited: Jan 22, 2014
  19. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Its a kind of rts where different units are passing/entering,the spawner trigger again and again as they advance in the map.This might be causing the same trigger to spawn again/again as Retrigger Limit is set to None.
    It will be the ideal to have an option for,disabling the spawner after it has triggered it's set wave.

    In future if possible add wave completion bonus(World variables) to triggered spawners also :)

    Thanks.
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok I will add a Retrigger Limit of "Disable after First".

    As mentioned before, Triggered Spawners can not have the concept of elimination waves, so we can't do wave completion bonus exactly the same. We did add "wave spawn bonus" there, which is similar. I'm not at my desk so the name might be slightly off. It changes World Variables either when the triggered wave starts or finishes spawning, I forget which.

    Will that work?
     
  21. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Core GameKit (renamed Killer Waves) v3.0 is live! Humongous Changelist:

    • Breaking Change: Rename your "KillerWaves" folder under the DarkTonic folder to "CoreGameKit" before upgrading.
    • Breaking Change: Playmaker custom actions have all been renamed, so don't re-import the Playmaker package if you don't want to lose all your old Killer Waves custom actions.
    • Breaking Change (if anyone was using it). World Variable Resetter script removed. You now use the normal LevelWaveSettings prefab on a main menu screen instead to do what it did. The Readme section has been updated with instructions on how to do this. It's less confusing this way and less to learn.
    • Updated UI with buttons and collapsible sections similar to Master Audio. Cleaner and more polished now.
    • Added "KillerInt" support to Killables. Now for any integer value in that inspector, you can either specify an integer or tell it to use a World Variable value. Warning, this will delete any non-default values you had in these fields.
    • Added "KillerFloat" support to Killables. Now for any float value in that inspector, you can either specify an integer or tell it to use a World Variable value. Warning, this will delete any non-default values you had in these fields.
    • All variable modifier collections can now specify another variable as well as a number.
    • These Killer Int / Float and total refactoring will mean that you will lose almost every integer and float value you have specified, so it's best to start from scratch after upgrading, or re-enter all variable modifiers and values. I give very detailed errors on invalid World Variables specified everywhere upon clicking Play.
    • Added dropdown for variable modifications, choices are add (the default), set, subtract and multiply.
    • Fixed compile errors on Unity 4.0 - 4.2 from Unity 4.3 2D additions
    • Fixed bug where World Variable Listeners didn't show the initial value.
    • Fixed bug where elimination waves would repeat endlessly when repeat was on.
    • Fixed bug where elimination waves set to repeat until a World Variable is above / below a certain value would instead only do the "number of repetitions" you specified before switching to that mode.
    • Fixed bug where 1-2 prefabs would spawn from a disabled syncro spawner.
    • Now clicking on the Core GameKit graphic banner in any Inspector will take you to to the LevelWaveSettings prefab in the Scene.
    • Added "keep center" checkbox for spawner Incremental Settings. That will make sure half go to the left and half to the right.
    • Removed Playmaker Custom Action KillerWavesWorldVariableChangeValue. Please delete this from your project if you already opened the Playmaker optional package.
    • In its place, we added 6 Playmaker Custom Actions. KillerWavesVariableFloatSet, FloatAdd, FloatMultiply, and the same 3 for Integer variables.
    • Added Spawn Rotation Mode to both spawner types (Killable already had it). Options are: use prefab rotation, use spawner rotation and custom rotation. Note that any random rotation options in the spawner will happen after the spawn rotation mode is used as a root.
    • Added wave repeat bonus variable modifiers section to syncro spawners.
    • Added wave spawn bonus variable modifiers section to Triggered Spawners. Optionally you can have each repetition of the wave (in the repeat section) trigger the modifiers again.
    • Modified World Variable listener to support float and int. Added fields for "use commas" and number of decimal places to display.
    • Updated NGUI optional package with World Variable changes.
    • Prefab Pools now show during runtime the number of each item still in the pool.
    • Added ability to change World Variable value during runtime.
    • Added list of Syncro Spawners with settings icons on them in the Level Settings prefab.
    • Added list of Prefab Pools and World Variables with settings icons in the Level Settings prefab.
    • Added "Pool Boss" section under LevelSettings for PoolManager - type object pooling (this avoids Instantiate and Destroy calls). Uses OnSpawned and OnDespawned events, same as PoolManager!
    • Added Character Controller support to Killable.
    • Fixed endless Inspector bug in some configurations in LevelSettings prefab.
     
    Last edited: Jan 23, 2014
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    And by the way, we're having an Insanity Sale on Core GameKit for $5, for 48 hours only! It started at 9pm, just a few minutes ago. Grab it while it's on sale!
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I will be making a new video in the next few days, showing pooling and the new Inspector variable usage. Hold tight! If you've used Playmaker before, the variable usage will be very familiar. Just select "variable" instead of "self" if you want to use a variable. Then select the variable.

    Everything is in the readme though if you want to get a jump on it.
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I forgot to update the Readme PDF. The readme doc is up to date. Just submitted a hotfix version 3.0.1, it contains the newest PDF and will be live in 5 minutes.
     
    Last edited: Jan 23, 2014
  25. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    hi, thanks for the new killer waves, best regards!
     
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Thanks man, let me know what you think of the new additions!
     
  27. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    This is awesome!! It's Christmas!! xD
     
  28. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Wow adding variables will help greatly to control waves during runtime :)
    Thanks for adding this nice feature.
    Send you a PM.
     
  29. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    Okay so now I'm having some trouble with despawning all ammo during runtime. I get the error message saying that it isn't in PoolBoss, and so it can't despawn, when I've clearly added it to the pool. What could be the case here?
     
  30. TomEnokR

    TomEnokR

    Joined:
    Jan 23, 2014
    Posts:
    17
    I just bought this asset for $30 4 days ago. So... I'm a bit annoyed that it's now on sale for 1/6th the price.

    At any rate, I purchased this game exclusively to make a Tower Defense game (passing up on other assets that are specifically designed for Tower Defense). In your description, you list Tower Defense as one of the possible uses of this asset. Do you have any TD examples that I can reference, using this asset? This is my first game, and any assistance would be greatly appreciated. Thanks.
     
    Last edited: Jan 23, 2014
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I feel your price pain. We bought NGUI for $95 and a couple days later it was $16. However even at $30 this you got a great deal. Pool Manager alone is $30. With our product you get pooling plus tons of other things. And pooling is pretty much required for performance so why not get powerful freebies with it?

    We dot have any TD examples. We were actually going to work on specific genre add on packs on top of Core GameKit, the first of which will be Tower Defense. I can't give an ETA on that but it won't be very soon. We can answer your specific questions though here. Let us know how we can help you one piece at a time.

    Thank you.
     
    Last edited: Jan 24, 2014
  32. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Hi guys. I'm quite tempted to pick this one up while it's on sale. Been quite happy with Master Audio so far, and like Master Audio it seems to take something I could at least begin to approach on my own and turns it into a robust solution. But I must admit I'm a bit torn on whether this would save time, or add clutter in the end though. "Swiss Army knife" solutions are a bit of a double-edged sword.

    I'm not trying to put down your tool in any way, just trying to decide if it's right for me. Really, I'm trying to talk myself into it. :) More than the price, I try to keep a tight limit on the number of plugins I integrate. I can handle global variables and HP scripts and the like pretty easily, but a plug-and-play solution could be great for prototyping / fooling around. I already have ProBuilder and Playmaker as prototype tools, so throwing this in there could give me a quick logic framework as well.

    How much overhead will the unused parts of the script add, if any? My guess would be little to none.

    If I didn't already have PoolManager the choice would be easier. I'm quite happy with PoolManager too - is there any way to continue to use it? Any clear pooling advantages in Core GameKit?

    I'd welcome any thoughts.
     
  33. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Pool Manager has more bells and whistles. You can in fact uncomment a few lines in SpawnUtility.cs to use Pool Manager instead of Pool Boss (our built-in one).

    The overhead in these scripts is very low. Almost every script is event-based. Unused parts add zero overhead. The combat / auto-variable update and pooling are the most valuable features. The wave spawning thing is what this plugin began as, and it's quite nice, but not one the most valuable things in the package I would say.

    If you're trying to minimize the number of packages you use, actually for that reason, I'd recommend picking this up and do away with Pool Manager. The interface is similar in that regard. I think that almost every game can benefit from Triggered Spawners and the Killable combat feature (or use it for pickups like coins and health packs). And it's a cinch to set up.

    Watch the videos if you haven't. But keep in mind that many 3D games have been with this as well. I hope that helps!
     
    Last edited: Jan 23, 2014
  34. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    I'll almost certainly be picking it up for use with Playmaker / ProBuilder in weekend code "doodles", at the very least. Thanks for the input. :)
     
  35. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You're welcome!
     
  36. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Dude, it's $6.
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    lol, at that price, try it out! I'm sure you'll use 2 or 3 of the main 5 features minimum in your future games, if not your current one (depends how far along you already are). They are all very intuitive, super-optimized and insanely quick to set up.
     
    Last edited: Jan 24, 2014
  38. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    For anyone that is pondering this, buy it at any price (especially at this super low price). I've been playing around with this asset and doing all kinds of odd things with it. I have bugged the developer many times, but he responds almost instantly! Wow. Seriously, very fast response times no matter how crazy my questions have been. Just for the hell of it, I made this work with UFPS, which was extremely easy to do. I seriously enjoy the ease of use. I can code in C# (and old school C), but I prefer for speed to use amazing assets like this, Master Audio, NGUI, UFPS, and Playmaker. This asset by far is the easiest to use (plus Master Audio). This is an asset that you will use at some point in time. I can not say enough about this. If you pass up this awesome sale, you will regret it (even if you are brand new to Unity, buy it).
     
  39. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Oh, I agree price wise this is a no-brainer right now. But it's more "Will I actually use this?" than "Is it worth it?", especially when I already have a pooling solution I'm fairly happy with and a decent custom globals / health system. In the end, I think I will and I've already bought.

    There's some value in choosing your assets wisely, though. :) Hopefully someone glancing through the forums having the same debate hits the discussion and it provides some help.
     
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
  41. JAMiller

    JAMiller

    Joined:
    Apr 2, 2009
    Posts:
    78
    Excellent news about the new version! I've been using KillerWaves for several months now with my project and really like it. It boosted my development speed a lot allowed me to get a lot of useful functionality really fast!

    There is one thing I can't seem to figure out, which I believe should be simple: How can I tell when a TriggeredSpawner is done spawning? I thought I could just read some property on the spawner on ItemSpawned (listener), but can't seem to figure out how many objects are queued to spawn, or if it is still "gonna spawn". Any advice?

    __________________

    Edit: Thanks for your reply, WaveFinishedSpawning is exactly what I was looking for!
     
    Last edited: Jan 24, 2014
  42. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    There is no property on the spawner to read unfortunately.

    You should use the TriggeredSpawnerListener class - make a subclass of it. The event you want to add code to (override) is called WaveFinishedSpawning. That fires after the last item in the wave has spawned. Then of course drag that listener into the Listener field of the spawner to make the connection. You can actually put the Listener on the same prefab as the Spawner if you like. I used Listeners instead of events to subscribe to because they perform considerably faster this way.

    You can see me do this (hook up a different listener) in the 4th video on youtube.
     
    Last edited: Jan 24, 2014
  43. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    I'm now having trouble with firing the players ammo, I keep getting an error message saying that since the item isn't in the PoolBoss it wont despawn. How do I fix this? I'm using Pool Boss for performance reasons obviously, but I can't seem to get the most basic part of my game to work. The players ammo wont despawn on invisible or when it hits an enemy, because of this. What am I to do? Would code triggering while using a triggered spawner help with this? I'm really lost and frustrated with this issue, any help would be much appreciated.
     
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    2 ways to solve it.

    1) Add the player ammo prefab to Pool Boss.

    2) Check the "auto-add missing items" checkbox. However you shouldn't go live with that option, that's just a quick fix.

    Make sure that you put enough instances (qty) of everything in the Pool Boss before you release. You did read the Readme section on Pool Boss, right? I though it was clear. If you did and part of it was not, let me know which part.
     
  45. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129

    So the Ammo is definitely added to the prefab pool, but it's still not working. There's definitely more than enough in the pool, for what I wanna do. What I'm trying to do is use PlayMaker to spawn one. Right now I'm using the Core Game Kit Syncro Spawner Spawn One action. That doesn't work at all. How can I use PlayMaker with PoolBoss?
     
  46. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I can't reproduce your problem - Pool Boss works flawlessly for me. Spawn One action should work too, it's no different than how the spawner normally works. Do have a small project you could send me to reproduce the problem?
     
  47. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    I think I'm using the wrong source. Should I attach a spawner to the ship prefab?
     
  48. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    You mean so the player can fire? Then probably yes. You could also temporary use a Triggered Spawner with "mouse click" event and see if that spawns a shot, without even using Playmaker yet.
     
  49. ChrisMaster

    ChrisMaster

    Joined:
    Dec 27, 2013
    Posts:
    87
    Hi Jerotas, I bought your assset, to bad one day before the sale... but I have a problem, despawners are not working for me, going of screen, hitting an enemy, nothing .... ver 2.7b. Any tips?
     
  50. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Which despawners? The checkboxes on Killable? Triggered Despawner? One of the other Despawner scripts? I'll need to know that before giving advice.