[ Login | Register ]

The Shining Source

« previous next »
Pages: [1] Print
Autonomous Character Movement in SF   (Read 15889 times)
Old Post January 13, 2007, 04:24:09 pm
#1
Job
Shining Light *

Posts: 230

Logged
Autonomous Character Movement in SF
In Shining Force many of the townspeople move around autonomously in a near random fashion. This movement can't be completely random because otherwise it wouldn't make any sense.

How do you think this is implemented in Shining Force? Is it a step by step algorithm (i.e. flip a four sided coin and move the character in the appropriate direction if possible) or path based (i.e. dynamically build a randomized path and let the character follow it, then create a new path once the old one completes)?

I would prefer a step by step implementation. I guess we could assign probabilities to each of the following directions. For example, if the character just moved up, then the probability of it moving back is 0.1, and the remaining directions have a probability of 0.3 each.

Any thoughts?


Old Post January 13, 2007, 05:10:29 pm
#2
Ty
Administrator
Shining Sideburns *

Posts: 837

Logged
Re: Autonomous Character Movement in SF
If it wasn't path based, then I'd guess each NPC has a "zone" they can walk within. Movement would be decided randomly, but the previous direction would be noted so the character wouldn't shuffle between the same two spaces. It would also check the collision layer to stop it from bumping into the player and other NPCs (though I'm guessing zones would not overlap to save having to calculate all the collision possibilities).

I'd probably use this method in combination with a path, so NPCs can have a set route or just wander around semi-aimlessly.


Old Post January 13, 2007, 08:41:07 pm
#3
Job
Shining Light *

Posts: 230

Logged
Re: Autonomous Character Movement in SF
I implemented a step-by-step demo:
http://www.bloo.us/javascript/tileengine/
Watch the Cerberus. I'm not specfying a range so it moves all over the place, but once that gets added i think it'll be pretty good.


Old Post January 13, 2007, 08:45:32 pm
#4
Ty
Administrator
Shining Sideburns *

Posts: 837

Logged
Re: Autonomous Character Movement in SF
Nice work! Looks like I'm going to have to break out the compiler tomorrow. All these cool things are making me feel left out Sad

Is it just random movement at the moment? I'm guessing you'll be adding an anchor point that will limit its full movement. I like it.


Old Post January 13, 2007, 08:57:20 pm
#5
Job
Shining Light *

Posts: 230

Logged
Re: Autonomous Character Movement in SF
Yeah, i give each direction 0.25 probability. Then,  after one move the direction opposite to the move gets reduced to 0.1, while the remaining get increased to 0.3, to reduce the chances of having the character reverse his direction.
I will be adding a range to limit the character's movement. An anchor point sounds like a good idea, so i would just check the distance from the anchor point, to determine if it's within the range (rather than using a rectangle).


Old Post January 14, 2007, 12:19:34 am
#6
Blahian *

Posts: 38

Logged
Re: Autonomous Character Movement in SF
This is a pretty interesting solution! I'll be trying to figure this out soon too. I think I'm also going to have an option that the character could remain the same spot, instead of always having to choose a direction to move too.


New Post January 14, 2007, 01:45:38 am
#7
Shining Star *

Posts: 65

Logged
Re: Autonomous Character Movement in SF
very nice work Job.. the times i've looked thorugh the forums there dose'nt seem much you CAN'T do lol keep up the good work Grin


Pages: [1] Print 
« previous next »
Jump to:  

Powered by SMF 1.1.21 | SMF © 2013, Simple Machines