2
\$\begingroup\$

I'm planning a roguelike game and I'm unsure how to design for animations. Since a roguelike is turn-based, the game model is discrete and would have no intermediate states during an animation(?). I've come up with two possible approaches:

  1. Perform state transitions immediately upon input and compute the animations that occurred. In the case of a moving character, draw the animation as a member of the destination tile (instead of the static sprite) and coming from the origin tile.
  2. Compute animations before transitioning and transition the state asynchronously after the animation completes. Draw moving objects as members of their origin tile so that they arrive immediately before the state transition.

Do developers of this type of game tend to prefer approach 1 or 2 (or some third option) and why?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I'm somewhat confused from your question. The general rule and i don't think this is defined by game style but rather the game architecture itself, is that rendering(animations) should happen independently in your game. And the switch between animations should be triggered by state changes. If you arrange your game architecture like this then it's only a matter of when a state change is triggered. I hope i did provide some insight.

Edit: updated with more info.


You have to change your point of view on this matter. When you are saying that this type of game doesn't have many animations, you should really be thinking about the game/object state changes, which in such a type of game is usually correct, many things remain static for extended periods of time. I will try to give you a very brief example of how a state change interacts with animations but really, you should further look this up on the net. Maybe check how animations are handled in general.

So in my example i have a player object/class with a private member named current_state of type PLAYER_STATE. PLAYER_STATE could be an enum could be class, how you architecture your game is on you. I prefer to use enums.

enum PLAYER_STATE 
{
    IDLE,
    RUNNNG,
    JUMPING
};

Now you should probably have some kind of system to handle your animations. And that system would check on the players state (current_state) to see what action is the player currently performing and re-adjust your animation(frame sequence for sprites) to the one corresponding to the action that is stored on your player (IDLE, RUNNING, JUMPING). I hope i gave you an idea but really, this is an extended topic that needs further research.

\$\endgroup\$
3
  • \$\begingroup\$ Yes, this is helpful. The reason I thought my game style might play in is because this type of game doesn't typically have a lot of animations, and I thought that might be relevant somehow. You say that a "switch between animations should be triggered by state changes." Do you mean to use events for specific changes? \$\endgroup\$
    – aebabis
    Commented Aug 4, 2014 at 16:20
  • \$\begingroup\$ @acbabis i updated my answer with more info. \$\endgroup\$
    – apoiat
    Commented Aug 4, 2014 at 22:02
  • \$\begingroup\$ Thanks for your help. Upon reading your response, I realize what I should have asked is: "How should the animation engine get information about the game's previous state?" That's the problem I'm trying to solve. Do you have any recommended reading? \$\endgroup\$
    – aebabis
    Commented Aug 4, 2014 at 22:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .