Gamelogic
  • Home
  • Blog
  • Tools
    • Grids 2 (for Unity)
      • Features
      • Documentation
    • Grids 1 (Legacy, for Unity)
      • 30 games in 30 days
      • Features
      • Tutorials, Documentation, and FAQ
      • Games made with Grids for Unity
      • Examples
      • What is new?
      • Grid Prototypes and Previews
      • Buy
    • Extensions
    • Colors
      • Features
      • Documentation and tutorials
      • Buy
    • Words
      • Features
      • Documentation
      • Buy
    • Abstract Strategy
      • Features
      • Documentation and tutorials
      • Examples
      • Buy
    • Match
      • Features
    • Grids (for GameMaker)
      • 30 games in 30 days
      • Features
      • Documentation
      • Buy
  • Buy
  • Articles
  • Support
    • Knowledge Base
    • Email Support
  • About
    • Meet our team

Blog

Introducing Generators

We added generators to version 1.2 of Extensions. A generator, in our terminology, is an object that can give you new instances of a type on demand.

(This is similar to random number generators, which gives you a new number whenever you ask it).

We provide a few classes that make generators more powerful:

BatchGenerator: This returns batches of objects. Each batch is a copy of a list of objects, called the batch template. The main purpose of this generator is to plug it into a ShuffledBatchGenerator.

ShuffledBatchGenerator: This generator returns elements from batches, but with each batch shuffled. It takes a batch generator as input. If your batch template is ABC, then the following is an example of a sequence of elements returned by the ShuffledBatchGenerator: ACBBCACAB… Note that successive groups of three elements contains ABC exactly once.

Buffer: This generator returns the same elements as a given generator, but buffers a fixed number of elements that can be “peeked”. This makes it easier to implement mechanics where the player is shown upcoming objects (such as in tile match games, where the player is shown a number of tiles coming up).

Find out more about Extensions 1.2 Download Extensions from the Asset Store

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

  1. Gamelogic Extensions for Unity 1.2 is now available  The newest version of our free extensions library is now...
  2. Introducing Response Curves  A response curve is an easy-to-define piece-wise linear curve. They...
  3. Extensions for Unity  A few weeks ago we released a new (free!) package...
  • Permalink
  • Posted: 19 February 2015
  • Tags: generators
  • Author: Gamelogic
Recent Posts
  • Tool Documentation Overhaul
  • What is new in Grids Pro 2.3.5
  • What is new in Grids Pro 2.3.2
  • What is new in Abstract Strategy 2.1.1
  • What is new in Words 2.0.2
Categories
  • 30 Games in 30 Days
  • AbstractStrategy
  • Aside
  • Colors
  • Example
  • Extensions
  • General
  • Grids
  • Grids 2
  • Previews
  • Programming
  • Social Media
  • Uncategorized
  • Words
Follow us on Twitter
My Tweets
Meta
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
  • Home
  • Features
  • Blog
  • About
  • 14 Eglin Road, Sunninghill, Johannesburg, South Africa
  • support@gamelogic.co.za
Stay Connected
  • Facebook
  • Google
  • Linkedin
  • Rss
  • Twitter
  • Gamelogic © 2013