Locomotion layer example

BlitzMax Forums/BlitzMax Beginners Area/Locomotion layer example

Htbaa(Posted 2009) [#1]
Does anyone know of a example game with source code or a snipper that shows how you could use a locomotion layer in your game?

For example, a car has the option to accelerate, brake, steer left and steer right. These are 4 object methods that can be called. For player input it would be as simple as:

If KeyDown(KEY_UP)
    Self.Accelerate()
End If
etc...


However, for the AI driven agents a steering force has to be calculated by some activated steering behavior. This steering force can be a vector that when added to the velocity vector makes sure the agent moves to the desired target. When calculating this steering force the max. turn rate, objects mass, max force and so on is taken into consideration.

The steering behaviors and applying the steering force works fine. But I need to implement the locomotion layer. And that's where I'm stuck.

The way I see it the calculated steering force is an instruction for the locomotion layer. It tells whether to brake or accelerate and to steer to the left or right, or not at all. It could also activate animation sequences.

For example, an airplane that's making a sharp turn has to alter its pitch. In a 2D sprite based game this would mean execution an animation showing this.

I've been looking around but can't find any examples. If anyone knows of any please let me know. Thanks.


tonyg(Posted 2009) [#2]
You might want to check Steering Behaviors For Autonomous Characters . Scott Shaver produced code


Htbaa(Posted 2009) [#3]
Thanks. I've seen Scott Shavers' code before and it looks to me like it's a BlitzMax version of the code provided by Mat Buckland. In which he does a very good job. I've got the book myself. But Scott doesn't implement the locomotion layer in his examples.

Now on the page you linked to there seem to be a couple of articles about implementing the locomotion layer, but all those links seem to be dead.

The steering behaviors are no issue. I just need a good example on how to implement the locomotion layer.


tonyg(Posted 2009) [#4]
If you're looking for the Car Physics for Games then you can use webarchive :
Monstrous Software


Htbaa(Posted 2009) [#5]
Stupid me. I've used archive.org earlier today for source code from another older AI book... That I didn't think of it earlier.

Thanks!