• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

360 directional movement animations

Hi,

General question... any reason to not go beyond 8 directional movement system?

More or less figured out a workflow to make 360° sprite images fairly quickly.. was going to have a mess around implementing a 360° directional movement system.. obviously, 4 and 8 are pretty common.. had a search and no one seems to have posted this type of question before.. happy to get some input before i have a go myself..

Thanks!
 
B

bassdrop_subwave

Guest
I'm pretty new so wouldn't quite know what all physics conditions might be affected but I'd say the majority might want to appeal to W,A,S,D or the arrow keys. 360 degree I think may be aimed more at controller players. Which, since GM's console tiers are pretty up there compared to the PC release ones, maybe most development is centered around Steam as the potential sales platform.

I'd say - whatever makes it unique gives you an edge! Go for it. Maybe make two early prototypes: one that uses 8 way and another 360 and just see which one is more fun to play.
 

kburkhart84

Firehammer Games
360 degree stuff isn't all that uncommon honestly...the issue here is the difference between 360 degree movement and having actual 360 animations per animation. You could slim it down to like 16 or so, have the movement be arbitrary(the full 360 degree freedom), but have the animations choose the closest direction. 360 animations might be fine for a couple things, but once you have several animations, and then have several enemies with several animations, the graphics really start piling up. Even just cutting them down to 45 directions cuts it down 8 times, and would likely not be very noticed...but that is still TONS of sprite frames. It also depends on what workflow you have to actually create these things, and what actual resolution you are planning on using.
 
Thanks both for your input.

I should be clear on the outcome im aiming for... smooth-looking movement.. the snappy 8 direction changes don't really gel with that... it's the first time using this workflow so I'll see how it goes!

I have seen really smooth stuff like:

https://www.reddit.com/r/gamemaker/comments/gpsncc
that uses math to achieve the outcome.

I'm pretty sure Brigador is entirely made of sprite sheets.. well that's what it sounded like from the GDC talk...


@kburkhart84 if you can list a few examples i'd been keen to look them up..
 

woods

Member
something along the lines of this?


//90 deg -4way movement
//45 deg -8way movement
//22.5 deg -16way movement
//11.25 deg -32way movement

rough pseudo-code using 22.5 degree movement with 16 frames

if (angle_to_mouse >= 0 || angle_to_mouse <=22.5)
{
//use image_index = 0-3;
}

if (angle_to_mouse >= 22.5 || angle_to_mouse <= 45)
{
//use image_index = 4-7;
}
.
.
.

can you really tell the difference between 15 and 18 degrees of rotation with all that everything going on on screen? ;o)



another thought..

direction = image_angle;
//works well with a top down spaceship and whatnots that don't have legs ;o)


what exactly are you trying to animate?
//might give some better insights on how to help
 

rytan451

Member
General question... any reason to not go beyond 8 directional movement system?
Yes. The amount of memory available on a graphics card/onboard graphics processor is limited. Each animation uses a bit of VRAM (Video RAM); lots of animations means that you need to use lots of VRAM. It's possible to go beyond 8 directional. But you have to weigh between having more precisely angled graphics versus memory usage. For example, with smaller objects, 16 directions could be plenty; just see what Factorio did with its dying drone animation!

Of course, hard drive memory is cheap, and if the player has a lot of VRAM, why not let them choose how many in-between angles to use? Again, drawing off Factorio, it's possible for you to make a setting that controls whether the game loads (for example) 16 directional animations for an object, or 32.
 

kburkhart84

Firehammer Games
Neither of your examples shows anything with tons of spritesheets though.

I have seen really smooth stuff like:
This one was done using math as you said, so it has very little actual graphics. The effect is pretty good though, and the style works just fine.

I'm pretty sure Brigador is entirely made of sprite sheets.. well that's what it sounded like from the GDC talk...
I investigated this one. I saw a steam forum post the devs responded to. They are actually using 3d models, and then in game engine they are rendering sprites from them. I seriously doubt they are rendering 360 degrees of those animations as that would tax VRAM, but they are rendering enough of them that it is smooth enough that you don't notice. With fast paced moving objects like that, they might have gotten away with 32 directions with you not noticing at all. And the lighting is done using information in engine from those renders, such as normal maps. The cool part about rendering in engine is that they can do so at whatever resolution they need, so they get the niceness of 3d models with the workflow/performance of sprites. I'm sure it added quite a workload to make happen though. Wiki says they also used their own custom game engine.

