libgdx/gdx-ai — pull request #6 by avianey (2014-09-20 13:20:49+00:00)
Title: Provider system for the message api

Implementation of issue #5

Providers can be registered for different message type (just like Listeners).
Providers provides info for a given message type and a given listener.

Imagin a game like Sim City where house objects are created, destroyed, etc... When houses are created they want to know about their neighbour population, the city criminality, the street pollution, etc... When streets, cities and houses are Providers there's nothing more to do than to register as a listener when instanciating a new House. As a provider, the City object will provide current criminality. As a provider, the Streets objects will provide adjacent houses with pollution data. As providers, houses will provide info to their neighboors... No more coupling or centralized catalog of object to maintain !

(I tested the implementation in a simpler use case ;-))