|
artemax
blitzmax port of the Artemis entity system framework.
Featured artemax.modIntroductionThis project hosts Artemax (haha), the blitzmax port of Artemis. Artemis is a high performance Entity System framework for games, originally written in Java, and is a framework to manage entities in a game world. Although Artemax is currently being used in games in development it is still considered experimental. Use in your projects at your own risk. Blitzmax IntegrationArtemax has no code dependencies. It can be used in any Blitzmax framework without problems, provided the necessary systems are created. I am creating a minimalistic blitzmax engine and systems collection called game2d which will simplify the setup of Artemax within Blitzmax. Visit the game2d wiki page for more information. DetailsSo, how does it work? While we cannot explain entity/component paradigm here (there are other better articles out there) we can explain how you use Artemis to accomplish separation of data and logic, including rendering. The main concepts in Artemis are: Entities, Components and Systems. There are other things in there as well, but they are mainly meant to facilitate those three things and make things "go". EntitiesEntities are very raw and basic, think of them as a identifier for an entity. An instance of TEntity is meant to identify that entity throughout the system. The most important aspect of TEntity is the entityId, which no other living entity has in the system. ComponentsComponents are pure data classes, they do not have any logic in them other than that for setting/getting the data. An example component would be Position, containing only X and Y coordinate values, and an allowed set method would be setPosition(x,y). All components extend TComponent, which is meant to identify the components in the framework. SystemsThese are really the most important aspect of the framework. Entity systems are meant to process certain aspects of entities. An entity aspect means that a entity possessing certain components that enable it to be processed in a certain manner by one or more systems. One system processes only one aspect. An example aspect be Movement, which would process an entity aspect consisting of Position and Velocity. The system that would process such an aspect could be called MovementAspect and would contain the logic necessery to move entities around according to their Position and Velocity, setting and getting whatever data it requires. Entities do not communicate between themselves, but systems can communicate with other systems. Use the TSystemManager to retrieve a system within another. Systems can provide whatever API necessery for inter-system communication. The framework bundles a few TEntitySystem implementations that can be extended, depending on the usage, be sure to read the description on all EntitySystem implementations and be sure to understand them, because choosing the right TEntitySystem can provide a significant performance boost. | |