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

Racing AI with time constraint

8 posts in this topic

Hello community I have an atypical question for you. I am working on a car AI for a racing game. I am not allowed to disclose specific details, so don't try to find logic in next sentence :). We want a mod where AI would always reach the goal at a particular time ie. first checkpoint in 15 sec, second in 10 sec etc. Actually that describes the problem pretty well. Let's say we have only one car, realistic physics engine, and we want our AI to be able to drive to checkpoints for the given time. Note that "cheating" the pysics is allowed.

So far we have that drives around the track aggresively and really fast. I was thinking about implementing a pid controller for car speed, where my control variable would be projected time (from current acceleration and velocity) to reach the checkpoint, and tweak the throttle accordingly. However I am unsure how exactly I would tweak the throttle, and what other factors should I look after, or even if this method would give good passing times (tolerated margin of error would be +-0.5sec).

What do you think of my idea, or do you have other ideas for this particular problem? Some other guidances would be helpful also, like general vehicle AI tips and tricks and/or books, because I am really inexperienced in this field, yet I have a really responsible job of implementing this stuff, and I have done a good job so far :).
0

Share this post


Link to post
Share on other sites
Ooohhh... fun with rubber-banding!

Sounds like you are on the right track as far as what to tweak. The problem you have to look for is that hard targets on time can be a problem if they are the only (or primary) consideration. Imagine that the player restricts the car from going -- either intentionally or unintentionally (crashes). Once released from this restriction, the car will be so desperate to catch up that it will accelerate very unrealistically to do so. You need to make sure that you have other reasonable restrictions such as rate of acceleration, speed, etc. and just live with the consequences.
1

Share this post


Link to post
Share on other sites
Thank you Dave for a prompt reply.
It is nice that you pointed out this situation where a player could restrict intentionally an AI car, and then it would accelerate unrealistically, but this situation is prohibited by design. Other situation is where other AI cars restrict each other unintentionally, and this is a whole other set of problems, and I still havent wrapped my head around it fully. My first thought are that I should imeplement some kind of master mind AI that would look after car agents (like a flock) and would prohibit them from getting into dangerous situations. I would also tweak the physics layer when necessary to avoid sideslips off track or something similar. This would yield unrealistic results sometimes (but rarely) but it's a tradeoff we have to pay.
But so far my first question remains, before I start to work on a full race. Let's just say we have one car and time constraints. I have to figure this out before I go to vacation :). I will try to implement something by tommorow and I wil report.
0

Share this post


Link to post
Share on other sites
I think the challenge would be to make the car look like it's trying to win, regardless of whether it gets 10 seconds or 15. If a car looks like it's taking it easy on you, e.g. driving very slowly, it's a bad look. Also not breaking physics too much to go fast.

As far as slowing it down, there's all kinds of driver errors you could introduce, e.g. taking a bad line, bad gear changes, braking too early/late for a corner, going too aggressive and slipping/spinning out. For going faster that optimum driving with physics.... I guess instant gear changes, super-grippy tires with no wear, advance knowledge of track condition, a slight horsepower boost, cars assisting each other.
0

Share this post


Link to post
Share on other sites
[quote name='jefferytitan' timestamp='1346191148' post='4974250']
I think the challenge would be to make the car look like it's trying to win, regardless of whether it gets 10 seconds or 15. If a car looks like it's taking it easy on you, e.g. driving very slowly, it's a bad look. Also not breaking physics too much to go fast.

[/quote]

Hi jeffery, thank you for showing up on this thread.
But it looks like you didn't understand my problem. This is not a classical human vs AI race, and I am not allowed to disclose specific details so I simplified my problem like this: What do you think would be a good method for implementing a vehicle AI that has a feature that it can always reach checkpoints on predetermined times. Edited by mohjkrtoi
0

Share this post


Link to post
Share on other sites
Okay.... I like Dave Mark's approach. Maybe break the track into good and bad lines (with the ability to switch between them). Create a series of segments of those lines with best and worst case times for the segments (assuming no physics cheating or accidents). This will allow you to set bounds on how long is remaining to the finish line. If the best case is greater than the desired remaining time, turn physics cheating on. If the worst case is lower than the desired remaining time, have an accident or do something else stupid. Otherwise switch between the good and bad lines for the next segment depending upon whether you are over or under the desired time.
0

Share this post


Link to post
Share on other sites
Hey guys, i tried to prototype this but it looks to unrealistic so far, it looks like we are going go abandon this idea. Thank you all.
0

Share this post


Link to post
Share on other sites
Can you estimate the time that is going to be wasted in typical interference cases? For example, overtaking a slow car ahead, or waiting for two cars to separate before having room to pass them? Even a conservative or inexact estimate would be very useful: the car could accelerate smoothly in advance by the right amount, and avoid unpleasant sudden speed changes.

Another suggestion: probably, not all cars have equally tight time constraints, and even if they do some have an earlier deadline: lower priority cars should cooperate by moving out of the way, so that many cars are slowed frequently by acceptable and recoverable amounts and none risk missing the deadline.
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