What's your preferred way of letting objects affect the game?

Started by
19 comments, last by darkhaven3 11 years, 1 month ago

In my recent game projects, I can relate my design to a company : game entitys (player, asteroids, aliens, laser beams,...) are under the care of a manager (PlayerManager, FlyingObjectsManager, BulletManager,etc...), that are under the care of the Main manager (Game)

Basically, the main manager tells the other managers to do their stuff or redraw their stuff when it's time, and the others manager tell their entity to update or redraw, and manages their group of entities (e.g. the flyingObjectManager spawns asteroids and bonus and recycle them when they go out of the screen).

When their should be an interaction between entities from different manager, it is carried by the main manager either procedurally (e.g. in my game loop retrieve a collection of flying objects/bullets from the corresponding manager, and ask the player manager if anything collides with a player), either event-driven (e.g., a player entity has collided with a bonus, the score must be updated and the bonus entity must be hidden).

Of course, my games are simple, so this level of details is adequate. For bigger projects, (e.g. an ARPG in an open world), their would be more levels of management, like in a big company.

Space Zig-Zag, a casual game of skill for Android by Sporniket-Studio.com

Advertisement


I can see this being a legitimate approach if and only if your game logic is heavily data-driven and validated by external tools prior to loading into the engine.

Really? All I can see is the many hundreds of ways this can crash and burn in a series of amusing ways... more so when you consider the follow up reply about not sanity checking the results... dry.png

Sure it can crash and burn if I care to introduce bad definitions in the frametable. Who cares? If the function called by a frame for a particular mobj_t says "You can't move here because I said so", then the mobj_t shouldn't give a damn. All that would happen is the mobj_t would stop moving in that direction, and possibly attempt to move in a different direction arbitrarily. It's not an mobj_t's responsibility to determine where it can move in this specific context; it's handled at a higher level. All an mobj_t is responsible for is itself, or being the target of another mobj_t in special cases (monster infighting, or the player being the target of a monster, mainly). And even in that case, mobj_t's typically don't care if they are targets of one another, and can't directly modify one another's target reference; they will attack one another until it is somehow resolved by other mechanics, typically by means of one mobj_t changing targets to the player or another monster, or entering its death state.

It seems simple and concise enough to be easy to debug and easy to implement, and it seems like it would be quite fast, especially in the context of a 2D sidescroller.

This topic is closed to new replies.

Advertisement