Items on the ground…

So, since the inception of Zombox 3 years ago I’ve wanted to make it possible for items to lie on the ground, outside of any particular container they could be stored in. This is a standard element of many RPGs like Diablo, Torchlight, Minecraft, etc.

The reason that this was never possible in Zombox (up until now) is due to the sheer number of resources required to have an implementation of this idea work. If the actual item geometry is to be displayed on the ground, that’s a lot of extra polygons that an iOS device just wouldn’t be able to handle. If a graphical representation of the item is to be displayed (like, its GUI icon), it would require a lot of draw calls to display each and every icon that is dropped…and every draw call is another hit on the GPU, which would quickly slow the game to a crawl. Batching wouldn’t work on those icons unless they were using a texture atlas, and updating UV/vert lists on a mesh to match icon/world coordinates would be slow.

But then I realized that I could use a particle system to do all of this quickly, and in only 1 draw call. The solution is a bit of a hack that requires “freezing” particles at particular frames on a texture. To elaborate, Unity allows you to tell a particle system to cycle through cells on a texture sheet. This is how animated particles are created — you create a texture sheet with a grid of cells, each containing a different frame of animation. Then you tell Unity’s particle system to cycle through the cells at a given rate, which results in an animated particle texture.

Well, if I create a texture sheet that contains all of my icon textures, and then tell a particle system to advance to a particular cell of that texture sheet and freeze there, I am able to achieve the effect of individual sub-textures of a texture sheet displaying properly on individual particles. Once that’s done, the rest is easy.

So…as a result of this new system, several new things in Zombox are possible:

  • items can be dropped or picked up, anywhere in the game world
  • objects that contain items drop their items on the ground when they are destroyed. The dropped items will be degraded in the process, though
  • when a player approaches an item on the ground, the item will hover around the player, alerting the player that they can examine the item
  • zombies and npcs will now drop their items/weapons when they die. Thus, their items/weapons can be retrieved by the player following their death

Click here to see a scaled-down image of the particle texture sheet I created, which stores all item icons within it. This is the texture that the particle system which displays all dropped items references.

Here are some animations showing various player interactions with dropped items:




6 Responses to “Items on the ground…”

  1. Boy says:

    Cuanto falta para que este listo por completo??…Estas perdiendo fans por el tiempo tardado…Se aprecia mucho tu esfuerzo, sigue asi. lo haces exelente

  2. Henning says:

    Oh draw calls and texture atlas-ing. I remember them so fondly… :/ clever work-around, Tyson.

  3. 8-Bit Ape says:

    Really excited for this game. Will it be multiplayer? When do you anticipate an early demo? Also, thanks for mentioning UnityVS. I find the MonoDevelop IDE rather flaky and I use Visual Studio day to day in my day job. Great work so far!

  4. Anonymous says:

    Whoa this is amazing! Absolutely brilliant! 😀

  5. Anonymous says:

    Just real ease it and update it

  6. Anonymous says:

    Just release it already and update it

Log in or Register

Leave a Reply

Your email address will not be published. Required fields are marked *