I have a couple of suggestions I wanted to run by the community. I’ll implement them myself if people agree they are a good idea but thought I’d canvas opinion.
Suggestion 1: Allow entities to be ordered by “priority” when adding them to the world
Rationale: I didn’t realise until recently that entities are always added to the front of the list, which I understand is for efficiency. In the past my world class’s update routines have always become a little heavy and difficult to maintain. In my latest development I am trying to develop entities as “components” loosely following an MVC pattern with the idea of creating easily reusable chunks of code, and a sparse World update function. I don’t know if it is overkill but I would like to have some control over the order they update. This change would obviously affect the World and Entity class so I would implement it so that using priority is totally optional.
Suggestion 2: Entity class to have “queuedToAdd/Delete” functions (or some better name)
Rationale: Following on from previous rationale regarding component based entities. It would be good to know when an entity has been added to the add/delete queues, not just when they have been added/removed. This way the entity can take responsibility and ownership for adding any entities it needs to the world and they would be available at the same time.
Suggestion 3: FlashPunk has the handy Create and Recycle methods so the Entity class should have an init function which is called by Create.
Rationale: Object recycling is very good but it would be nice to have an init function that is automatically called an people and override. This would essentially take the role of the constructor and the constructor would only be used for one time only initialisation. This would hopefully encourage object pooling and enforce a useful pattern.
Finally, I recently created a MaskableStamp graphic class. It essentially allows you to programmatically populate a vector with alpha values which you can apply to a Stamp. Think destructible terrain in Worms. If anyone thinks it would be useful I can clean up the comments and create a pull request for it.
That’s it for now, prob have some more soon.