• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Hawkblood

Need help with 3D parabolic paths

9 posts in this topic

I am building a space sim and I'm having problems with my ship not smoothly transitioning between waypoints (or sometimes missing them entirely). The code I have been writing and re-writing and re-writing (many times) has yielded the same results. I have "TurnTo" code so that my ship will look at the waypoint it has targeted. I can accelerate and decelerate if it's a straight shot with 1 waypoint. The problem comes when I have more than one. I have been using simple linear vector math to accomplish these futile efforts.

 

Now I would like to try an approach I didn't want: Parabolic paths between my waypoints. Essentially, I am discarding any notion of laws of motion like momentum for a "fixed" path. I hope I'm explaining it correctly.....

 

Basically I want each of my waypoints to be the "axis of symmetry" of a parabolic equation. Of course, this needs to be 3D. I'm not sure where to start with this, so any help would be appreciated.

0

Share this post


Link to post
Share on other sites

You have just discovered that kinematics solutions are hard.  It is a lesson that everyone gets to learn eventually.  We still use IK and FK solutions in games, but they are resource-intensive and sometimes produce interesting results.

 

When you use physics for important gameplay parts, the simulators tend to break in subtle and not-so-subtle ways.

 

 

The other option is...  CHEAT.

 

When you need to follow a known path, just build the path and slide along it.  

0

Share this post


Link to post
Share on other sites

It's not a matter of not knowing "how" to turn, move, or avoid. It has to do with the HIGH SPEEDS involved. These ships are moving at such high speeds (nearing speed of light with the appropriate time-dilation effect), that any method that leaves timing to chance (or processor speed) will result in inconsistent results. Sure, the lower "maneuvering speeds" will be done with normal collision detection and avoidance, but I am traveling between planets at near SOL. The ship will either overshoot the waypoint or undershoot and slow down too early. Believe me, I've done my due diligence on trying......

 

I've been brain storming and I think instead of a parabola, I need a circular path. Here is an illustration of what I am trying to do:

[attachment=14621:Untitled.png]

The "ship" will be traveling to WP2.

It needs to avoid something, so it has pre-calculated a way around it and assigned WP1.

At some predetermined point in space "tangent A" on its way to WP1, it will begin its "curved path".

It will continue on this path until it reaches "tangent B" where it will continue on to WP2.

 

I hope this clears up any confusion about what I need help on....

0

Share this post


Link to post
Share on other sites

any method that leaves timing to chance (or processor speed) will result in inconsistent results. Sure, the lower "maneuvering speeds" will be done with normal collision detection and avoidance, but I am traveling between planets at near SOL. The ship will either overshoot the waypoint or undershoot and slow down too early. Believe me, I've done my due diligence on trying......

Yes, that is the problem with any physics-based solution.  Your physics system provides functions for turning and such.  But because you cannot control all of the input, you cannot guarantee consistent results across the entire range.

 

 

So cheat.

 

You already have your spline figured out:

The "ship" will be traveling to WP2.
It needs to avoid something, so it has pre-calculated a way around it and assigned WP1.
At some predetermined point in space "tangent A" on its way to WP1, it will begin its "curved path".
It will continue on this path until it reaches "tangent B" where it will continue on to WP2.

Build the spline and follow along the path.

 

If something changes along the way rebuild your spline and continue.

1

Share this post


Link to post
Share on other sites

A spline sounds intriguing. How would I go about creating one? Did some quick googling, and have no idea where to start......

0

Share this post


Link to post
Share on other sites
I think if your moving at light speed you would have to stop traveling at half way to your target or you would crash into it. Moving at light speed means you can't just stop on a dime. Everyone on board would die.
0

Share this post


Link to post
Share on other sites

2 words: "inertial dampeners". And no, I'm not wanting it to "stop on a dime". The solar system is a vast expanse. If the player was subjected to any conventional speeds for going between even the relatively short distances between planets, he would quit the game before he got to the first planet. Interstellar travel would take impossibly long times too. Therefore, I use "near light speed" for interplanetary travel and "faster than light speed" for interstellar travel. The NLS presents an interesting phenomenon of time dilation. The closer you get to SOL, the slower your perception of time becomes. So an outside observer could "see" you travel NLS from one planet to another and take, say 20 minutes, but you would think it only took 2 minutes. This effect is achieved by simply causing the player's ship to "go faster" than it actually is and advancing the game's clock at that same amount...... My scale is "actual" where 1 unit is 1 meter. Yes, there IS a problem with using floating point values with scales that large. I had to make a new vector storage class to accommodate it.

0

Share this post


Link to post
Share on other sites

A spline sounds intriguing. How would I go about creating one? Did some quick googling, and have no idea where to start......


A spline is one one of the most basic elements of computer animation. The topic sometimes shows up in the For Beginners forum.

A spline is a smooth curve that is defined by a series of points, called knots or control points.

There are many kinds of splines. The most programmer-friendly type of spline is the Hermite spline family; they can be easily calculated by multiplying a matrix that defines the properties of the spline with a matrix that defines the control points, multiplying the result by a quadratic of the distance through the curve, and multiplying the result by a constant. Once you write the code you can just change swap out 16 numbers to generate any cubic Hermite spline.

Inside the Hermite spline family, the Catmull-Rom spline is especially nice for computer graphics because it has continuous smooth motion when two splines are placed next to each other. In other words, you can travel along a whole bunch of Catmull-Rom splines along a long and twisty path, and it will look good.

A few seconds on Google shows this example, which seems to cover it pretty well. Edited by frob
1

Share this post


Link to post
Share on other sites

So if I am reading this right D3DXVec3CatmullRom(...) will need 4 known points in space. I can use the "tangent" points as my control points and I have to come up with the two in the middle, presumably along the curve of the sphere..... That doesn't sound too hard. I wondered what D3DXVec3CatmullRom was when I saw it in http://msdn.microsoft.com/en-us/library/windows/desktop/bb205506(v=vs.85).aspx but as you know, Microsoft is not very good with explaining anything.

 

So now I need to get those four vectors...... If I have anymore problems I'll post them here. Thank you for your help.

0

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0