5
\$\begingroup\$

I am currently working on a role-playing video game featuring sprites that take the form of antropomorphic objects. These sprites can move around in the four cardinal directions, and turn to face the direction they walk in.

Unlike humans, objects are not as equally proportioned all the way around. What this means is that in the case of at least one of my characters, the side-profile of the sprite is a lot thinner than the front-profile, seeing as the object is a harmonica.

The sprite in question

This causes a problem with the character's collisions with objects. If the character walked into, say, a tree while facing sideways, then turned to face the front, a large portion of the sprite will inevitably then be inside the tree.

I've considered multiple potential solutions to the problem, but they all seem to have pretty severe drawbacks.

  1. Make the side-view hitbox as large as the front-view hitbox. This would mean that players will not be able to walk nearly as close to an object as they should while facing East or West.
  2. Push the player out of the object when they turn. This would end up looking quite strange and unclean.
  3. Don't allow the player to turn from a side-view when they're too close to an object. This would be confusing and unintuitive.
  4. Allow front-view sprites to clip through objects. This would look pretty bad.

I can't think of any other solutions to this problem, nor am I able to choose a different object for this character (for personal reasons). Is what I am attempting to achieve here not viable/possible?

\$\endgroup\$
9
  • 2
    \$\begingroup\$ Have an easter egg animation that the character is doing some steps backwards in case it cant rotate when it is too close to the wall. Since you wrote it is a RPG, the extra 0.3s it would to take to make a turn should not be a problem. \$\endgroup\$
    – Zibelas
    Mar 4 at 10:22
  • 2
    \$\begingroup\$ Please tell me when this guy jumps off a ledge or something, the air passes through as he's falling and you hear harmonica sounds... \$\endgroup\$ Mar 4 at 20:15
  • 1
    \$\begingroup\$ If you have falling, be sure to handle the case where the character is facing the wall, close to the wall whilst falling, then turns to the camera. You don't want him pausing mid-air to take a step backwards \$\endgroup\$
    – Basic
    Mar 4 at 21:15
  • 1
    \$\begingroup\$ @Zibelas' suggestion means you'll write some code like If turning from side to front view and distance from wall < blah, play the "walk backwards" animation. Be sure to handle the case when you're next to the wall and falling, as that animation would make no sense. You either need an airborne animation or to disallow the movement \$\endgroup\$
    – Basic
    Mar 4 at 21:37
  • 1
    \$\begingroup\$ Most humans are not equally proportioned from all angles/directions, despite what sprite based games might have you think. \$\endgroup\$ Mar 5 at 7:12

2 Answers 2

11
\$\begingroup\$

When you implement characters with weird traits, then it is generally a good idea to not try to glance over their weirdness, but to lean into it and make it a part of their game mechanics.

So let's try to approach this problem from the perspective of an animator. When a wide, anthropomorphic harmonica would run into an obstacle and turn sideways, how would it do that?

It can't just turn on its own axis like a regular humanoid character would, because it would then collide with the obstacle. It would need to take a step back before it turns its unwieldy body around and then waddle in the new direction. It needs to walk through a narrow gap with not enough space to move as it would regularly? Well, then it would have to awkwardly squeeze itself through the path by walking sideways. It would look really clumsy, making the character cute and endearing.

This is also what you could be doing in this situation.

  1. Have the sprite walk backwards until it has enough space to turn
  2. If there is enough space, turn it into the new direction. Preferably using an animation which visualizes the effort it takes to overcome the momentum of its unwieldy body.
  3. If there is not enough space, have it walk sideways with reduced speed until there is enough room to turn around

(a skilled animator could perhaps merge 1 and 2 into one animation)

You wondered if this might be unintuitive to the player. I would argue that it might actually not be unintuitive at all. The character does have an awkward body shape, which has implications on how it moves through the world.

This mechanic could actually be used for puzzles. For example, imagine a level like this:

################################
                             ###
Start                        ###
                             ###
                             ###
############################ ###
############################ ###
#############                     Goal
#############      ######### ###
#############      ######### ###
#############      ######### ###
#############                  #
#############                  #
#############                  #
################################
################################

When the character occupies 1x3 tiles, then it could not enter the passage. But when you give it the ability to move sideways, then it could. However, when it also needs 3x3 unblocked tiles to turn, then it could not take the direct path by turning east at the crossroad. It would have to move through the chamber below in order to find enough space to turn from vertical to horizontal.

Now imagine what else you could do with this mechanic when you introduce movable, destructible or switchable blocks. The player needs to consider where it needs to turn the character and what they need to do beforehand in order to clear up the necessary space for doing so.


I am looking forward to guiding that adorkable harmonica person through your game world.

