• 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
Udovis Devoh

Old school racing (TopGear, Lotus) game track algorithm

11 posts in this topic

Hi, I'm working on a old school racing game made in JavaScript. I use sine waves packets (added sines with different wave lengths, phase and amplitude) for the track's shape. However, It doesn't feel entirely right. You can look at it here (please use Chrome, Ie9 or Firefox), or else, it will be slow.
[url="http://www.anticulture.net/Games/RandomRacing/"]http://www.anticulture.net/Games/RandomRacing/[/url]
I believe it looks good, but I would like to know what are the true math algorithm that was used in old games like rad racer, topgear (1, 2, 3000) and lotus turbo challenge. Thank you!
0

Share this post


Link to post
Share on other sites
Actually that's pretty good, and all that was really done back in the day was handle the interrupt that would occur at the beginning of each scanline and scroll it by a given amount - very similar to what you're doing.

Realize that
a) It will never feel completely right done this way
b) There are times when you want to just have it go right or left for a while to give a sense that the track is going in a complete circle. Right now it just feels like it is an inifinitely (generally) straight track.

It feels really nice, and looks awesome, but you almost need to overdo a turn here or there so that the track feels like it is connected in a loop - unless of course the track isn't connected in a loop.

You may experiment with shifting the scene up or down a bit too... perhaps it would feel better if it wasn't so exactly behind the player.

All in all it feels good... I think you are closer than you realize. Just needs some minor tweaking!
1

Share this post


Link to post
Share on other sites
Thanks a lot for the encouragements :[img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] . Yes, I think it looks good, but the problem I see is the curves. Since I use "added sine waves", each wave has a full cycle, which means that whenever you turn right, you will immediately turn left (because of the wave's rarefaction). I suspect old school games didn't use sine waves, but some other kind of math function (which I don't know about). That is my main concern.
0

Share this post


Link to post
Share on other sites
Say you want to simulate turning 90 degrees in one direction. All you would do is use a sine wave of the appropriate length, from, say, 0 radians to pi/2 or even pi/4 for your horizontal offsets. While driving, the sine wave should gradually go from having no amplitude to much amplitude to go into the curve. Hold it at that amplitude for however long the turn is, and finally gradually interpolate back down to no amplitude to get out of the curve.
1

Share this post


Link to post
Share on other sites
Alright, I will do that. I guess sines can be used with some tweaking.
Right now, what I do is extremely simple. The track itself is a math function of some sines, and I never have to interpolate anything. Some parts of the wave are cancelled by other wave, and some interference patterns are created. Playing my game is basically like watching a function on a Ti-83, but with a moving 3Dish perspective.
0

Share this post


Link to post
Share on other sites
Just keep in mind there is not necessarily just one way to do this. What you've got going on would be perfect if, say, the tracks travel for a long distance and aren't meant to be looped. Say a race across the countryside or something.

If you really want to be closer to top gear, you really can't beat just watching a couple youtube videos and figuring out how to emulate what you see. Maybe you don't do it like they did exactly... but that doesn't really matter! For instance... I could be mistaken, but it seems when there are multiple road curves on screen, that there is always a hill where the second curve is... Sometimes overcoming technical difficulties can produce unexpected, nice, extra "features"!

Anyway I like yours. I hope to not miss your post when you make more progress!
0

Share this post


Link to post
Share on other sites
Look into splines. 2D Splines will give you a way to define both closed and open circuits on generally-flat ground, 3D splines will allow you to also define hills and valleys. Once you have splines, and can evaluate them at a given point, cast a ray for each horizontal line to see where it intersects the spline to get the distance (used to scale the roadway). You should also be able to use the control points store track data (e.g. this section of road is a bridge, this section is the finish line, etc).

I'm not certain how they'd have done it in the really olden days though -- I'd guess run-length-encoded deltas, possibly with interpolated values in-between.
1

Share this post


Link to post
Share on other sites
It seems I'm now (in the new version of my game) trying to emulate splines using sine waves. Thanks.

edit: I dopped "spline emulation through sine wave" and now I use perlin noise with a lot of smoothing, then I normalize the function to expand the minimum and maximum to a desired range. I get better results with that.
0

Share this post


Link to post
Share on other sites
Just to keep interested people updated, I finished the new version of my game (requires a modern browser (Chrome, Firefox, Ie9))
[url="http://www.anticulture.net/Games/ajaxracer/"]http://www.anticulture.net/Games/ajaxracer/[/url]
1

Share this post


Link to post
Share on other sites
My only suggestion now would be longer tracks, 6 laps seemed awful quick and I think more might be repetitive.

Nice quick piece of fun though
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