I actually have a similar(but different) pipeline for my art. I'm using 3d models, but I'm pre-rendering them in Blender. I'm also rendering normal maps. So I get some of the same advantages they have, and I get real-time lighting as well. But I'm rendering for 1080P, so like sprite games, if you play at 4K, there is more scaling involved. It does however let me render the angles and animations I need easily enough. It takes longer in general to make a 3d model than to draw a sprite, but once the model and rig is done, animations can be made faster than in many cases of sprites. And iteration is much faster as well as I make a single change on the model and just hit the render button.

EDIT***

Found another thing, Brigador(according to a dev responding in another topic) uses 64 directions for vehicle sprites, which often gets cut almost in half for any that are symmetrical.
 
Last edited:
rough pseudo-code using 22.5 degree movement with 16 frames

if (angle_to_mouse >= 0 || angle_to_mouse <=22.5)
{
//use image_index = 0-3;
}

if (angle_to_mouse >= 22.5 || angle_to_mouse <= 45)
{
//use image_index = 4-7;
}
Really, man?!? I can't decide if you are being serious or not?
So, on top of having a 100+ cases "if" statement (with no elses), you want him to have ALL his animations in ONE sprite?!?
This can be done much cleaner in less than a dozen lines.

GML:
var _slice = 360/number_of_directions;
var _state = player_state_as_string;      //Eg. "walk"
direction = (direction div _slice)*_slice;

switch(direction){
    var _spr;   
    case 0:     _str = "right";        break;
    case 90:     _str = "up";        break;
    case 180:     _str = "left";        break;
    case 270:     _str = "down";        break;
}

var _sprite = (asset_get_index("spr_player_") + _state + "_" +  _str);
This is the easy part. Managing your textures swaps down the road for 360 directions*8 frames = 2880 different sprites for just one single animation!
So Idle animation, 2880 sprites. Walk animation, 2880 sprites, attack animation 2800 sprites, etc...
You can clearly see how you will NOT be able to change your player's shirt's color that easily, after that. Once commited, you're commited, or you have to start it all over again.
If the eye can get tricked into thinking 24 fps is actually a movie, I think you can round down directions to 16 or 32 and still have a convincing effect.
 

woods

Member
not an actual usable code..
but more visual concept for swapping out a handful of sub-images for a short animation for changing the sprite based on direction...

sort of like expanding on your case switch for 4direction movement... add in 45 for up/right (leads to 8way movement)
... split that again ..22(16 way movement) ..again with 11(32way movement) ..etc


it can be done... is it efficient? ...after some point the player is not going to notice much of a change in the angle of their player
for the most part i would think that 8way directional movement would be plenty... or start using things like point_dir to smooth out the turning of things.
 
Thanks all again.

@rytan451 cool, factorio looks pretty good + technical limitations pretty much answers that (dont do it.. but I wanna see what happens anyway..)

@kburkhart84 thanks for doing some digging mate and verifying.. that workflow is pretty much what i am going to step into... with the factorio and brigador outputs in mind and that workflow established its pretty easy to upscale/downscale so i'll play with it and see what looks best or not noticeably different for the additional performance..

@woods + @Slow Fingers thanks for the exemplar code and input

I guess i'll post in a few days after playing around for a bit and give some feedback on what this looks like / performance hits / etc. gotta do the 9-5 + young family.. finding time is tough....
 

Director_X

Member
In GM1.4 and older versions, we could easily create rotating animation sequence for 36 frames. And then point the anim via direction. (eg tank/turret rotation/movement). That would create really smooth animation.
 

kburkhart84

Firehammer Games
thanks for doing some digging mate and verifying.. that workflow is pretty much what i am going to step into... with the factorio and brigador outputs in mind and that workflow established its pretty easy to upscale/downscale so i'll play with it and see what looks best or not noticeably different for the additional performance..
I will say that it is 100% doable in gamemaker with the same pipeline too. You can render to a surface, and then turn the surface into a sprite. It will be some coding work though, AND you will need to partially learn the 3d side of things, which gamemaker is really weak for. Not gonna lie, you might be better off just going full 3d, either here in GM or elsewhere. Even when Brigador was created, I'm not sure why they did it that way, as 3d performance even on integrated GPUs is plenty good for many 3d game concepts.
 
Top