Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Showcase / Steering behaviors in Ruby
- By lobo_tuerto Date 2009-08-10 04:15 Edited 2009-08-10 13:55
Hi guys, just to let you know that I've started to code a little app that implements steering behaviors as seen in:
I'm planning to use them in my next mini game (a missile commander clone).

You can try the demo and tell me what you think. It implements a number of things, although it's in a very basic state (worked on it this weekend).

There is a basic app, with 4 behaviors implemented:

    * Seek
    * Flee
    * Arrive
    * Pursuit

More to come, probably next week, if I can make myself some time. :D
Although I think I will refactor it a bit before implementing more stuff.

There is a Viewport class to that I created so I could play with my vehicles on a very large space. Think of it as a sandbox that you can configure to an arbitrary size. And right now it wraps around, treating the viewport as a toroid.
For example, you can have a 4000x3000 virtual space inside a 800x600 viewport inside your real 1024x768 screen.
I implemented this because I'm planning to showcase the behaviors each on a different viewport, but all in the same screen at once.
I think it might be used to implement a minimap, maybe?

There are 3 agents in the demo app.
Use your mouse, clicking on the screen will set a mark.
The green agent will flee from it.
The white agent will try to arrive to it.
The red one will pursue the white one, predicting it's future position (little white crosshair in front of white agent)

Press D to hide the text. Esc to leave the demo.

Here is the link to github:
- By lobo_tuerto Date 2009-08-10 13:46
Updated info.
- By Shinobi Chef Date 2009-08-12 17:11
Hey nice work :)

I tested it out and found the white and red ships work perfect though the green ship moves off screen then jumps around all over the place after a few seconds
- By lobo_tuerto Date 2009-08-12 17:32
Hey thx :)

Well to tell you the truth, that is expected.
The toroid is not fully implemented, I just wrap around the screen edges in a very basic way, no further calculations are made.
And maybe it wouldn't be too hard to implement, just delegate the distance calculation to the viewport... :)
- By lobo_tuerto Date 2009-08-13 04:17
The updated, now entities belonging to a viewport are clipped. No more image leaking.

You can zoom in and out from viewports using your mouse scroll or up-arrow, down-arrow. This is context sensitive, it will zoom out (in) whichever viewport your mouse is over.

You can click inside viewports only.

Cleaned a bit the debug info, and cleaned a bit the way it's called.

Go take a look :)
Up Topic Gosu / Gosu Showcase / Steering behaviors in Ruby

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill