Search Unity

PoolManager [By Path-o-logical-Games]

Discussion in 'Assets and Asset Store' started by Rafes, Sep 13, 2011.

  1. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    Please post it to our forums, thanks! http://support.path-o-logical.com/forums
     
  2. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    Ok, done!
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I bought Pool Manager 2 before it was in the Asset Store. The Asset Store informed me they cannot give me the newest because they have no record of my purchase. I even emailed them my invoice for when I bought it. They said I had to contact the author instead. So Rafe, not sure if you've been getting my emails or not, but I NEED the update...my build is 3 or 4 months old. Please reply.
     
  4. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    That is frustrating. They assured us that people who buy PoolManager from the asset store would get free updates. Our support email has definitely been working. I just checked the history of your support emails and I see this slipped through (it was part of a thread where we talked about another issue). I will send you an updated package on Tuesday night when I get back (I'm on my iPhone just checking in while on Holiday).

    Merry Xmas and happy holidays by the way!


    Thanks for bringing this to our attention again.
     
  5. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Sorry to sound nosy but jerotas actually said he bought the product *before* it was in the Asset Store, so it was directly from your store. As far as I know you can't get Asset Store updates of products bought from other stores, which makes commercial sense for Unity since they can't provide a service without getting their fair share of it.
     
  6. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    I read that as well but it didn't sound in line with a private email conversation. If PoolManager IS bought directly from us, then we absolutely offer free updates through our distributor. It should be automatic (download again with login). If it is not working please contact support@path-o-logical.com right away!


    Thanks MaDDoX.
     
  7. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    Hi
    Since i upgraded to Unity 3.4.2 f3 and Xcode 4.2.1 my scene crashes on Load.
    It's taken me ages of enabling/disabling objects to find the culprit of the crash - but all i saw in Xcode (ran fine in Unity editor) during the running of the build was an error pointing to SpriteMesh_UpdateVerts.

    Has anyone had any issues with PoolManager? (SpawnPool script). The scene loads just fine if i disable all Spawn Pool scripts.

    Edit: Have posted to forums too - sorry its a habit coming here.
     
    Last edited: Dec 27, 2011
  8. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
  9. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    166
    Hi, I am using the pool manager software but I was wondering if it works with network views. I haven't tested this out yet but the problem with network views is that the person who network instantiates an object now "owns" that object and controls it across the network. If this doesn't work with spawn and despawn (and I haven't tested this yet, but I don't think it would), can you make an update that would would like this:

    Code (csharp):
    1. Network.Instantiate();
    2.  
    3. PoolManager.Pools["Objects"].NetworkSpawn();
    That would be a really cool feature. It would reassign the network view to be the player that called the spawn method.

    Thanks!
     
  10. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    I don't know enough about your needs to implement this properly. PoolManager only makes objects when there aren't any pooled. When this happens there is a call to instantiate. There are options available to gain some control over this, but in the end, based on your pseudo code, you want to transfer ownership of objects which already exist. Is that possible?
     
  11. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    166
    Basically, what I'm asking is: is it possible to have a spawn pool that would work on a network game? So I wouldn't have to use the Unity network commands.

    I'll elaborate: I am creating a multi player game that has enemies being created and deleted all the time. So I have to use the network commands to do this for all connected players. but I see significant slow down on my iPhone, probably because of the garbage collector. So it would be nice if there could be some support in pool manager for network games.

    I don't know if it is possible but there seems to be this command:

    Code (csharp):
    1. NetworkView.owner;
    Maybe when one of the players makes a call to SpawnOnNetwork() (or something called that, your pool manager can reassign that objects network view to that player. Something like this:

    Code (csharp):
    1. PoolManager.Pools["Objects"].SpawnOnNetwork(Transform aMissileProjectile, Int groupNumber);
    2. aMissleProjectile.networkView.owner = playerThatSpawnedObject.networkPlayerID;
    But then it might be impossible to reassign the network view to a different player ID. I haven't experimented with it yet.

    Thanks.
     
    Last edited: Jan 19, 2012
  12. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    We are not developing a multiplayer game at the moment so it would be hard for me to create an elegant solution. However, as long as references can be maintained I don't see why those references can't be pooled. If there needed to be another layer that kept information about reference locations so they could be reliably retrieved, that should work too. It sounds like this would be a thin layer on top of PoolManager and if I can help with API info that would allow you to do this, I would be glad to.

    Are the spawns all made on a server? Could they hold this capability so on spawn they move? I'm just shooting in the dark here.
     
  13. alewinn

    alewinn

    Joined:
    Nov 8, 2009
    Posts:
    185
    Hi,

    Is PoolManager 2 compatible with 3.5 yet ?
     
  14. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    166
    I'm going to keep writing my game and test out all my ideas on how this will work. I'm not even sure if I'm allowed to change the ownership of a network view or not. Thanks for your help, I'll be asking you more about the API as time goes on.
     
  15. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    "Is PoolManager 2 compatible with 3.5 yet ?"

    Not yet. We will be looking in to upgrading to, and supporting, 3.5 very soon. Keep in mind the Unity 3.5 is still in beta.

    Anyone who buys PoolManager will get free upgrades.
     
  16. pneill

    pneill

    Joined:
    Jan 21, 2007
    Posts:
    207
    Is the issue with 3.5 that you haven't tested against it or are there known issues?
     
  17. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    I have heard there is an issue with how C# is being compiled for Flash, but so far that is all. We have not upgraded yet because it has not been released yet and we don't branch development. We will test soon. If there is nothing wrong, we will post. So far no one has reported any issues aside from the flash thing though, and that may have been fixed (it wasn't a PoolManager issue from what we could tell, just Flash)
     
  18. alewinn

    alewinn

    Joined:
    Nov 8, 2009
    Posts:
    185
    That's Ok as we are not publishing to flash, but need a robust long term maintained way of spawning lots of agents in lots of ways.
     
  19. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hi
    Been reading this thread and think pool manager is what I need
    Just a few questions
    Could I for example have a pool of say 10 baddies but state the prefabs in the pool but not the number ?
    What I mean is ; pool of 10 which will contain zombie and skeleton but I don't know how many of each
    Could be 4 zombie and 6 skeleton or anything
    Also in this situation I would of course wish to preload those pooled prefabs for speed
    Can I have pool manger error if I attempt to spawn a non preloaded prefab
    This is so of course it forces me to add it to preload and avoid stalls later
    I have lots if scenes but all quite small so know in advance what will and won't be spawned
    I hope my questions make sense !

    Cheers
     
  20. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    Yes. Yes it does.... Next!? ;)

    except.... right now it can ignore spawn requests based on a max count. You could set this equal to the preload amount, so no new ones are ever spawned, but it won't throw an error. While this would be trivial to add, I always like to keep things general if there is any easy way to provide the solution with the current API. What I would do is simply test the return value of spawn. It will be an instance in all situations, unless you use the max spawn option, in which case it will return null if nothing is spawned. You could then throw an error anytime spawn returns null and you would have your feature. Make sense?
     
  21. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey Rafes,

    Glad I gave you a load of YES questions :)
    As 2 the 2nd point I guess I could use what you say. It was more of a "I spawn a zombie, but I haven't preloaded a Zombie, please error'. But I can implement something to achieve that.
    My final question before I purchase (and I assume the answer is yes anyway) is:
    Currently I sometimes wish to do something to all zombie's (like kill them, or something); my current method is to either find with tag or have a baddie controller which knows about all zombies.
    Can I assume that as the zombies would be in the baddie pool in pool manager I could look through that pool, find active zombies and therefore get a reference too them and then do any action I wish on all zombies?
    I think that makes sense.

    Assuming the answer is yes (which we both know it will be :) ) I shall purchase.
    I'll buy direct as I have read there are issues with purchasing through the asset store.

    Cheers
     
  22. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Just bought it anyway :)
     
  23. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hmmmm, now all my other imported assets seem screwed up; can't find namespace for anything.
    Erm, how do I fix? :-(((

    Cheers
     
  24. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Humph. Well I remove a particular asset and it compiles ok - don't know what's going on there!
    One quick question though.
    When I wish to destroy an object - sorry despawn :)
    How do I know which pool it came from?. My players sword might hit a baddie and therefore do a despawn on the baddie pool; but it might hit an object (whatever) from another pool. Do my game objects need to know which pool they are from?

    Cheers
     
  25. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Ok! ;)
    I've thought about it :)))
    Here's what I am trying to do :_)))
    I wish to pre-load everything required in a scene.
    Therefore beforehand I will know which pools and which prefabs exist (as it were); therefore when I ask to spawn "skeleton" I don't want to stipulate the pool it came from because that has already been setup.
    I guess I am asking can I use the prefabs name as a reference to the pool it's using?
    This just seems like a cleaner neater way too me. As long as I have preloaded my prefab into the correct pool at the start then it should just spawn.
    Sorry!, hope you can help - I suspect there is an embarrassingly easy answer :)

    Cheers
     
  26. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Sorry another question :)

    SpawnPool baddies = PoolManager.Pools["Baddies"];
    List<Transform> baddies_copy = new List<Transform>(baddies);

    But if I look at say baddies[0].position it's a constant (even though the baddie is moving) - presumably the point at which the spawn occurred. How do I relate that to the actual active object so I can get it's real world coordinates?

    Appreciated!

    Cheers
     
  27. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    Yes. Here is a page from the docs Example Patterns section that shows using the SpawnPool as a list:
    http://docs.poolmanager.path-o-logical.com/example-patterns/using-a-pool-as-a-list


    Yes, there are a few ways of approaching this. First and foremost, PoolManager is designed so you can organize pools in logical groupings, for examlpe, all enemies, all wepoans, etc, whatever makes sense to your game. You could give a base class to all things in your game which introduces an attribute "poolName" and a function "despawn()", and then when you want to despawn them, you can just send a message, or run a delegate, or just get the component, call a function directly, and let them despawn themsleves. In this pattern, the object already knows its own poolname and will just despawn.

    The above is probably the best design pattern for generic behaviors in both speed and simplicity, however, if you want something more procedural, you can iterate through PoolManager to find things, and it will be very fast because all iterations are done over referenced data. You can run through all SpawnPools and check for either the name of the Prefab or use an instance to see if its prefab is in the SpawnPool (http://docs.poolmanager.path-o-logical.com/code-reference/spawnpool). PoolManager.Pools is a special dictionary so it can be run in a for loop like any other dictionary. Then in the loop, you can play with these two properties:

    GetPrefab - Returns the prefab used to create the passed instance. This is provided for convenience as Unity doesn't offer this feature. http://docs.poolmanager.path-o-logical.com/code-reference/spawnpool/spawnpool-getprefab

    prefabs - Access to the prefabs cached in the SpawnPool. (http://docs.poolmanager.path-o-logical.com/code-reference/spawnpool/prefabs)

    GetPrefab does internal comparisons on cached GameObjects. If you want to see if your prefab is matching on of the prefabs in the prefabs dictionary, you will want to do soemthing similar youself. e.g. if poolPrefab.gameObject == myPrefab.gameObject { ... } This will compare the actual objects in memory as opposed to a shallow name-based check. If you do this hundreds of times a frame it might be a performance hit as Unity makes a GetGomponent call each time you use 'gameObject' (so cache your prefab gameObject outside the loop to cut it in half). It should still be OK in most 'on-death'-type events.


    That is strange. Even though you are converting the SpawnPool to a reguilar List, it should still just be handing off references to the same transforms. Does it do the same thing when you look at the objects directly from the SpawnPool? (It should.) I can't explain this without a stripped-down example scene. If you can't debug this, please strip it down and send it to us. Here is our support page: http://support.path-o-logical.com/

    Please also continue this last one on our support forums (http://support.path-o-logical.com/forums) so we can spam away!

    - Rafe
     
    Last edited: Jan 24, 2012
  28. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey Rafes,

    Sorry for so many questions :)
    As for the last issue/bug. I rebooted and now all ok some must assume a 'Unity moment' (perhaps something to do with the problems I had importing the package??).
    The problem I have with 'which pool am I from' is that I have a 'spawn point' (just a collider with a simple script attached).
    To this I usually drag a prefab (zombie/skeleton whatever) and then let that script do the spawn.
    It works fine, but I have to hardcode the actual pool like:

    Transform spawn = PoolManager.Pools["Baddies"].Spawn(spawn_me.transform,transform.position,transform.rotation);

    If I wanted my spawn point to generate a weapon from the 'weapons' pool you can see the issue.
    Can I not 'somehow' ask what pool is skeleton in? (as long as it's not expensive) ? ;or is that exactly what you mean by the get prefab thingy?? (sorry if I mis-understand!) ;-)

    Appreciate the detailed reply!!

    Cheers
     
    Last edited: Jan 24, 2012
  29. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    You can do it any way you like.
    * Add the information to the prefab so it knows what to do when asked to generically spawn itself
    * Get the info by looking through the prefabs for a match
    * Get the info from the spawned instance - in this one if you get any return value, you are in the right place when looping through all SpawnPools

    If the spawn point's only job is to spawn instances, I suggest you make your own component (class) with a string field "poolName", for this example, call it "SpawnPoolMember". Now, on your spawn pool, instead of a list of transforms, use a List<SpawnPoolMember> and drag and drop the prefabs in to the list in the inspector. In your spawn point's code, you now have direct access to the component so you can loop through them and do something like:
    PHP:
    spawnMeXform spawnMe.transform
    Transform spawn 
    PoolManager.Pools[spawnMe.poolName].Spawn(spawnMeXformspawnMeXform.positionspawnMeXform.rotation);
     
    Last edited: Jan 25, 2012
  30. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Ah :)
    Some c# OOP still eludes me :)
    Sometimes I am sure the OOP'ness makes code certainly slower and more obscure.
    So I took the easier route :) ; simply make the pool name part of the prefab and my skeleton inherits from a baddies class which has this defined. It works *perfectly* - thanks!
    Just for the record, assets I have purchased that are worth every penny: FingerGestures, NGUI and now Pool Manager :)

    Cheers
     
  31. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    Thanks! I'm glad we found a solution that fits your game.
     
  32. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
  33. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    I am interested in using Pool Manager in my project, but I have some questions, hesitations:

    I don´t understand the need of OnDespawned() if Despawn() is supossed to work in the same way as Destroy().

    With destroy I can do this:

    function OnCollisionEnter(collision : Collision) {

    var contact : ContactPoint = collision.contacts[0];
    var rot : Quaternion = Quaternion.FromToRotation(Vector3.up, contact.normal);
    var pos : Vector3 = contact.point;
    Instantiate(explosionPrefab, pos, rot);

    Destroy (gameObject);
    }


    And it is not necessary to use any other function for the result of the collision event (explosion,etc).

    Also, if Spawn is using a type different from Instantiate then they are not "changeable" without making more modifications in the existing code...

    Is Pool Manager compatible with javascript code? I suposse it is a silly question but the case is all my code is in javascript... :)

    Thanks.
     
    Last edited: Feb 7, 2012
  34. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    Hi,

    OnDespawned() is an optional event that is triggered after despawning. In the case you show you wouldn't use it. You might want it for cleanup or if Despawn() is run from another script, etc.

    I'd have to try it, but didn't Unity change Instantiate so it takes a Transform as well? Anyway, it is a minor item and originally allowed for a minor performance increase since transform was used more often in our game. now I cache everything, so I could expose more methods to take GameObjects, I just didn't want to add more 'stuff'.

    Yes, UnityScript works fine.
     
  35. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    The Spawner version that supports Pool Manager is live on the Asset Store.
     
  36. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    A user posted that Unity 3.5 is no longer in beta. I am sure glad they did too, because it took me about 15min to find proof! I thought maybe I had missed an email, but I couldn't find one. The only link I found for the Unity website is the beta stuff. I searched around the internet and the only mention I found was a single news site: http://www.gamasutra.com/view/news/40286/Unity_35_update_released_biggest_to_date.php

    Then I finally found this blog post: http://blogs.unity3d.com/2012/02/20/unity-3-5-released/. We would have liked a notice that things were stable and upgraded to release candidate. Oh well....

    Obviously upgrading to a new version is a big undertaking. We will get through it as soon as possible. Currently, the only report I have gotten of requested support is that PoolManager's particle emitter auto-depsawn is not happy with the new particle system. Please post if you know of anything else that needs to be looked at.

    Cheers,
     
  37. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Has this been fixed?


     
  38. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    It will be in the next release jrricky. It wasn't marked as a critical fix so it didn't get its own release, and there was more time than expected between releases. Sorry for the delay. A new release is coming soon that will include the Unity 3.5 Shuriken and I am also looking in to granting access to some prefab specific settings at runtime.
     
  39. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Looking forward to the next release (with shuriken support) to buy this as we need a good pooling solution within our 3.5 project.
     
  40. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    A quick update....
    This has been an absolutely crazy month for all of us. I managed to install 3.5 and branch our code repository this weekend. Everything appears to work (backwards compatible). I hope to get the 3.5 support and a new feature done in the coming week.
     
  41. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
  42. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    Hi - went to your site to grab the latest version, but can't see where to download if I've already purchased through you?

    Cheers
     
  43. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    Hm seems I need a coupon code? But haven't received one for this latest update?
     
  44. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    Hi,

    You should be able to log in with the information from your original purchase to download an update. If you lost the email, or have any trouble,mplease email support@path-o-logical.com and provide your personal information (name, address, rough date of purchase) and we can look you up.
     
  45. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Hi Rafes,

    Have you already submit it to the AssetStore?

    Roy
     
  46. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    Yes, before I posted here.

    Getting stuff faster is one of the benefits of buying direct ;)
     
  47. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    That's true ;) I already bought it a wile ago so I have to wait for Asset Store.
     
  48. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    This was posted 2 days ago and still no update in the Asset Store?
     
  49. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764
    I have not received any emails either. I'll email them.
     
  50. Rafes

    Rafes

    Joined:
    Jun 2, 2011
    Posts:
    764