• Advertisement
Sign in to follow this  
  • entries
    45
  • comments
    115
  • views
    54824

Trivial mathematics

Sign in to follow this  

394 views

I started a basic demo of steering behaviours using C++/SDL the other day, which are great for getting amazing looking results with very little code. It quickly reminded me of how rusty my trigonometry was though! For example, it took me 10 minutes of scribbling on the back of an envelope before I could prove to myself how to calculate the angle of a vector (hint). Sad. However, I find that proving an answer to yourself is always more satisfying than looking it up, because you come away with not only an answer but an understanding of the process.

My next task is to implement a wandering steering behaviour by randomly displacing a point along the circumference of a circle located in front of the vehicle. It sounds trivial but all the converting to and from angles and vectors and translating from absolute to relative values starts to send me mad after a few hours! This is why I don't tend to bother with 3D graphics...
Sign in to follow this  


2 Comments


Recommended Comments

Guest Anonymous Poster

Posted

I have a great C++ object oriented math library, with source code, called M++ that used to be sold by Dyad Software. It has all of the standard mathematical numerical routines like the IMSL library (now Visual Numerics). It is great for working with vectors and matrices, fourier transforms, numerical integration, etc. because it is all coordinate free. This might be of interest to you for your game development.

Another company, Dundas Software bought them out and still sells it (but no longer supports it). Contact info is:
Jake Tai
800 463 1492 Ext. 156
416 467 5100 Ext. 156
416 422 4801 Fax
mailto:jaket@dundas.com

Dundas Software
250 Ferrand Drive, Suite 500
Toronto, On, Canada, M3C 3G8

I wrote an OO Geometry library on top of it. It does reflections and rotations in n-space, and for 2 & 3 dimensions has classes like Cartesian, Polar, Spherical, Cylindrical with coordinate transform functions that allow you to move from one system to another. For example x.toSpherical() transforms x into Spherical regardless as to whether x is Cartesian, Cylindrical or Spherical. Its very simple-minded but makes life real easy. If you are interested I can send you a copy (if I can find it).

I am interested in your steering behaviours idea. I don't have any particular use for it but just don't know much about programming for games and would like to see how you guys do it.

Carter Waid

Share this comment


Link to comment
To be honest I don't do much that is mathematically based! I play to my strengths and avoid my weaknesses, so to speak. Thanks though.

Most of the interesting aspects of steering behaviours can be found at the web site I linked to, including Java applets demonstrating how they work. My project just combines that with the concept of staying in some basic formations, which has been well-covered by a couple of articles and papers, but which I thought I'd attempt myself.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement