It is currently Mon May 21, 2018 12:31 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Erratic enemy movement?
PostPosted: Wed May 16, 2018 10:42 pm 
Offline
User avatar

Joined: Thu Jul 23, 2015 7:54 pm
Posts: 166
Location: USA
I’ve been having some trouble visualizing how to make enemies move in a way that’s “erratic”, but not completely obviously random. Particularly among flying / airborne enemies.

Some examples of movements similar to what I’m thinking of are things like the birds in the Airman / Crashman stages of Mega Man, and the dude from 8 Eye’s’s falcon (who I know isn’t an enemy, but the way he moves is still interesting.)

Does anyone have a general idea of how movement like this is done? Is it all just lookup tables? Trig-based?


Top
 Profile  
 
PostPosted: Wed May 16, 2018 11:59 pm 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 426
pick random direction, pick random duration. Move that direction for that long. Loop.


Top
 Profile  
 
PostPosted: Thu May 17, 2018 12:04 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 729
Have an array of patterns. Pick a pattern randomly. Repeat.


Top
 Profile  
 
PostPosted: Thu May 17, 2018 12:04 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6286
Location: Canada
Two things I could suggest:

1. Don't make random decisions every frame. Pick a random direction and make the enemy commit to it for many frames before making another decision. This interval could be randomized as well.

2. Make smooth / filtered movement by controlling acceleration rather than velocity. Like how velocity adds to position each frame, you can add acceleration to velocity each frame as well. This extra step changes a straight line into a curve, which gives a very different impression of motion, but also may help the player anticipate the way it's going to move, because it can be seen turning in advance.

You can make a pseudo sine wave motion (e.g. Castlevania medusa head) simply by flipping the acceleration at a regular interval, maybe every 100 frames.


Edit: suggestion 1 was already given above while I was typing.


Top
 Profile  
 
PostPosted: Thu May 17, 2018 12:57 am 
Offline
User avatar

Joined: Thu Jul 23, 2015 7:54 pm
Posts: 166
Location: USA
Oziphantom wrote:
pick random direction, pick random duration. Move that direction for that long. Loop.
I’m more or less doing this already with other enemies, but I still want there to be a sense that the enemy is moving towards the player. Maybe I can do the standard “if the player is to the left move left, etc.”, but add a bit of “noise” via the random variable.

rainwarrior wrote:
2. Make smooth / filtered movement by controlling acceleration rather than velocity. Like how velocity adds to position each frame, you can add acceleration to velocity each frame as well. This extra step changes a straight line into a curve, which gives a very different impression of motion, but also may help the player anticipate the way it's going to move, because it can be seen turning in advance.
Do you think it’s necessary to have sub-pixels for acceleration?


Top
 Profile  
 
PostPosted: Thu May 17, 2018 3:35 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10480
Location: Rio de Janeiro - Brazil
Sogona wrote:
Do you think it’s necessary to have sub-pixels for acceleration?

Definitely yes.


Top
 Profile  
 
PostPosted: Thu May 17, 2018 4:47 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 3064
Location: Tampere, Finland
For reference, here's the enemy logic for the birds in Ninja Gaiden: http://tasvideos.org/GameResources/NES/ ... html#Birds

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi


Top
 Profile  
 
PostPosted: Thu May 17, 2018 5:03 am 
Offline
User avatar

Joined: Thu Jul 23, 2015 7:54 pm
Posts: 166
Location: USA
thefox wrote:
For reference, here's the enemy logic for the birds in Ninja Gaiden: http://tasvideos.org/GameResources/NES/ ... html#Birds
Thank you! I tried to disassemble what I think is the code in MM2 for the birds, but without a symbol list it was hard to understand any of it. And any RAM maps for the game I could find were pretty lacking.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group