\$\endgroup\$
4
  • \$\begingroup\$ Love the ideas you've suggested. Using the turning as a puzzle mechanic is a brilliant concept! My only questions are: - 1. Animating the sprite might prove quite difficult, especially as the limbs are so thin. The walking animation consists of the legs simply moving up & down, which just about sells the illusion, but animating a humorous turn may not go so well. I am no skilled animator XD - 2. Initiating a sideways walk might be quite difficult to determine automatically. I guess I could have a specific button that allows shuffling, which would be similar to a crouch button. \$\endgroup\$
    – Rorny
    Mar 4 at 21:23
  • \$\begingroup\$ The first question isn't really something you would expect to get answers for in gamedev (though maybe "tilting" the book-shaped guy would be good for sideway animation) but for the second one, I would recommend you to use Physics2D.Raycast() and see if the walls on both sides are too near \$\endgroup\$
    – Arian_ki
    Mar 5 at 20:11
  • \$\begingroup\$ +1 for leaning into it. Games are experiences, and experiencing things that are foreign to players make for great player engagement (providing the quirks do not needlessly obstruct the focal gameplay). \$\endgroup\$
    – Flater
    Mar 5 at 22:43
  • \$\begingroup\$ Another potential problem I've just thought of is related to the hitbox of the sideview sprite. As this answer implies, the Harmonica should not be able to get too close to a Northern or Southern wall when facing the side, as in theory it still takes up space even if you can't see it. However, due to the strange perspective of many RPGs, that would mean leaving a visible empty and awkward space between the obstacle and the sprite. Did any of that make sense? \$\endgroup\$
    – Rorny
    Mar 6 at 0:19
2
\$\begingroup\$

What depth plane is the character in?

What is the character's position in the Z plane relative to the obstacle? If the character is directly in the same plane as the obstacle, then it's reasonable to assume that the character cannot freely rotate to face the camera--they either must remain facing the obstacle or they must back up in some way to rotate. Nothing seems odd about that to me in either case.

If on the other hand they're actually in front of the obstacle a little bit, then they could rotate to face the player and you'd just draw them a bit in front of the obstacle so it wouldn't look weird. Of course in that case the obstacle isn't really an obstacle...

In the end, I think you're worry for nothing

So I think the options you're worried about aren't actually something to worry about. It makes total sense for the character not to be able to rotate freely when right up against the obstacle without backing up first, possibly in a humorous way as suggested by Phillip.

Why not do a quick test?

It's always a good idea to do a quick rough test to see what it feels like for the player in the different scenarios in question (in this case different options for what to do when the player tries to rotate to face the camera). Can you rough out animations showing the different options, or better yet, simple storyboards on paper? Whatever lets you see what it would look like for minimal time and effort. Iterate quickly until you find one that feels good. Show them to other people and get their opinions too. Bottom line: get out of theorizing and do some experiments if you haven't done so already. See this article with tips from the legendary Will Wright, designer of Sim City, The Sims, Spore, etc.: https://www.masterclass.com/articles/will-wrights-tips-for-successful-prototyping-in-video-games#the-2-kinds-of-video-game-prototypes

\$\endgroup\$
4
  • \$\begingroup\$ Good point. Seeing as I don't actually know a proper programming language atm (I've been looking into Godot and its GD Script), actually testing things would prove quite difficult. - I came across this particular issue while considering potential situations in the game, and was afraid that I would end up struggling to learn how to use a whole game engine only to not then be able to do what I had in mind. \$\endgroup\$
    – Rorny
    Mar 4 at 21:27
  • 1
    \$\begingroup\$ Do you have an animation program you know how to use well? Or you could even try your hand at making an old-school flipbook with a stack of physical sticky notes and sketch out various animations of the different options (one per flipbook). That's what I had in mind more than coding something up, as I assume that creating a rough animation is going to be faster than getting something coded. In fact what about just doing a simple storyboard? You could do that on a single sheet of paper per option, and it'd be faster than making animations. You want the experiment to be as simple as possible. \$\endgroup\$
    – bob
    Mar 4 at 21:36
  • 3
    \$\begingroup\$ And btw I love the character concept. Just based on that alone, the concept looks like it has promise. For me the idea of anthropomorphic household objects is funny, so I'd lean into the humor. Your game of course, so just some feedback. \$\endgroup\$
    – bob
    Mar 4 at 21:39
  • 2
    \$\begingroup\$ I don't have an animation program per se, but I have created frame-by-frame animations in normal photo editing programs in the past. I could try to work with that. - And I'm glad you like the idea! I do intend to lean into the humourous aspect of it :) \$\endgroup\$
    – Rorny
    Mar 4 at 22:06

You must log in to answer this question.

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