I have two components I'd like to connect them to each other.
I'd like to sync this components, how to do it?
But problem is that I want to change on screen representation (other class such as PositionInerpolator do it, and it can work only with GraphicsComponent), and it must change physical body position. Is it a bad idea, and I must move physical body directly?
Thanks in advance.
The way I handle it in my engine is to call a FixedUpdate() on all components when the fixed timestep physics frame ends, when the PhysicsComponent receives FixedUpdate() it will query for the rigid body position from the physics engine, if it finds a change in position since the last update it sends a message to itself saying its position has changed, and includes the new position in the message. This is a message type the RenderComponent listens for. When the RenderComponent receives the position it updates the position of the render mesh.
You're free to see the exact code for yourself if you would like, the engine is open-source, and is built on an Entity->Components hierarchy: http://quickstartengine.codeplex.com
GameSubsystems) can implement registerComponent(Component*). pro. Components and GameSubystems know nothing about each other. con. In C++ it would look like ugly and slow typeid-switch... a decision which Components to register (and how to organize them). For example, GameSubsystemRender can register Renderable Components. pro. Components know nothing about how they are used. Low... Components. 3: Component registers itself in GameSubsystem(s). We know at compile-time that there is a GameSubsystemRenderer, so let's ComponentImageRender will call something like
, Enemy, Powerup are NOT game classes. An entity is only defined by the components it owns (and that can change during time). So the player Airship starts with Sprite, Position, Health and Input components. A powerup has the Sprite, Position, BoundingBox. And so on. The main loop manages the game "physics", i.e. how the components interact each other: foreach(entity (let it be entity1...I'm writing a shooter (like 1942, classic 2D graphics) and I'd like to use a component based approch. So far I thought about the following design: Each game element (airship, projectile, powerup
): set_vector a 123,456 I'd use these short scripts to do simple things like change the position of objects during runtime (for debugging or other purposes), create simple config files for all kinds of entities which would go like: bomb.script: set_damage 1000 set_range 250 set_texture Data/Sprites/bomb.png etc. From a superficial glance, Lua, AngelScript etc. seem to be a little bit bloated for my simple needs (Although I must admit I haven't put tons of time into those two). Can you recommend something better?
who or what they are. My questions are: Does this seem like anything that is normal or used by anyone? I cannot find anything on the subject. How could I maintain an order to the components like physics then position change? Is this even necessary? What are other ways of insuring that components that should be process every frame are in fact processed? EDIT I think I will be concidering...In order to get components to be able to update every frame (and leave this functionality out of components that don't need to) I got the idea to make an UpdateComponent component. Other components
Say I develop a game for mobile platform running OpenGL ES 2.0. I have done 2D part, and now I wish to import some 3D objects. The imported 3D objects must contain the following: Vertices positions Normals UVs Texturing information Animation information Collision mesh Maybe some other things... I am aware, that I could and (maybe should) create my own file format that brings these data from... the above mentioned features plus things I haven't considered yet Programming language is: C++. Currently, I'm developing under Windows 7, Visual Studio 2010, and OpenGL ES 2.0 emulator. Later
change as well. How should the entity representation be notified of the change in state? Then again, should it be notified at all? It seem that if the representation needs to be made aware the entity has.... state_->handleEvent(event, this); } That means that I don't really ever need more than one instance of a particular entity state; doing something like entity.setState(new StandState) is therefore highly wasteful. Then again, making each entity state a singleton hardly seems appropriate. What do you suggest I do? (The same can be said about game states, so whatever the solution
to calculate that point than digging up the plane's equation and then plugging in x and z? Should I store the plane equations and update them on vertex height change or should I just regenerate the plane.... This image should help further explain heightmaps and show how triangles are generated from the points. This picture would be looking straight down on a heightmap, and each intersection would be a vertex... algorithm: Calculate the player's velocity from input/gravity/previous velocity/etc Move the player's position (nextPos = prevPos + velocity * timeSinceLastFrame) Figure out which triangle (all
language, in my case Lua. On the other hand I want to use a component based design for my entities, and here starts my questions: 1) Should I define my componentes in C++? If I do this in C++ won't I lose all the RTTI information I want for my editor? On the other hand, I use box2d for physics, if I define all my components in script won't it be a lot of work to expose third party libs to lua? 2...I have a 2D basic editor written in Qt, and I'm in the process of adding entities. I want the editor to be able to receive RTTI information from entities to change properties, create some logic being
I'm writing a game engine which is going very fine. However, I'm now posed with handling textures. My Engine is in 2D, for simplicity reasons mostly to get a good idea of how to work with OpenGL. I do this in C++, and I have a hierarchical set-up when it comes to classes. There's a base class and some other classes derive from that. So now I'm onto the part where I want to load up some textures and apply them to polygons. The way my engine works in drawing things is like this: Load up a tile map file and parse it. The tile map contains all the information like events, lights, passability