• 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
ThePointingMan

Smoothing out the ray tracing of a surface on a curve

4 posts in this topic

I've been using unity for some school projects recently, and I made a  racing game fairly similar to F-zero GX. It was really unpolished though, and I've got a question about one thing that I thought really needed polish. While the hover car goes along the track, it shoots a ray directly below it and orientates itself so that the car's up is the same as the surface's normal. Gravity is always pulling in the hover cars down direction. The biggest problem I am having with doing this is that with upward curves. Lets say I was doing a loop de loop. The car would move forward by an amount, then orientate itself and move forward again. If you are going fast enough though, you end up moving so far forward that you tap the surface of the loop de loops curve with your ship, making you loose all momentum. Does anyone have any ideas as to what I could do to work around this?

0

Share this post


Link to post
Share on other sites
My suggestion for this sort of problem would be to run multiple update steps in order to break up the path into smaller pieces. Depending on how you are doing the computations, I'd probably look at the starting position and the ending position and checking if the distance to the track and orientation are too "different". If they are, back up half delta and check there, if half delta is not too different, compute that and recompute the end point based on the new intermediate point which should have less of a delta to the end point now. This assumes you are not completely reliant on a physics engine doing all the work and that you can break up the steps a bit more. If you are reliant on a physics engine, you could consider turning off collision between the track and the car given that the car is a "hover" car which sounds like it should never actually collide at all.

Another possibility with the physics engine is to use a ray cast prior to stepping where you figure out the normal at the end position before stepping the physics. Now impart rotational velocity so that over the physics update the ship will automatically rotate to the end orientation such that the car will not be purely purely linear motion straight forward. This would keep the nose from going straight into the road though it still would not solve for the car actually moving fast enough to penetrate.

There are a lot of possibilities ranging from the multiple stepping solutions (probably your best bets) to working around the linear time steps in the physics engine (probably not as good). The thing I see with the physics solutions though is that while you can probably get the rotational velocities to mostly work, it would leave speed control as a function of gameplay such that it works kinda like a slot car track, going too fast and you wipe out, going too slow and you won't make the loop etc.

Some more information on the setup of the code would be most useful to dig into the details better. I.e. which physics engine, if you have an actual curve description you can analyse pre-physics, etc.
2

Share this post


Link to post
Share on other sites

Am I correct in thinking the ship is not orienting fast enough to the track? IE the the ship eases to its next target orientation, and if the ship is blazing past a load of polys with radically different normals, it doesn't adopt its orientation fast enough?

 

If you are relying on a physics engine and you can't simply increase how fast the ship orients to the normals, there's a few things you could do.

 

First, increasing the polycount of the collision geometry would help, so would casting a ray from the ship's nose rather than centre point. If those don't work, you could setup a dummy model that is positioned a % of your speed ahead of you on the spline, that governs your ship's orientation. For example if you were going 50mph it would be only half a ship ahead, and if you were going 500mph it would be 5 ships ahead. Then simply copy the dummy model's orientation matrix to the actual player ship.

 

By the way, how are you handling the hover mechanic?

Edited by rumblesushi
2

Share this post


Link to post
Share on other sites

For the hover mechanic, I shoot a raycast straight down from the center of the ship, if the distance from the start of the ray to where the ray hits is shorter then a specific amount it moves it back up to the minimum distance. As for the physics engine, It seems as though Unity uses the PhysX engine. Unfortunately I can't give you specific pieces of code right now as I am not at my house, but when I return there I will put up some more info on how I am doing everything. I think this first suggestion AllEightUp gave will probably do the trick though! Thanks very much for your input. I'm also thinking of doing something like what rumblesushi suggested, I'm thinking having a raycast at the middle, nose, and back, all checking would probably be best.

Edited by ThePointingMan
0

Share this post


Link to post
Share on other sites

As it happens I use 4 rays to orient my ship to the track. One at the nose and tail to calculate the pitch, and one at either side of the middle of the ship to calculate the roll.

 

The orientation behaviour is generally perfect, the only problem I've found is not orienting all the way round an F-Zero style tube. You drop off at the sides. I'll need the gravity to be the vector between the ship and the middle of the tube rather than the ship's Y Axis.

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