What do you need to know about component based architecture in games?

What do you need to know about component based architecture in games?

When you’re making a game, you need to create objects to represent the entities in your games – like monsters, the player, bullets, and so on. When you first get started, you might think the most logical thing is […] This is a blog post by site administrator Ray Wenderlich, an independent software developer and gamer.

What are the components of the GameObject class?

Instead, we have a single GameObject class and two component classes: PhysicsComponent and GraphicsComponent. A decoration is simply a GameObject with a GraphicsComponent but no PhysicsComponent. A zone is the opposite, and a prop has both components.

How are components used in plug and play?

Components are basically plug-and-play for objects. They let us build complex entities with rich behavior by plugging different reusable component objects into sockets on the entity. Think software Voltron. A single entity spans multiple domains. To keep the domains isolated, the code for each is placed in its own component class.

Can a game have the same domains as a business?

A game doesn’t have the same domains as a business app, but the rule still applies. As much as possible, we don’t want AI, physics, rendering, sound and other domains to know about each other, but now we’ve got all of that crammed into one class.

What should be the base class of a game?

When you first get started, you might think the most logical thing is to create a base class called “Game Object” that contains the common code. Then you can create subclasses for Monsters, and maybe subclasses of Monsters for specific types of monsters. For simple games, this works quite fine and is quite easy to program.

How to rework object hierarchy in a game?

So you have two options: Rework the object hierarchy. You could switch around the object hierarchy – maybe make Player a subclass of Monster. Move the code to a common base class. Alternatively you could move the ranged properties and code up to a common base class.

How are design classes defined in component based architecture?

Recognizes all design classes that correspond to the problem domain as defined in the analysis model and architectural model. Recognizes all design classes that correspond to the infrastructure domain. Describes all design classes that are not acquired as reusable components, and specifies message details.

How is a component-level design represented in source code?

A component-level design can be represented by using some intermediary representation (e.g. graphical, tabular, or text-based) that can be translated into source code. The design of data structures, interfaces, and algorithms should conform to well-established guidelines to help us avoid the introduction of errors.

https://www.youtube.com/watch?v=O4O8rGDcBS8